aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2014-06-17 00:57:59 +0900
committertmk <nobody@nowhere>2014-07-30 14:07:43 +0900
commitc67ae2a6b546c822759352586c14cd9dccbbe0ff (patch)
treeab77175c64bfce74d2662260b9cdb2af8d8a7efd /common
parent04fe78ee0a7fe9baed39f021799a3dbb24ebeb36 (diff)
downloadqmk_firmware-c67ae2a6b546c822759352586c14cd9dccbbe0ff.tar.gz
qmk_firmware-c67ae2a6b546c822759352586c14cd9dccbbe0ff.zip
Port action_* to mbed
Diffstat (limited to 'common')
-rw-r--r--common/action.c2
-rw-r--r--common/action.h13
-rw-r--r--common/action_layer.c2
-rw-r--r--common/action_layer.h2
-rw-r--r--common/action_macro.c8
-rw-r--r--common/action_macro.h8
-rw-r--r--common/action_util.c20
-rw-r--r--common/action_util.h9
-rw-r--r--common/bootmagic.c2
-rw-r--r--common/host.c4
-rw-r--r--common/keyboard.c2
-rw-r--r--common/keyboard.h8
-rw-r--r--common/keymap.c4
-rw-r--r--common/keymap.h2
-rw-r--r--common/print.h2
-rw-r--r--common/report.h22
-rw-r--r--common/wait.h20
17 files changed, 83 insertions, 47 deletions
diff --git a/common/action.c b/common/action.c
index fddb97c50..94498fe6c 100644
--- a/common/action.c
+++ b/common/action.c
@@ -499,7 +499,7 @@ void clear_keyboard_but_mods(void)
499#endif 499#endif
500} 500}
501 501
502bool is_tap_key(key_t key) 502bool is_tap_key(keypos_t key)
503{ 503{
504 action_t action = layer_switch_get_action(key); 504 action_t action = layer_switch_get_action(key);
505 505
diff --git a/common/action.h b/common/action.h
index 077711c23..8a4736d7b 100644
--- a/common/action.h
+++ b/common/action.h
@@ -25,6 +25,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
25#include "action_macro.h" 25#include "action_macro.h"
26 26
27 27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
28/* tapping count and state */ 32/* tapping count and state */
29typedef struct { 33typedef struct {
30 bool interrupted :1; 34 bool interrupted :1;
@@ -42,12 +46,11 @@ typedef struct {
42#endif 46#endif
43} keyrecord_t; 47} keyrecord_t;
44 48
45
46/* Execute action per keyevent */ 49/* Execute action per keyevent */
47void action_exec(keyevent_t event); 50void action_exec(keyevent_t event);
48 51
49/* action for key */ 52/* action for key */
50action_t action_for_key(uint8_t layer, key_t key); 53action_t action_for_key(uint8_t layer, keypos_t key);
51 54
52/* macro */ 55/* macro */
53const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt); 56const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
@@ -65,11 +68,15 @@ void unregister_mods(uint8_t mods);
65void clear_keyboard(void); 68void clear_keyboard(void);
66void clear_keyboard_but_mods(void); 69void clear_keyboard_but_mods(void);
67void layer_switch(uint8_t new_layer); 70void layer_switch(uint8_t new_layer);
68bool is_tap_key(key_t key); 71bool is_tap_key(keypos_t key);
69 72
70/* debug */ 73/* debug */
71void debug_event(keyevent_t event); 74void debug_event(keyevent_t event);
72void debug_record(keyrecord_t record); 75void debug_record(keyrecord_t record);
73void debug_action(action_t action); 76void debug_action(action_t action);
74 77
78#ifdef __cplusplus
79}
80#endif
81
75#endif /* ACTION_H */ 82#endif /* ACTION_H */
diff --git a/common/action_layer.c b/common/action_layer.c
index 526e24d53..c535615f4 100644
--- a/common/action_layer.c
+++ b/common/action_layer.c
@@ -112,7 +112,7 @@ void layer_debug(void)
112 112
113 113
114 114
115action_t layer_switch_get_action(key_t key) 115action_t layer_switch_get_action(keypos_t key)
116{ 116{
117 action_t action; 117 action_t action;
118 action.code = ACTION_TRANSPARENT; 118 action.code = ACTION_TRANSPARENT;
diff --git a/common/action_layer.h b/common/action_layer.h
index 034e00027..b6da353cf 100644
--- a/common/action_layer.h
+++ b/common/action_layer.h
@@ -72,6 +72,6 @@ void layer_xor(uint32_t state);
72 72
73 73
74/* return action depending on current layer status */ 74/* return action depending on current layer status */
75action_t layer_switch_get_action(key_t key); 75action_t layer_switch_get_action(keypos_t key);
76 76
77#endif 77#endif
diff --git a/common/action_macro.c b/common/action_macro.c
index d85aee379..ba93fc8b2 100644
--- a/common/action_macro.c
+++ b/common/action_macro.c
@@ -14,10 +14,10 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <util/delay.h>
18#include "action.h" 17#include "action.h"
19#include "action_util.h" 18#include "action_util.h"
20#include "action_macro.h" 19#include "action_macro.h"
20#include "wait.h"
21 21
22#ifdef DEBUG_ACTION 22#ifdef DEBUG_ACTION
23#include "debug.h" 23#include "debug.h"
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
28 28
29#ifndef NO_ACTION_MACRO 29#ifndef NO_ACTION_MACRO
30 30
31#define MACRO_READ() (macro = pgm_read_byte(macro_p++)) 31#define MACRO_READ() (macro = MACRO_GET(macro_p++))
32void action_macro_play(const macro_t *macro_p) 32void action_macro_play(const macro_t *macro_p)
33{ 33{
34 macro_t macro = END; 34 macro_t macro = END;
@@ -58,7 +58,7 @@ void action_macro_play(const macro_t *macro_p)
58 case WAIT: 58 case WAIT:
59 MACRO_READ(); 59 MACRO_READ();
60 dprintf("WAIT(%u)\n", macro); 60 dprintf("WAIT(%u)\n", macro);
61 { uint8_t ms = macro; while (ms--) _delay_ms(1); } 61 { uint8_t ms = macro; while (ms--) wait_ms(1); }
62 break; 62 break;
63 case INTERVAL: 63 case INTERVAL:
64 interval = MACRO_READ(); 64 interval = MACRO_READ();
@@ -77,7 +77,7 @@ void action_macro_play(const macro_t *macro_p)
77 return; 77 return;
78 } 78 }
79 // interval 79 // interval
80 { uint8_t ms = interval; while (ms--) _delay_ms(1); } 80 { uint8_t ms = interval; while (ms--) wait_ms(1); }
81 } 81 }
82} 82}
83#endif 83#endif
diff --git a/common/action_macro.h b/common/action_macro.h
index 621826308..aedc32ec6 100644
--- a/common/action_macro.h
+++ b/common/action_macro.h
@@ -17,12 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17#ifndef ACTION_MACRO_H 17#ifndef ACTION_MACRO_H
18#define ACTION_MACRO_H 18#define ACTION_MACRO_H
19#include <stdint.h> 19#include <stdint.h>
20#include <avr/pgmspace.h> 20#include "progmem.h"
21 21
22 22
23#define MACRO_NONE 0 23#define MACRO_NONE 0
24#define MACRO(...) ({ static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; }) 24#define MACRO(...) ({ static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; })
25 25#define MACRO_GET(p) pgm_read_byte(p)
26 26
27typedef uint8_t macro_t; 27typedef uint8_t macro_t;
28 28
diff --git a/common/action_util.c b/common/action_util.c
index 5f44b3812..dbee630d1 100644
--- a/common/action_util.c
+++ b/common/action_util.c
@@ -31,8 +31,8 @@ static uint8_t real_mods = 0;
31static uint8_t weak_mods = 0; 31static uint8_t weak_mods = 0;
32 32
33#ifdef USB_6KRO_ENABLE 33#ifdef USB_6KRO_ENABLE
34#define RO_ADD(a, b) ((a + b) % REPORT_KEYS) 34#define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS)
35#define RO_SUB(a, b) ((a - b + REPORT_KEYS) % REPORT_KEYS) 35#define RO_SUB(a, b) ((a - b + KEYBOARD_REPORT_KEYS) % KEYBOARD_REPORT_KEYS)
36#define RO_INC(a) RO_ADD(a, 1) 36#define RO_INC(a) RO_ADD(a, 1)
37#define RO_DEC(a) RO_SUB(a, 1) 37#define RO_DEC(a) RO_SUB(a, 1)
38static int8_t cb_head = 0; 38static int8_t cb_head = 0;
@@ -98,7 +98,7 @@ void del_key(uint8_t key)
98void clear_keys(void) 98void clear_keys(void)
99{ 99{
100 // not clear mods 100 // not clear mods
101 for (int8_t i = 1; i < REPORT_SIZE; i++) { 101 for (int8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) {
102 keyboard_report->raw[i] = 0; 102 keyboard_report->raw[i] = 0;
103 } 103 }
104} 104}
@@ -145,7 +145,7 @@ void clear_oneshot_mods(void)
145uint8_t has_anykey(void) 145uint8_t has_anykey(void)
146{ 146{
147 uint8_t cnt = 0; 147 uint8_t cnt = 0;
148 for (uint8_t i = 1; i < REPORT_SIZE; i++) { 148 for (uint8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) {
149 if (keyboard_report->raw[i]) 149 if (keyboard_report->raw[i])
150 cnt++; 150 cnt++;
151 } 151 }
@@ -162,7 +162,7 @@ uint8_t get_first_key(void)
162#ifdef NKRO_ENABLE 162#ifdef NKRO_ENABLE
163 if (keyboard_nkro) { 163 if (keyboard_nkro) {
164 uint8_t i = 0; 164 uint8_t i = 0;
165 for (; i < REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) 165 for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
166 ; 166 ;
167 return i<<3 | biton(keyboard_report->nkro.bits[i]); 167 return i<<3 | biton(keyboard_report->nkro.bits[i]);
168 } 168 }
@@ -234,7 +234,7 @@ static inline void add_key_byte(uint8_t code)
234#else 234#else
235 int8_t i = 0; 235 int8_t i = 0;
236 int8_t empty = -1; 236 int8_t empty = -1;
237 for (; i < REPORT_KEYS; i++) { 237 for (; i < KEYBOARD_REPORT_KEYS; i++) {
238 if (keyboard_report->keys[i] == code) { 238 if (keyboard_report->keys[i] == code) {
239 break; 239 break;
240 } 240 }
@@ -242,7 +242,7 @@ static inline void add_key_byte(uint8_t code)
242 empty = i; 242 empty = i;
243 } 243 }
244 } 244 }
245 if (i == REPORT_KEYS) { 245 if (i == KEYBOARD_REPORT_KEYS) {
246 if (empty != -1) { 246 if (empty != -1) {
247 keyboard_report->keys[empty] = code; 247 keyboard_report->keys[empty] = code;
248 } 248 }
@@ -278,7 +278,7 @@ static inline void del_key_byte(uint8_t code)
278 } while (i != cb_tail); 278 } while (i != cb_tail);
279 } 279 }
280#else 280#else
281 for (uint8_t i = 0; i < REPORT_KEYS; i++) { 281 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
282 if (keyboard_report->keys[i] == code) { 282 if (keyboard_report->keys[i] == code) {
283 keyboard_report->keys[i] = 0; 283 keyboard_report->keys[i] = 0;
284 } 284 }
@@ -289,7 +289,7 @@ static inline void del_key_byte(uint8_t code)
289#ifdef NKRO_ENABLE 289#ifdef NKRO_ENABLE
290static inline void add_key_bit(uint8_t code) 290static inline void add_key_bit(uint8_t code)
291{ 291{
292 if ((code>>3) < REPORT_BITS) { 292 if ((code>>3) < KEYBOARD_REPORT_BITS) {
293 keyboard_report->nkro.bits[code>>3] |= 1<<(code&7); 293 keyboard_report->nkro.bits[code>>3] |= 1<<(code&7);
294 } else { 294 } else {
295 dprintf("add_key_bit: can't add: %02X\n", code); 295 dprintf("add_key_bit: can't add: %02X\n", code);
@@ -298,7 +298,7 @@ static inline void add_key_bit(uint8_t code)
298 298
299static inline void del_key_bit(uint8_t code) 299static inline void del_key_bit(uint8_t code)
300{ 300{
301 if ((code>>3) < REPORT_BITS) { 301 if ((code>>3) < KEYBOARD_REPORT_BITS) {
302 keyboard_report->nkro.bits[code>>3] &= ~(1<<(code&7)); 302 keyboard_report->nkro.bits[code>>3] &= ~(1<<(code&7));
303 } else { 303 } else {
304 dprintf("del_key_bit: can't del: %02X\n", code); 304 dprintf("del_key_bit: can't del: %02X\n", code);
diff --git a/common/action_util.h b/common/action_util.h
index f9d3161a8..a955638b4 100644
--- a/common/action_util.h
+++ b/common/action_util.h
@@ -20,6 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20#include <stdint.h> 20#include <stdint.h>
21#include "report.h" 21#include "report.h"
22 22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
23extern report_keyboard_t *keyboard_report; 27extern report_keyboard_t *keyboard_report;
24 28
25void send_keyboard_report(void); 29void send_keyboard_report(void);
@@ -54,4 +58,9 @@ void oneshot_disable(void);
54uint8_t has_anykey(void); 58uint8_t has_anykey(void);
55uint8_t has_anymod(void); 59uint8_t has_anymod(void);
56uint8_t get_first_key(void); 60uint8_t get_first_key(void);
61
62#ifdef __cplusplus
63}
64#endif
65
57#endif 66#endif
diff --git a/common/bootmagic.c b/common/bootmagic.c
index 642d5face..b002a5856 100644
--- a/common/bootmagic.c
+++ b/common/bootmagic.c
@@ -111,7 +111,7 @@ static bool scan_keycode(uint8_t keycode)
111 matrix_row_t matrix_row = matrix_get_row(r); 111 matrix_row_t matrix_row = matrix_get_row(r);
112 for (uint8_t c = 0; c < MATRIX_COLS; c++) { 112 for (uint8_t c = 0; c < MATRIX_COLS; c++) {
113 if (matrix_row & ((matrix_row_t)1<<c)) { 113 if (matrix_row & ((matrix_row_t)1<<c)) {
114 if (keycode == keymap_key_to_keycode(0, (key_t){ .row = r, .col = c })) { 114 if (keycode == keymap_key_to_keycode(0, (keypos_t){ .row = r, .col = c })) {
115 return true; 115 return true;
116 } 116 }
117 } 117 }
diff --git a/common/host.c b/common/host.c
index 2e56971bd..e9b791670 100644
--- a/common/host.c
+++ b/common/host.c
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <stdint.h> 18#include <stdint.h>
19#include <avr/interrupt.h> 19//#include <avr/interrupt.h>
20#include "keycode.h" 20#include "keycode.h"
21#include "host.h" 21#include "host.h"
22#include "util.h" 22#include "util.h"
@@ -55,7 +55,7 @@ void host_keyboard_send(report_keyboard_t *report)
55 55
56 if (debug_keyboard) { 56 if (debug_keyboard) {
57 dprint("keyboard_report: "); 57 dprint("keyboard_report: ");
58 for (uint8_t i = 0; i < REPORT_SIZE; i++) { 58 for (uint8_t i = 0; i < KEYBOARD_REPORT_SIZE; i++) {
59 dprintf("%02X ", report->raw[i]); 59 dprintf("%02X ", report->raw[i]);
60 } 60 }
61 dprint("\n"); 61 dprint("\n");
diff --git a/common/keyboard.c b/common/keyboard.c
index 2b66f20a0..b71d5bf13 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -100,7 +100,7 @@ void keyboard_task(void)
100 for (uint8_t c = 0; c < MATRIX_COLS; c++) { 100 for (uint8_t c = 0; c < MATRIX_COLS; c++) {
101 if (matrix_change & ((matrix_row_t)1<<c)) { 101 if (matrix_change & ((matrix_row_t)1<<c)) {
102 action_exec((keyevent_t){ 102 action_exec((keyevent_t){
103 .key = (key_t){ .row = r, .col = c }, 103 .key = (keypos_t){ .row = r, .col = c },
104 .pressed = (matrix_row & ((matrix_row_t)1<<c)), 104 .pressed = (matrix_row & ((matrix_row_t)1<<c)),
105 .time = (timer_read() | 1) /* time should not be 0 */ 105 .time = (timer_read() | 1) /* time should not be 0 */
106 }); 106 });
diff --git a/common/keyboard.h b/common/keyboard.h
index d1a922420..60f8a89d1 100644
--- a/common/keyboard.h
+++ b/common/keyboard.h
@@ -30,16 +30,16 @@ extern "C" {
30typedef struct { 30typedef struct {
31 uint8_t col; 31 uint8_t col;
32 uint8_t row; 32 uint8_t row;
33} key_t; 33} keypos_t;
34 34
35/* key event */ 35/* key event */
36typedef struct { 36typedef struct {
37 key_t key; 37 keypos_t key;
38 bool pressed; 38 bool pressed;
39 uint16_t time; 39 uint16_t time;
40} keyevent_t; 40} keyevent_t;
41 41
42/* equivalent test of key_t */ 42/* equivalent test of keypos_t */
43#define KEYEQ(keya, keyb) ((keya).row == (keyb).row && (keya).col == (keyb).col) 43#define KEYEQ(keya, keyb) ((keya).row == (keyb).row && (keya).col == (keyb).col)
44 44
45/* Rules for No Event: 45/* Rules for No Event:
@@ -52,7 +52,7 @@ static inline bool IS_RELEASED(keyevent_t event) { return (!IS_NOEVENT(event) &&
52 52
53/* Tick event */ 53/* Tick event */
54#define TICK (keyevent_t){ \ 54#define TICK (keyevent_t){ \
55 .key = (key_t){ .row = 255, .col = 255 }, \ 55 .key = (keypos_t){ .row = 255, .col = 255 }, \
56 .pressed = false, \ 56 .pressed = false, \
57 .time = (timer_read() | 1) \ 57 .time = (timer_read() | 1) \
58} 58}
diff --git a/common/keymap.c b/common/keymap.c
index bfb8ffac1..0df2e2edf 100644
--- a/common/keymap.c
+++ b/common/keymap.c
@@ -28,7 +28,7 @@ static action_t keycode_to_action(uint8_t keycode);
28 28
29 29
30/* converts key to action */ 30/* converts key to action */
31action_t action_for_key(uint8_t layer, key_t key) 31action_t action_for_key(uint8_t layer, keypos_t key)
32{ 32{
33 uint8_t keycode = keymap_key_to_keycode(layer, key); 33 uint8_t keycode = keymap_key_to_keycode(layer, key);
34 switch (keycode) { 34 switch (keycode) {
@@ -156,7 +156,7 @@ static action_t keycode_to_action(uint8_t keycode)
156 * Consider using new keymap API instead. 156 * Consider using new keymap API instead.
157 */ 157 */
158__attribute__ ((weak)) 158__attribute__ ((weak))
159uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) 159uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
160{ 160{
161 return keymap_get_keycode(layer, key.row, key.col); 161 return keymap_get_keycode(layer, key.row, key.col);
162} 162}
diff --git a/common/keymap.h b/common/keymap.h
index 4c3019a36..e1a6f992e 100644
--- a/common/keymap.h
+++ b/common/keymap.h
@@ -43,7 +43,7 @@ keymap_config_t keymap_config;
43 43
44 44
45/* translates key to keycode */ 45/* translates key to keycode */
46uint8_t keymap_key_to_keycode(uint8_t layer, key_t key); 46uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
47 47
48/* translates Fn keycode to action */ 48/* translates Fn keycode to action */
49action_t keymap_fn_to_action(uint8_t keycode); 49action_t keymap_fn_to_action(uint8_t keycode);
diff --git a/common/print.h b/common/print.h
index 4001bcf1b..a8dbbc020 100644
--- a/common/print.h
+++ b/common/print.h
@@ -37,7 +37,7 @@
37 37
38#if defined(__AVR__) 38#if defined(__AVR__)
39 39
40#include "xprintf.h" 40#include "avr/xprintf.h"
41 41
42 42
43// TODO: avoid collision with arduino/Print.h 43// TODO: avoid collision with arduino/Print.h
diff --git a/common/report.h b/common/report.h
index 71543cc23..62190469a 100644
--- a/common/report.h
+++ b/common/report.h
@@ -74,19 +74,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
74/* key report size(NKRO or boot mode) */ 74/* key report size(NKRO or boot mode) */
75#if defined(PROTOCOL_PJRC) && defined(NKRO_ENABLE) 75#if defined(PROTOCOL_PJRC) && defined(NKRO_ENABLE)
76# include "usb.h" 76# include "usb.h"
77# define REPORT_SIZE KBD2_SIZE 77# define KEYBOARD_REPORT_SIZE KBD2_SIZE
78# define REPORT_KEYS (KBD2_SIZE - 2) 78# define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2)
79# define REPORT_BITS (KBD2_SIZE - 1) 79# define KEYBOARD_REPORT_BITS (KBD2_SIZE - 1)
80 80
81#elif defined(PROTOCOL_LUFA) && defined(NKRO_ENABLE) 81#elif defined(PROTOCOL_LUFA) && defined(NKRO_ENABLE)
82# include "protocol/lufa/descriptor.h" 82# include "protocol/lufa/descriptor.h"
83# define REPORT_SIZE NKRO_EPSIZE 83# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE
84# define REPORT_KEYS (NKRO_EPSIZE - 2) 84# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2)
85# define REPORT_BITS (NKRO_EPSIZE - 1) 85# define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1)
86 86
87#else 87#else
88# define REPORT_SIZE 8 88# define KEYBOARD_REPORT_SIZE 8
89# define REPORT_KEYS 6 89# define KEYBOARD_REPORT_KEYS 6
90#endif 90#endif
91 91
92 92
@@ -115,16 +115,16 @@ extern "C" {
115 * 115 *
116 */ 116 */
117typedef union { 117typedef union {
118 uint8_t raw[REPORT_SIZE]; 118 uint8_t raw[KEYBOARD_REPORT_SIZE];
119 struct { 119 struct {
120 uint8_t mods; 120 uint8_t mods;
121 uint8_t reserved; 121 uint8_t reserved;
122 uint8_t keys[REPORT_KEYS]; 122 uint8_t keys[KEYBOARD_REPORT_KEYS];
123 }; 123 };
124#ifdef NKRO_ENABLE 124#ifdef NKRO_ENABLE
125 struct { 125 struct {
126 uint8_t mods; 126 uint8_t mods;
127 uint8_t bits[REPORT_BITS]; 127 uint8_t bits[KEYBOARD_REPORT_BITS];
128 } nkro; 128 } nkro;
129#endif 129#endif
130} __attribute__ ((packed)) report_keyboard_t; 130} __attribute__ ((packed)) report_keyboard_t;
diff --git a/common/wait.h b/common/wait.h
new file mode 100644
index 000000000..40d00b0c7
--- /dev/null
+++ b/common/wait.h
@@ -0,0 +1,20 @@
1#ifndef WAIT_H
2#define WAIT_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#if defined(__AVR__)
9# include <util/delay.h>
10# define wait_ms(ms) _delay_ms(ms)
11# define wait_us(us) _delay_us(us)
12#elif defined(__arm__)
13# include "wait_api.h"
14#endif
15
16#ifdef __cplusplus
17}
18#endif
19
20#endif