2 Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 #include "layer_switch.h"
28 #include "action_macro.h"
32 static void process_action(keyrecord_t *record);
33 #ifndef NO_ACTION_TAPPING
34 static bool process_tapping(keyrecord_t *record);
35 static void waiting_buffer_scan_tap(void);
38 static void debug_event(keyevent_t event);
39 static void debug_record(keyrecord_t record);
40 static void debug_action(action_t action);
41 #ifndef NO_ACTION_TAPPING
42 static void debug_tapping_key(void);
43 static void debug_waiting_buffer(void);
50 /* period of tapping(ms) */
52 #define TAPPING_TERM 200
55 /* tap count needed for toggling a feature */
56 #ifndef TAPPING_TOGGLE
57 #define TAPPING_TOGGLE 5
60 #ifndef NO_ACTION_TAPPING
61 /* stores a key event of current tap. */
62 static keyrecord_t tapping_key = {};
64 #define IS_TAPPING() !IS_NOEVENT(tapping_key.event)
65 #define IS_TAPPING_PRESSED() (IS_TAPPING() && tapping_key.event.pressed)
66 #define IS_TAPPING_RELEASED() (IS_TAPPING() && !tapping_key.event.pressed)
67 #define IS_TAPPING_KEY(k) (IS_TAPPING() && KEYEQ(tapping_key.event.key, (k)))
68 #define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < TAPPING_TERM)
74 * stores key events waiting for settling current tap.
76 #define WAITING_BUFFER_SIZE 8
77 static keyrecord_t waiting_buffer[WAITING_BUFFER_SIZE] = {};
79 /* point to empty cell to enq */
80 static uint8_t waiting_buffer_head = 0;
82 /* point to the oldest data cell to deq */
83 static uint8_t waiting_buffer_tail = 0;
85 static bool waiting_buffer_enq(keyrecord_t record)
87 if (IS_NOEVENT(record.event)) {
91 if ((waiting_buffer_head + 1) % WAITING_BUFFER_SIZE == waiting_buffer_tail) {
92 debug("waiting_buffer_enq: Over flow.\n");
96 waiting_buffer[waiting_buffer_head] = record;
97 waiting_buffer_head = (waiting_buffer_head + 1) % WAITING_BUFFER_SIZE;
99 debug("waiting_buffer_enq: "); debug_waiting_buffer();
103 static void waiting_buffer_clear(void)
105 waiting_buffer_head = 0;
106 waiting_buffer_tail = 0;
109 #if TAPPING_TERM >= 500
110 static bool waiting_buffer_typed(keyevent_t event)
112 for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) {
113 if (KEYEQ(event.key, waiting_buffer[i].event.key) && event.pressed != waiting_buffer[i].event.pressed) {
121 bool waiting_buffer_has_anykey_pressed(void)
123 for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) {
124 if (waiting_buffer[i].event.pressed) return true;
132 * Problem: Want to capitalize like 'The' but the result tends to be 'THe'.
133 * Solution: Oneshot modifier have its effect on only one key coming next.
134 * Tap Shift, then type 't', 'h' and 'e'. Not need to hold Shift key.
136 * Hold: works as normal modifier.
137 * Tap: one shot modifier.
138 * 2 Tap: cancel one shot modifier.
139 * 5-Tap: toggles enable/disable oneshot feature.
148 static void oneshot_start(uint8_t mods, uint16_t time)
150 oneshot_state.mods = mods;
151 oneshot_state.time = time;
152 oneshot_state.ready = true;
155 static void oneshot_cancel(void)
157 oneshot_state.mods = 0;
158 oneshot_state.time = 0;
159 oneshot_state.ready = false;
162 static void oneshot_toggle(void)
164 oneshot_state.disabled = !oneshot_state.disabled;
169 void action_exec(keyevent_t event)
171 if (!IS_NOEVENT(event)) {
172 debug("\n---- action_exec: start -----\n");
173 debug("EVENT: "); debug_event(event); debug("\n");
176 keyrecord_t record = { .event = event };
178 #ifndef NO_ACTION_TAPPING
179 // pre-process on tapping
180 if (process_tapping(&record)) {
181 if (!IS_NOEVENT(record.event)) {
182 debug("processed: "); debug_record(record); debug("\n");
186 if (!waiting_buffer_enq(record)) {
187 // clear all in case of overflow.
188 debug("OVERFLOW: CLEAR ALL STATES\n");
190 waiting_buffer_clear();
191 tapping_key = (keyrecord_t){};
195 // process waiting_buffer
196 if (!IS_NOEVENT(event) && waiting_buffer_head != waiting_buffer_tail) {
197 debug("---- action_exec: process waiting_buffer -----\n");
200 for (; waiting_buffer_tail != waiting_buffer_head; waiting_buffer_tail = (waiting_buffer_tail + 1) % WAITING_BUFFER_SIZE) {
201 if (process_tapping(&waiting_buffer[waiting_buffer_tail])) {
202 debug("processed: waiting_buffer["); debug_dec(waiting_buffer_tail); debug("] = ");
203 debug_record(waiting_buffer[waiting_buffer_tail]); debug("\n\n");
208 if (!IS_NOEVENT(event)) {
212 process_action(&record);
213 if (!IS_NOEVENT(record.event)) {
214 debug("processed: "); debug_record(record); debug("\n");
219 static void process_action(keyrecord_t *record)
221 keyevent_t event = record->event;
222 uint8_t tap_count = record->tap.count;
224 if (IS_NOEVENT(event)) { return; }
226 action_t action = layer_switch_get_action(event.key);
227 debug("ACTION: "); debug_action(action);
228 debug(" overlays: "); overlay_debug();
229 debug(" keymaps: "); keymap_debug();
230 debug(" default_layer: "); debug_dec(default_layer); debug("\n");
232 switch (action.kind.id) {
237 uint8_t mods = (action.kind.id == ACT_LMODS) ? action.key.mods :
240 uint8_t tmp_mods = host_get_mods();
243 host_send_keyboard_report();
245 register_code(action.key.code);
246 if (mods && action.key.code) {
247 host_set_mods(tmp_mods);
248 host_send_keyboard_report();
251 if (mods && !action.key.code) {
253 host_send_keyboard_report();
255 unregister_code(action.key.code);
259 #ifndef NO_ACTION_TAPPING
263 uint8_t mods = (action.kind.id == ACT_LMODS_TAP) ? action.key.mods :
265 switch (action.layer.code) {
269 if (tap_count == 0) {
270 debug("MODS_TAP: Oneshot: add_mods\n");
273 else if (tap_count == 1) {
274 debug("MODS_TAP: Oneshot: start\n");
275 oneshot_start(mods, event.time);
277 else if (tap_count == TAPPING_TOGGLE) {
278 debug("MODS_TAP: Oneshot: toggle\n");
282 debug("MODS_TAP: Oneshot: cancel&add_mods\n");
283 // double tap cancels oneshot and works as normal modifier.
288 if (tap_count == 0) {
289 debug("MODS_TAP: Oneshot: cancel/del_mods\n");
290 // cancel oneshot on hold
294 else if (tap_count == 1) {
295 debug("MODS_TAP: Oneshot: del_mods\n");
300 debug("MODS_TAP: Oneshot: del_mods\n");
309 if (waiting_buffer_has_anykey_pressed()) {
310 debug("MODS_TAP: Tap: Cancel: add_mods\n");
311 // ad hoc: set 0 to cancel tap
312 record->tap.count = 0;
315 debug("MODS_TAP: Tap: register_code\n");
316 register_code(action.key.code);
319 debug("MODS_TAP: No tap: add_mods\n");
324 debug("MODS_TAP: Tap: unregister_code\n");
325 unregister_code(action.key.code);
327 debug("MODS_TAP: No tap: add_mods\n");
337 #ifdef EXTRAKEY_ENABLE
338 /* other HID usage */
340 switch (action.usage.page) {
343 host_system_send(action.usage.code);
350 host_consumer_send(action.usage.code);
352 host_consumer_send(0);
359 #ifdef MOUSEKEY_ENABLE
363 mousekey_on(action.key.code);
366 mousekey_off(action.key.code);
372 #ifndef NO_ACTION_KEYMAP
374 switch (action.layer.code) {
377 switch (action.layer.val & 0x03) {
390 if (!event.pressed) {
399 /* NOTE: 4-7 rserved */
402 /* Keymap Reset default layer */
403 case (OP_RESET | ON_PRESS):
405 default_layer_set(action.layer.val);
408 case (OP_RESET | ON_RELEASE):
409 if (!event.pressed) {
410 default_layer_set(action.layer.val);
413 case (OP_RESET | ON_BOTH):
414 default_layer_set(action.layer.val);
417 /* Keymap Bit invert */
419 /* with tap toggle */
421 if (tap_count < TAPPING_TOGGLE) {
422 debug("KEYMAP_INV: tap toggle(press).\n");
423 keymap_invert(action.layer.val);
426 if (tap_count <= TAPPING_TOGGLE) {
427 debug("KEYMAP_INV: tap toggle(release).\n");
428 keymap_invert(action.layer.val);
432 case (OP_INV | ON_PRESS):
434 keymap_invert(action.layer.val);
437 case (OP_INV | ON_RELEASE):
438 if (!event.pressed) {
439 keymap_invert(action.layer.val);
442 case (OP_INV | ON_BOTH):
443 keymap_invert(action.layer.val);
449 keymap_on(action.layer.val);
451 keymap_off(action.layer.val);
454 case (OP_ON | ON_PRESS):
456 keymap_on(action.layer.val);
459 case (OP_ON | ON_RELEASE):
460 if (!event.pressed) {
461 keymap_on(action.layer.val);
464 case (OP_ON | ON_BOTH):
465 keymap_on(action.layer.val);
471 keymap_off(action.layer.val);
473 keymap_on(action.layer.val);
476 case (OP_OFF | ON_PRESS):
478 keymap_off(action.layer.val);
481 case (OP_OFF | ON_RELEASE):
482 if (!event.pressed) {
483 keymap_off(action.layer.val);
486 case (OP_OFF | ON_BOTH):
487 keymap_off(action.layer.val);
493 keymap_set(action.layer.val);
498 case (OP_SET | ON_PRESS):
500 keymap_set(action.layer.val);
503 case (OP_SET | ON_RELEASE):
504 if (!event.pressed) {
505 keymap_set(action.layer.val);
508 case (OP_SET | ON_BOTH):
509 keymap_set(action.layer.val);
512 /* Keymap Bit invert with tap key */
516 debug("KEYMAP_TAP_KEY: Tap: register_code\n");
517 register_code(action.layer.code);
519 debug("KEYMAP_TAP_KEY: No tap: On on press\n");
520 keymap_on(action.layer.val);
524 debug("KEYMAP_TAP_KEY: Tap: unregister_code\n");
525 unregister_code(action.layer.code);
527 debug("KEYMAP_TAP_KEY: No tap: Off on release\n");
528 keymap_off(action.layer.val);
536 #ifndef NO_ACTION_OVERLAY
538 switch (action.layer.code) {
539 // Overlay Invert bit4
541 if (action.layer.val == 0) {
542 // NOTE: reserved for future use
545 overlay_set(overlay_stat ^ action.layer.val);
549 if (action.layer.val == 0) {
551 if (event.pressed) overlay_clear();
553 overlay_set(overlay_stat ^ action.layer.val<<4);
557 if (action.layer.val == 0) {
559 if (!event.pressed) overlay_clear();
561 overlay_set(overlay_stat ^ action.layer.val<<8);
565 if (action.layer.val == 0) {
569 overlay_set(overlay_stat ^ action.layer.val<<12);
573 /* Overlay Bit invert */
575 /* with tap toggle */
577 if (tap_count < TAPPING_TOGGLE) {
578 debug("OVERLAY_INV: tap toggle(press).\n");
579 overlay_invert(action.layer.val);
582 if (tap_count <= TAPPING_TOGGLE) {
583 debug("OVERLAY_INV: tap toggle(release).\n");
584 overlay_invert(action.layer.val);
588 case (OP_INV | ON_PRESS):
590 overlay_invert(action.layer.val);
593 case (OP_INV | ON_RELEASE):
594 if (!event.pressed) {
595 overlay_invert(action.layer.val);
598 case (OP_INV | ON_BOTH):
599 overlay_invert(action.layer.val);
605 overlay_on(action.layer.val);
607 overlay_off(action.layer.val);
610 case (OP_ON | ON_PRESS):
612 overlay_on(action.layer.val);
615 case (OP_ON | ON_RELEASE):
616 if (!event.pressed) {
617 overlay_on(action.layer.val);
620 case (OP_ON | ON_BOTH):
621 overlay_on(action.layer.val);
624 /* Overlay Bit off */
627 overlay_off(action.layer.val);
629 overlay_on(action.layer.val);
632 case (OP_OFF | ON_PRESS):
634 overlay_off(action.layer.val);
637 case (OP_OFF | ON_RELEASE):
638 if (!event.pressed) {
639 overlay_off(action.layer.val);
642 case (OP_OFF | ON_BOTH):
643 overlay_off(action.layer.val);
646 /* Overlay Bit set */
649 overlay_move(action.layer.val);
654 case (OP_SET | ON_PRESS):
656 overlay_move(action.layer.val);
659 case (OP_SET | ON_RELEASE):
660 if (!event.pressed) {
661 overlay_move(action.layer.val);
664 case (OP_SET | ON_BOTH):
665 overlay_move(action.layer.val);
668 /* Overlay Bit invert with tap key */
672 debug("OVERLAY_TAP_KEY: Tap: register_code\n");
673 register_code(action.layer.code);
675 debug("OVERLAY_TAP_KEY: No tap: On on press\n");
676 overlay_on(action.layer.val);
680 debug("OVERLAY_TAP_KEY: Tap: unregister_code\n");
681 unregister_code(action.layer.code);
683 debug("OVERLAY_TAP_KEY: No tap: Off on release\n");
684 overlay_off(action.layer.val);
693 #ifndef NO_ACTION_MACRO
695 action_macro_play(action_get_macro(record, action.func.id, action.func.opt));
700 #ifndef NO_ACTION_FUNCTION
702 action_function(record, action.func.id, action.func.opt);
710 #ifndef NO_ACTION_TAPPING
713 * Rule: Tap key is typed(pressed and released) within TAPPING_TERM.
714 * (without interfering by typing other key)
716 /* return true when key event is processed or consumed. */
717 static bool process_tapping(keyrecord_t *keyp)
719 keyevent_t event = keyp->event;
722 if (IS_TAPPING_PRESSED()) {
723 if (WITHIN_TAPPING_TERM(event)) {
724 if (tapping_key.tap.count == 0) {
725 if (IS_TAPPING_KEY(event.key) && !event.pressed) {
727 debug("Tapping: First tap(0->1).\n");
728 tapping_key.tap.count = 1;
729 tapping_key.tap.interrupted = (waiting_buffer_has_anykey_pressed() ? true : false);
731 process_action(&tapping_key);
734 keyp->tap = tapping_key.tap;
737 #if TAPPING_TERM >= 500
738 /* This can prevent from typing some tap keys in a row at a time. */
739 else if (!event.pressed && waiting_buffer_typed(event)) {
740 // other key typed. not tap.
741 debug("Tapping: End. No tap. Interfered by typing key\n");
742 process_action(&tapping_key);
743 tapping_key = (keyrecord_t){};
751 // other key events shall be enq'd till tapping state settles.
757 if (IS_TAPPING_KEY(event.key) && !event.pressed) {
758 debug("Tapping: Tap release("); debug_dec(tapping_key.tap.count); debug(")\n");
759 keyp->tap = tapping_key.tap;
760 process_action(keyp);
765 else if (is_tap_key(keyp->event.key) && event.pressed) {
766 if (tapping_key.tap.count > 1) {
767 debug("Tapping: Start new tap with releasing last tap(>1).\n");
769 process_action(&(keyrecord_t){
770 .tap = tapping_key.tap,
771 .event.key = tapping_key.event.key,
772 .event.time = event.time,
773 .event.pressed = false
776 debug("Tapping: Start while last tap(1).\n");
779 waiting_buffer_scan_tap();
784 if (!IS_NOEVENT(keyp->event)) {
785 debug("Tapping: key event while last tap(>0).\n");
787 process_action(keyp);
792 // after TAPPING_TERM
794 if (tapping_key.tap.count == 0) {
795 debug("Tapping: End. Timeout. Not tap(0): ");
796 debug_event(event); debug("\n");
797 process_action(&tapping_key);
798 tapping_key = (keyrecord_t){};
802 if (IS_TAPPING_KEY(event.key) && !event.pressed) {
803 debug("Tapping: End. last timeout tap release(>0).");
804 keyp->tap = tapping_key.tap;
805 process_action(keyp);
806 tapping_key = (keyrecord_t){};
809 else if (is_tap_key(keyp->event.key) && event.pressed) {
810 if (tapping_key.tap.count > 1) {
811 debug("Tapping: Start new tap with releasing last timeout tap(>1).\n");
813 process_action(&(keyrecord_t){
814 .tap = tapping_key.tap,
815 .event.key = tapping_key.event.key,
816 .event.time = event.time,
817 .event.pressed = false
820 debug("Tapping: Start while last timeout tap(1).\n");
823 waiting_buffer_scan_tap();
828 if (!IS_NOEVENT(keyp->event)) {
829 debug("Tapping: key event while last timeout tap(>0).\n");
831 process_action(keyp);
836 } else if (IS_TAPPING_RELEASED()) {
837 if (WITHIN_TAPPING_TERM(event)) {
838 if (tapping_key.tap.count > 0 && IS_TAPPING_KEY(event.key) && event.pressed) {
840 keyp->tap = tapping_key.tap;
841 keyp->tap.count += 1;
842 debug("Tapping: Tap press("); debug_dec(keyp->tap.count); debug(")\n");
843 process_action(keyp);
847 } else if (event.pressed && is_tap_key(event.key)) {
848 // Sequential tap can be interfered with other tap key.
849 debug("Tapping: Start with interfering other tap.\n");
851 waiting_buffer_scan_tap();
855 if (!IS_NOEVENT(keyp->event)) debug("Tapping: other key just after tap.\n");
856 process_action(keyp);
860 // timeout. no sequential tap.
861 debug("Tapping: End(Timeout after releasing last tap): ");
862 debug_event(event); debug("\n");
863 tapping_key = (keyrecord_t){};
868 // not tapping satate
870 if (event.pressed && is_tap_key(event.key)) {
871 debug("Tapping: Start(Press tap key).\n");
873 waiting_buffer_scan_tap();
877 process_action(keyp);
883 /* scan buffer for tapping */
884 static void waiting_buffer_scan_tap(void)
886 // tapping already is settled
887 if (tapping_key.tap.count > 0) return;
888 // invalid state: tapping_key released && tap.count == 0
889 if (!tapping_key.event.pressed) return;
891 for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) {
892 if (IS_TAPPING_KEY(waiting_buffer[i].event.key) &&
893 !waiting_buffer[i].event.pressed &&
894 WITHIN_TAPPING_TERM(waiting_buffer[i].event)) {
895 tapping_key.tap.count = 1;
896 waiting_buffer[i].tap.count = 1;
897 process_action(&tapping_key);
899 debug("waiting_buffer_scan_tap: found at ["); debug_dec(i); debug("]\n");
900 debug_waiting_buffer();
910 * Utilities for actions.
912 void register_code(uint8_t code)
917 #ifdef CAPSLOCK_LOCKING_ENABLE
918 else if (KC_LOCKING_CAPS == code) {
919 #ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE
920 // Resync: ignore if caps lock already is on
921 if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) return;
923 host_add_key(KC_CAPSLOCK);
924 host_send_keyboard_report();
925 host_del_key(KC_CAPSLOCK);
926 host_send_keyboard_report();
929 else if IS_KEY(code) {
930 // TODO: should push command_proc out of this block?
931 if (command_proc(code)) return;
933 #ifndef NO_ACTION_TAPPING
934 if (oneshot_state.mods && oneshot_state.ready && !oneshot_state.disabled) {
935 uint8_t tmp_mods = host_get_mods();
936 host_add_mods(oneshot_state.mods);
938 host_send_keyboard_report();
940 host_set_mods(tmp_mods);
941 oneshot_state.ready = false;
946 host_send_keyboard_report();
949 else if IS_MOD(code) {
950 host_add_mods(MOD_BIT(code));
951 host_send_keyboard_report();
955 void unregister_code(uint8_t code)
960 #ifdef CAPSLOCK_LOCKING_ENABLE
961 else if (KC_LOCKING_CAPS == code) {
962 #ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE
963 // Resync: ignore if caps lock already is off
964 if (!(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) return;
966 host_add_key(KC_CAPSLOCK);
967 host_send_keyboard_report();
968 host_del_key(KC_CAPSLOCK);
969 host_send_keyboard_report();
972 else if IS_KEY(code) {
974 host_send_keyboard_report();
976 else if IS_MOD(code) {
977 host_del_mods(MOD_BIT(code));
978 host_send_keyboard_report();
982 void add_mods(uint8_t mods)
986 host_send_keyboard_report();
990 void del_mods(uint8_t mods)
994 host_send_keyboard_report();
998 void set_mods(uint8_t mods)
1000 host_set_mods(mods);
1001 host_send_keyboard_report();
1004 void clear_keyboard(void)
1007 clear_keyboard_but_mods();
1010 void clear_keyboard_but_mods(void)
1013 host_send_keyboard_report();
1014 #ifdef MOUSEKEY_ENABLE
1018 #ifdef EXTRAKEY_ENABLE
1019 host_system_send(0);
1020 host_consumer_send(0);
1024 bool sending_anykey(void)
1026 return (host_has_anykey() || host_mouse_in_use() ||
1027 host_last_sysytem_report() || host_last_consumer_report());
1030 bool is_tap_key(key_t key)
1032 action_t action = layer_switch_get_action(key);
1034 switch (action.kind.id) {
1040 switch (action.layer.code) {
1041 case 0x04 ... 0xEF: /* tap key */
1049 if (action.func.opt & FUNC_TAP) { return true; }
1059 static void debug_event(keyevent_t event)
1061 debug_hex16((event.key.row<<8) | event.key.col);
1062 if (event.pressed) debug("d("); else debug("u(");
1063 debug_dec(event.time); debug(")");
1065 static void debug_record(keyrecord_t record)
1067 debug_event(record.event); debug(":"); debug_dec(record.tap.count);
1068 if (record.tap.interrupted) debug("-");
1070 static void debug_action(action_t action)
1072 switch (action.kind.id) {
1073 case ACT_LMODS: debug("ACT_LMODS"); break;
1074 case ACT_RMODS: debug("ACT_RMODS"); break;
1075 case ACT_LMODS_TAP: debug("ACT_LMODS_TAP"); break;
1076 case ACT_RMODS_TAP: debug("ACT_RMODS_TAP"); break;
1077 case ACT_USAGE: debug("ACT_USAGE"); break;
1078 case ACT_MOUSEKEY: debug("ACT_MOUSEKEY"); break;
1079 case ACT_KEYMAP: debug("ACT_KEYMAP"); break;
1080 case ACT_OVERLAY: debug("ACT_OVERLAY"); break;
1081 case ACT_MACRO: debug("ACT_MACRO"); break;
1082 case ACT_COMMAND: debug("ACT_COMMAND"); break;
1083 case ACT_FUNCTION: debug("ACT_FUNCTION"); break;
1084 default: debug("UNKNOWN"); break;
1087 debug_hex4(action.kind.param>>8);
1089 debug_hex8(action.kind.param & 0xff);
1092 #ifndef NO_ACTION_TAPPING
1093 static void debug_tapping_key(void)
1095 debug("TAPPING_KEY="); debug_record(tapping_key); debug("\n");
1097 static void debug_waiting_buffer(void)
1100 for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) {
1101 debug("["); debug_dec(i); debug("]="); debug_record(waiting_buffer[i]); debug(" ");