LED drivers: update I2C API usage (#22951)

This commit is contained in:
Ryan 2024-01-24 12:11:41 +11:00 committed by GitHub
parent d96ac7084e
commit 728aa576b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 100 additions and 100 deletions

View file

@ -38,20 +38,20 @@ bool g_led_control_registers_update_required = false;
void is31fl3218_write_register(uint8_t reg, uint8_t data) {
#if IS31FL3218_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, reg, &data, 1, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(IS31FL3218_I2C_ADDRESS << 1, reg, &data, 1, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, reg, &data, 1, IS31FL3218_I2C_TIMEOUT);
i2c_write_register(IS31FL3218_I2C_ADDRESS << 1, reg, &data, 1, IS31FL3218_I2C_TIMEOUT);
#endif
}
void is31fl3218_write_pwm_buffer(void) {
#if IS31FL3218_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT);
i2c_write_register(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT);
#endif
}

View file

@ -38,20 +38,20 @@ bool g_led_control_registers_update_required = false;
void is31fl3218_write_register(uint8_t reg, uint8_t data) {
#if IS31FL3218_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, reg, &data, 1, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(IS31FL3218_I2C_ADDRESS << 1, reg, &data, 1, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, reg, &data, 1, IS31FL3218_I2C_TIMEOUT);
i2c_write_register(IS31FL3218_I2C_ADDRESS << 1, reg, &data, 1, IS31FL3218_I2C_TIMEOUT);
#endif
}
void is31fl3218_write_pwm_buffer(void) {
#if IS31FL3218_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT);
i2c_write_register(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT);
#endif
}

View file

@ -46,10 +46,10 @@ bool g_led_control_registers_update_required[IS31FL3731_DRIVER_COUNT]
void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3731_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3731_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3731_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3731_I2C_TIMEOUT);
#endif
}
@ -65,10 +65,10 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3731_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3731_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3731_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT);
i2c_write_register(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT);
#endif
}
}

View file

@ -45,10 +45,10 @@ bool g_led_control_registers_update_required[IS31FL3731_DRIVER_COUNT]
void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3731_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3731_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3731_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3731_I2C_TIMEOUT);
#endif
}
@ -64,10 +64,10 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3731_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3731_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3731_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT);
i2c_write_register(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT);
#endif
}
}

View file

@ -77,10 +77,10 @@ bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT]
void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT);
#endif
}
@ -97,10 +97,10 @@ void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3733_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3733_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT);
#endif
}
}

View file

@ -76,10 +76,10 @@ bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT]
void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT);
#endif
}
@ -96,10 +96,10 @@ void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3733_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3733_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT);
#endif
}
}

View file

@ -61,10 +61,10 @@ bool g_led_control_registers_update_required[IS31FL3736_DRIVER_COUNT]
void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3736_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3736_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3736_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3736_I2C_TIMEOUT);
#endif
}
@ -81,10 +81,10 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3736_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3736_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3736_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT);
#endif
}
}

View file

@ -61,10 +61,10 @@ bool g_led_control_registers_update_required[IS31FL3736_DRIVER_COUNT]
void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3736_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3736_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3736_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3736_I2C_TIMEOUT);
#endif
}
@ -81,10 +81,10 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3736_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3736_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3736_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT);
#endif
}
}

View file

@ -64,10 +64,10 @@ bool g_led_control_registers_update_required[IS31FL3737_DRIVER_COUNT]
void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3737_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3737_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3737_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3737_I2C_TIMEOUT);
#endif
}
@ -84,10 +84,10 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3737_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3737_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3737_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT);
#endif
}
}

View file

@ -64,10 +64,10 @@ bool g_led_control_registers_update_required[IS31FL3737_DRIVER_COUNT]
void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3737_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3737_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3737_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3737_I2C_TIMEOUT);
#endif
}
@ -84,10 +84,10 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3737_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3737_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3737_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT);
#endif
}
}

View file

@ -67,10 +67,10 @@ uint8_t g_scaling_registers[IS31FL3741_DRIVER_COUNT][IS31FL3741_SCALING_REGISTER
void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3741_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3741_I2C_TIMEOUT);
#endif
}
@ -89,20 +89,20 @@ void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t index) {
#if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3741_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT);
i2c_write_register(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT);
#endif
}
// transfer the left cause the total number is 351
#if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT);
i2c_write_register(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT);
#endif
}

View file

@ -67,10 +67,10 @@ uint8_t g_scaling_registers[IS31FL3741_DRIVER_COUNT][IS31FL3741_SCALING_REGISTER
void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3741_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3741_I2C_TIMEOUT);
#endif
}
@ -89,20 +89,20 @@ void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t index) {
#if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3741_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT);
i2c_write_register(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT);
#endif
}
// transfer the left cause the total number is 351
#if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT);
i2c_write_register(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT);
#endif
}

View file

@ -62,10 +62,10 @@ uint8_t g_scaling_registers[IS31FL3742A_DRIVER_COUNT][IS31FL3742A_SCALING_REGIST
void is31fl3742a_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3742A_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3742A_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3742A_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3742A_I2C_TIMEOUT);
#endif
}
@ -82,10 +82,10 @@ void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3742A_PWM_REGISTER_COUNT; i += 30) {
#if IS31FL3742A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3742A_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT);
#endif
}
}

View file

@ -62,10 +62,10 @@ uint8_t g_scaling_registers[IS31FL3742A_DRIVER_COUNT][IS31FL3742A_SCALING_REGIST
void is31fl3742a_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3742A_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3742A_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3742A_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3742A_I2C_TIMEOUT);
#endif
}
@ -82,10 +82,10 @@ void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3742A_PWM_REGISTER_COUNT; i += 30) {
#if IS31FL3742A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3742A_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT);
#endif
}
}

