From d96ac7084e213de1b1714d7299f3c390aed84105 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 24 Jan 2024 09:18:44 +1100 Subject: [PATCH] LED drivers: remove `write_pwm_buffer()` from public API (#22884) --- drivers/led/issi/is31fl3218-mono.c | 8 ++++---- drivers/led/issi/is31fl3218.c | 8 ++++---- drivers/led/issi/is31fl3731-mono.c | 8 ++++---- drivers/led/issi/is31fl3731-mono.h | 1 - drivers/led/issi/is31fl3731.c | 8 ++++---- drivers/led/issi/is31fl3731.h | 1 - drivers/led/issi/is31fl3733-mono.c | 8 ++++---- drivers/led/issi/is31fl3733-mono.h | 1 - drivers/led/issi/is31fl3733.c | 8 ++++---- drivers/led/issi/is31fl3733.h | 1 - drivers/led/issi/is31fl3736-mono.c | 8 ++++---- drivers/led/issi/is31fl3736-mono.h | 1 - drivers/led/issi/is31fl3736.c | 8 ++++---- drivers/led/issi/is31fl3736.h | 1 - drivers/led/issi/is31fl3737-mono.c | 8 ++++---- drivers/led/issi/is31fl3737-mono.h | 1 - drivers/led/issi/is31fl3737.c | 8 ++++---- drivers/led/issi/is31fl3737.h | 1 - drivers/led/issi/is31fl3741-mono.c | 12 ++++++------ drivers/led/issi/is31fl3741-mono.h | 1 - drivers/led/issi/is31fl3741.c | 12 ++++++------ drivers/led/issi/is31fl3741.h | 1 - drivers/led/issi/is31fl3742a-mono.c | 8 ++++---- drivers/led/issi/is31fl3742a-mono.h | 1 - drivers/led/issi/is31fl3742a.c | 8 ++++---- drivers/led/issi/is31fl3742a.h | 1 - drivers/led/issi/is31fl3743a-mono.c | 8 ++++---- drivers/led/issi/is31fl3743a-mono.h | 1 - drivers/led/issi/is31fl3743a.c | 8 ++++---- drivers/led/issi/is31fl3743a.h | 1 - drivers/led/issi/is31fl3745-mono.c | 8 ++++---- drivers/led/issi/is31fl3745-mono.h | 1 - drivers/led/issi/is31fl3745.c | 8 ++++---- drivers/led/issi/is31fl3745.h | 1 - drivers/led/issi/is31fl3746a-mono.c | 8 ++++---- drivers/led/issi/is31fl3746a-mono.h | 1 - drivers/led/issi/is31fl3746a.c | 8 ++++---- drivers/led/issi/is31fl3746a.h | 1 - drivers/led/snled27351-mono.c | 8 ++++---- drivers/led/snled27351-mono.h | 1 - drivers/led/snled27351.c | 8 ++++---- drivers/led/snled27351.h | 1 - keyboards/input_club/k_type/is31fl3733-dual.c | 14 +++++++------- keyboards/input_club/k_type/is31fl3733-dual.h | 1 - 44 files changed, 99 insertions(+), 120 deletions(-) diff --git a/drivers/led/issi/is31fl3218-mono.c b/drivers/led/issi/is31fl3218-mono.c index d15745f637..de2c44b29b 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 a6fbda1b27..2f6668b301 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 4533f2e7ea..908922fb70 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 ba7f52fde0..1b205e0115 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 5c96ce804c..b188d128d9 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 b144aa48ed..71cf38db4d 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 008feb50f4..de20c169fe 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 2fae1f1afe..591fca907a 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 cc4dd53d6f..de2dbd74d5 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 a1b44b5751..532d35ed57 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 e4afa75ac6..1cbc6edcff 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 5e80eb646a..43d1548c02 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 6d16efbbe1..979d1add85 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 5f0b11e46a..086edc0e4a 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 9cc4d11d74..067d98d5ee 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 a11d2ef423..6d081bfa00 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 318695d298..2df189bcea 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 a707808b51..7f0d86df82 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 093a7d1133..37ce58ed3f 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 06c7da5afd..d2ba1b7d17 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 b5d041af4f..6eca5009c2 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 92127a3c4e..e7777a88d5 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 c9572520b2..f36605f14a 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 04614e4f6e..8de284fa7d 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 b849c714ac..1ba8ee7b47 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 304dd5925b..5f34a3cdb9 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 30d26badb5..b49decf634 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 544531ec25..8ec3ce0755 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 71a4bd1b32..df094952a1 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 87bb63e6b4..381b853716 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 7ba74d7c18..2c9f5accba 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 dbff193acd..f60f0acfd9 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 ccf5217230..aed8876f28 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 f0bffb6c53..3c67f7ecc7 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 56b311f653..d66866aacb 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 12bd501cb5..002a91f175 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 216f59271b..17346f39a4 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 870b6ebc88..32647a37bd 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 6b1b1456b4..f75e81ef12 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 8188b075ff..3a22115623 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 43b6982e00..52ec54c34b 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 5c50bf27f1..4b811719d9 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 ade8af802f..7e32ba30b0 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 9cdfb29f74..1237fc77d1 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);