aboutsummaryrefslogtreecommitdiff
path: root/pjrc
diff options
context:
space:
mode:
Diffstat (limited to 'pjrc')
-rw-r--r--pjrc/host.c10
-rw-r--r--pjrc/main.c97
-rw-r--r--pjrc/pjrc.c76
-rw-r--r--pjrc/pjrc.h26
-rw-r--r--pjrc/usb.c34
-rw-r--r--pjrc/usb.h2
-rw-r--r--pjrc/usb_keyboard.c4
7 files changed, 224 insertions, 25 deletions
diff --git a/pjrc/host.c b/pjrc/host.c
index 35d59de80..fcf71d579 100644
--- a/pjrc/host.c
+++ b/pjrc/host.c
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
22#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) 22#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE)
23#include "usb_mouse.h" 23#include "usb_mouse.h"
24#endif 24#endif
25#ifdef USB_EXTRA_ENABLE 25#ifdef EXTRAKEY_ENABLE
26#include "usb_extra.h" 26#include "usb_extra.h"
27#endif 27#endif
28#include "debug.h" 28#include "debug.h"
@@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30#include "util.h" 30#include "util.h"
31 31
32 32
33#ifdef USB_NKRO_ENABLE 33#ifdef NKRO_ENABLE
34bool keyboard_nkro = false; 34bool keyboard_nkro = false;
35#endif 35#endif
36 36
@@ -51,7 +51,7 @@ uint8_t host_keyboard_leds(void)
51/* keyboard report operations */ 51/* keyboard report operations */
52void host_add_key(uint8_t key) 52void host_add_key(uint8_t key)
53{ 53{
54#ifdef USB_NKRO_ENABLE 54#ifdef NKRO_ENABLE
55 if (keyboard_nkro) { 55 if (keyboard_nkro) {
56 add_key_bit(key); 56 add_key_bit(key);
57 return; 57 return;
@@ -109,7 +109,7 @@ uint8_t host_has_anykey(void)
109 109
110uint8_t host_get_first_key(void) 110uint8_t host_get_first_key(void)
111{ 111{
112#ifdef USB_NKRO_ENABLE 112#ifdef NKRO_ENABLE
113 if (keyboard_nkro) { 113 if (keyboard_nkro) {
114 uint8_t i = 0; 114 uint8_t i = 0;
115 for (; i < REPORT_KEYS && !keyboard_report->keys[i]; i++) 115 for (; i < REPORT_KEYS && !keyboard_report->keys[i]; i++)
@@ -133,7 +133,7 @@ void host_mouse_send(report_mouse_t *report)
133} 133}
134#endif 134#endif
135 135
136#ifdef USB_EXTRA_ENABLE 136#ifdef EXTRAKEY_ENABLE
137void host_system_send(uint16_t data) 137void host_system_send(uint16_t data)
138{ 138{
139 usb_extra_system_send(data); 139 usb_extra_system_send(data);
diff --git a/pjrc/main.c b/pjrc/main.c
new file mode 100644
index 000000000..f84925d7f
--- /dev/null
+++ b/pjrc/main.c
@@ -0,0 +1,97 @@
1/* Keyboard example with debug channel, for Teensy USB Development Board
2 * http://www.pjrc.com/teensy/usb_keyboard.html
3 * Copyright (c) 2008 PJRC.COM, LLC
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
24#include <stdbool.h>
25#include <avr/io.h>
26#include <avr/interrupt.h>
27#include <util/delay.h>
28#include "keyboard.h"
29#include "usb.h"
30#include "matrix.h"
31#include "print.h"
32#include "debug.h"
33#include "util.h"
34#include "jump_bootloader.h"
35#ifdef PS2_MOUSE_ENABLE
36# include "ps2_mouse.h"
37#endif
38#include "host.h"
39#include "pjrc.h"
40
41
42#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
43
44
45bool debug_enable = false;
46bool debug_matrix = false;
47bool debug_keyboard = false;
48bool debug_mouse = false;
49
50
51int main(void)
52{
53 DEBUG_LED_CONFIG;
54 DEBUG_LED_OFF;
55
56 // set for 16 MHz clock
57 CPU_PRESCALE(0);
58
59 // Initialize the USB, and then wait for the host to set configuration.
60 // If the Teensy is powered without a PC connected to the USB port,
61 // this will wait forever.
62 usb_init();
63 while (!usb_configured()) /* wait */ ;
64
65 keyboard_init();
66 matrix_scan();
67 if (matrix_key_count() >= 3) {
68#ifdef DEBUG_LED
69 for (int i = 0; i < 6; i++) {
70 DEBUG_LED_CONFIG;
71 DEBUG_LED_ON;
72 _delay_ms(500);
73 DEBUG_LED_OFF;
74 _delay_ms(500);
75 }
76#else
77 _delay_ms(5000);
78#endif
79 print_enable = true;
80 debug_enable = true;
81 debug_matrix = true;
82 debug_keyboard = true;
83 debug_mouse = true;
84 print("debug enabled.\n");
85 }
86 if (matrix_key_count() >= 4) {
87 print("jump to bootloader...\n");
88 _delay_ms(1000);
89 jump_bootloader(); // not return
90 }
91
92
93 host_set_driver(pjrc_driver());
94 while (1) {
95 keyboard_proc();
96 }
97}
diff --git a/pjrc/pjrc.c b/pjrc/pjrc.c
new file mode 100644
index 000000000..0562a12ff
--- /dev/null
+++ b/pjrc/pjrc.c
@@ -0,0 +1,76 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include "usb_keyboard.h"
20#include "usb_mouse.h"
21#include "usb_extra.h"
22#include "host_driver.h"
23#include "pjrc.h"
24
25
26/*------------------------------------------------------------------*
27 * Host driver
28 *------------------------------------------------------------------*/
29static uint8_t keyboard_leds(void);
30static void send_keyboard(report_keyboard_t *report);
31static void send_mouse(report_mouse_t *report);
32static void send_system(uint16_t data);
33static void send_consumer(uint16_t data);
34
35static host_driver_t driver = {
36 keyboard_leds,
37 send_keyboard,
38 send_mouse,
39 send_system,
40 send_consumer
41};
42
43host_driver_t *pjrc_driver(void)
44{
45 return &driver;
46}
47
48static uint8_t keyboard_leds(void) {
49 return usb_keyboard_leds;
50}
51
52static void send_keyboard(report_keyboard_t *report)
53{
54 usb_keyboard_send_report(report);
55}
56
57static void send_mouse(report_mouse_t *report)
58{
59#ifdef MOUSE_ENABLE
60 usb_mouse_send(report->x, report->y, report->v, report->h, report->buttons);
61#endif
62}
63
64static void send_system(uint16_t data)
65{
66#ifdef EXTRAKEY_ENABLE
67 usb_extra_system_send(data);
68#endif
69}
70
71static void send_consumer(uint16_t data)
72{
73#ifdef EXTRAKEY_ENABLE
74 usb_extra_consumer_send(data);
75#endif
76}
diff --git a/pjrc/pjrc.h b/pjrc/pjrc.h
new file mode 100644
index 000000000..06e79626f
--- /dev/null
+++ b/pjrc/pjrc.h
@@ -0,0 +1,26 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef PJRC_H
19#define PJRC_H
20
21#include "host_driver.h"
22
23
24host_driver_t *pjrc_driver(void);
25
26#endif
diff --git a/pjrc/usb.c b/pjrc/usb.c
index ea2e71b3d..9989a4b2d 100644
--- a/pjrc/usb.c
+++ b/pjrc/usb.c
@@ -91,18 +91,18 @@ bool suspend = false;
91static const uint8_t PROGMEM endpoint_config_table[] = { 91static const uint8_t PROGMEM endpoint_config_table[] = {
92 // enable, UECFG0X(type, direction), UECFG1X(size, bank, allocation) 92 // enable, UECFG0X(type, direction), UECFG1X(size, bank, allocation)
93 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(KBD_SIZE) | KBD_BUFFER, // 1 93 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(KBD_SIZE) | KBD_BUFFER, // 1
94#ifdef USB_MOUSE_ENABLE 94#ifdef MOUSE_ENABLE
95 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(MOUSE_SIZE) | MOUSE_BUFFER, // 2 95 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(MOUSE_SIZE) | MOUSE_BUFFER, // 2
96#else 96#else
97 0, // 2 97 0, // 2
98#endif 98#endif
99 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(DEBUG_TX_SIZE) | DEBUG_TX_BUFFER, // 3 99 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(DEBUG_TX_SIZE) | DEBUG_TX_BUFFER, // 3
100#ifdef USB_EXTRA_ENABLE 100#ifdef EXTRAKEY_ENABLE
101 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(EXTRA_SIZE) | EXTRA_BUFFER, // 4 101 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(EXTRA_SIZE) | EXTRA_BUFFER, // 4
102#else 102#else
103 0, // 4 103 0, // 4
104#endif 104#endif
105#ifdef USB_NKRO_ENABLE 105#ifdef NKRO_ENABLE
106 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(KBD2_SIZE) | KBD2_BUFFER, // 5 106 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(KBD2_SIZE) | KBD2_BUFFER, // 5
107#else 107#else
108 0, // 5 108 0, // 5
@@ -176,7 +176,7 @@ static uint8_t PROGMEM keyboard_hid_report_desc[] = {
176 0x81, 0x00, // Input (Data, Array), 176 0x81, 0x00, // Input (Data, Array),
177 0xc0 // End Collection 177 0xc0 // End Collection
178}; 178};
179#ifdef USB_NKRO_ENABLE 179#ifdef NKRO_ENABLE
180static uint8_t PROGMEM keyboard2_hid_report_desc[] = { 180static uint8_t PROGMEM keyboard2_hid_report_desc[] = {
181 0x05, 0x01, // Usage Page (Generic Desktop), 181 0x05, 0x01, // Usage Page (Generic Desktop),
182 0x09, 0x06, // Usage (Keyboard), 182 0x09, 0x06, // Usage (Keyboard),
@@ -213,7 +213,7 @@ static uint8_t PROGMEM keyboard2_hid_report_desc[] = {
213}; 213};
214#endif 214#endif
215 215
216#ifdef USB_MOUSE_ENABLE 216#ifdef MOUSE_ENABLE
217// Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension 217// Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension
218// http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521 218// http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521
219// http://www.keil.com/forum/15671/ 219// http://www.keil.com/forum/15671/
@@ -282,7 +282,7 @@ static uint8_t PROGMEM debug_hid_report_desc[] = {
282 0xC0 // end collection 282 0xC0 // end collection
283}; 283};
284 284
285#ifdef USB_EXTRA_ENABLE 285#ifdef EXTRAKEY_ENABLE
286// audio controls & system controls 286// audio controls & system controls
287// http://www.microsoft.com/whdc/archive/w2kbd.mspx 287// http://www.microsoft.com/whdc/archive/w2kbd.mspx
288static uint8_t PROGMEM extra_hid_report_desc[] = { 288static uint8_t PROGMEM extra_hid_report_desc[] = {
@@ -318,7 +318,7 @@ static uint8_t PROGMEM extra_hid_report_desc[] = {
318#define KBD_HID_DESC_NUM 0 318#define KBD_HID_DESC_NUM 0
319#define KBD_HID_DESC_OFFSET (9+(9+9+7)*KBD_HID_DESC_NUM+9) 319#define KBD_HID_DESC_OFFSET (9+(9+9+7)*KBD_HID_DESC_NUM+9)
320 320
321#ifdef USB_MOUSE_ENABLE 321#ifdef MOUSE_ENABLE
322# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 1) 322# define MOUSE_HID_DESC_NUM (KBD_HID_DESC_NUM + 1)
323# define MOUSE_HID_DESC_OFFSET (9+(9+9+7)*MOUSE_HID_DESC_NUM+9) 323# define MOUSE_HID_DESC_OFFSET (9+(9+9+7)*MOUSE_HID_DESC_NUM+9)
324#else 324#else
@@ -328,14 +328,14 @@ static uint8_t PROGMEM extra_hid_report_desc[] = {
328#define DEBUG_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 1) 328#define DEBUG_HID_DESC_NUM (MOUSE_HID_DESC_NUM + 1)
329#define DEBUG_HID_DESC_OFFSET (9+(9+9+7)*DEBUG_HID_DESC_NUM+9) 329#define DEBUG_HID_DESC_OFFSET (9+(9+9+7)*DEBUG_HID_DESC_NUM+9)
330 330
331#ifdef USB_EXTRA_ENABLE 331#ifdef EXTRAKEY_ENABLE
332# define EXTRA_HID_DESC_NUM (DEBUG_HID_DESC_NUM + 1) 332# define EXTRA_HID_DESC_NUM (DEBUG_HID_DESC_NUM + 1)
333# define EXTRA_HID_DESC_OFFSET (9+(9+9+7)*EXTRA_HID_DESC_NUM+9) 333# define EXTRA_HID_DESC_OFFSET (9+(9+9+7)*EXTRA_HID_DESC_NUM+9)
334#else 334#else
335# define EXTRA_HID_DESC_NUM (DEBUG_HID_DESC_NUM + 0) 335# define EXTRA_HID_DESC_NUM (DEBUG_HID_DESC_NUM + 0)
336#endif 336#endif
337 337
338#ifdef USB_NKRO_ENABLE 338#ifdef NKRO_ENABLE
339# define KBD2_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 1) 339# define KBD2_HID_DESC_NUM (EXTRA_HID_DESC_NUM + 1)
340# define KBD2_HID_DESC_OFFSET (9+(9+9+7)*EXTRA_HID_DESC_NUM+9) 340# define KBD2_HID_DESC_OFFSET (9+(9+9+7)*EXTRA_HID_DESC_NUM+9)
341#else 341#else
@@ -383,7 +383,7 @@ static uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
383 KBD_SIZE, 0, // wMaxPacketSize 383 KBD_SIZE, 0, // wMaxPacketSize
384 10, // bInterval 384 10, // bInterval
385 385
386#ifdef USB_MOUSE_ENABLE 386#ifdef MOUSE_ENABLE
387 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 387 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
388 9, // bLength 388 9, // bLength
389 4, // bDescriptorType 389 4, // bDescriptorType
@@ -444,7 +444,7 @@ static uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
444 DEBUG_TX_SIZE, 0, // wMaxPacketSize 444 DEBUG_TX_SIZE, 0, // wMaxPacketSize
445 1, // bInterval 445 1, // bInterval
446 446
447#ifdef USB_EXTRA_ENABLE 447#ifdef EXTRAKEY_ENABLE
448 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 448 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
449 9, // bLength 449 9, // bLength
450 4, // bDescriptorType 450 4, // bDescriptorType
@@ -473,7 +473,7 @@ static uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
473 10, // bInterval 473 10, // bInterval
474#endif 474#endif
475 475
476#ifdef USB_NKRO_ENABLE 476#ifdef NKRO_ENABLE
477 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 477 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
478 9, // bLength 478 9, // bLength
479 4, // bDescriptorType 479 4, // bDescriptorType
@@ -542,17 +542,17 @@ static struct descriptor_list_struct {
542 // HID/REPORT descriptors 542 // HID/REPORT descriptors
543 {0x2100, KBD_INTERFACE, config1_descriptor+KBD_HID_DESC_OFFSET, 9}, 543 {0x2100, KBD_INTERFACE, config1_descriptor+KBD_HID_DESC_OFFSET, 9},
544 {0x2200, KBD_INTERFACE, keyboard_hid_report_desc, sizeof(keyboard_hid_report_desc)}, 544 {0x2200, KBD_INTERFACE, keyboard_hid_report_desc, sizeof(keyboard_hid_report_desc)},
545#ifdef USB_MOUSE_ENABLE 545#ifdef MOUSE_ENABLE
546 {0x2100, MOUSE_INTERFACE, config1_descriptor+MOUSE_HID_DESC_OFFSET, 9}, 546 {0x2100, MOUSE_INTERFACE, config1_descriptor+MOUSE_HID_DESC_OFFSET, 9},
547 {0x2200, MOUSE_INTERFACE, mouse_hid_report_desc, sizeof(mouse_hid_report_desc)}, 547 {0x2200, MOUSE_INTERFACE, mouse_hid_report_desc, sizeof(mouse_hid_report_desc)},
548#endif 548#endif
549 {0x2100, DEBUG_INTERFACE, config1_descriptor+DEBUG_HID_DESC_OFFSET, 9}, 549 {0x2100, DEBUG_INTERFACE, config1_descriptor+DEBUG_HID_DESC_OFFSET, 9},
550 {0x2200, DEBUG_INTERFACE, debug_hid_report_desc, sizeof(debug_hid_report_desc)}, 550 {0x2200, DEBUG_INTERFACE, debug_hid_report_desc, sizeof(debug_hid_report_desc)},
551#ifdef USB_EXTRA_ENABLE 551#ifdef EXTRAKEY_ENABLE
552 {0x2100, EXTRA_INTERFACE, config1_descriptor+EXTRA_HID_DESC_OFFSET, 9}, 552 {0x2100, EXTRA_INTERFACE, config1_descriptor+EXTRA_HID_DESC_OFFSET, 9},
553 {0x2200, EXTRA_INTERFACE, extra_hid_report_desc, sizeof(extra_hid_report_desc)}, 553 {0x2200, EXTRA_INTERFACE, extra_hid_report_desc, sizeof(extra_hid_report_desc)},
554#endif 554#endif
555#ifdef USB_NKRO_ENABLE 555#ifdef NKRO_ENABLE
556 {0x2100, KBD2_INTERFACE, config1_descriptor+KBD2_HID_DESC_OFFSET, 9}, 556 {0x2100, KBD2_INTERFACE, config1_descriptor+KBD2_HID_DESC_OFFSET, 9},
557 {0x2200, KBD2_INTERFACE, keyboard2_hid_report_desc, sizeof(keyboard2_hid_report_desc)}, 557 {0x2200, KBD2_INTERFACE, keyboard2_hid_report_desc, sizeof(keyboard2_hid_report_desc)},
558#endif 558#endif
@@ -653,7 +653,7 @@ ISR(USB_GEN_vect)
653 } 653 }
654 } 654 }
655 /* TODO: should keep IDLE rate on each keyboard interface */ 655 /* TODO: should keep IDLE rate on each keyboard interface */
656#ifdef USB_NKRO_ENABLE 656#ifdef NKRO_ENABLE
657 if (!keyboard_nkro && usb_keyboard_idle_config && (++div4 & 3) == 0) { 657 if (!keyboard_nkro && usb_keyboard_idle_config && (++div4 & 3) == 0) {
658#else 658#else
659 if (usb_keyboard_idle_config && (++div4 & 3) == 0) { 659 if (usb_keyboard_idle_config && (++div4 & 3) == 0) {
@@ -894,7 +894,7 @@ ISR(USB_COM_vect)
894 } 894 }
895 } 895 }
896 } 896 }
897#ifdef USB_MOUSE_ENABLE 897#ifdef MOUSE_ENABLE
898 if (wIndex == MOUSE_INTERFACE) { 898 if (wIndex == MOUSE_INTERFACE) {
899 if (bmRequestType == 0xA1) { 899 if (bmRequestType == 0xA1) {
900 if (bRequest == HID_GET_REPORT) { 900 if (bRequest == HID_GET_REPORT) {
diff --git a/pjrc/usb.h b/pjrc/usb.h
index a4e40bdd1..82e18f176 100644
--- a/pjrc/usb.h
+++ b/pjrc/usb.h
@@ -120,7 +120,7 @@ void usb_remote_wakeup(void);
120#define KBD_REPORT_KEYS (KBD_SIZE - 2) 120#define KBD_REPORT_KEYS (KBD_SIZE - 2)
121 121
122// secondary keyboard 122// secondary keyboard
123#ifdef USB_NKRO_ENABLE 123#ifdef NKRO_ENABLE
124#define KBD2_INTERFACE 4 124#define KBD2_INTERFACE 4
125#define KBD2_ENDPOINT 5 125#define KBD2_ENDPOINT 5
126#define KBD2_SIZE 16 126#define KBD2_SIZE 16
diff --git a/pjrc/usb_keyboard.c b/pjrc/usb_keyboard.c
index 34e9d495b..e057c77fa 100644
--- a/pjrc/usb_keyboard.c
+++ b/pjrc/usb_keyboard.c
@@ -55,7 +55,7 @@ int8_t usb_keyboard_send_report(report_keyboard_t *report)
55{ 55{
56 int8_t result = 0; 56 int8_t result = 0;
57 57
58#ifdef USB_NKRO_ENABLE 58#ifdef NKRO_ENABLE
59 if (keyboard_nkro) 59 if (keyboard_nkro)
60 result = send_report(report, KBD2_ENDPOINT, 0, KBD2_REPORT_KEYS); 60 result = send_report(report, KBD2_ENDPOINT, 0, KBD2_REPORT_KEYS);
61 else 61 else
@@ -105,7 +105,7 @@ static inline int8_t send_report(report_keyboard_t *report, uint8_t endpoint, ui
105 UENUM = endpoint; 105 UENUM = endpoint;
106 } 106 }
107 UEDATX = report->mods; 107 UEDATX = report->mods;
108#ifdef USB_NKRO_ENABLE 108#ifdef NKRO_ENABLE
109 if (!keyboard_nkro) 109 if (!keyboard_nkro)
110 UEDATX = 0; 110 UEDATX = 0;
111#else 111#else