diff options
| author | Pete Neisen <pete@neisen.xyz> | 2023-11-29 15:38:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-30 09:38:06 +1100 |
| commit | 7cc90c234f55364bb5ebf45f9bb4274fd9926b9d (patch) | |
| tree | 97e03c3eb5007cf857968b22529379102019aa16 /quantum/led_matrix | |
| parent | cfbbb503a430a4f11c764cfab44737c4856afe0d (diff) | |
Converted RGB matrix to use last_input_activity_elapsed(). (#21687)
Co-authored-by: Nick Brassel <nick@tzarc.org>
Diffstat (limited to 'quantum/led_matrix')
| -rw-r--r-- | quantum/led_matrix/led_matrix.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c index 4d67a295df..4699c4a4c2 100644 --- a/quantum/led_matrix/led_matrix.c +++ b/quantum/led_matrix/led_matrix.c | |||
| @@ -74,9 +74,6 @@ static uint8_t led_last_enable = UINT8_MAX; | |||
| 74 | static uint8_t led_last_effect = UINT8_MAX; | 74 | static uint8_t led_last_effect = UINT8_MAX; |
| 75 | static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false}; | 75 | static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false}; |
| 76 | static led_task_states led_task_state = SYNCING; | 76 | static led_task_states led_task_state = SYNCING; |
| 77 | #if LED_MATRIX_TIMEOUT > 0 | ||
| 78 | static uint32_t led_anykey_timer; | ||
| 79 | #endif // LED_MATRIX_TIMEOUT > 0 | ||
| 80 | 77 | ||
| 81 | // double buffers | 78 | // double buffers |
| 82 | static uint32_t led_timer_buffer; | 79 | static uint32_t led_timer_buffer; |
| @@ -156,9 +153,6 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { | |||
| 156 | #ifndef LED_MATRIX_SPLIT | 153 | #ifndef LED_MATRIX_SPLIT |
| 157 | if (!is_keyboard_master()) return; | 154 | if (!is_keyboard_master()) return; |
| 158 | #endif | 155 | #endif |
| 159 | #if LED_MATRIX_TIMEOUT > 0 | ||
| 160 | led_anykey_timer = 0; | ||
| 161 | #endif // LED_MATRIX_TIMEOUT > 0 | ||
| 162 | 156 | ||
| 163 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | 157 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED |
| 164 | uint8_t led[LED_HITS_TO_REMEMBER]; | 158 | uint8_t led[LED_HITS_TO_REMEMBER]; |
| @@ -208,22 +202,11 @@ static bool led_matrix_none(effect_params_t *params) { | |||
| 208 | } | 202 | } |
| 209 | 203 | ||
| 210 | static void led_task_timers(void) { | 204 | static void led_task_timers(void) { |
| 211 | #if defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_MATRIX_TIMEOUT > 0 | 205 | #if defined(LED_MATRIX_KEYREACTIVE_ENABLED) |
| 212 | uint32_t deltaTime = sync_timer_elapsed32(led_timer_buffer); | 206 | uint32_t deltaTime = sync_timer_elapsed32(led_timer_buffer); |
| 213 | #endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_MATRIX_TIMEOUT > 0 | 207 | #endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) |
| 214 | led_timer_buffer = sync_timer_read32(); | 208 | led_timer_buffer = sync_timer_read32(); |
| 215 | 209 | ||
| 216 | // Update double buffer timers | ||
| 217 | #if LED_MATRIX_TIMEOUT > 0 | ||
| 218 | if (led_anykey_timer < UINT32_MAX) { | ||
| 219 | if (UINT32_MAX - deltaTime < led_anykey_timer) { | ||
| 220 | led_anykey_timer = UINT32_MAX; | ||
| 221 | } else { | ||
| 222 | led_anykey_timer += deltaTime; | ||
| 223 | } | ||
| 224 | } | ||
| 225 | #endif // LED_MATRIX_TIMEOUT > 0 | ||
| 226 | |||
| 227 | // Update double buffer last hit timers | 210 | // Update double buffer last hit timers |
| 228 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED | 211 | #ifdef LED_MATRIX_KEYREACTIVE_ENABLED |
| 229 | uint8_t count = last_hit_buffer.count; | 212 | uint8_t count = last_hit_buffer.count; |
| @@ -329,7 +312,7 @@ void led_matrix_task(void) { | |||
| 329 | // while suspended and just do a software shutdown. This is a cheap hack for now. | 312 | // while suspended and just do a software shutdown. This is a cheap hack for now. |
| 330 | bool suspend_backlight = suspend_state || | 313 | bool suspend_backlight = suspend_state || |
| 331 | #if LED_MATRIX_TIMEOUT > 0 | 314 | #if LED_MATRIX_TIMEOUT > 0 |
| 332 | (led_anykey_timer > (uint32_t)LED_MATRIX_TIMEOUT) || | 315 | (last_input_activity_elapsed() > (uint32_t)LED_MATRIX_TIMEOUT) || |
| 333 | #endif // LED_MATRIX_TIMEOUT > 0 | 316 | #endif // LED_MATRIX_TIMEOUT > 0 |
| 334 | false; | 317 | false; |
| 335 | 318 | ||
