aboutsummaryrefslogtreecommitdiff
path: root/qmk/keyboards/sofle_choc/keymaps/custom/star_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'qmk/keyboards/sofle_choc/keymaps/custom/star_key.c')
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/star_key.c34
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
+ }
+}