diff options
author | Simon Arlott <70171+nomis@users.noreply.github.com> | 2022-04-16 23:02:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-17 00:02:32 +0200 |
commit | 5841c755ae0b5629deb4c139eb535a82437112a2 (patch) | |
tree | 5b2b62da583c1933558192b48fb340bef9843f1f /quantum/rgblight/rgblight.c | |
parent | e5918cf968f3e2c4a62858ee789748443ba58d10 (diff) |
rgblight: Add functions to stop blinking one or all but one layer (#16859)
Diffstat (limited to 'quantum/rgblight/rgblight.c')
-rw-r--r-- | quantum/rgblight/rgblight.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index f4ddb81e92..1f8b68ee59 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -826,6 +826,21 @@ void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t ti _repeat_timer = sync_timer_read() + duration_ms; } +void rgblight_unblink_layer(uint8_t layer) { + rgblight_set_layer_state(layer, false); + _blinking_layer_mask &= ~((rgblight_layer_mask_t)1 << layer); +} + +void rgblight_unblink_all_but_layer(uint8_t layer) { + for (uint8_t i = 0; i < RGBLIGHT_MAX_LAYERS; i++) { + if (i != layer) { + if ((_blinking_layer_mask & (rgblight_layer_mask_t)1 << i) != 0) { + rgblight_unblink_layer(i); + } + } + } +} + void rgblight_blink_layer_repeat_helper(void) { if (_blinking_layer_mask != 0 && timer_expired(sync_timer_read(), _repeat_timer)) { for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) { |