From a2b76703a9ed91e86ebbba3e4796525a856e27f2 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 9 Oct 2025 08:32:59 +0200 Subject: Moved the star_key handler in it’s own file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qmk/keyboards/sofle_choc/keymaps/custom/star_key.c | 34 +++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'qmk/keyboards/sofle_choc/keymaps/custom/star_key.c') 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 + } +} -- cgit v1.2.3