variables name refactoring

This commit is contained in:
Emanuele Trabattoni
2025-07-23 22:39:40 +02:00
parent 8f5615a034
commit 59d8c2c2d4
12 changed files with 98 additions and 100 deletions

View File

@@ -10,18 +10,18 @@ namespace drivers
Buzzer::Buzzer()
{
LOG_INFO("Initializing Beeper");
pinMode(buzzerPin, OUTPUT);
ledcAttach(buzzerPin, 1000, 8);
m_bp.pin = buzzerPin;
pinMode(c_buzzerPin, OUTPUT);
ledcAttach(c_buzzerPin, 1000, 8);
m_bp.pin = c_buzzerPin;
m_bp.beeperTask = NULL;
//beep(50, NOTE_G);
beep(50, NOTE_G);
}
Buzzer::~Buzzer()
{
beepStop();
ledcDetach(buzzerPin);
pinMode(buzzerPin, INPUT);
ledcDetach(c_buzzerPin);
pinMode(c_buzzerPin, INPUT);
}
void Buzzer::beep(const uint16_t tBeep, const note_t note)
@@ -57,11 +57,11 @@ namespace drivers
while (true)
{
ledcWriteNote(bPar->pin, bPar->note, OCTAVE); // on with selected note
vTaskDelay(pdMS_TO_TICKS(bPar->tOn));
delay(bPar->tOn);
ledcWriteTone(bPar->pin, 0); // off
if (bPar->tOff == 0)
break;
vTaskDelay(pdMS_TO_TICKS(bPar->tOff));
delay(bPar->tOff);
}
LOG_DEBUG("Beeper Task Ended");
bPar->beeperTask = NULL;

View File

@@ -10,7 +10,8 @@ namespace drivers
class Buzzer
{
const uint8_t buzzerPin = 46; // hardware assigned
const uint8_t c_buzzerPin = 46; // hardware assigned
typedef struct
{
note_t note;

View File

@@ -9,21 +9,21 @@ namespace drivers
Led::Led()
{
LOG_INFO("Inizializing RGB Led");
pinMode(ledPin, OUTPUT);
m_lp.pin = ledPin;
pinMode(c_ledPin, OUTPUT);
m_lp.pin = c_ledPin;
m_lp.blinkTask = NULL;
}
Led::~Led()
{
setColor({0, 0, 0});
pinMode(ledPin, INPUT);
pinMode(c_ledPin, INPUT);
}
void Led::setColor(const color_t color)
{
blinkStop();
rgbLedWrite(ledPin, color.r, color.g, color.b);
rgbLedWrite(c_ledPin, color.r, color.g, color.b);
}
void Led::blinkColor(const uint16_t tOn, const uint16_t tOff, const color_t color)
@@ -62,11 +62,11 @@ namespace drivers
while (true)
{
rgbLedWrite(lPar->pin, lPar->color1.g, lPar->color1.r, lPar->color1.b);
vTaskDelay(pdMS_TO_TICKS(lPar->tOn));
delay(lPar->tOn);
rgbLedWrite(lPar->pin, lPar->color2.g, lPar->color2.r, lPar->color2.b); // off
if (lPar->tOff == 0)
break;
vTaskDelay(pdMS_TO_TICKS(lPar->tOff));
delay(lPar->tOff);
}
LOG_DEBUG("Blinker Task Ended");
lPar->blinkTask = NULL;

View File

@@ -10,7 +10,7 @@ namespace drivers
class Led
{
const uint8_t ledPin = 38;
const uint8_t c_ledPin = 38;
public:
typedef struct