diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2025-10-09 08:32:59 +0200 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2025-10-09 08:32:59 +0200 |
| commit | a2b76703a9ed91e86ebbba3e4796525a856e27f2 (patch) | |
| tree | 60072a66d0858b1ae3d4686ddf0ce84e1c4b2331 /qmk/keyboards/sofle_choc/keymaps/custom/star_key.c | |
| parent | 6f07047180a2e6b189200c18cafe5b4ccc9d2997 (diff) | |
Moved the star_key handler in it’s own file
Diffstat (limited to 'qmk/keyboards/sofle_choc/keymaps/custom/star_key.c')
| -rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/star_key.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/star_key.c b/qmk/keyboards/sofle_choc/keymaps/custom/star_key.c index 8c04c00..03ce6b5 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/star_key.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/star_key.c @@ -22,16 +22,36 @@ void star_key_init(void) { } } -void set_star_key(bool status) { - is_star = status; - is_synced = 0; -} - void sync_star_key(void) { if (!is_synced) { // Send the state to the other side of the keyboard master_to_slave_t m2s = { is_star }; - transaction_rpc_send(SET_STAR_KEY, sizeof(m2s), &m2s); - is_synced = 1; + is_synced = transaction_rpc_send(SET_STAR_KEY, sizeof(m2s), &m2s); } } +static uint8_t star_number = 0; +#define LY_SYMB TD(TD_LAYER_SYMB) +void star_key_process_record(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_O: + star_number = (star_number + 1) % 3; + if (star_number != 0 && is_star == 0) { + is_star = 1; + is_synced = 0; + } else if (star_number == 0) { + is_star = 0; + is_synced = 0; + } + return; + case LY_SYMB: + // Ignore the layer events + return; + default: + if (star_number != 0) { + star_number = 0; + is_star = 0; + is_synced = 0; + } + return; // Process all other keycodes normally + } +} |
