1
0
Fork 0

Merge pull request #10404 from cmdremily/opendeck-core

Allow the use of only one IS31FL3731 LED driver
This commit is contained in:
Drashna Jaelre 2020-10-04 13:05:26 -07:00 committed by GitHub
commit c4f910b1b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -23,6 +23,7 @@ typedef void (*rgb_func_pointer)(void);
* *
* noinline to optimise for firmware size not speed (not in hot path) * noinline to optimise for firmware size not speed (not in hot path)
*/ */
#if !(defined(RGBLIGHT_DISABLE_KEYCODES) || defined(RGB_MATRIX_DISABLE_KEYCODES))
static void __attribute__((noinline)) handleKeycodeRGB(const uint8_t is_shifted, const rgb_func_pointer inc_func, const rgb_func_pointer dec_func) { static void __attribute__((noinline)) handleKeycodeRGB(const uint8_t is_shifted, const rgb_func_pointer inc_func, const rgb_func_pointer dec_func) {
if (is_shifted) { if (is_shifted) {
dec_func(); dec_func();
@ -30,6 +31,7 @@ static void __attribute__((noinline)) handleKeycodeRGB(const uint8_t is_shifted,
inc_func(); inc_func();
} }
} }
#endif
/** /**
* Wrapper for animation mode * Wrapper for animation mode
@ -56,7 +58,9 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
// Split keyboards need to trigger on key-up for edge-case issue // Split keyboards need to trigger on key-up for edge-case issue
if (!record->event.pressed) { if (!record->event.pressed) {
#endif #endif
#if !(defined(RGBLIGHT_DISABLE_KEYCODES) || defined(RGB_MATRIX_DISABLE_KEYCODES))
uint8_t shifted = get_mods() & MOD_MASK_SHIFT; uint8_t shifted = get_mods() & MOD_MASK_SHIFT;
#endif
switch (keycode) { switch (keycode) {
case RGB_TOG: case RGB_TOG:
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)

View file

@ -31,7 +31,9 @@ static void init(void) {
i2c_init(); i2c_init();
# ifdef IS31FL3731 # ifdef IS31FL3731
IS31FL3731_init(DRIVER_ADDR_1); IS31FL3731_init(DRIVER_ADDR_1);
# ifdef DRIVER_ADDR_2
IS31FL3731_init(DRIVER_ADDR_2); IS31FL3731_init(DRIVER_ADDR_2);
# endif
# elif defined(IS31FL3733) # elif defined(IS31FL3733)
IS31FL3733_init(DRIVER_ADDR_1, 0); IS31FL3733_init(DRIVER_ADDR_1, 0);
# elif defined(IS31FL3737) # elif defined(IS31FL3737)
@ -55,7 +57,9 @@ static void init(void) {
// This actually updates the LED drivers // This actually updates the LED drivers
# ifdef IS31FL3731 # ifdef IS31FL3731
IS31FL3731_update_led_control_registers(DRIVER_ADDR_1, 0); IS31FL3731_update_led_control_registers(DRIVER_ADDR_1, 0);
# ifdef DRIVER_ADDR_2
IS31FL3731_update_led_control_registers(DRIVER_ADDR_2, 1); IS31FL3731_update_led_control_registers(DRIVER_ADDR_2, 1);
# endif
# elif defined(IS31FL3733) # elif defined(IS31FL3733)
IS31FL3733_update_led_control_registers(DRIVER_ADDR_1, 0); IS31FL3733_update_led_control_registers(DRIVER_ADDR_1, 0);
IS31FL3733_update_led_control_registers(DRIVER_ADDR_2, 1); IS31FL3733_update_led_control_registers(DRIVER_ADDR_2, 1);
@ -69,7 +73,9 @@ static void init(void) {
# ifdef IS31FL3731 # ifdef IS31FL3731
static void flush(void) { static void flush(void) {
IS31FL3731_update_pwm_buffers(DRIVER_ADDR_1, 0); IS31FL3731_update_pwm_buffers(DRIVER_ADDR_1, 0);
# ifdef DRIVER_ADDR_2
IS31FL3731_update_pwm_buffers(DRIVER_ADDR_2, 1); IS31FL3731_update_pwm_buffers(DRIVER_ADDR_2, 1);
# endif
} }
const rgb_matrix_driver_t rgb_matrix_driver = { const rgb_matrix_driver_t rgb_matrix_driver = {