1
0
Fork 0
forked from forks/qmk_firmware

is31fl3733: change write_register() return type to void (#22824)

This commit is contained in:
Ryan 2024-01-08 15:54:26 +11:00 committed by GitHub
parent 7fb8dd1440
commit 368a2eb08f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 30 deletions

View file

@ -77,23 +77,17 @@ bool g_pwm_buffer_update_required[IS31FL3733_DRIVER_COUNT] = {false};
uint8_t g_led_control_registers[IS31FL3733_DRIVER_COUNT][IS31FL3733_LED_CONTROL_REGISTER_COUNT] = {0};
bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT] = {false};
bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
// If the transaction fails function returns false.
void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
i2c_transfer_buffer[0] = reg;
i2c_transfer_buffer[1] = data;
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
return false;
}
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) == 0) break;
}
#else
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
return false;
}
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT);
#endif
return true;
}
void is31fl3733_select_page(uint8_t addr, uint8_t page) {

View file

@ -116,7 +116,7 @@ extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];
void is31fl3733_init_drivers(void);
void is31fl3733_init(uint8_t addr, uint8_t sync);
bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_select_page(uint8_t addr, uint8_t page);
bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);

View file

@ -76,23 +76,17 @@ bool g_pwm_buffer_update_required[IS31FL3733_DRIVER_COUNT] = {false};
uint8_t g_led_control_registers[IS31FL3733_DRIVER_COUNT][IS31FL3733_LED_CONTROL_REGISTER_COUNT] = {0};
bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT] = {false};
bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
// If the transaction fails function returns false.
void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
i2c_transfer_buffer[0] = reg;
i2c_transfer_buffer[1] = data;
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
return false;
}
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) == 0) break;
}
#else
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
return false;
}
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT);
#endif
return true;
}
void is31fl3733_select_page(uint8_t addr, uint8_t page) {

View file

@ -141,7 +141,7 @@ extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];
void is31fl3733_init_drivers(void);
void is31fl3733_init(uint8_t addr, uint8_t sync);
bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_select_page(uint8_t addr, uint8_t page);
bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);

View file

@ -74,23 +74,17 @@ bool g_pwm_buffer_update_required[IS31FL3733_DRIVER_COUNT] = {false};
uint8_t g_led_control_registers[IS31FL3733_DRIVER_COUNT][IS31FL3733_LED_CONTROL_REGISTER_COUNT] = {0};
bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT] = {false};
bool is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data) {
// If the transaction fails function returns false.
void is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data) {
i2c_transfer_buffer[0] = reg;
i2c_transfer_buffer[1] = data;
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
return false;
}
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) == 0) break;
}
#else
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
return false;
}
i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT);
#endif
return true;
}
void is31fl3733_select_page(uint8_t index, uint8_t addr, uint8_t page) {

View file

@ -83,7 +83,7 @@ extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];
void is31fl3733_init_drivers(void);
void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync);
bool is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_select_page(uint8_t index, uint8_t addr, uint8_t page);
bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer);