Skip to content

Commit 0b2d8aa

Browse files
committed
Rename register
1 parent 239a522 commit 0b2d8aa

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: src/OrangeLED.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ OrangeLED::OrangeLED(uint8_t deviceAddress) : I2CDevice(deviceAddress) {}
66

77
uint8_t OrangeLED::brightness() {
88
// Read bits 0 - 5 from orange_led register
9-
uint8_t data = readFromRegister<uint8_t>(WHITE_LED_REGISTER_INFO);
9+
uint8_t data = readFromRegister<uint8_t>(ORANGE_LED_REGISTER_INFO);
1010
return data & 63;
1111
}
1212

@@ -15,19 +15,19 @@ void OrangeLED::setBrightness(uint8_t brightness) {
1515
return; // Invalid brightness value
1616
}
1717

18-
uint8_t currentRegisterData = readFromRegister<uint8_t>(WHITE_LED_REGISTER_INFO);
18+
uint8_t currentRegisterData = readFromRegister<uint8_t>(ORANGE_LED_REGISTER_INFO);
1919
// Overwrite bits 0 - 5 with the new value
20-
writeToRegister<uint8_t>(WHITE_LED_REGISTER_INFO, (currentRegisterData & ~63) | brightness);
20+
writeToRegister<uint8_t>(ORANGE_LED_REGISTER_INFO, (currentRegisterData & ~63) | brightness);
2121
}
2222

2323
bool OrangeLED::errorStatusEnabled() {
2424
// Read bit 7 from orange_led register
25-
uint8_t data = readFromRegister<uint8_t>(WHITE_LED_REGISTER_INFO);
25+
uint8_t data = readFromRegister<uint8_t>(ORANGE_LED_REGISTER_INFO);
2626
return data & (1 << 7);
2727
}
2828

2929
void OrangeLED::setErrorStatusEnabled(bool enabled) {
30-
uint8_t currentRegisterData = readFromRegister<uint8_t>(WHITE_LED_REGISTER_INFO);
30+
uint8_t currentRegisterData = readFromRegister<uint8_t>(ORANGE_LED_REGISTER_INFO);
3131
// Set bit 7 to 1 if enabled or 0 if disabled while keeping the other bits unchanged
32-
writeToRegister<uint8_t>(WHITE_LED_REGISTER_INFO, (currentRegisterData & ~(1 << 7)) | (enabled << 7));
32+
writeToRegister<uint8_t>(ORANGE_LED_REGISTER_INFO, (currentRegisterData & ~(1 << 7)) | (enabled << 7));
3333
}

Diff for: src/registers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct RegisterInfo {
1414
constexpr RegisterInfo STATUS_REGISTER_INFO{0x00, "uint8", 1};
1515
constexpr RegisterInfo SLAVE_ADDRESS_REGISTER_INFO{0x01, "uint8", 1};
1616
constexpr RegisterInfo CONTROL_REGISTER_INFO{0x02, "uint8", 1};
17-
constexpr RegisterInfo WHITE_LED_REGISTER_INFO{0x03, "uint8", 1};
17+
constexpr RegisterInfo ORANGE_LED_REGISTER_INFO{0x03, "uint8", 1};
1818
constexpr RegisterInfo RGB_LED_RED_REGISTER_INFO{0x04, "uint8", 1};
1919
constexpr RegisterInfo GREEN_REGISTER_INFO{0x05, "uint8", 1};
2020
constexpr RegisterInfo BLUE_REGISTER_INFO{0x06, "uint8", 1};

0 commit comments

Comments
 (0)