diff --git a/drivers/led/issi/is31fl3218-mono.c b/drivers/led/issi/is31fl3218-mono.c index d15745f6378..de2c44b29b4 100644 --- a/drivers/led/issi/is31fl3218-mono.c +++ b/drivers/led/issi/is31fl3218-mono.c @@ -45,13 +45,13 @@ void is31fl3218_write_register(uint8_t reg, uint8_t data) { #endif } -void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) { +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, pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(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, pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT); + i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT); #endif } @@ -123,7 +123,7 @@ void is31fl3218_set_led_control_register(uint8_t index, bool value) { void is31fl3218_update_pwm_buffers(void) { if (g_pwm_buffer_update_required) { - is31fl3218_write_pwm_buffer(g_pwm_buffer); + is31fl3218_write_pwm_buffer(); // Load PWM registers and LED Control register data is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); diff --git a/drivers/led/issi/is31fl3218.c b/drivers/led/issi/is31fl3218.c index a6fbda1b278..2f6668b301a 100644 --- a/drivers/led/issi/is31fl3218.c +++ b/drivers/led/issi/is31fl3218.c @@ -45,13 +45,13 @@ void is31fl3218_write_register(uint8_t reg, uint8_t data) { #endif } -void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) { +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, pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(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, pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT); + i2c_writeReg(IS31FL3218_I2C_ADDRESS << 1, IS31FL3218_REG_PWM, g_pwm_buffer, 18, IS31FL3218_I2C_TIMEOUT); #endif } @@ -139,7 +139,7 @@ void is31fl3218_set_led_control_register(uint8_t index, bool red, bool green, bo void is31fl3218_update_pwm_buffers(void) { if (g_pwm_buffer_update_required) { - is31fl3218_write_pwm_buffer(g_pwm_buffer); + is31fl3218_write_pwm_buffer(); // Load PWM registers and LED Control register data is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); diff --git a/drivers/led/issi/is31fl3731-mono.c b/drivers/led/issi/is31fl3731-mono.c index 4533f2e7eac..908922fb709 100644 --- a/drivers/led/issi/is31fl3731-mono.c +++ b/drivers/led/issi/is31fl3731-mono.c @@ -57,7 +57,7 @@ void is31fl3731_select_page(uint8_t addr, uint8_t page) { is31fl3731_write_register(addr, IS31FL3731_REG_COMMAND, page); } -void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 9 transfers of 16 bytes. @@ -65,10 +65,10 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(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, pwm_buffer + i, 16, IS31FL3731_I2C_TIMEOUT); + i2c_writeReg(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT); #endif } } @@ -194,7 +194,7 @@ void is31fl3731_set_led_control_register(uint8_t index, bool value) { void is31fl3731_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { - is31fl3731_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3731_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3731-mono.h b/drivers/led/issi/is31fl3731-mono.h index ba7f52fde0c..1b205e01150 100644 --- a/drivers/led/issi/is31fl3731-mono.h +++ b/drivers/led/issi/is31fl3731-mono.h @@ -108,7 +108,6 @@ void is31fl3731_init_drivers(void); void is31fl3731_init(uint8_t addr); void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3731_select_page(uint8_t addr, uint8_t page); -void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3731_set_value(int index, uint8_t value); void is31fl3731_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3731.c b/drivers/led/issi/is31fl3731.c index 5c96ce804c9..b188d128d91 100644 --- a/drivers/led/issi/is31fl3731.c +++ b/drivers/led/issi/is31fl3731.c @@ -56,7 +56,7 @@ void is31fl3731_select_page(uint8_t addr, uint8_t page) { is31fl3731_write_register(addr, IS31FL3731_REG_COMMAND, page); } -void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 9 transfers of 16 bytes. @@ -64,10 +64,10 @@ void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, IS31FL3731_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(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, pwm_buffer + i, 16, IS31FL3731_I2C_TIMEOUT); + i2c_writeReg(addr << 1, IS31FL3731_FRAME_REG_PWM + i, g_pwm_buffer[index] + i, 16, IS31FL3731_I2C_TIMEOUT); #endif } } @@ -209,7 +209,7 @@ void is31fl3731_set_led_control_register(uint8_t index, bool red, bool green, bo void is31fl3731_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { - is31fl3731_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3731_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h index b144aa48ed8..71cf38db4dc 100644 --- a/drivers/led/issi/is31fl3731.h +++ b/drivers/led/issi/is31fl3731.h @@ -109,7 +109,6 @@ void is31fl3731_init_drivers(void); void is31fl3731_init(uint8_t addr); void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3731_select_page(uint8_t addr, uint8_t page); -void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/issi/is31fl3733-mono.c b/drivers/led/issi/is31fl3733-mono.c index 008feb50f48..de20c169fea 100644 --- a/drivers/led/issi/is31fl3733-mono.c +++ b/drivers/led/issi/is31fl3733-mono.c @@ -89,7 +89,7 @@ void is31fl3733_select_page(uint8_t addr, uint8_t page) { is31fl3733_write_register(addr, IS31FL3733_REG_COMMAND, page); } -void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. @@ -97,10 +97,10 @@ void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT); #endif } } @@ -213,7 +213,7 @@ void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3733_select_page(addr, IS31FL3733_COMMAND_PWM); - is31fl3733_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3733_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3733-mono.h b/drivers/led/issi/is31fl3733-mono.h index 2fae1f1afe1..591fca907a9 100644 --- a/drivers/led/issi/is31fl3733-mono.h +++ b/drivers/led/issi/is31fl3733-mono.h @@ -118,7 +118,6 @@ void is31fl3733_init_drivers(void); void is31fl3733_init(uint8_t addr, uint8_t sync); 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_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3733_set_value(int index, uint8_t value); void is31fl3733_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c index cc4dd53d6f5..de2dbd74d58 100644 --- a/drivers/led/issi/is31fl3733.c +++ b/drivers/led/issi/is31fl3733.c @@ -88,7 +88,7 @@ void is31fl3733_select_page(uint8_t addr, uint8_t page) { is31fl3733_write_register(addr, IS31FL3733_REG_COMMAND, page); } -void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. @@ -96,10 +96,10 @@ void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT); #endif } } @@ -228,7 +228,7 @@ void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3733_select_page(addr, IS31FL3733_COMMAND_PWM); - is31fl3733_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3733_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h index a1b44b57518..532d35ed577 100644 --- a/drivers/led/issi/is31fl3733.h +++ b/drivers/led/issi/is31fl3733.h @@ -143,7 +143,6 @@ void is31fl3733_init_drivers(void); void is31fl3733_init(uint8_t addr, uint8_t sync); 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_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/issi/is31fl3736-mono.c b/drivers/led/issi/is31fl3736-mono.c index e4afa75ac61..1cbc6edcff8 100644 --- a/drivers/led/issi/is31fl3736-mono.c +++ b/drivers/led/issi/is31fl3736-mono.c @@ -73,7 +73,7 @@ void is31fl3736_select_page(uint8_t addr, uint8_t page) { is31fl3736_write_register(addr, IS31FL3736_REG_COMMAND, page); } -void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. @@ -81,10 +81,10 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 16, IS31FL3736_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT); #endif } } @@ -202,7 +202,7 @@ void is31fl3736_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3736_select_page(addr, IS31FL3736_COMMAND_PWM); - is31fl3736_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3736_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3736-mono.h b/drivers/led/issi/is31fl3736-mono.h index 5e80eb646ab..43d1548c028 100644 --- a/drivers/led/issi/is31fl3736-mono.h +++ b/drivers/led/issi/is31fl3736-mono.h @@ -113,7 +113,6 @@ void is31fl3736_init_drivers(void); void is31fl3736_init(uint8_t addr); void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3736_select_page(uint8_t addr, uint8_t page); -void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3736_set_value(int index, uint8_t value); void is31fl3736_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c index 6d16efbbe14..979d1add85d 100644 --- a/drivers/led/issi/is31fl3736.c +++ b/drivers/led/issi/is31fl3736.c @@ -73,7 +73,7 @@ void is31fl3736_select_page(uint8_t addr, uint8_t page) { is31fl3736_write_register(addr, IS31FL3736_REG_COMMAND, page); } -void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. @@ -81,10 +81,10 @@ void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 16, IS31FL3736_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3736_I2C_TIMEOUT); #endif } } @@ -219,7 +219,7 @@ void is31fl3736_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3736_select_page(addr, IS31FL3736_COMMAND_PWM); - is31fl3736_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3736_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h index 5f0b11e46ad..086edc0e4a0 100644 --- a/drivers/led/issi/is31fl3736.h +++ b/drivers/led/issi/is31fl3736.h @@ -127,7 +127,6 @@ void is31fl3736_init_drivers(void); void is31fl3736_init(uint8_t addr); void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3736_select_page(uint8_t addr, uint8_t page); -void is31fl3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/issi/is31fl3737-mono.c b/drivers/led/issi/is31fl3737-mono.c index 9cc4d11d743..067d98d5eed 100644 --- a/drivers/led/issi/is31fl3737-mono.c +++ b/drivers/led/issi/is31fl3737-mono.c @@ -76,7 +76,7 @@ void is31fl3737_select_page(uint8_t addr, uint8_t page) { is31fl3737_write_register(addr, IS31FL3737_REG_COMMAND, page); } -void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. @@ -84,10 +84,10 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 16, IS31FL3737_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT); #endif } } @@ -199,7 +199,7 @@ void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3737_select_page(addr, IS31FL3737_COMMAND_PWM); - is31fl3737_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3737_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3737-mono.h b/drivers/led/issi/is31fl3737-mono.h index a11d2ef4234..6d081bfa00d 100644 --- a/drivers/led/issi/is31fl3737-mono.h +++ b/drivers/led/issi/is31fl3737-mono.h @@ -103,7 +103,6 @@ void is31fl3737_init_drivers(void); void is31fl3737_init(uint8_t addr); void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3737_select_page(uint8_t addr, uint8_t page); -void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3737_set_value(int index, uint8_t value); void is31fl3737_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c index 318695d2987..2df189bcea2 100644 --- a/drivers/led/issi/is31fl3737.c +++ b/drivers/led/issi/is31fl3737.c @@ -76,7 +76,7 @@ void is31fl3737_select_page(uint8_t addr, uint8_t page) { is31fl3737_write_register(addr, IS31FL3737_REG_COMMAND, page); } -void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. @@ -84,10 +84,10 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 16, IS31FL3737_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3737_I2C_TIMEOUT); #endif } } @@ -215,7 +215,7 @@ void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3737_select_page(addr, IS31FL3737_COMMAND_PWM); - is31fl3737_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3737_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h index a707808b51f..7f0d86df823 100644 --- a/drivers/led/issi/is31fl3737.h +++ b/drivers/led/issi/is31fl3737.h @@ -120,7 +120,6 @@ void is31fl3737_init_drivers(void); void is31fl3737_init(uint8_t addr); void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3737_select_page(uint8_t addr, uint8_t page); -void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/issi/is31fl3741-mono.c b/drivers/led/issi/is31fl3741-mono.c index 093a7d1133b..37ce58ed3f4 100644 --- a/drivers/led/issi/is31fl3741-mono.c +++ b/drivers/led/issi/is31fl3741-mono.c @@ -79,7 +79,7 @@ void is31fl3741_select_page(uint8_t addr, uint8_t page) { is31fl3741_write_register(addr, IS31FL3741_REG_COMMAND, page); } -void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assume page 0 is already selected for (uint16_t i = 0; i < 342; i += 18) { @@ -89,20 +89,20 @@ void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { #if IS31FL3741_I2C_PERSISTENCE > 0 for (uint8_t j = 0; j < IS31FL3741_I2C_PERSISTENCE; j++) { - if (i2c_writeReg(addr << 1, i % 180, pwm_buffer + i, 18, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i % 180, pwm_buffer + i, 18, IS31FL3741_I2C_TIMEOUT); + i2c_writeReg(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, pwm_buffer + 342, 9, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, 162, pwm_buffer + 342, 9, IS31FL3741_I2C_TIMEOUT); + i2c_writeReg(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT); #endif } @@ -199,7 +199,7 @@ void is31fl3741_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3741_select_page(addr, IS31FL3741_COMMAND_PWM_0); - is31fl3741_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3741_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3741-mono.h b/drivers/led/issi/is31fl3741-mono.h index 06c7da5afd8..d2ba1b7d174 100644 --- a/drivers/led/issi/is31fl3741-mono.h +++ b/drivers/led/issi/is31fl3741-mono.h @@ -105,7 +105,6 @@ void is31fl3741_init_drivers(void); void is31fl3741_init(uint8_t addr); void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3741_select_page(uint8_t addr, uint8_t page); -void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3741_set_value(int index, uint8_t value); void is31fl3741_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c index b5d041af4fa..6eca5009c28 100644 --- a/drivers/led/issi/is31fl3741.c +++ b/drivers/led/issi/is31fl3741.c @@ -79,7 +79,7 @@ void is31fl3741_select_page(uint8_t addr, uint8_t page) { is31fl3741_write_register(addr, IS31FL3741_REG_COMMAND, page); } -void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assume page 0 is already selected for (uint16_t i = 0; i < 342; i += 18) { @@ -89,20 +89,20 @@ void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { #if IS31FL3741_I2C_PERSISTENCE > 0 for (uint8_t j = 0; j < IS31FL3741_I2C_PERSISTENCE; j++) { - if (i2c_writeReg(addr << 1, i % 180, pwm_buffer + i, 18, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i % 180, g_pwm_buffer[index] + i, 18, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i % 180, pwm_buffer + i, 18, IS31FL3741_I2C_TIMEOUT); + i2c_writeReg(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, pwm_buffer + 342, 9, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, 162, pwm_buffer + 342, 9, IS31FL3741_I2C_TIMEOUT); + i2c_writeReg(addr << 1, 162, g_pwm_buffer[index] + 342, 9, IS31FL3741_I2C_TIMEOUT); #endif } @@ -213,7 +213,7 @@ void is31fl3741_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3741_select_page(addr, IS31FL3741_COMMAND_PWM_0); - is31fl3741_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3741_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h index 92127a3c4ec..e7777a88d5f 100644 --- a/drivers/led/issi/is31fl3741.h +++ b/drivers/led/issi/is31fl3741.h @@ -122,7 +122,6 @@ void is31fl3741_init_drivers(void); void is31fl3741_init(uint8_t addr); void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3741_select_page(uint8_t addr, uint8_t page); -void is31fl3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/issi/is31fl3742a-mono.c b/drivers/led/issi/is31fl3742a-mono.c index c9572520b2f..f36605f14a1 100644 --- a/drivers/led/issi/is31fl3742a-mono.c +++ b/drivers/led/issi/is31fl3742a-mono.c @@ -74,7 +74,7 @@ void is31fl3742a_select_page(uint8_t addr, uint8_t page) { is31fl3742a_write_register(addr, IS31FL3742A_REG_COMMAND, page); } -void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 6 transfers of 30 bytes. @@ -82,10 +82,10 @@ void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 30, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 30, IS31FL3742A_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT); #endif } } @@ -183,7 +183,7 @@ void is31fl3742a_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3742a_select_page(addr, IS31FL3742A_COMMAND_PWM); - is31fl3742a_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3742a_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3742a-mono.h b/drivers/led/issi/is31fl3742a-mono.h index 04614e4f6ea..8de284fa7d9 100644 --- a/drivers/led/issi/is31fl3742a-mono.h +++ b/drivers/led/issi/is31fl3742a-mono.h @@ -75,7 +75,6 @@ void is31fl3742a_init_drivers(void); void is31fl3742a_init(uint8_t addr); void is31fl3742a_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3742a_select_page(uint8_t addr, uint8_t page); -void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3742a_set_value(int index, uint8_t value); void is31fl3742a_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3742a.c b/drivers/led/issi/is31fl3742a.c index b849c714ac0..1ba8ee7b472 100644 --- a/drivers/led/issi/is31fl3742a.c +++ b/drivers/led/issi/is31fl3742a.c @@ -74,7 +74,7 @@ void is31fl3742a_select_page(uint8_t addr, uint8_t page) { is31fl3742a_write_register(addr, IS31FL3742A_REG_COMMAND, page); } -void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 6 transfers of 30 bytes. @@ -82,10 +82,10 @@ void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 30, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 30, IS31FL3742A_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 30, IS31FL3742A_I2C_TIMEOUT); #endif } } @@ -187,7 +187,7 @@ void is31fl3742a_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3742a_select_page(addr, IS31FL3742A_COMMAND_PWM); - is31fl3742a_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3742a_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3742a.h b/drivers/led/issi/is31fl3742a.h index 304dd5925b3..5f34a3cdb97 100644 --- a/drivers/led/issi/is31fl3742a.h +++ b/drivers/led/issi/is31fl3742a.h @@ -77,7 +77,6 @@ void is31fl3742a_init_drivers(void); void is31fl3742a_init(uint8_t addr); void is31fl3742a_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3742a_select_page(uint8_t addr, uint8_t page); -void is31fl3742a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3742a_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3742a_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/issi/is31fl3743a-mono.c b/drivers/led/issi/is31fl3743a-mono.c index 30d26badb5c..b49decf6340 100644 --- a/drivers/led/issi/is31fl3743a-mono.c +++ b/drivers/led/issi/is31fl3743a-mono.c @@ -83,7 +83,7 @@ void is31fl3743a_select_page(uint8_t addr, uint8_t page) { is31fl3743a_write_register(addr, IS31FL3743A_REG_COMMAND, page); } -void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 11 transfers of 18 bytes. @@ -91,10 +91,10 @@ void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 18, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i + 1, pwm_buffer + i, 18, IS31FL3743A_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT); #endif } } @@ -192,7 +192,7 @@ void is31fl3743a_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3743a_select_page(addr, IS31FL3743A_COMMAND_PWM); - is31fl3743a_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3743a_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3743a-mono.h b/drivers/led/issi/is31fl3743a-mono.h index 544531ec256..8ec3ce07553 100644 --- a/drivers/led/issi/is31fl3743a-mono.h +++ b/drivers/led/issi/is31fl3743a-mono.h @@ -85,7 +85,6 @@ void is31fl3743a_init_drivers(void); void is31fl3743a_init(uint8_t addr, uint8_t sync); void is31fl3743a_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3743a_select_page(uint8_t addr, uint8_t page); -void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3743a_set_value(int index, uint8_t value); void is31fl3743a_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3743a.c b/drivers/led/issi/is31fl3743a.c index 71a4bd1b32c..df094952a11 100644 --- a/drivers/led/issi/is31fl3743a.c +++ b/drivers/led/issi/is31fl3743a.c @@ -83,7 +83,7 @@ void is31fl3743a_select_page(uint8_t addr, uint8_t page) { is31fl3743a_write_register(addr, IS31FL3743A_REG_COMMAND, page); } -void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 11 transfers of 18 bytes. @@ -91,10 +91,10 @@ void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 18, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i + 1, pwm_buffer + i, 18, IS31FL3743A_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3743A_I2C_TIMEOUT); #endif } } @@ -196,7 +196,7 @@ void is31fl3743a_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3743a_select_page(addr, IS31FL3743A_COMMAND_PWM); - is31fl3743a_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3743a_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3743a.h b/drivers/led/issi/is31fl3743a.h index 87bb63e6b44..381b8537164 100644 --- a/drivers/led/issi/is31fl3743a.h +++ b/drivers/led/issi/is31fl3743a.h @@ -87,7 +87,6 @@ void is31fl3743a_init_drivers(void); void is31fl3743a_init(uint8_t addr, uint8_t sync); void is31fl3743a_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3743a_select_page(uint8_t addr, uint8_t page); -void is31fl3743a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3743a_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3743a_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/issi/is31fl3745-mono.c b/drivers/led/issi/is31fl3745-mono.c index 7ba74d7c185..2c9f5accbab 100644 --- a/drivers/led/issi/is31fl3745-mono.c +++ b/drivers/led/issi/is31fl3745-mono.c @@ -83,7 +83,7 @@ void is31fl3745_select_page(uint8_t addr, uint8_t page) { is31fl3745_write_register(addr, IS31FL3745_REG_COMMAND, page); } -void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 8 transfers of 18 bytes. @@ -91,10 +91,10 @@ void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 18, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i + 1, pwm_buffer + i, 18, IS31FL3745_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT); #endif } } @@ -192,7 +192,7 @@ void is31fl3745_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3745_select_page(addr, IS31FL3745_COMMAND_PWM); - is31fl3745_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3745_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3745-mono.h b/drivers/led/issi/is31fl3745-mono.h index dbff193acdd..f60f0acfd96 100644 --- a/drivers/led/issi/is31fl3745-mono.h +++ b/drivers/led/issi/is31fl3745-mono.h @@ -85,7 +85,6 @@ void is31fl3745_init_drivers(void); void is31fl3745_init(uint8_t addr, uint8_t sync); void is31fl3745_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3745_select_page(uint8_t addr, uint8_t page); -void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3745_set_value(int index, uint8_t value); void is31fl3745_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3745.c b/drivers/led/issi/is31fl3745.c index ccf5217230d..aed8876f289 100644 --- a/drivers/led/issi/is31fl3745.c +++ b/drivers/led/issi/is31fl3745.c @@ -83,7 +83,7 @@ void is31fl3745_select_page(uint8_t addr, uint8_t page) { is31fl3745_write_register(addr, IS31FL3745_REG_COMMAND, page); } -void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 8 transfers of 18 bytes. @@ -91,10 +91,10 @@ void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 18, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i + 1, pwm_buffer + i, 18, IS31FL3745_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3745_I2C_TIMEOUT); #endif } } @@ -196,7 +196,7 @@ void is31fl3745_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3745_select_page(addr, IS31FL3745_COMMAND_PWM); - is31fl3745_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3745_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3745.h b/drivers/led/issi/is31fl3745.h index f0bffb6c530..3c67f7ecc79 100644 --- a/drivers/led/issi/is31fl3745.h +++ b/drivers/led/issi/is31fl3745.h @@ -87,7 +87,6 @@ void is31fl3745_init_drivers(void); void is31fl3745_init(uint8_t addr, uint8_t sync); void is31fl3745_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3745_select_page(uint8_t addr, uint8_t page); -void is31fl3745_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3745_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3745_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/issi/is31fl3746a-mono.c b/drivers/led/issi/is31fl3746a-mono.c index 56b311f6536..d66866aacbe 100644 --- a/drivers/led/issi/is31fl3746a-mono.c +++ b/drivers/led/issi/is31fl3746a-mono.c @@ -74,7 +74,7 @@ void is31fl3746a_select_page(uint8_t addr, uint8_t page) { is31fl3746a_write_register(addr, IS31FL3746A_REG_COMMAND, page); } -void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 4 transfers of 18 bytes. @@ -82,10 +82,10 @@ void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 18, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i + 1, pwm_buffer + i, 18, IS31FL3746A_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT); #endif } } @@ -184,7 +184,7 @@ void is31fl3746a_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3746a_select_page(addr, IS31FL3746A_COMMAND_PWM); - is31fl3746a_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3746a_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3746a-mono.h b/drivers/led/issi/is31fl3746a-mono.h index 12bd501cb54..002a91f1752 100644 --- a/drivers/led/issi/is31fl3746a-mono.h +++ b/drivers/led/issi/is31fl3746a-mono.h @@ -87,7 +87,6 @@ void is31fl3746a_init_drivers(void); void is31fl3746a_init(uint8_t addr); void is31fl3746a_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3746a_select_page(uint8_t addr, uint8_t page); -void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3746a_set_value(int index, uint8_t value); void is31fl3746a_set_value_all(uint8_t value); diff --git a/drivers/led/issi/is31fl3746a.c b/drivers/led/issi/is31fl3746a.c index 216f59271b6..17346f39a43 100644 --- a/drivers/led/issi/is31fl3746a.c +++ b/drivers/led/issi/is31fl3746a.c @@ -74,7 +74,7 @@ void is31fl3746a_select_page(uint8_t addr, uint8_t page) { is31fl3746a_write_register(addr, IS31FL3746A_REG_COMMAND, page); } -void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 0 is already selected. // Transmit PWM registers in 4 transfers of 18 bytes. @@ -82,10 +82,10 @@ void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 18, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i + 1, pwm_buffer + i, 18, IS31FL3746A_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i + 1, g_pwm_buffer[index] + i, 18, IS31FL3746A_I2C_TIMEOUT); #endif } } @@ -188,7 +188,7 @@ void is31fl3746a_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3746a_select_page(addr, IS31FL3746A_COMMAND_PWM); - is31fl3746a_write_pwm_buffer(addr, g_pwm_buffer[index]); + is31fl3746a_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/issi/is31fl3746a.h b/drivers/led/issi/is31fl3746a.h index 870b6ebc88e..32647a37bde 100644 --- a/drivers/led/issi/is31fl3746a.h +++ b/drivers/led/issi/is31fl3746a.h @@ -89,7 +89,6 @@ void is31fl3746a_init_drivers(void); void is31fl3746a_init(uint8_t addr); void is31fl3746a_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3746a_select_page(uint8_t addr, uint8_t page); -void is31fl3746a_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void is31fl3746a_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3746a_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/drivers/led/snled27351-mono.c b/drivers/led/snled27351-mono.c index 6b1b1456b42..f75e81ef12e 100644 --- a/drivers/led/snled27351-mono.c +++ b/drivers/led/snled27351-mono.c @@ -63,7 +63,7 @@ void snled27351_select_page(uint8_t addr, uint8_t page) { snled27351_write_register(addr, SNLED27351_REG_COMMAND, page); } -void snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void snled27351_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes PG1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. @@ -71,10 +71,10 @@ void snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 16, SNLED27351_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT); #endif } } @@ -196,7 +196,7 @@ void snled27351_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { snled27351_select_page(addr, SNLED27351_COMMAND_PWM); - snled27351_write_pwm_buffer(addr, g_pwm_buffer[index]); + snled27351_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/snled27351-mono.h b/drivers/led/snled27351-mono.h index 8188b075ff6..3a221156234 100644 --- a/drivers/led/snled27351-mono.h +++ b/drivers/led/snled27351-mono.h @@ -157,7 +157,6 @@ void snled27351_init_drivers(void); void snled27351_init(uint8_t addr); void snled27351_select_page(uint8_t addr, uint8_t page); void snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); -void snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); void snled27351_set_value(int index, uint8_t value); void snled27351_set_value_all(uint8_t value); diff --git a/drivers/led/snled27351.c b/drivers/led/snled27351.c index 43b6982e00e..52ec54c34b4 100644 --- a/drivers/led/snled27351.c +++ b/drivers/led/snled27351.c @@ -63,7 +63,7 @@ void snled27351_select_page(uint8_t addr, uint8_t page) { snled27351_write_register(addr, SNLED27351_REG_COMMAND, page); } -void snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { +void snled27351_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes PG1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. @@ -71,10 +71,10 @@ void snled27351_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { 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, pwm_buffer + i, 16, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; + if (i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break; } #else - i2c_writeReg(addr << 1, i, pwm_buffer + i, 16, SNLED27351_I2C_TIMEOUT); + i2c_writeReg(addr << 1, i, g_pwm_buffer[index] + i, 16, SNLED27351_I2C_TIMEOUT); #endif } } @@ -212,7 +212,7 @@ void snled27351_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { snled27351_select_page(addr, SNLED27351_COMMAND_PWM); - snled27351_write_pwm_buffer(addr, g_pwm_buffer[index]); + snled27351_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/drivers/led/snled27351.h b/drivers/led/snled27351.h index 5c50bf27f19..4b811719d9e 100644 --- a/drivers/led/snled27351.h +++ b/drivers/led/snled27351.h @@ -171,7 +171,6 @@ void snled27351_init_drivers(void); void snled27351_init(uint8_t addr); void snled27351_select_page(uint8_t addr, uint8_t page); void snled27351_write_register(uint8_t addr, uint8_t reg, uint8_t data); -void 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); void snled27351_set_color_all(uint8_t red, uint8_t green, uint8_t blue); diff --git a/keyboards/input_club/k_type/is31fl3733-dual.c b/keyboards/input_club/k_type/is31fl3733-dual.c index ade8af802fe..7e32ba30b0a 100644 --- a/keyboards/input_club/k_type/is31fl3733-dual.c +++ b/keyboards/input_club/k_type/is31fl3733-dual.c @@ -75,7 +75,7 @@ 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) == 0) break; + if (i2c_writeReg(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); @@ -87,18 +87,18 @@ void is31fl3733_select_page(uint8_t index, uint8_t addr, uint8_t page) { is31fl3733_write_register(index, addr, IS31FL3733_REG_COMMAND, page); } -void is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer) { +void is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t index) { // Assumes page 1 is already selected. // Transmit PWM registers in 12 transfers of 16 bytes. // Iterate over the pwm_buffer contents at 16 byte intervals. - for (int i = 0; i < IS31FL3733_PWM_REGISTER_COUNT; i += 16) { + for (uint8_t i = 0; i < IS31FL3733_PWM_REGISTER_COUNT; i += 16) { #if IS31FL3733_I2C_PERSISTENCE > 0 - for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) { - if (i2c_writeReg(index, addr << 1, i, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT) == 0) break; + 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; } #else - i2c_writeReg(index, addr << 1, i, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT); + i2c_writeReg(index, addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT); #endif } } @@ -216,7 +216,7 @@ void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index) { if (g_pwm_buffer_update_required[index]) { is31fl3733_select_page(index, addr, IS31FL3733_COMMAND_PWM); - is31fl3733_write_pwm_buffer(index, addr, g_pwm_buffer[index]); + is31fl3733_write_pwm_buffer(addr, index); g_pwm_buffer_update_required[index] = false; } diff --git a/keyboards/input_club/k_type/is31fl3733-dual.h b/keyboards/input_club/k_type/is31fl3733-dual.h index 9cdfb29f748..1237fc77d1e 100644 --- a/keyboards/input_club/k_type/is31fl3733-dual.h +++ b/keyboards/input_club/k_type/is31fl3733-dual.h @@ -86,7 +86,6 @@ void is31fl3733_init_drivers(void); void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync); 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_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer); void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue);