+static void oneshot_cancel(void)
+{
+ oneshot_state.mods = 0;
+ oneshot_state.time = 0;
+ oneshot_state.ready = false;
+}
+
+static void oneshot_toggle(void)
+{
+ oneshot_state.disabled = !oneshot_state.disabled;
+}
+
+
+
+void action_exec(keyevent_t event)
+{
+ if (!IS_NOEVENT(event)) {
+ debug("\n---- action_exec: start -----\n");
+ debug("EVENT: "); debug_event(event); debug("\n");
+ }
+
+ keyrecord_t record = { .event = event };
+
+ // pre-process on tapping
+ if (process_tapping(&record)) {
+ if (!IS_NOEVENT(record.event)) {
+ debug("processed: "); debug_record(record); debug("\n");
+ }
+ } else {
+ // enqueue
+ if (!waiting_buffer_enq(record)) {
+ // clear all in case of overflow.
+ debug("OVERFLOW: CLEAR ALL STATES\n");
+ clear_keyboard();
+ waiting_buffer_clear();
+ tapping_key = (keyrecord_t){};
+ }
+ }
+
+ // process waiting_buffer
+ if (!IS_NOEVENT(event) && waiting_buffer_head != waiting_buffer_tail) {
+ debug("---- action_exec: process waiting_buffer -----\n");
+ }
+
+ for (; waiting_buffer_tail != waiting_buffer_head; waiting_buffer_tail = (waiting_buffer_tail + 1) % WAITING_BUFFER_SIZE) {
+ if (process_tapping(&waiting_buffer[waiting_buffer_tail])) {
+ debug("processed: waiting_buffer["); debug_dec(waiting_buffer_tail); debug("] = ");
+ debug_record(waiting_buffer[waiting_buffer_tail]); debug("\n\n");
+ } else {
+ break;
+ }
+ }
+ if (!IS_NOEVENT(event)) {
+ debug("\n");
+ }
+}
+
+static void process_action(keyrecord_t *record)
+{
+ keyevent_t event = record->event;
+ uint8_t tap_count = record->tap_count;
+
+ if (IS_NOEVENT(event)) { return; }
+
+ action_t action = keymap_get_action(current_layer, event.key.pos.row, event.key.pos.col);
+ //debug("action: "); debug_hex16(action.code); if (event.pressed) debug("d\n"); else debug("u\n");
+ debug("ACTION: "); debug_action(action); debug("\n");