Skip to content

Commit

Permalink
[AW9364 Led Driver] Rename protected members to prevent recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Jan 4, 2025
1 parent 7ebe4ee commit 3e8701c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/AW9364LedDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ class AW9364LedDriver
{
_driver_pin = pin;
_virtualGpio = NULL;
this->pinMode(_driver_pin, OUTPUT);
this->digitalWrite(_driver_pin, LOW);
this->_pinMode(_driver_pin, OUTPUT);
this->_digitalWrite(_driver_pin, LOW);
}

void begin(VirtualGpio *handler, uint8_t pin)
{
_virtualGpio = handler;
_driver_pin = pin;
this->pinMode(_driver_pin, OUTPUT);
this->digitalWrite(_driver_pin, LOW);
this->_pinMode(_driver_pin, OUTPUT);
this->_digitalWrite(_driver_pin, LOW);
}

void setBrightness(uint8_t value)
Expand All @@ -63,12 +63,12 @@ class AW9364LedDriver
value = 16;
}
if (value == 0) {
this->digitalWrite(_driver_pin, 0);
this->_digitalWrite(_driver_pin, 0);
_brightness = 0;
return;
}
if (_brightness == 0) {
this->digitalWrite(_driver_pin, 1);
this->_digitalWrite(_driver_pin, 1);
_brightness = MAX_BRIGHTNESS_STEPS;
}
int from = MAX_BRIGHTNESS_STEPS - _brightness;
Expand All @@ -86,8 +86,8 @@ class AW9364LedDriver
}

for (int i = 0; i < num; i++) {
this->digitalWrite(_driver_pin, 0);
this->digitalWrite(_driver_pin, 1);
this->_digitalWrite(_driver_pin, 0);
this->_digitalWrite(_driver_pin, 1);
}

if (_virtualGpio) {
Expand All @@ -106,7 +106,7 @@ class AW9364LedDriver

protected:

void pinMode(uint8_t pin, uint8_t mode)
void _pinMode(uint8_t pin, uint8_t mode)
{
if (_virtualGpio) {
_virtualGpio->pinMode(pin, mode);
Expand All @@ -115,7 +115,7 @@ class AW9364LedDriver
}
}

void digitalWrite(uint8_t pin, uint8_t value)
void _digitalWrite(uint8_t pin, uint8_t value)
{
if (_virtualGpio) {
_virtualGpio->digitalWrite(pin, value);
Expand Down

0 comments on commit 3e8701c

Please sign in to comment.