diff options
| -rw-r--r-- | drivers/issi/is31fl3731-simple.c | 18 | ||||
| -rw-r--r-- | drivers/issi/is31fl3731-simple.h | 2 | ||||
| -rw-r--r-- | quantum/led_matrix.c | 20 | ||||
| -rw-r--r-- | quantum/led_matrix.h | 30 | ||||
| -rw-r--r-- | quantum/led_matrix_drivers.c | 50 | ||||
| -rw-r--r-- | quantum/quantum.c | 16 | ||||
| -rw-r--r-- | quantum/quantum.h | 6 | ||||
| -rw-r--r-- | tmk_core/common/action.c | 2 |
8 files changed, 79 insertions, 65 deletions
diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c index 46d51dac7..9c31df209 100644 --- a/drivers/issi/is31fl3731-simple.c +++ b/drivers/issi/is31fl3731-simple.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include "is31fl3731-simple.h" | 29 | #include "is31fl3731-simple.h" |
| 30 | #include "i2c_master.h" | 30 | #include "i2c_master.h" |
| 31 | #include "progmem.h" | 31 | #include "progmem.h" |
| 32 | #include "print.h" | ||
| 32 | 33 | ||
| 33 | // This is a 7-bit address, that gets left-shifted and bit 0 | 34 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 34 | // set to 0 for write, 1 for read (as per I2C protocol) | 35 | // set to 0 for write, 1 for read (as per I2C protocol) |
| @@ -72,10 +73,19 @@ uint8_t g_twi_transfer_buffer[20]; | |||
| 72 | // We could optimize this and take out the unused registers from these | 73 | // We could optimize this and take out the unused registers from these |
| 73 | // buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's | 74 | // buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's |
| 74 | // probably not worth the extra complexity. | 75 | // probably not worth the extra complexity. |
| 75 | uint8_t g_pwm_buffer[DRIVER_COUNT][144]; | 76 | uint8_t g_pwm_buffer[LED_DRIVER_COUNT][144]; |
| 76 | bool g_pwm_buffer_update_required = false; | 77 | bool g_pwm_buffer_update_required = false; |
| 77 | 78 | ||
| 78 | uint8_t g_led_control_registers[DRIVER_COUNT][18] = { { 0 }, { 0 } }; | 79 | /* There's probably a better way to init this... */ |
| 80 | #if LED_DRIVER_COUNT == 1 | ||
| 81 | uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}}; | ||
| 82 | #elif LED_DRIVER_COUNT == 2 | ||
| 83 | uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}}; | ||
| 84 | #elif LED_DRIVER_COUNT == 3 | ||
| 85 | uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}}; | ||
| 86 | #elif LED_DRIVER_COUNT == 4 | ||
| 87 | uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}}; | ||
| 88 | #endif | ||
| 79 | bool g_led_control_registers_update_required = false; | 89 | bool g_led_control_registers_update_required = false; |
| 80 | 90 | ||
| 81 | // This is the bit pattern in the LED control registers | 91 | // This is the bit pattern in the LED control registers |
| @@ -194,7 +204,7 @@ void IS31FL3731_init(uint8_t addr) { | |||
| 194 | } | 204 | } |
| 195 | 205 | ||
| 196 | void IS31FL3731_set_value(int index, uint8_t value) { | 206 | void IS31FL3731_set_value(int index, uint8_t value) { |
| 197 | if (index >= 0 && index < DRIVER_LED_TOTAL) { | 207 | if (index >= 0 && index < LED_DRIVER_LED_COUNT) { |
| 198 | is31_led led = g_is31_leds[index]; | 208 | is31_led led = g_is31_leds[index]; |
| 199 | 209 | ||
| 200 | // Subtract 0x24 to get the second index of g_pwm_buffer | 210 | // Subtract 0x24 to get the second index of g_pwm_buffer |
| @@ -204,7 +214,7 @@ void IS31FL3731_set_value(int index, uint8_t value) { | |||
| 204 | } | 214 | } |
| 205 | 215 | ||
| 206 | void IS31FL3731_set_value_all(uint8_t value) { | 216 | void IS31FL3731_set_value_all(uint8_t value) { |
| 207 | for (int i = 0; i < DRIVER_LED_TOTAL; i++) { | 217 | for (int i = 0; i < LED_DRIVER_LED_COUNT; i++) { |
| 208 | IS31FL3731_set_value(i, value); | 218 | IS31FL3731_set_value(i, value); |
| 209 | } | 219 | } |
| 210 | } | 220 | } |
diff --git a/drivers/issi/is31fl3731-simple.h b/drivers/issi/is31fl3731-simple.h index c102837a3..3b107d48f 100644 --- a/drivers/issi/is31fl3731-simple.h +++ b/drivers/issi/is31fl3731-simple.h | |||
| @@ -25,7 +25,7 @@ typedef struct is31_led { | |||
| 25 | uint8_t v; | 25 | uint8_t v; |
| 26 | } __attribute__((packed)) is31_led; | 26 | } __attribute__((packed)) is31_led; |
| 27 | 27 | ||
| 28 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | 28 | extern const is31_led g_is31_leds[LED_DRIVER_LED_COUNT]; |
| 29 | 29 | ||
| 30 | void IS31FL3731_init(uint8_t addr); | 30 | void IS31FL3731_init(uint8_t addr); |
| 31 | void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 31 | void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c index 9a0aa6acd..3b284990d 100644 --- a/quantum/led_matrix.c +++ b/quantum/led_matrix.c | |||
| @@ -59,7 +59,7 @@ bool g_suspend_state = false; | |||
| 59 | uint32_t g_tick = 0; | 59 | uint32_t g_tick = 0; |
| 60 | 60 | ||
| 61 | // Ticks since this key was last hit. | 61 | // Ticks since this key was last hit. |
| 62 | uint8_t g_key_hit[DRIVER_LED_TOTAL]; | 62 | uint8_t g_key_hit[LED_DRIVER_LED_COUNT]; |
| 63 | 63 | ||
| 64 | // Ticks since any key was last hit. | 64 | // Ticks since any key was last hit. |
| 65 | uint32_t g_any_key_hit = 0; | 65 | uint32_t g_any_key_hit = 0; |
| @@ -95,7 +95,7 @@ void map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i, uint8_t | |||
| 95 | led_matrix led; | 95 | led_matrix led; |
| 96 | *led_count = 0; | 96 | *led_count = 0; |
| 97 | 97 | ||
| 98 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { | 98 | for (uint8_t i = 0; i < LED_DRIVER_LED_COUNT; i++) { |
| 99 | // map_index_to_led(i, &led); | 99 | // map_index_to_led(i, &led); |
| 100 | led = g_leds[i]; | 100 | led = g_leds[i]; |
| 101 | if (row == led.matrix_co.row && column == led.matrix_co.col) { | 101 | if (row == led.matrix_co.row && column == led.matrix_co.col) { |
| @@ -187,7 +187,7 @@ void led_matrix_task(void) { | |||
| 187 | g_any_key_hit++; | 187 | g_any_key_hit++; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | for (int led = 0; led < DRIVER_LED_TOTAL; led++) { | 190 | for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) { |
| 191 | if (g_key_hit[led] < 255) { | 191 | if (g_key_hit[led] < 255) { |
| 192 | if (g_key_hit[led] == 254) | 192 | if (g_key_hit[led] == 254) |
| 193 | g_last_led_count = MAX(g_last_led_count - 1, 0); | 193 | g_last_led_count = MAX(g_last_led_count - 1, 0); |
| @@ -271,7 +271,7 @@ void led_matrix_init(void) { | |||
| 271 | // TODO: put the 1 second startup delay here? | 271 | // TODO: put the 1 second startup delay here? |
| 272 | 272 | ||
| 273 | // clear the key hits | 273 | // clear the key hits |
| 274 | for (int led=0; led<DRIVER_LED_TOTAL; led++) { | 274 | for (int led=0; led<LED_DRIVER_LED_COUNT; led++) { |
| 275 | g_key_hit[led] = 255; | 275 | g_key_hit[led] = 255; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| @@ -317,7 +317,7 @@ static uint8_t decrement(uint8_t value, uint8_t step, uint8_t min, uint8_t max) | |||
| 317 | // uint8_t led[8], led_count; | 317 | // uint8_t led[8], led_count; |
| 318 | // map_row_column_to_led(row,column,led,&led_count); | 318 | // map_row_column_to_led(row,column,led,&led_count); |
| 319 | // for(uint8_t i = 0; i < led_count; i++) { | 319 | // for(uint8_t i = 0; i < led_count; i++) { |
| 320 | // if (led[i] < DRIVER_LED_TOTAL) { | 320 | // if (led[i] < LED_DRIVER_LED_COUNT) { |
| 321 | // void *address = backlight_get_custom_key_value_eeprom_address(led[i]); | 321 | // void *address = backlight_get_custom_key_value_eeprom_address(led[i]); |
| 322 | // eeprom_update_byte(address, value); | 322 | // eeprom_update_byte(address, value); |
| 323 | // } | 323 | // } |
| @@ -396,9 +396,11 @@ uint8_t led_matrix_get_mode(void) { | |||
| 396 | return led_matrix_config.mode; | 396 | return led_matrix_config.mode; |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | void led_matrix_set_value(uint8_t val, bool eeprom_write) { | 399 | void led_matrix_set_value_noeeprom(uint8_t val) { |
| 400 | led_matrix_config.val = val; | 400 | led_matrix_config.val = val; |
| 401 | if (eeprom_write) { | 401 | } |
| 402 | eeconfig_update_led_matrix(led_matrix_config.raw); | 402 | |
| 403 | } | 403 | void led_matrix_set_value(uint8_t val) { |
| 404 | led_matrix_set_value_noeeprom(val); | ||
| 405 | eeconfig_update_led_matrix(led_matrix_config.raw); | ||
| 404 | } | 406 | } |
diff --git a/quantum/led_matrix.h b/quantum/led_matrix.h index 20f2e73c6..6db162963 100644 --- a/quantum/led_matrix.h +++ b/quantum/led_matrix.h | |||
| @@ -21,6 +21,11 @@ | |||
| 21 | #define LED_MATRIX_H | 21 | #define LED_MATRIX_H |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | #ifndef BACKLIGHT_ENABLE | ||
| 25 | #error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE | ||
| 26 | #endif | ||
| 27 | |||
| 28 | |||
| 24 | typedef struct Point { | 29 | typedef struct Point { |
| 25 | uint8_t x; | 30 | uint8_t x; |
| 26 | uint8_t y; | 31 | uint8_t y; |
| @@ -38,7 +43,7 @@ typedef struct led_matrix { | |||
| 38 | uint8_t modifier:1; | 43 | uint8_t modifier:1; |
| 39 | } __attribute__((packed)) led_matrix; | 44 | } __attribute__((packed)) led_matrix; |
| 40 | 45 | ||
| 41 | extern const led_matrix g_leds[DRIVER_LED_TOTAL]; | 46 | extern const led_matrix g_leds[LED_DRIVER_LED_COUNT]; |
| 42 | 47 | ||
| 43 | typedef struct { | 48 | typedef struct { |
| 44 | uint8_t index; | 49 | uint8_t index; |
| @@ -104,26 +109,11 @@ void led_matrix_decrease_speed(void); | |||
| 104 | void led_matrix_mode(uint8_t mode, bool eeprom_write); | 109 | void led_matrix_mode(uint8_t mode, bool eeprom_write); |
| 105 | void led_matrix_mode_noeeprom(uint8_t mode); | 110 | void led_matrix_mode_noeeprom(uint8_t mode); |
| 106 | uint8_t led_matrix_get_mode(void); | 111 | uint8_t led_matrix_get_mode(void); |
| 107 | void led_matrix_set_value(uint8_t mode, bool eeprom_write); | 112 | void led_matrix_set_value(uint8_t mode); |
| 113 | void led_matrix_set_value_noeeprom(uint8_t mode); | ||
| 108 | 114 | ||
| 109 | #ifndef BACKLIGHT_ENABLE | 115 | // Hook into the existing backlight API |
| 110 | #define backlight_toggle() backlight_matrix_toggle() | 116 | #define backlight_set(val) led_matrix_set_value(val) |
| 111 | #define backlight_enable() backlight_matrix_enable() | ||
| 112 | #define backlight_enable_noeeprom() backlight_matrix_enable_noeeprom() | ||
| 113 | #define backlight_disable() backlight_matrix_disable() | ||
| 114 | #define backlight_disable_noeeprom() backlight_matrix_disable_noeeprom() | ||
| 115 | #define backlight_step() backlight_matrix_step() | ||
| 116 | #define backlight_set_value(val) backlight_matrix_set_value(val) | ||
| 117 | #define backlight_set_value_noeeprom(val) backlight_matrix_set_value_noeeprom(val) | ||
| 118 | #define backlight_step_reverse() backlight_matrix_step_reverse() | ||
| 119 | #define backlight_increase_val() backlight_matrix_increase_val() | ||
| 120 | #define backlight_decrease_val() backlight_matrix_decrease_val() | ||
| 121 | #define backlight_increase_speed() backlight_matrix_increase_speed() | ||
| 122 | #define backlight_decrease_speed() backlight_matrix_decrease_speed() | ||
| 123 | #define backlight_mode(mode) backlight_matrix_mode(mode) | ||
| 124 | #define backlight_mode_noeeprom(mode) backlight_matrix_mode_noeeprom(mode) | ||
| 125 | #define backlight_get_mode() backlight_matrix_get_mode() | ||
| 126 | #endif | ||
| 127 | 117 | ||
| 128 | typedef struct { | 118 | typedef struct { |
| 129 | /* Perform any initialisation required for the other driver functions to work. */ | 119 | /* Perform any initialisation required for the other driver functions to work. */ |
diff --git a/quantum/led_matrix_drivers.c b/quantum/led_matrix_drivers.c index f00f4f366..e0f8b2094 100644 --- a/quantum/led_matrix_drivers.c +++ b/quantum/led_matrix_drivers.c | |||
| @@ -39,32 +39,32 @@ static void init(void) { | |||
| 39 | i2c_init(); | 39 | i2c_init(); |
| 40 | #ifdef IS31FL3731 | 40 | #ifdef IS31FL3731 |
| 41 | #ifdef LED_DRIVER_ADDR_1 | 41 | #ifdef LED_DRIVER_ADDR_1 |
| 42 | IS31FL3731_init(DRIVER_ADDR_1); | 42 | IS31FL3731_init(LED_DRIVER_ADDR_1); |
| 43 | #endif | 43 | #endif |
| 44 | #ifdef LED_DRIVER_ADDR_2 | 44 | #ifdef LED_DRIVER_ADDR_2 |
| 45 | IS31FL3731_init(DRIVER_ADDR_2); | 45 | IS31FL3731_init(LED_DRIVER_ADDR_2); |
| 46 | #endif | 46 | #endif |
| 47 | #ifdef LED_DRIVER_ADDR_3 | 47 | #ifdef LED_DRIVER_ADDR_3 |
| 48 | IS31FL3731_init(DRIVER_ADDR_3); | 48 | IS31FL3731_init(LED_DRIVER_ADDR_3); |
| 49 | #endif | 49 | #endif |
| 50 | #ifdef LED_DRIVER_ADDR_4 | 50 | #ifdef LED_DRIVER_ADDR_4 |
| 51 | IS31FL3731_init(DRIVER_ADDR_4); | 51 | IS31FL3731_init(LED_DRIVER_ADDR_4); |
| 52 | #endif | 52 | #endif |
| 53 | #else | 53 | #else |
| 54 | #ifdef LED_DRIVER_ADDR_1 | 54 | #ifdef LED_DRIVER_ADDR_1 |
| 55 | IS31FL3733_init(DRIVER_ADDR_1); | 55 | IS31FL3733_init(LED_DRIVER_ADDR_1); |
| 56 | #endif | 56 | #endif |
| 57 | #ifdef LED_DRIVER_ADDR_2 | 57 | #ifdef LED_DRIVER_ADDR_2 |
| 58 | IS31FL3733_init(DRIVER_ADDR_2); | 58 | IS31FL3733_init(LED_DRIVER_ADDR_2); |
| 59 | #endif | 59 | #endif |
| 60 | #ifdef LED_DRIVER_ADDR_3 | 60 | #ifdef LED_DRIVER_ADDR_3 |
| 61 | IS31FL3733_init(DRIVER_ADDR_3); | 61 | IS31FL3733_init(LED_DRIVER_ADDR_3); |
| 62 | #endif | 62 | #endif |
| 63 | #ifdef LED_DRIVER_ADDR_4 | 63 | #ifdef LED_DRIVER_ADDR_4 |
| 64 | IS31FL3733_init(DRIVER_ADDR_4); | 64 | IS31FL3733_init(LED_DRIVER_ADDR_4); |
| 65 | #endif | 65 | #endif |
| 66 | #endif | 66 | #endif |
| 67 | for (int index = 0; index < DRIVER_LED_TOTAL; index++) { | 67 | for (int index = 0; index < LED_DRIVER_COUNT; index++) { |
| 68 | #ifdef IS31FL3731 | 68 | #ifdef IS31FL3731 |
| 69 | IS31FL3731_set_led_control_register(index, true); | 69 | IS31FL3731_set_led_control_register(index, true); |
| 70 | #else | 70 | #else |
| @@ -74,29 +74,29 @@ static void init(void) { | |||
| 74 | // This actually updates the LED drivers | 74 | // This actually updates the LED drivers |
| 75 | #ifdef IS31FL3731 | 75 | #ifdef IS31FL3731 |
| 76 | #ifdef LED_DRIVER_ADDR_1 | 76 | #ifdef LED_DRIVER_ADDR_1 |
| 77 | IS31FL3731_update_led_control_registers(DRIVER_ADDR_1); | 77 | IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0); |
| 78 | #endif | 78 | #endif |
| 79 | #ifdef LED_DRIVER_ADDR_2 | 79 | #ifdef LED_DRIVER_ADDR_2 |
| 80 | IS31FL3731_update_led_control_registers(DRIVER_ADDR_2); | 80 | IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_2, 1); |
| 81 | #endif | 81 | #endif |
| 82 | #ifdef LED_DRIVER_ADDR_3 | 82 | #ifdef LED_DRIVER_ADDR_3 |
| 83 | IS31FL3731_update_led_control_registers(DRIVER_ADDR_3); | 83 | IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_3, 2); |
| 84 | #endif | 84 | #endif |
| 85 | #ifdef LED_DRIVER_ADDR_4 | 85 | #ifdef LED_DRIVER_ADDR_4 |
| 86 | IS31FL3731_update_led_control_registers(DRIVER_ADDR_4); | 86 | IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_4, 3); |
| 87 | #endif | 87 | #endif |
| 88 | #else | 88 | #else |
| 89 | #ifdef LED_DRIVER_ADDR_1 | 89 | #ifdef LED_DRIVER_ADDR_1 |
| 90 | IS31FL3733_update_led_control_registers(DRIVER_ADDR_1); | 90 | IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_1, 0); |
| 91 | #endif | 91 | #endif |
| 92 | #ifdef LED_DRIVER_ADDR_2 | 92 | #ifdef LED_DRIVER_ADDR_2 |
| 93 | IS31FL3733_update_led_control_registers(DRIVER_ADDR_2); | 93 | IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_2, 1); |
| 94 | #endif | 94 | #endif |
| 95 | #ifdef LED_DRIVER_ADDR_3 | 95 | #ifdef LED_DRIVER_ADDR_3 |
| 96 | IS31FL3733_update_led_control_registers(DRIVER_ADDR_3); | 96 | IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_3, 2); |
| 97 | #endif | 97 | #endif |
| 98 | #ifdef LED_DRIVER_ADDR_4 | 98 | #ifdef LED_DRIVER_ADDR_4 |
| 99 | IS31FL3733_update_led_control_registers(DRIVER_ADDR_4); | 99 | IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_4, 3); |
| 100 | #endif | 100 | #endif |
| 101 | #endif | 101 | #endif |
| 102 | } | 102 | } |
| @@ -104,29 +104,29 @@ static void init(void) { | |||
| 104 | static void flush(void) { | 104 | static void flush(void) { |
| 105 | #ifdef IS31FL3731 | 105 | #ifdef IS31FL3731 |
| 106 | #ifdef LED_DRIVER_ADDR_1 | 106 | #ifdef LED_DRIVER_ADDR_1 |
| 107 | IS31FL3731_update_pwm_buffers(DRIVER_ADDR_1); | 107 | IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); |
| 108 | #endif | 108 | #endif |
| 109 | #ifdef LED_DRIVER_ADDR_2 | 109 | #ifdef LED_DRIVER_ADDR_2 |
| 110 | IS31FL3731_update_pwm_buffers(DRIVER_ADDR_2); | 110 | IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_2, 1); |
| 111 | #endif | 111 | #endif |
| 112 | #ifdef LED_DRIVER_ADDR_3 | 112 | #ifdef LED_DRIVER_ADDR_3 |
| 113 | IS31FL3731_update_pwm_buffers(DRIVER_ADDR_3); | 113 | IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_3, 2); |
| 114 | #endif | 114 | #endif |
| 115 | #ifdef LED_DRIVER_ADDR_4 | 115 | #ifdef LED_DRIVER_ADDR_4 |
| 116 | IS31FL3731_update_pwm_buffers(DRIVER_ADDR_4); | 116 | IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_4, 3); |
| 117 | #endif | 117 | #endif |
| 118 | #else | 118 | #else |
| 119 | #ifdef LED_DRIVER_ADDR_1 | 119 | #ifdef LED_DRIVER_ADDR_1 |
| 120 | IS31FL3733_update_pwm_buffers(DRIVER_ADDR_1); | 120 | IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); |
| 121 | #endif | 121 | #endif |
| 122 | #ifdef LED_DRIVER_ADDR_2 | 122 | #ifdef LED_DRIVER_ADDR_2 |
| 123 | IS31FL3733_update_pwm_buffers(DRIVER_ADDR_2); | 123 | IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_2, 1); |
| 124 | #endif | 124 | #endif |
| 125 | #ifdef LED_DRIVER_ADDR_3 | 125 | #ifdef LED_DRIVER_ADDR_3 |
| 126 | IS31FL3733_update_pwm_buffers(DRIVER_ADDR_3); | 126 | IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_3, 2); |
| 127 | #endif | 127 | #endif |
| 128 | #ifdef LED_DRIVER_ADDR_4 | 128 | #ifdef LED_DRIVER_ADDR_4 |
| 129 | IS31FL3733_update_pwm_buffers(DRIVER_ADDR_4); | 129 | IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_4, 3); |
| 130 | #endif | 130 | #endif |
| 131 | #endif | 131 | #endif |
| 132 | } | 132 | } |
diff --git a/quantum/quantum.c b/quantum/quantum.c index bd3715c80..0e605d4cb 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -1031,7 +1031,11 @@ void matrix_init_quantum() { | |||
| 1031 | eeconfig_init(); | 1031 | eeconfig_init(); |
| 1032 | } | 1032 | } |
| 1033 | #ifdef BACKLIGHT_ENABLE | 1033 | #ifdef BACKLIGHT_ENABLE |
| 1034 | backlight_init_ports(); | 1034 | #ifdef LED_MATRIX_ENABLE |
| 1035 | led_matrix_init(); | ||
| 1036 | #else | ||
| 1037 | backlight_init_ports(); | ||
| 1038 | #endif | ||
| 1035 | #endif | 1039 | #endif |
| 1036 | #ifdef AUDIO_ENABLE | 1040 | #ifdef AUDIO_ENABLE |
| 1037 | audio_init(); | 1041 | audio_init(); |
| @@ -1067,8 +1071,12 @@ void matrix_scan_quantum() { | |||
| 1067 | matrix_scan_combo(); | 1071 | matrix_scan_combo(); |
| 1068 | #endif | 1072 | #endif |
| 1069 | 1073 | ||
| 1070 | #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN) | 1074 | #if defined(BACKLIGHT_ENABLE) |
| 1071 | backlight_task(); | 1075 | #if defined(LED_MATRIX_ENABLE) |
| 1076 | led_matrix_task(); | ||
| 1077 | #elif defined(BACKLIGHT_PIN) | ||
| 1078 | backlight_task(); | ||
| 1079 | #endif | ||
| 1072 | #endif | 1080 | #endif |
| 1073 | 1081 | ||
| 1074 | #ifdef RGB_MATRIX_ENABLE | 1082 | #ifdef RGB_MATRIX_ENABLE |
| @@ -1198,7 +1206,7 @@ static inline void set_pwm(uint16_t val) { | |||
| 1198 | OCRxx = val; | 1206 | OCRxx = val; |
| 1199 | } | 1207 | } |
| 1200 | 1208 | ||
| 1201 | #ifndef BACKLIGHT_CUSTOM_DRIVER | 1209 | #ifndef BACKLIGHT_CUSTOM_DRIVER || LED_MATRIX_ENABLE |
| 1202 | __attribute__ ((weak)) | 1210 | __attribute__ ((weak)) |
| 1203 | void backlight_set(uint8_t level) { | 1211 | void backlight_set(uint8_t level) { |
| 1204 | if (level > BACKLIGHT_LEVELS) | 1212 | if (level > BACKLIGHT_LEVELS) |
diff --git a/quantum/quantum.h b/quantum/quantum.h index 56a6a1a99..169883609 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
| @@ -28,7 +28,11 @@ | |||
| 28 | #include "matrix.h" | 28 | #include "matrix.h" |
| 29 | #include "keymap.h" | 29 | #include "keymap.h" |
| 30 | #ifdef BACKLIGHT_ENABLE | 30 | #ifdef BACKLIGHT_ENABLE |
| 31 | #include "backlight.h" | 31 | #ifdef LED_MATRIX_ENABLE |
| 32 | #include "led_matrix.h" | ||
| 33 | #else | ||
| 34 | #include "backlight.h" | ||
| 35 | #endif | ||
| 32 | #endif | 36 | #endif |
| 33 | #ifdef RGBLIGHT_ENABLE | 37 | #ifdef RGBLIGHT_ENABLE |
| 34 | #include "rgblight.h" | 38 | #include "rgblight.h" |
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index ec8d6ed7b..d4d4ac28d 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c | |||
| @@ -537,7 +537,7 @@ void process_action(keyrecord_t *record, action_t action) | |||
| 537 | action_macro_play(action_get_macro(record, action.func.id, action.func.opt)); | 537 | action_macro_play(action_get_macro(record, action.func.id, action.func.opt)); |
| 538 | break; | 538 | break; |
| 539 | #endif | 539 | #endif |
| 540 | #ifdef BACKLIGHT_ENABLE | 540 | #if defined(BACKLIGHT_ENABLE) | defined(LED_MATRIX_ENABLE) |
| 541 | case ACT_BACKLIGHT: | 541 | case ACT_BACKLIGHT: |
| 542 | if (!event.pressed) { | 542 | if (!event.pressed) { |
| 543 | switch (action.backlight.opt) { | 543 | switch (action.backlight.opt) { |
