aboutsummaryrefslogtreecommitdiff
path: root/quantum/led_matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/led_matrix.c')
-rw-r--r--quantum/led_matrix.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c
index 72eb5190b..5dd37dff1 100644
--- a/quantum/led_matrix.c
+++ b/quantum/led_matrix.c
@@ -35,8 +35,8 @@
35# define LED_DISABLE_TIMEOUT 0 35# define LED_DISABLE_TIMEOUT 0
36#endif 36#endif
37 37
38#ifndef LED_DISABLE_WHEN_USB_SUSPENDED 38#if LED_DISABLE_WHEN_USB_SUSPENDED == false
39# define LED_DISABLE_WHEN_USB_SUSPENDED false 39# undef LED_DISABLE_WHEN_USB_SUSPENDED
40#endif 40#endif
41 41
42#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX 42#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
@@ -65,7 +65,6 @@
65#endif 65#endif
66 66
67// globals 67// globals
68bool g_suspend_state = false;
69led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr 68led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
70uint32_t g_led_timer; 69uint32_t g_led_timer;
71#ifdef LED_MATRIX_FRAMEBUFFER_EFFECTS 70#ifdef LED_MATRIX_FRAMEBUFFER_EFFECTS
@@ -76,6 +75,7 @@ last_hit_t g_last_hit_tracker;
76#endif // LED_MATRIX_KEYREACTIVE_ENABLED 75#endif // LED_MATRIX_KEYREACTIVE_ENABLED
77 76
78// internals 77// internals
78static bool suspend_state = false;
79static uint8_t led_last_enable = UINT8_MAX; 79static uint8_t led_last_enable = UINT8_MAX;
80static uint8_t led_last_effect = UINT8_MAX; 80static uint8_t led_last_effect = UINT8_MAX;
81static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false}; 81static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false};
@@ -325,9 +325,7 @@ void led_matrix_task(void) {
325 // Ideally we would also stop sending zeros to the LED driver PWM buffers 325 // Ideally we would also stop sending zeros to the LED driver PWM buffers
326 // while suspended and just do a software shutdown. This is a cheap hack for now. 326 // while suspended and just do a software shutdown. This is a cheap hack for now.
327 bool suspend_backlight = 327 bool suspend_backlight =
328#if LED_DISABLE_WHEN_USB_SUSPENDED == true 328 suspend_state ||
329 g_suspend_state ||
330#endif // LED_DISABLE_WHEN_USB_SUSPENDED == true
331#if LED_DISABLE_TIMEOUT > 0 329#if LED_DISABLE_TIMEOUT > 0
332 (led_anykey_timer > (uint32_t)LED_DISABLE_TIMEOUT) || 330 (led_anykey_timer > (uint32_t)LED_DISABLE_TIMEOUT) ||
333#endif // LED_DISABLE_TIMEOUT > 0 331#endif // LED_DISABLE_TIMEOUT > 0
@@ -416,13 +414,15 @@ void led_matrix_init(void) {
416} 414}
417 415
418void led_matrix_set_suspend_state(bool state) { 416void led_matrix_set_suspend_state(bool state) {
419 if (LED_DISABLE_WHEN_USB_SUSPENDED && state) { 417#ifdef LED_DISABLE_WHEN_USB_SUSPENDED
418 if (state) {
420 led_matrix_set_value_all(0); // turn off all LEDs when suspending 419 led_matrix_set_value_all(0); // turn off all LEDs when suspending
421 } 420 }
422 g_suspend_state = state; 421 suspend_state = state;
422#endif
423} 423}
424 424
425bool led_matrix_get_suspend_state(void) { return g_suspend_state; } 425bool led_matrix_get_suspend_state(void) { return suspend_state; }
426 426
427void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) { 427void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
428 led_matrix_eeconfig.enable ^= 1; 428 led_matrix_eeconfig.enable ^= 1;