forked from forks/qmk_firmware
is31fl3733: change write_register()
return type to void
(#22824)
This commit is contained in:
parent
7fb8dd1440
commit
368a2eb08f
|
@ -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};
|
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 g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT] = {false};
|
||||||
|
|
||||||
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) {
|
||||||
// If the transaction fails function returns false.
|
|
||||||
i2c_transfer_buffer[0] = reg;
|
i2c_transfer_buffer[0] = reg;
|
||||||
i2c_transfer_buffer[1] = data;
|
i2c_transfer_buffer[1] = data;
|
||||||
|
|
||||||
#if IS31FL3733_I2C_PERSISTENCE > 0
|
#if IS31FL3733_I2C_PERSISTENCE > 0
|
||||||
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
|
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
|
||||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) == 0) break;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void is31fl3733_select_page(uint8_t addr, uint8_t page) {
|
void is31fl3733_select_page(uint8_t addr, uint8_t page) {
|
||||||
|
|
|
@ -116,7 +116,7 @@ extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];
|
||||||
|
|
||||||
void is31fl3733_init_drivers(void);
|
void is31fl3733_init_drivers(void);
|
||||||
void is31fl3733_init(uint8_t addr, uint8_t sync);
|
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);
|
void is31fl3733_select_page(uint8_t addr, uint8_t page);
|
||||||
bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
||||||
|
|
||||||
|
|
|
@ -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};
|
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 g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT] = {false};
|
||||||
|
|
||||||
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) {
|
||||||
// If the transaction fails function returns false.
|
|
||||||
i2c_transfer_buffer[0] = reg;
|
i2c_transfer_buffer[0] = reg;
|
||||||
i2c_transfer_buffer[1] = data;
|
i2c_transfer_buffer[1] = data;
|
||||||
|
|
||||||
#if IS31FL3733_I2C_PERSISTENCE > 0
|
#if IS31FL3733_I2C_PERSISTENCE > 0
|
||||||
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
|
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
|
||||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) == 0) break;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void is31fl3733_select_page(uint8_t addr, uint8_t page) {
|
void is31fl3733_select_page(uint8_t addr, uint8_t page) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];
|
||||||
|
|
||||||
void is31fl3733_init_drivers(void);
|
void is31fl3733_init_drivers(void);
|
||||||
void is31fl3733_init(uint8_t addr, uint8_t sync);
|
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);
|
void is31fl3733_select_page(uint8_t addr, uint8_t page);
|
||||||
bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
||||||
|
|
||||||
|
|
|
@ -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};
|
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 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) {
|
void is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data) {
|
||||||
// If the transaction fails function returns false.
|
|
||||||
i2c_transfer_buffer[0] = reg;
|
i2c_transfer_buffer[0] = reg;
|
||||||
i2c_transfer_buffer[1] = data;
|
i2c_transfer_buffer[1] = data;
|
||||||
|
|
||||||
#if IS31FL3733_I2C_PERSISTENCE > 0
|
#if IS31FL3733_I2C_PERSISTENCE > 0
|
||||||
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
|
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
|
||||||
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) == 0) break;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT) != 0) {
|
i2c_transmit(index, addr << 1, i2c_transfer_buffer, 2, IS31FL3733_I2C_TIMEOUT);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void is31fl3733_select_page(uint8_t index, uint8_t addr, uint8_t page) {
|
void is31fl3733_select_page(uint8_t index, uint8_t addr, uint8_t page) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];
|
||||||
|
|
||||||
void is31fl3733_init_drivers(void);
|
void is31fl3733_init_drivers(void);
|
||||||
void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync);
|
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);
|
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);
|
bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue