diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2025-10-04 11:43:42 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2025-10-04 11:43:42 +0200 |
commit | e23b3c87c2d1e3056c89834f4c34c3a289ba3b81 (patch) | |
tree | b8296c8d5f05ff626de0ee2eeb322f7374937e92 /qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c | |
parent | 4d42af985e96d5e5b4d4289dce401a215e607cd6 (diff) |
Added a led for the star key for ergo-l
Diffstat (limited to 'qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c')
-rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c index c21ba53..2843bbd 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c @@ -1,12 +1,24 @@ #include QMK_KEYBOARD_H #include "keymap_bepo.h" #include "keycodes.h" +#include "star_key.h" + +void keyboard_post_init_user(void) { + rgb_matrix_sethsv_noeeprom(HSV_WHITE); + star_key_init(); +} + +void housekeeping_task_user(void) { + if (is_keyboard_master()) { + sync_star_key(); + } +} /* * Rules and modifier to apply over the keycodes. This includes the keys * redefinitions and the keys to include in the caps_word mecanism. * - * All thoses update are working over the custom keys declared in `keycodes.h` + * All thoses update are working over the custom keys declared in `keycodes.h` */ /* @@ -63,6 +75,7 @@ static uint32_t key_timer; // timer for last keyboard activity, use // 32bit value and function to make longer // idle time possible static uint16_t latest_key = 0L; +static uint8_t star_number = 0; bool process_record_user(uint16_t keycode, keyrecord_t *record) { @@ -72,7 +85,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // know if we are inside a typing sequence or not. key_timer = timer_read32(); latest_key = keycode; - } + if (keycode != KC_O && star_number != 0) { + star_number = 0; + set_star_key(0); + } + } switch (keycode) { case KC_LEFT_SHIFT: @@ -87,7 +104,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; // If a key where released just before, consider we are typing some text - // and not starting a new sequence + // and not starting a new sequence case KEY_E: if (record->event.pressed && timer_elapsed32(key_timer) < TAPPING_TERM) { if (is_caps_word_on()) { @@ -140,7 +157,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { layer_off(1); } return true; + + // Handle the dead key in the ErgoL layout. + // The variable is synchronized over the other side of the keyboard. + case KC_O: + star_number = (star_number + 1) % 3; + set_star_key(star_number != 0); + return true; default: return true; // Process all other keycodes normally } } + |