forked from mirrors/qmk_firmware
snled27351: change write_register()
return type to void
(#22825)
This commit is contained in:
parent
368a2eb08f
commit
7467231158
4 changed files with 8 additions and 20 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue