LED drivers: remove write_pwm_buffer() from public API (#22884)

This commit is contained in:
Ryan 2024-01-24 09:18:44 +11:00 committed by GitHub
parent e446366326
commit d96ac7084e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 99 additions and 120 deletions

View file

@ -45,13 +45,13 @@ void is31fl3218_write_register(uint8_t reg, uint8_t data) {
#endif #endif
} }
void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) { void is31fl3218_write_pwm_buffer(void) {
#if IS31FL3218_I2C_PERSISTENCE > 0 #if IS31FL3218_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) { 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 #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 #endif
} }
@ -123,7 +123,7 @@ void is31fl3218_set_led_control_register(uint8_t index, bool value) {
void is31fl3218_update_pwm_buffers(void) { void is31fl3218_update_pwm_buffers(void) {
if (g_pwm_buffer_update_required) { 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 // Load PWM registers and LED Control register data
is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01);

View file

@ -45,13 +45,13 @@ void is31fl3218_write_register(uint8_t reg, uint8_t data) {
#endif #endif
} }
void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) { void is31fl3218_write_pwm_buffer(void) {
#if IS31FL3218_I2C_PERSISTENCE > 0 #if IS31FL3218_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3218_I2C_PERSISTENCE; i++) { 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 #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 #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) { void is31fl3218_update_pwm_buffers(void) {
if (g_pwm_buffer_update_required) { 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 // Load PWM registers and LED Control register data
is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01); is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01);

View file

@ -57,7 +57,7 @@ void is31fl3731_select_page(uint8_t addr, uint8_t page) {
is31fl3731_write_register(addr, IS31FL3731_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 9 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3731_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3731_I2C_PERSISTENCE > 0 #if IS31FL3731_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3731_I2C_PERSISTENCE; j++) { 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 #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 #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) { void is31fl3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -108,7 +108,6 @@ void is31fl3731_init_drivers(void);
void is31fl3731_init(uint8_t addr); void is31fl3731_init(uint8_t addr);
void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(int index, uint8_t value);
void is31fl3731_set_value_all(uint8_t value); void is31fl3731_set_value_all(uint8_t value);

View file

@ -56,7 +56,7 @@ void is31fl3731_select_page(uint8_t addr, uint8_t page) {
is31fl3731_write_register(addr, IS31FL3731_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 9 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3731_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3731_I2C_PERSISTENCE > 0 #if IS31FL3731_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3731_I2C_PERSISTENCE; j++) { 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 #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 #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) { void is31fl3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -109,7 +109,6 @@ void is31fl3731_init_drivers(void);
void is31fl3731_init(uint8_t addr); void is31fl3731_init(uint8_t addr);
void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(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); void is31fl3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -89,7 +89,7 @@ void is31fl3733_select_page(uint8_t addr, uint8_t page) {
is31fl3733_write_register(addr, IS31FL3733_REG_COMMAND, 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. // Assumes page 1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3733_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3733_I2C_PERSISTENCE > 0 #if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3733_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -213,7 +213,7 @@ void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3733_select_page(addr, IS31FL3733_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -118,7 +118,6 @@ void is31fl3733_init_drivers(void);
void is31fl3733_init(uint8_t addr, uint8_t sync); void is31fl3733_init(uint8_t addr, uint8_t sync);
void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_select_page(uint8_t addr, uint8_t page); void is31fl3733_select_page(uint8_t addr, uint8_t page);
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(int index, uint8_t value);
void is31fl3733_set_value_all(uint8_t value); void is31fl3733_set_value_all(uint8_t value);

View file

@ -88,7 +88,7 @@ void is31fl3733_select_page(uint8_t addr, uint8_t page) {
is31fl3733_write_register(addr, IS31FL3733_REG_COMMAND, 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. // Assumes page 1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3733_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3733_I2C_PERSISTENCE > 0 #if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3733_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -228,7 +228,7 @@ void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3733_select_page(addr, IS31FL3733_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -143,7 +143,6 @@ void is31fl3733_init_drivers(void);
void is31fl3733_init(uint8_t addr, uint8_t sync); void is31fl3733_init(uint8_t addr, uint8_t sync);
void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); void is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_select_page(uint8_t addr, uint8_t page); void is31fl3733_select_page(uint8_t addr, uint8_t page);
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(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); void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -73,7 +73,7 @@ void is31fl3736_select_page(uint8_t addr, uint8_t page) {
is31fl3736_write_register(addr, IS31FL3736_REG_COMMAND, 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. // Assumes page 1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3736_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3736_I2C_PERSISTENCE > 0 #if IS31FL3736_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3736_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -202,7 +202,7 @@ void is31fl3736_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3736_select_page(addr, IS31FL3736_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -113,7 +113,6 @@ void is31fl3736_init_drivers(void);
void is31fl3736_init(uint8_t addr); void is31fl3736_init(uint8_t addr);
void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(int index, uint8_t value);
void is31fl3736_set_value_all(uint8_t value); void is31fl3736_set_value_all(uint8_t value);

View file

@ -73,7 +73,7 @@ void is31fl3736_select_page(uint8_t addr, uint8_t page) {
is31fl3736_write_register(addr, IS31FL3736_REG_COMMAND, 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. // Assumes page 1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3736_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3736_I2C_PERSISTENCE > 0 #if IS31FL3736_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3736_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -219,7 +219,7 @@ void is31fl3736_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3736_select_page(addr, IS31FL3736_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -127,7 +127,6 @@ void is31fl3736_init_drivers(void);
void is31fl3736_init(uint8_t addr); void is31fl3736_init(uint8_t addr);
void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(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); void is31fl3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -76,7 +76,7 @@ void is31fl3737_select_page(uint8_t addr, uint8_t page) {
is31fl3737_write_register(addr, IS31FL3737_REG_COMMAND, 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. // Assumes page 1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3737_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3737_I2C_PERSISTENCE > 0 #if IS31FL3737_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3737_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -199,7 +199,7 @@ void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3737_select_page(addr, IS31FL3737_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -103,7 +103,6 @@ void is31fl3737_init_drivers(void);
void is31fl3737_init(uint8_t addr); void is31fl3737_init(uint8_t addr);
void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(int index, uint8_t value);
void is31fl3737_set_value_all(uint8_t value); void is31fl3737_set_value_all(uint8_t value);

View file

@ -76,7 +76,7 @@ void is31fl3737_select_page(uint8_t addr, uint8_t page) {
is31fl3737_write_register(addr, IS31FL3737_REG_COMMAND, 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. // Assumes page 1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3737_PWM_REGISTER_COUNT; i += 16) {
#if IS31FL3737_I2C_PERSISTENCE > 0 #if IS31FL3737_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3737_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -215,7 +215,7 @@ void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3737_select_page(addr, IS31FL3737_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -120,7 +120,6 @@ void is31fl3737_init_drivers(void);
void is31fl3737_init(uint8_t addr); void is31fl3737_init(uint8_t addr);
void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(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); void is31fl3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -79,7 +79,7 @@ void is31fl3741_select_page(uint8_t addr, uint8_t page) {
is31fl3741_write_register(addr, IS31FL3741_REG_COMMAND, 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 // Assume page 0 is already selected
for (uint16_t i = 0; i < 342; i += 18) { 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 #if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3741_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
// transfer the left cause the total number is 351 // transfer the left cause the total number is 351
#if IS31FL3741_I2C_PERSISTENCE > 0 #if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) { 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 #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 #endif
} }
@ -199,7 +199,7 @@ void is31fl3741_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3741_select_page(addr, IS31FL3741_COMMAND_PWM_0); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -105,7 +105,6 @@ void is31fl3741_init_drivers(void);
void is31fl3741_init(uint8_t addr); void is31fl3741_init(uint8_t addr);
void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(int index, uint8_t value);
void is31fl3741_set_value_all(uint8_t value); void is31fl3741_set_value_all(uint8_t value);

View file

@ -79,7 +79,7 @@ void is31fl3741_select_page(uint8_t addr, uint8_t page) {
is31fl3741_write_register(addr, IS31FL3741_REG_COMMAND, 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 // Assume page 0 is already selected
for (uint16_t i = 0; i < 342; i += 18) { 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 #if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3741_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
// transfer the left cause the total number is 351 // transfer the left cause the total number is 351
#if IS31FL3741_I2C_PERSISTENCE > 0 #if IS31FL3741_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3741_I2C_PERSISTENCE; i++) { 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 #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 #endif
} }
@ -213,7 +213,7 @@ void is31fl3741_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3741_select_page(addr, IS31FL3741_COMMAND_PWM_0); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -122,7 +122,6 @@ void is31fl3741_init_drivers(void);
void is31fl3741_init(uint8_t addr); void is31fl3741_init(uint8_t addr);
void is31fl3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(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); void is31fl3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -74,7 +74,7 @@ void is31fl3742a_select_page(uint8_t addr, uint8_t page) {
is31fl3742a_write_register(addr, IS31FL3742A_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 6 transfers of 30 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3742A_PWM_REGISTER_COUNT; i += 30) {
#if IS31FL3742A_I2C_PERSISTENCE > 0 #if IS31FL3742A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3742A_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -183,7 +183,7 @@ void is31fl3742a_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3742a_select_page(addr, IS31FL3742A_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -75,7 +75,6 @@ void is31fl3742a_init_drivers(void);
void is31fl3742a_init(uint8_t addr); void is31fl3742a_init(uint8_t addr);
void is31fl3742a_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(int index, uint8_t value);
void is31fl3742a_set_value_all(uint8_t value); void is31fl3742a_set_value_all(uint8_t value);

View file

@ -74,7 +74,7 @@ void is31fl3742a_select_page(uint8_t addr, uint8_t page) {
is31fl3742a_write_register(addr, IS31FL3742A_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 6 transfers of 30 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3742A_PWM_REGISTER_COUNT; i += 30) {
#if IS31FL3742A_I2C_PERSISTENCE > 0 #if IS31FL3742A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3742A_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -187,7 +187,7 @@ void is31fl3742a_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3742a_select_page(addr, IS31FL3742A_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -77,7 +77,6 @@ void is31fl3742a_init_drivers(void);
void is31fl3742a_init(uint8_t addr); void is31fl3742a_init(uint8_t addr);
void is31fl3742a_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(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); void is31fl3742a_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -83,7 +83,7 @@ void is31fl3743a_select_page(uint8_t addr, uint8_t page) {
is31fl3743a_write_register(addr, IS31FL3743A_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 11 transfers of 18 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3743A_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3743A_I2C_PERSISTENCE > 0 #if IS31FL3743A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3743A_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -192,7 +192,7 @@ void is31fl3743a_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3743a_select_page(addr, IS31FL3743A_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -85,7 +85,6 @@ void is31fl3743a_init_drivers(void);
void is31fl3743a_init(uint8_t addr, uint8_t sync); void is31fl3743a_init(uint8_t addr, uint8_t sync);
void is31fl3743a_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(int index, uint8_t value);
void is31fl3743a_set_value_all(uint8_t value); void is31fl3743a_set_value_all(uint8_t value);

View file

@ -83,7 +83,7 @@ void is31fl3743a_select_page(uint8_t addr, uint8_t page) {
is31fl3743a_write_register(addr, IS31FL3743A_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 11 transfers of 18 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3743A_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3743A_I2C_PERSISTENCE > 0 #if IS31FL3743A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3743A_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -196,7 +196,7 @@ void is31fl3743a_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3743a_select_page(addr, IS31FL3743A_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -87,7 +87,6 @@ void is31fl3743a_init_drivers(void);
void is31fl3743a_init(uint8_t addr, uint8_t sync); void is31fl3743a_init(uint8_t addr, uint8_t sync);
void is31fl3743a_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(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); void is31fl3743a_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -83,7 +83,7 @@ void is31fl3745_select_page(uint8_t addr, uint8_t page) {
is31fl3745_write_register(addr, IS31FL3745_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 8 transfers of 18 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3745_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3745_I2C_PERSISTENCE > 0 #if IS31FL3745_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3745_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -192,7 +192,7 @@ void is31fl3745_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3745_select_page(addr, IS31FL3745_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -85,7 +85,6 @@ void is31fl3745_init_drivers(void);
void is31fl3745_init(uint8_t addr, uint8_t sync); void is31fl3745_init(uint8_t addr, uint8_t sync);
void is31fl3745_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(int index, uint8_t value);
void is31fl3745_set_value_all(uint8_t value); void is31fl3745_set_value_all(uint8_t value);

View file

@ -83,7 +83,7 @@ void is31fl3745_select_page(uint8_t addr, uint8_t page) {
is31fl3745_write_register(addr, IS31FL3745_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 8 transfers of 18 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3745_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3745_I2C_PERSISTENCE > 0 #if IS31FL3745_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3745_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -196,7 +196,7 @@ void is31fl3745_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3745_select_page(addr, IS31FL3745_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -87,7 +87,6 @@ void is31fl3745_init_drivers(void);
void is31fl3745_init(uint8_t addr, uint8_t sync); void is31fl3745_init(uint8_t addr, uint8_t sync);
void is31fl3745_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(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); void is31fl3745_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -74,7 +74,7 @@ void is31fl3746a_select_page(uint8_t addr, uint8_t page) {
is31fl3746a_write_register(addr, IS31FL3746A_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 4 transfers of 18 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3746A_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3746A_I2C_PERSISTENCE > 0 #if IS31FL3746A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3746A_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -184,7 +184,7 @@ void is31fl3746a_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3746a_select_page(addr, IS31FL3746A_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -87,7 +87,6 @@ void is31fl3746a_init_drivers(void);
void is31fl3746a_init(uint8_t addr); void is31fl3746a_init(uint8_t addr);
void is31fl3746a_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(int index, uint8_t value);
void is31fl3746a_set_value_all(uint8_t value); void is31fl3746a_set_value_all(uint8_t value);

View file

@ -74,7 +74,7 @@ void is31fl3746a_select_page(uint8_t addr, uint8_t page) {
is31fl3746a_write_register(addr, IS31FL3746A_REG_COMMAND, 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. // Assumes page 0 is already selected.
// Transmit PWM registers in 4 transfers of 18 bytes. // 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) { for (uint8_t i = 0; i < IS31FL3746A_PWM_REGISTER_COUNT; i += 18) {
#if IS31FL3746A_I2C_PERSISTENCE > 0 #if IS31FL3746A_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < IS31FL3746A_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -188,7 +188,7 @@ void is31fl3746a_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3746a_select_page(addr, IS31FL3746A_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -89,7 +89,6 @@ void is31fl3746a_init_drivers(void);
void is31fl3746a_init(uint8_t addr); void is31fl3746a_init(uint8_t addr);
void is31fl3746a_write_register(uint8_t addr, uint8_t reg, uint8_t data); 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_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(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); void is31fl3746a_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -63,7 +63,7 @@ void snled27351_select_page(uint8_t addr, uint8_t page) {
snled27351_write_register(addr, SNLED27351_REG_COMMAND, 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. // Assumes PG1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < SNLED27351_PWM_REGISTER_COUNT; i += 16) {
#if SNLED27351_I2C_PERSISTENCE > 0 #if SNLED27351_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < SNLED27351_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -196,7 +196,7 @@ void snled27351_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
snled27351_select_page(addr, SNLED27351_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -157,7 +157,6 @@ void snled27351_init_drivers(void);
void snled27351_init(uint8_t addr); void snled27351_init(uint8_t addr);
void snled27351_select_page(uint8_t addr, uint8_t page); 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_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(int index, uint8_t value);
void snled27351_set_value_all(uint8_t value); void snled27351_set_value_all(uint8_t value);

View file

@ -63,7 +63,7 @@ void snled27351_select_page(uint8_t addr, uint8_t page) {
snled27351_write_register(addr, SNLED27351_REG_COMMAND, 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. // Assumes PG1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // 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) { for (uint8_t i = 0; i < SNLED27351_PWM_REGISTER_COUNT; i += 16) {
#if SNLED27351_I2C_PERSISTENCE > 0 #if SNLED27351_I2C_PERSISTENCE > 0
for (uint8_t j = 0; j < SNLED27351_I2C_PERSISTENCE; j++) { 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 #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 #endif
} }
} }
@ -212,7 +212,7 @@ void snled27351_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
snled27351_select_page(addr, SNLED27351_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -171,7 +171,6 @@ void snled27351_init_drivers(void);
void snled27351_init(uint8_t addr); void snled27351_init(uint8_t addr);
void snled27351_select_page(uint8_t addr, uint8_t page); 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_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(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); void snled27351_set_color_all(uint8_t red, uint8_t green, uint8_t blue);

View file

@ -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) { void is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data) {
#if IS31FL3733_I2C_PERSISTENCE > 0 #if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) { for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) {
if (i2c_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 #else
i2c_writeReg(index, addr << 1, reg, &data, 1, IS31FL3733_I2C_TIMEOUT); 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); 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. // Assumes page 1 is already selected.
// Transmit PWM registers in 12 transfers of 16 bytes. // Transmit PWM registers in 12 transfers of 16 bytes.
// Iterate over the pwm_buffer contents at 16 byte intervals. // 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 #if IS31FL3733_I2C_PERSISTENCE > 0
for (uint8_t i = 0; i < IS31FL3733_I2C_PERSISTENCE; i++) { for (uint8_t j = 0; j < IS31FL3733_I2C_PERSISTENCE; j++) {
if (i2c_writeReg(index, addr << 1, i, pwm_buffer + i, 16, IS31FL3733_I2C_TIMEOUT) == 0) break; if (i2c_writeReg(index, addr << 1, i, g_pwm_buffer[index] + i, 16, IS31FL3733_I2C_TIMEOUT) == I2C_STATUS_SUCCESS) break;
} }
#else #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 #endif
} }
} }
@ -216,7 +216,7 @@ void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) { if (g_pwm_buffer_update_required[index]) {
is31fl3733_select_page(index, addr, IS31FL3733_COMMAND_PWM); 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; g_pwm_buffer_update_required[index] = false;
} }

View file

@ -86,7 +86,6 @@ void is31fl3733_init_drivers(void);
void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync); void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync);
void is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data); void is31fl3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data);
void is31fl3733_select_page(uint8_t index, uint8_t addr, uint8_t page); void is31fl3733_select_page(uint8_t index, uint8_t addr, uint8_t page);
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(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); void is31fl3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue);