Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Suggestion: add double buffer to LED drivers #22119

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions drivers/led/issi/is31fl3741.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ uint8_t g_twi_transfer_buffer[20] = {0xFF};
// buffers and the transfers in is31fl3741_write_pwm_buffer() but it's
// probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][ISSI_MAX_LEDS];
uint8_t g_pwm_buffer_send[DRIVER_COUNT][ISSI_MAX_LEDS];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
bool g_scaling_registers_update_required[DRIVER_COUNT] = {false};

Expand Down Expand Up @@ -223,11 +224,14 @@ void is31fl3741_set_led_control_register(uint8_t index, bool red, bool green, bo

void is31fl3741_update_pwm_buffers(uint8_t addr, uint8_t index) {
if (g_pwm_buffer_update_required[index]) {
// unlock the command register and select PG2
is31fl3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
is31fl3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM0);
if (memcmp(g_pwm_buffer, g_pwm_buffer_send, sizeof(g_pwm_buffer)) != 0) {
memcpy(g_pwm_buffer_send, g_pwm_buffer, sizeof(g_pwm_buffer));
// unlock the command register and select PG2
is31fl3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
is31fl3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM0);

is31fl3741_write_pwm_buffer(addr, g_pwm_buffer[index]);
is31fl3741_write_pwm_buffer(addr, g_pwm_buffer_send[index]);
}
}

g_pwm_buffer_update_required[index] = false;
Expand Down