[kp18058]: clang_tidy problems. this starts to be frustrating.

This commit is contained in:
NewoPL 2024-11-03 12:46:14 +01:00
parent 6c06a826e9
commit f4a2baa8d0
2 changed files with 6 additions and 6 deletions

View file

@ -60,7 +60,7 @@ void KP18058::program_led_driver() {
};
// Create the settings struct
KP18058_Settings settings{};
KP18058Settings settings{};
settings.address_identification = 1;
settings.working_mode = all_channels_zero() ? STANDBY_MODE : RGBCW_MODE;
@ -91,13 +91,13 @@ void KP18058::program_led_driver() {
// Calculate parity bits for each byte
uint8_t *settings_bytes = reinterpret_cast<uint8_t *>(&settings);
for (size_t i = 0; i < sizeof(KP18058_Settings); i++) {
for (size_t i = 0; i < sizeof(KP18058Settings); i++) {
settings_bytes[i] |= get_parity_bit(settings_bytes[i]);
}
// Send the I2C message
i2c_.start();
for (size_t i = 0; i < sizeof(KP18058_Settings); i++) {
for (size_t i = 0; i < sizeof(KP18058Settings); i++) {
// On error, try to repeat the byte transmission I2C_MAX_RETRY times
bool write_succeeded;
for (int attempt = 0; attempt < I2C_MAX_RETRY; attempt++) {

View file

@ -94,7 +94,7 @@ enum CDFrequency : uint8_t {
/**
* @brief the structure of the I2C message for configuring the KP18058 LED driver settings.
*/
struct KP18058_Settings {
struct KP18058Settings {
// Byte 0
uint8_t byte0_parity_bit : 1;
uint8_t start_byte_address : 4;
@ -132,8 +132,8 @@ struct KP18058_Settings {
#pragma pack(pop)
// Ensures that KP18058_Settings size is exactly 14 bytes during compilation
static_assert(sizeof(KP18058_Settings) == 14, "Size of KP18058_Settings must be exactly 14 bytes");
// Ensures that KP18058Settings size is exactly 14 bytes during compilation
static_assert(sizeof(KP18058Settings) == 14, "Size of KP18058Settings must be exactly 14 bytes");
} // namespace kp18058
} // namespace esphome