diff --git a/drivers/led/snled27351-mono.c b/drivers/led/snled27351-mono.c index 93fea8b515f..5d4b8e3a405 100644 --- a/drivers/led/snled27351-mono.c +++ b/drivers/led/snled27351-mono.c @@ -51,23 +51,17 @@ bool g_pwm_buffer_update_required[SNLED27351_DRIVER_COUNT] = {false}; uint8_t g_led_control_registers[SNLED27351_DRIVER_COUNT][SNLED27351_LED_CONTROL_REGISTER_COUNT] = {0}; bool g_led_control_registers_update_required[SNLED27351_DRIVER_COUNT] = {false}; -bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data) { - // If the transaction fails function returns false. +void snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data) { i2c_transfer_buffer[0] = reg; i2c_transfer_buffer[1] = data; #if SNLED27351_I2C_PERSISTENCE > 0 for (uint8_t i = 0; i < SNLED27351_I2C_PERSISTENCE; i++) { - if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) { - return false; - } + if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) == 0) break; } #else - if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) { - return false; - } + i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT); #endif - return true; } void snled27351_select_page(uint8_t addr, uint8_t page) { diff --git a/drivers/led/snled27351-mono.h b/drivers/led/snled27351-mono.h index 0a4d2469f08..df1cd21efbe 100644 --- a/drivers/led/snled27351-mono.h +++ b/drivers/led/snled27351-mono.h @@ -156,7 +156,7 @@ extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; void snled27351_init_drivers(void); void snled27351_init(uint8_t addr); void snled27351_select_page(uint8_t addr, uint8_t page); -bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); +void snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void snled27351_set_value(int index, uint8_t value); diff --git a/drivers/led/snled27351.c b/drivers/led/snled27351.c index 28f770d0cd1..e40d09e7597 100644 --- a/drivers/led/snled27351.c +++ b/drivers/led/snled27351.c @@ -51,23 +51,17 @@ bool g_pwm_buffer_update_required[SNLED27351_DRIVER_COUNT] = {false}; uint8_t g_led_control_registers[SNLED27351_DRIVER_COUNT][SNLED27351_LED_CONTROL_REGISTER_COUNT] = {0}; bool g_led_control_registers_update_required[SNLED27351_DRIVER_COUNT] = {false}; -bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data) { - // If the transaction fails function returns false. +void snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data) { i2c_transfer_buffer[0] = reg; i2c_transfer_buffer[1] = data; #if SNLED27351_I2C_PERSISTENCE > 0 for (uint8_t i = 0; i < SNLED27351_I2C_PERSISTENCE; i++) { - if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) { - return false; - } + if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) == 0) break; } #else - if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT) != 0) { - return false; - } + i2c_transmit(addr << 1, i2c_transfer_buffer, 2, SNLED27351_I2C_TIMEOUT); #endif - return true; } void snled27351_select_page(uint8_t addr, uint8_t page) { diff --git a/drivers/led/snled27351.h b/drivers/led/snled27351.h index 8260df1ce18..184fdbc523c 100644 --- a/drivers/led/snled27351.h +++ b/drivers/led/snled27351.h @@ -170,7 +170,7 @@ extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; void snled27351_init_drivers(void); void snled27351_init(uint8_t addr); void snled27351_select_page(uint8_t addr, uint8_t page); -bool snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); +void snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); bool snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void snled27351_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);