aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgb_matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/rgb_matrix.c')
-rw-r--r--quantum/rgb_matrix.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 8aae48603..1f7604943 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -67,8 +67,8 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv
67# define RGB_DISABLE_TIMEOUT 0 67# define RGB_DISABLE_TIMEOUT 0
68#endif 68#endif
69 69
70#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED 70#if RGB_DISABLE_WHEN_USB_SUSPENDED == false
71# define RGB_DISABLE_WHEN_USB_SUSPENDED false 71# undef RGB_DISABLE_WHEN_USB_SUSPENDED
72#endif 72#endif
73 73
74#if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX 74#if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
@@ -118,7 +118,6 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv
118#endif 118#endif
119 119
120// globals 120// globals
121bool g_suspend_state = false;
122rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr 121rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
123uint32_t g_rgb_timer; 122uint32_t g_rgb_timer;
124#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS 123#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
@@ -129,6 +128,7 @@ last_hit_t g_last_hit_tracker;
129#endif // RGB_MATRIX_KEYREACTIVE_ENABLED 128#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
130 129
131// internals 130// internals
131static bool suspend_state = false;
132static uint8_t rgb_last_enable = UINT8_MAX; 132static uint8_t rgb_last_enable = UINT8_MAX;
133static uint8_t rgb_last_effect = UINT8_MAX; 133static uint8_t rgb_last_effect = UINT8_MAX;
134static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false}; 134static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false};
@@ -410,9 +410,7 @@ void rgb_matrix_task(void) {
410 // Ideally we would also stop sending zeros to the LED driver PWM buffers 410 // Ideally we would also stop sending zeros to the LED driver PWM buffers
411 // while suspended and just do a software shutdown. This is a cheap hack for now. 411 // while suspended and just do a software shutdown. This is a cheap hack for now.
412 bool suspend_backlight = 412 bool suspend_backlight =
413#if RGB_DISABLE_WHEN_USB_SUSPENDED == true 413 suspend_state ||
414 g_suspend_state ||
415#endif // RGB_DISABLE_WHEN_USB_SUSPENDED == true
416#if RGB_DISABLE_TIMEOUT > 0 414#if RGB_DISABLE_TIMEOUT > 0
417 (rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) || 415 (rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) ||
418#endif // RGB_DISABLE_TIMEOUT > 0 416#endif // RGB_DISABLE_TIMEOUT > 0
@@ -501,13 +499,15 @@ void rgb_matrix_init(void) {
501} 499}
502 500
503void rgb_matrix_set_suspend_state(bool state) { 501void rgb_matrix_set_suspend_state(bool state) {
504 if (RGB_DISABLE_WHEN_USB_SUSPENDED && state) { 502#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
503 if (state) {
505 rgb_matrix_set_color_all(0, 0, 0); // turn off all LEDs when suspending 504 rgb_matrix_set_color_all(0, 0, 0); // turn off all LEDs when suspending
506 } 505 }
507 g_suspend_state = state; 506 suspend_state = state;
507#endif
508} 508}
509 509
510bool rgb_matrix_get_suspend_state(void) { return g_suspend_state; } 510bool rgb_matrix_get_suspend_state(void) { return suspend_state; }
511 511
512void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) { 512void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
513 rgb_matrix_config.enable ^= 1; 513 rgb_matrix_config.enable ^= 1;