diff options
author | stanrc85 <47038504+stanrc85@users.noreply.github.com> | 2021-07-01 04:06:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-01 01:06:06 -0700 |
commit | fb405c27ad07313f5d564c02bf03130d9aaf59c7 (patch) | |
tree | 92391e41350145e51f88735d0afbd1e62db63e60 /keyboards | |
parent | 13533508e236666b8827b62f2b2d6819d473ef2b (diff) | |
download | qmk_firmware-fb405c27ad07313f5d564c02bf03130d9aaf59c7.tar.gz qmk_firmware-fb405c27ad07313f5d564c02bf03130d9aaf59c7.zip |
[Keymap] RGB Timeout added to userspace (#13339)
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/kiwikey/wanderland/keymaps/stanrc85/keymap.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/keyboards/kiwikey/wanderland/keymaps/stanrc85/keymap.c b/keyboards/kiwikey/wanderland/keymaps/stanrc85/keymap.c index a2f65ae5ee..cd11c427ba 100644 --- a/keyboards/kiwikey/wanderland/keymaps/stanrc85/keymap.c +++ b/keyboards/kiwikey/wanderland/keymaps/stanrc85/keymap.c @@ -83,39 +83,3 @@ void oled_task_user(void) { oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); } #endif - -// Backlight timeout feature -#define BACKLIGHT_TIMEOUT 20 // in minutes -static uint16_t idle_timer = 0; -static uint8_t halfmin_counter = 0; -static bool led_on = true; -static bool rgb_on = true; - -void matrix_scan_user(void) { - // idle_timer needs to be set one time - if (idle_timer == 0) idle_timer = timer_read(); - if ( (led_on && timer_elapsed(idle_timer) > 30000) || (rgb_on && timer_elapsed(idle_timer) > 30000)) { - halfmin_counter++; - idle_timer = timer_read(); - } - - if ( (led_on && halfmin_counter >= BACKLIGHT_TIMEOUT * 2) || (rgb_on && halfmin_counter >= BACKLIGHT_TIMEOUT * 2)) { - rgblight_disable_noeeprom(); - led_on = false; - rgb_on = false; - halfmin_counter = 0; - } -}; - -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - if (led_on == false || rgb_on == false ) { - rgblight_enable_noeeprom(); - led_on = true; - rgb_on = true; - } - idle_timer = timer_read(); - halfmin_counter = 0; - } - return true; -} |