Skip to content

Commit

Permalink
Rename RGB registers
Browse files Browse the repository at this point in the history
  • Loading branch information
sebromero committed Jun 12, 2024
1 parent 9434df0 commit ebc4a53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/RGBLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ void RGBLED::enableIndoorAirQualityStatus() {

void RGBLED::enableIndoorAirQualityStatus(uint8_t brightness) {
writeToRegister(RGB_LED_RED_REGISTER_INFO, 0);
writeToRegister(GREEN_REGISTER_INFO, 0);
writeToRegister(BLUE_REGISTER_INFO, 0);
writeToRegister(RGB_LED_GREEN_REGISTER_INFO, 0);
writeToRegister(RGB_LED_BLUE_REGISTER_INFO, 0);
writeToRegister(INTENSITY_REGISTER_INFO, brightness);
}

Expand All @@ -22,8 +22,8 @@ void RGBLED::setColor(uint8_t r, uint8_t g, uint8_t b) {

void RGBLED::setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness) {
writeToRegister(RGB_LED_RED_REGISTER_INFO, r);
writeToRegister(GREEN_REGISTER_INFO, g);
writeToRegister(BLUE_REGISTER_INFO, b);
writeToRegister(RGB_LED_GREEN_REGISTER_INFO, g);
writeToRegister(RGB_LED_BLUE_REGISTER_INFO, b);
writeToRegister(INTENSITY_REGISTER_INFO, brightness);
}

Expand All @@ -37,8 +37,8 @@ void RGBLED::setColor(Color color, uint8_t brightness) {

Color RGBLED::color() {
uint8_t red = readFromRegister<uint8_t>(RGB_LED_RED_REGISTER_INFO);
uint8_t green = readFromRegister<uint8_t>(GREEN_REGISTER_INFO);
uint8_t blue = readFromRegister<uint8_t>(BLUE_REGISTER_INFO);
uint8_t green = readFromRegister<uint8_t>(RGB_LED_GREEN_REGISTER_INFO);
uint8_t blue = readFromRegister<uint8_t>(RGB_LED_BLUE_REGISTER_INFO);
return {red, green, blue};
}

Expand Down
4 changes: 2 additions & 2 deletions src/registers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ constexpr RegisterInfo SLAVE_ADDRESS_REGISTER_INFO{0x01, "uint8", 1};
constexpr RegisterInfo CONTROL_REGISTER_INFO{0x02, "uint8", 1};
constexpr RegisterInfo ORANGE_LED_REGISTER_INFO{0x03, "uint8", 1};
constexpr RegisterInfo RGB_LED_RED_REGISTER_INFO{0x04, "uint8", 1};
constexpr RegisterInfo GREEN_REGISTER_INFO{0x05, "uint8", 1};
constexpr RegisterInfo BLUE_REGISTER_INFO{0x06, "uint8", 1};
constexpr RegisterInfo RGB_LED_GREEN_REGISTER_INFO{0x05, "uint8", 1};
constexpr RegisterInfo RGB_LED_BLUE_REGISTER_INFO{0x06, "uint8", 1};
constexpr RegisterInfo INTENSITY_REGISTER_INFO{0x07, "uint8", 1};
constexpr RegisterInfo UART_CONTROL_REGISTER_INFO{0x08, "uint8", 1};
constexpr RegisterInfo CSV_DELIMITER_REGISTER_INFO{0x09, "uint8", 1};
Expand Down

0 comments on commit ebc4a53

Please sign in to comment.