View file

@ -71,10 +71,10 @@ uint8_t g_scaling_registers[IS31FL3743A_DRIVER_COUNT][IS31FL3743A_SCALING_REGIST
void is31fl3743a_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3743A_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3743A_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3743A_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3743A_I2C_TIMEOUT);
#endif
}
@ -91,10 +91,10 @@ void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3743A_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3743A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3743A_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT);
i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT);
#endif
}
}

View file

@ -71,10 +71,10 @@ uint8_t g_scaling_registers[IS31FL3743A_DRIVER_COUNT][IS31FL3743A_SCALING_REGIST
void is31fl3743a_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3743A_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3743A_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3743A_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3743A_I2C_TIMEOUT);
#endif
}
@ -91,10 +91,10 @@ void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3743A_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3743A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3743A_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT);
i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT);
#endif
}
}

View file

@ -71,10 +71,10 @@ uint8_t g_scaling_registers[IS31FL3745_DRIVER_COUNT][IS31FL3745_SCALING_REGISTER
void is31fl3745_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3745_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3745_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3745_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3745_I2C_TIMEOUT);
#endif
}
@ -91,10 +91,10 @@ void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3745_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3745_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3745_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT);
i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT);
#endif
}
}

View file

@ -71,10 +71,10 @@ uint8_t g_scaling_registers[IS31FL3745_DRIVER_COUNT][IS31FL3745_SCALING_REGISTER
void is31fl3745_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3745_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3745_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3745_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3745_I2C_TIMEOUT);
#endif
}
@ -91,10 +91,10 @@ void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3745_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3745_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3745_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT);
i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT);
#endif
}
}

View file

@ -62,10 +62,10 @@ uint8_t g_scaling_registers[IS31FL3746A_DRIVER_COUNT][IS31FL3746A_SCALING_REGIST
void is31fl3746a_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3746A_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3746A_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3746A_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3746A_I2C_TIMEOUT);
#endif
}
@ -82,10 +82,10 @@ void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3746A_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3746A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3746A_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT);
i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT);
#endif
}
}

View file

@ -62,10 +62,10 @@ uint8_t g_scaling_registers[IS31FL3746A_DRIVER_COUNT][IS31FL3746A_SCALING_REGIST
void is31fl3746a_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3746A_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3746A_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, IS31FL3746A_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, IS31FL3746A_I2C_TIMEOUT);
#endif
}
@ -82,10 +82,10 @@ void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3746A_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3746A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3746A_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT);
i2c_write_register(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT);
#endif
}
}

View file

@ -52,10 +52,10 @@ bool g_led_control_registers_update_required[SNLED27351_DRIVER_COUNT]
void snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if SNLED27351_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < SNLED27351_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, SNLED27351_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, SNLED27351_I2C_TIMEOUT);
#endif
}
@ -71,10 +71,10 @@ void snled27351_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < SNLED27351_PWM_REGISTER_COUNT; i += 16) {
#if SNLED27351_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < SNLED27351_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT);
#endif
}
}

View file

@ -52,10 +52,10 @@ bool g_led_control_registers_update_required[SNLED27351_DRIVER_COUNT]
void snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
#if SNLED27351_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < SNLED27351_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(addr << 1, reg, &data, 1, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, reg, &data, 1, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, reg, &data, 1, SNLED27351_I2C_TIMEOUT);
i2c_write_register(addr << 1, reg, &data, 1, SNLED27351_I2C_TIMEOUT);
#endif
}
@ -71,10 +71,10 @@ void snled27351_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < SNLED27351_PWM_REGISTER_COUNT; i += 16) {
#if SNLED27351_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < SNLED27351_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT);
i2c_write_register(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT);
#endif
}
}

View file

@ -114,7 +114,7 @@ i2c_status_t i2c_receive(uint8_t index, uint8_t address, uint8_t* data, uint16_t
return chibios_to_qmk(&status);
}
i2c_status_t i2c_writeReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) {
i2c_status_t i2c_write_register(uint8_t index, uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) {
if(index >= I2C_COUNT) {
return I2C_STATUS_ERROR;
}
@ -131,7 +131,7 @@ i2c_status_t i2c_writeReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, const
return chibios_to_qmk(&status);
}
i2c_status_t i2c_readReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) {
i2c_status_t i2c_read_register(uint8_t index, uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) {
if(index >= I2C_COUNT) {
return I2C_STATUS_ERROR;
}

View file

@ -123,6 +123,6 @@ void i2c_init(I2CDriver *driver, ioline_t scl_pin, ioline_t sda_pin);
i2c_status_t i2c_start(uint8_t index, uint8_t address);
i2c_status_t i2c_transmit(uint8_t index, uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout);
i2c_status_t i2c_receive(uint8_t index, uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);
i2c_status_t i2c_writeReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
i2c_status_t i2c_readReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
i2c_status_t i2c_write_register(uint8_t index, uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
i2c_status_t i2c_read_register(uint8_t index, uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
void i2c_stop(uint8_t index);

View file

@ -75,10 +75,10 @@ bool g_led_control_registers_update_required[IS31FL3733_DRIVER_COUNT]
void is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
if (i2c_writeReg(index, addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(index, addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(index, addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT);
i2c_write_register(index, addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT);
#endif
}
@ -95,10 +95,10 @@ void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t index) {
for (uint8_t i = 0; i < IS31FL3733_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3733_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(index, addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
if (i2c_write_register(index, addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
}
#else
i2c_writeReg(index, addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT);
i2c_write_register(index, addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT);
#endif
}
}