aboutsummaryrefslogtreecommitdiff
path: root/common/report.h
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-07-28 17:34:41 +0900
committertmk <nobody@nowhere>2013-07-28 17:34:41 +0900
commitdaa4a4235fd4a88b3b6f64e4a2cf590f28f4b65b (patch)
tree91d6c2de3f98bf11e85868c6cd4802f05a55e60e /common/report.h
parentc7d309e34bf5d05f245811389bea495d814e2111 (diff)
downloadqmk_firmware-daa4a4235fd4a88b3b6f64e4a2cf590f28f4b65b.tar.gz
qmk_firmware-daa4a4235fd4a88b3b6f64e4a2cf590f28f4b65b.zip
Add NKRO support for LUFA
Diffstat (limited to 'common/report.h')
-rw-r--r--common/report.h36
1 files changed, 29 insertions, 7 deletions
diff --git a/common/report.h b/common/report.h
index 02deb7797..91982840a 100644
--- a/common/report.h
+++ b/common/report.h
@@ -72,14 +72,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
72 72
73 73
74/* key report size(NKRO or boot mode) */ 74/* key report size(NKRO or boot mode) */
75#if defined(PROTOCOL_PJRC) 75#if defined(PROTOCOL_PJRC) && defined(NKRO_ENABLE)
76# include "usb.h" 76# include "usb.h"
77# if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS 77# define REPORT_SIZE KBD2_SIZE
78# define REPORT_KEYS KBD2_REPORT_KEYS 78# define REPORT_KEYS (KBD2_SIZE - 2)
79# else 79# define REPORT_BITS (KBD2_SIZE - 1)
80# define REPORT_KEYS KBD_REPORT_KEYS 80
81# endif 81#elif defined(PROTOCOL_LUFA) && defined(NKRO_ENABLE)
82# include "protocol/lufa/descriptor.h"
83# define REPORT_SIZE NKRO_EPSIZE
84# define REPORT_KEYS (NKRO_EPSIZE - 2)
85# define REPORT_BITS (NKRO_EPSIZE - 1)
86
82#else 87#else
88# define REPORT_SIZE 8
83# define REPORT_KEYS 6 89# define REPORT_KEYS 6
84#endif 90#endif
85 91
@@ -88,11 +94,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
88extern "C" { 94extern "C" {
89#endif 95#endif
90 96
97typedef union {
98 uint8_t raw[REPORT_SIZE];
99 struct {
100 uint8_t mods;
101 uint8_t reserved;
102 uint8_t keys[REPORT_KEYS];
103 };
104#ifdef NKRO_ENABLE
105 struct {
106 uint8_t mods;
107 uint8_t bits[REPORT_BITS];
108 } nkro;
109#endif
110} __attribute__ ((packed)) report_keyboard_t;
111/*
91typedef struct { 112typedef struct {
92 uint8_t mods; 113 uint8_t mods;
93 uint8_t rserved; 114 uint8_t reserved;
94 uint8_t keys[REPORT_KEYS]; 115 uint8_t keys[REPORT_KEYS];
95} __attribute__ ((packed)) report_keyboard_t; 116} __attribute__ ((packed)) report_keyboard_t;
117*/
96 118
97typedef struct { 119typedef struct {
98 uint8_t buttons; 120 uint8_t buttons;