summaryrefslogtreecommitdiff
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)
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 02deb7797e..91982840af 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/>.
/* key report size(NKRO or boot mode) */
-#if defined(PROTOCOL_PJRC)
+#if defined(PROTOCOL_PJRC) && defined(NKRO_ENABLE)
# include "usb.h"
-# if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS
-# define REPORT_KEYS KBD2_REPORT_KEYS
-# else
-# define REPORT_KEYS KBD_REPORT_KEYS
-# endif
+# define REPORT_SIZE KBD2_SIZE
+# define REPORT_KEYS (KBD2_SIZE - 2)
+# define REPORT_BITS (KBD2_SIZE - 1)
+
+#elif defined(PROTOCOL_LUFA) && defined(NKRO_ENABLE)
+# include "protocol/lufa/descriptor.h"
+# define REPORT_SIZE NKRO_EPSIZE
+# define REPORT_KEYS (NKRO_EPSIZE - 2)
+# define REPORT_BITS (NKRO_EPSIZE - 1)
+
#else
+# define REPORT_SIZE 8
# define REPORT_KEYS 6
#endif
@@ -88,11 +94,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern "C" {
#endif
+typedef union {
+ uint8_t raw[REPORT_SIZE];
+ struct {
+ uint8_t mods;
+ uint8_t reserved;
+ uint8_t keys[REPORT_KEYS];
+ };
+#ifdef NKRO_ENABLE
+ struct {
+ uint8_t mods;
+ uint8_t bits[REPORT_BITS];
+ } nkro;
+#endif
+} __attribute__ ((packed)) report_keyboard_t;
+/*
typedef struct {
uint8_t mods;
- uint8_t rserved;
+ uint8_t reserved;
uint8_t keys[REPORT_KEYS];
} __attribute__ ((packed)) report_keyboard_t;
+*/
typedef struct {
uint8_t buttons;