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);
373 switch (action.layer.code) {
376 switch (action.layer.val & 0x03) {
389 if (!event.pressed) {
398 /* NOTE: 4-7 rserved */
401 /* Keymap Reset default layer */
402 case (OP_RESET | ON_PRESS):
404 default_layer_set(action.layer.val);
407 case (OP_RESET | ON_RELEASE):
408 if (!event.pressed) {
409 default_layer_set(action.layer.val);
412 case (OP_RESET | ON_BOTH):
413 default_layer_set(action.layer.val);
416 /* Keymap Bit invert */
418 /* with tap toggle */
420 if (tap_count < TAPPING_TOGGLE) {
421 debug("KEYMAP_INV: tap toggle(press).\n");
422 keymap_invert(action.layer.val);
425 if (tap_count <= TAPPING_TOGGLE) {
426 debug("KEYMAP_INV: tap toggle(release).\n");
427 keymap_invert(action.layer.val);
431 case (OP_INV | ON_PRESS):
433 keymap_invert(action.layer.val);
436 case (OP_INV | ON_RELEASE):
437 if (!event.pressed) {
438 keymap_invert(action.layer.val);
441 case (OP_INV | ON_BOTH):
442 keymap_invert(action.layer.val);
448 keymap_on(action.layer.val);
450 keymap_off(action.layer.val);
453 case (OP_ON | ON_PRESS):
455 keymap_on(action.layer.val);
458 case (OP_ON | ON_RELEASE):
459 if (!event.pressed) {
460 keymap_on(action.layer.val);
463 case (OP_ON | ON_BOTH):
464 keymap_on(action.layer.val);
470 keymap_off(action.layer.val);
472 keymap_on(action.layer.val);
475 case (OP_OFF | ON_PRESS):
477 keymap_off(action.layer.val);
480 case (OP_OFF | ON_RELEASE):
481 if (!event.pressed) {
482 keymap_off(action.layer.val);
485 case (OP_OFF | ON_BOTH):
486 keymap_off(action.layer.val);
492 keymap_set(action.layer.val);
497 case (OP_SET | ON_PRESS):
499 keymap_set(action.layer.val);
502 case (OP_SET | ON_RELEASE):
503 if (!event.pressed) {
504 keymap_set(action.layer.val);
507 case (OP_SET | ON_BOTH):
508 keymap_set(action.layer.val);
511 /* Keymap Bit invert with tap key */
515 debug("KEYMAP_TAP_KEY: Tap: register_code\n");
516 register_code(action.layer.code);
518 debug("KEYMAP_TAP_KEY: No tap: On on press\n");
519 keymap_on(action.layer.val);
523 debug("KEYMAP_TAP_KEY: Tap: unregister_code\n");
524 unregister_code(action.layer.code);
526 debug("KEYMAP_TAP_KEY: No tap: Off on release\n");
527 keymap_off(action.layer.val);
534 #ifndef NO_ACTION_OVERLAY
536 switch (action.layer.code) {
537 // Overlay Invert bit4
539 if (action.layer.val == 0) {
540 // NOTE: reserved for future use
543 overlay_set(overlay_stat ^ action.layer.val);
547 if (action.layer.val == 0) {
549 if (event.pressed) overlay_clear();
551 overlay_set(overlay_stat ^ action.layer.val<<4);
555 if (action.layer.val == 0) {
557 if (!event.pressed) overlay_clear();
559 overlay_set(overlay_stat ^ action.layer.val<<8);
563 if (action.layer.val == 0) {
567 overlay_set(overlay_stat ^ action.layer.val<<12);
571 /* Overlay Bit invert */
573 /* with tap toggle */
575 if (tap_count < TAPPING_TOGGLE) {
576 debug("OVERLAY_INV: tap toggle(press).\n");
577 overlay_invert(action.layer.val);
580 if (tap_count <= TAPPING_TOGGLE) {
581 debug("OVERLAY_INV: tap toggle(release).\n");
582 overlay_invert(action.layer.val);
586 case (OP_INV | ON_PRESS):
588 overlay_invert(action.layer.val);
591 case (OP_INV | ON_RELEASE):
592 if (!event.pressed) {
593 overlay_invert(action.layer.val);
596 case (OP_INV | ON_BOTH):
597 overlay_invert(action.layer.val);
603 overlay_on(action.layer.val);
605 overlay_off(action.layer.val);
608 case (OP_ON | ON_PRESS):
610 overlay_on(action.layer.val);
613 case (OP_ON | ON_RELEASE):
614 if (!event.pressed) {
615 overlay_on(action.layer.val);
618 case (OP_ON | ON_BOTH):
619 overlay_on(action.layer.val);
622 /* Overlay Bit off */
625 overlay_off(action.layer.val);
627 overlay_on(action.layer.val);
630 case (OP_OFF | ON_PRESS):
632 overlay_off(action.layer.val);
635 case (OP_OFF | ON_RELEASE):
636 if (!event.pressed) {
637 overlay_off(action.layer.val);
640 case (OP_OFF | ON_BOTH):
641 overlay_off(action.layer.val);
644 /* Overlay Bit set */
647 overlay_move(action.layer.val);
652 case (OP_SET | ON_PRESS):
654 overlay_move(action.layer.val);
657 case (OP_SET | ON_RELEASE):
658 if (!event.pressed) {
659 overlay_move(action.layer.val);
662 case (OP_SET | ON_BOTH):
663 overlay_move(action.layer.val);
666 /* Overlay Bit invert with tap key */
670 debug("OVERLAY_TAP_KEY: Tap: register_code\n");
671 register_code(action.layer.code);
673 debug("OVERLAY_TAP_KEY: No tap: On on press\n");
674 overlay_on(action.layer.val);
678 debug("OVERLAY_TAP_KEY: Tap: unregister_code\n");
679 unregister_code(action.layer.code);
681 debug("OVERLAY_TAP_KEY: No tap: Off on release\n");
682 overlay_off(action.layer.val);
691 #ifndef NO_ACTION_MACRO
693 action_macro_play(action_get_macro(record, action.func.id, action.func.opt));
698 #ifndef NO_ACTION_FUNCTION
700 action_function(record, action.func.id, action.func.opt);
708 #ifndef NO_ACTION_TAPPING
711 * Rule: Tap key is typed(pressed and released) within TAPPING_TERM.
712 * (without interfering by typing other key)
714 /* return true when key event is processed or consumed. */
715 static bool process_tapping(keyrecord_t *keyp)
717 keyevent_t event = keyp->event;
720 if (IS_TAPPING_PRESSED()) {
721 if (WITHIN_TAPPING_TERM(event)) {
722 if (tapping_key.tap.count == 0) {
723 if (IS_TAPPING_KEY(event.key) && !event.pressed) {
725 debug("Tapping: First tap(0->1).\n");
726 tapping_key.tap.count = 1;
727 tapping_key.tap.interrupted = (waiting_buffer_has_anykey_pressed() ? true : false);
729 process_action(&tapping_key);
732 keyp->tap = tapping_key.tap;
735 #if TAPPING_TERM >= 500
736 /* This can prevent from typing some tap keys in a row at a time. */
737 else if (!event.pressed && waiting_buffer_typed(event)) {
738 // other key typed. not tap.
739 debug("Tapping: End. No tap. Interfered by typing key\n");
740 process_action(&tapping_key);
741 tapping_key = (keyrecord_t){};
749 // other key events shall be enq'd till tapping state settles.
755 if (IS_TAPPING_KEY(event.key) && !event.pressed) {
756 debug("Tapping: Tap release("); debug_dec(tapping_key.tap.count); debug(")\n");
757 keyp->tap = tapping_key.tap;
758 process_action(keyp);
763 else if (is_tap_key(keyp->event.key) && event.pressed) {
764 if (tapping_key.tap.count > 1) {
765 debug("Tapping: Start new tap with releasing last tap(>1).\n");
767 process_action(&(keyrecord_t){
768 .tap = tapping_key.tap,
769 .event.key = tapping_key.event.key,
770 .event.time = event.time,
771 .event.pressed = false
774 debug("Tapping: Start while last tap(1).\n");
777 waiting_buffer_scan_tap();
782 if (!IS_NOEVENT(keyp->event)) {
783 debug("Tapping: key event while last tap(>0).\n");
785 process_action(keyp);
790 // after TAPPING_TERM
792 if (tapping_key.tap.count == 0) {
793 debug("Tapping: End. Timeout. Not tap(0): ");
794 debug_event(event); debug("\n");
795 process_action(&tapping_key);
796 tapping_key = (keyrecord_t){};
800 if (IS_TAPPING_KEY(event.key) && !event.pressed) {
801 debug("Tapping: End. last timeout tap release(>0).");
802 keyp->tap = tapping_key.tap;
803 process_action(keyp);
804 tapping_key = (keyrecord_t){};
807 else if (is_tap_key(keyp->event.key) && event.pressed) {
808 if (tapping_key.tap.count > 1) {
809 debug("Tapping: Start new tap with releasing last timeout tap(>1).\n");
811 process_action(&(keyrecord_t){
812 .tap = tapping_key.tap,
813 .event.key = tapping_key.event.key,
814 .event.time = event.time,
815 .event.pressed = false
818 debug("Tapping: Start while last timeout tap(1).\n");
821 waiting_buffer_scan_tap();
826 if (!IS_NOEVENT(keyp->event)) {
827 debug("Tapping: key event while last timeout tap(>0).\n");
829 process_action(keyp);
834 } else if (IS_TAPPING_RELEASED()) {
835 if (WITHIN_TAPPING_TERM(event)) {
836 if (tapping_key.tap.count > 0 && IS_TAPPING_KEY(event.key) && event.pressed) {
838 keyp->tap = tapping_key.tap;
839 keyp->tap.count += 1;
840 debug("Tapping: Tap press("); debug_dec(keyp->tap.count); debug(")\n");
841 process_action(keyp);
845 } else if (event.pressed && is_tap_key(event.key)) {
846 // Sequential tap can be interfered with other tap key.
847 debug("Tapping: Start with interfering other tap.\n");
849 waiting_buffer_scan_tap();
853 if (!IS_NOEVENT(keyp->event)) debug("Tapping: other key just after tap.\n");
854 process_action(keyp);
858 // timeout. no sequential tap.
859 debug("Tapping: End(Timeout after releasing last tap): ");
860 debug_event(event); debug("\n");
861 tapping_key = (keyrecord_t){};
866 // not tapping satate
868 if (event.pressed && is_tap_key(event.key)) {
869 debug("Tapping: Start(Press tap key).\n");
871 waiting_buffer_scan_tap();
875 process_action(keyp);
881 /* scan buffer for tapping */
882 static void waiting_buffer_scan_tap(void)
884 // tapping already is settled
885 if (tapping_key.tap.count > 0) return;
886 // invalid state: tapping_key released && tap.count == 0
887 if (!tapping_key.event.pressed) return;
889 for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) {
890 if (IS_TAPPING_KEY(waiting_buffer[i].event.key) &&
891 !waiting_buffer[i].event.pressed &&
892 WITHIN_TAPPING_TERM(waiting_buffer[i].event)) {
893 tapping_key.tap.count = 1;
894 waiting_buffer[i].tap.count = 1;
895 process_action(&tapping_key);
897 debug("waiting_buffer_scan_tap: found at ["); debug_dec(i); debug("]\n");
898 debug_waiting_buffer();
908 * Utilities for actions.
910 void register_code(uint8_t code)
915 #ifdef CAPSLOCK_LOCKING_ENABLE
916 else if (KC_LOCKING_CAPS == code) {
917 #ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE
918 // Resync: ignore if caps lock already is on
919 if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) return;
921 host_add_key(KC_CAPSLOCK);
922 host_send_keyboard_report();
923 host_del_key(KC_CAPSLOCK);
924 host_send_keyboard_report();
927 else if IS_KEY(code) {
928 // TODO: should push command_proc out of this block?
929 if (command_proc(code)) return;
931 #ifndef NO_ACTION_TAPPING
932 if (oneshot_state.mods && oneshot_state.ready && !oneshot_state.disabled) {
933 uint8_t tmp_mods = host_get_mods();
934 host_add_mods(oneshot_state.mods);
936 host_send_keyboard_report();
938 host_set_mods(tmp_mods);
939 oneshot_state.ready = false;
944 host_send_keyboard_report();
947 else if IS_MOD(code) {
948 host_add_mods(MOD_BIT(code));
949 host_send_keyboard_report();
953 void unregister_code(uint8_t code)
958 #ifdef CAPSLOCK_LOCKING_ENABLE
959 else if (KC_LOCKING_CAPS == code) {
960 #ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE
961 // Resync: ignore if caps lock already is off
962 if (!(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) return;
964 host_add_key(KC_CAPSLOCK);
965 host_send_keyboard_report();
966 host_del_key(KC_CAPSLOCK);
967 host_send_keyboard_report();
970 else if IS_KEY(code) {
972 host_send_keyboard_report();
974 else if IS_MOD(code) {
975 host_del_mods(MOD_BIT(code));
976 host_send_keyboard_report();
980 void add_mods(uint8_t mods)
984 host_send_keyboard_report();
988 void del_mods(uint8_t mods)
992 host_send_keyboard_report();
996 void set_mods(uint8_t mods)
999 host_send_keyboard_report();
1002 void clear_keyboard(void)
1005 clear_keyboard_but_mods();
1008 void clear_keyboard_but_mods(void)
1011 host_send_keyboard_report();
1012 #ifdef MOUSEKEY_ENABLE
1016 #ifdef EXTRAKEY_ENABLE
1017 host_system_send(0);
1018 host_consumer_send(0);
1022 bool sending_anykey(void)
1024 return (host_has_anykey() || host_mouse_in_use() ||
1025 host_last_sysytem_report() || host_last_consumer_report());
1028 bool is_tap_key(key_t key)
1030 action_t action = layer_switch_get_action(key);
1032 switch (action.kind.id) {
1038 switch (action.layer.code) {
1039 case 0x04 ... 0xEF: /* tap key */
1047 if (action.func.opt & FUNC_TAP) { return true; }
1057 static void debug_event(keyevent_t event)
1059 debug_hex16((event.key.row<<8) | event.key.col);
1060 if (event.pressed) debug("d("); else debug("u(");
1061 debug_dec(event.time); debug(")");
1063 static void debug_record(keyrecord_t record)
1065 debug_event(record.event); debug(":"); debug_dec(record.tap.count);
1066 if (record.tap.interrupted) debug("-");
1068 static void debug_action(action_t action)
1070 switch (action.kind.id) {
1071 case ACT_LMODS: debug("ACT_LMODS"); break;
1072 case ACT_RMODS: debug("ACT_RMODS"); break;
1073 case ACT_LMODS_TAP: debug("ACT_LMODS_TAP"); break;
1074 case ACT_RMODS_TAP: debug("ACT_RMODS_TAP"); break;
1075 case ACT_USAGE: debug("ACT_USAGE"); break;
1076 case ACT_MOUSEKEY: debug("ACT_MOUSEKEY"); break;
1077 case ACT_KEYMAP: debug("ACT_KEYMAP"); break;
1078 case ACT_OVERLAY: debug("ACT_OVERLAY"); break;
1079 case ACT_MACRO: debug("ACT_MACRO"); break;
1080 case ACT_COMMAND: debug("ACT_COMMAND"); break;
1081 case ACT_FUNCTION: debug("ACT_FUNCTION"); break;
1082 default: debug("UNKNOWN"); break;
1085 debug_hex4(action.kind.param>>8);
1087 debug_hex8(action.kind.param & 0xff);
1090 #ifndef NO_ACTION_TAPPING
1091 static void debug_tapping_key(void)
1093 debug("TAPPING_KEY="); debug_record(tapping_key); debug("\n");
1095 static void debug_waiting_buffer(void)
1098 for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) {
1099 debug("["); debug_dec(i); debug("]="); debug_record(waiting_buffer[i]); debug(" ");