diff options
author | fauxpark <fauxpark@gmail.com> | 2023-07-08 01:01:36 +1000 |
---|---|---|
committer | fauxpark <fauxpark@gmail.com> | 2023-07-08 01:01:36 +1000 |
commit | ea1a9c37ed76aac93205b1aec38b11a310a50591 (patch) | |
tree | a9b8c1255aded2d43bc90dc1fdadc739411d8cfb /keyboards/stront/stront.c | |
parent | b32392f7b20e98f9776ef3f7dd79b1c43bd41c9d (diff) | |
parent | 71f0fc59bef7a37b55c7e1c10b1b21b8a86475b7 (diff) |
Merge remote-tracking branch 'upstream/master' into develop
Diffstat (limited to 'keyboards/stront/stront.c')
-rw-r--r-- | keyboards/stront/stront.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/keyboards/stront/stront.c b/keyboards/stront/stront.c new file mode 100644 index 0000000000..dc1f588c9b --- /dev/null +++ b/keyboards/stront/stront.c @@ -0,0 +1,61 @@ +// Copyright 2023 zzeneg (@zzeneg) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "stront.h" +#include "display.h" + +static bool display_enabled; + +/* public function to be used in keymaps */ +bool is_display_enabled(void) { + return display_enabled; +} + +/* default encoder keys */ +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { + return false; + } + if (index == 0) { + if (clockwise) { + tap_code_delay(KC_VOLU, 10); + } else { + tap_code_delay(KC_VOLD, 10); + } + } else if (index == 1) { + if (clockwise) { + tap_code_delay(KC_RIGHT, 10); + } else { + tap_code_delay(KC_LEFT, 10); + } + } + return true; +} + +/* Caps Lock processing */ +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if (res && display_enabled) { + display_process_caps(led_state.caps_lock); + } + + return res; +} + +void housekeeping_task_kb(void) { + if (display_enabled) { + display_housekeeping_task(); + } + + housekeeping_task_user(); +} + +void keyboard_post_init_kb(void) { + display_enabled = false; + + if (is_keyboard_left()) { + display_enabled = display_init_kb(); + } + + keyboard_post_init_user(); +} |