X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Freport.h;h=e7c31bd376a08fa4263bddef15a18abb4ebb7bb6;hb=901edea9275b02acd02abb8257b6b33a217fce0c;hp=899fc524cbdb2a159ef5e97eb4e5463b9b912885;hpb=3e7bb196124aeab8c84752501b7ec91915814735;p=qmk_firmware.git
diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h
index 899fc524c..e7c31bd37 100644
--- a/tmk_core/common/report.h
+++ b/tmk_core/common/report.h
@@ -23,9 +23,11 @@ along with this program. If not, see .
/* report id */
-#define REPORT_ID_MOUSE 1
-#define REPORT_ID_SYSTEM 2
-#define REPORT_ID_CONSUMER 3
+#define REPORT_ID_KEYBOARD 1
+#define REPORT_ID_MOUSE 2
+#define REPORT_ID_SYSTEM 3
+#define REPORT_ID_CONSUMER 4
+#define REPORT_ID_NKRO 5
/* mouse buttons */
#define MOUSE_BTN1 (1<<0)
@@ -36,6 +38,7 @@ along with this program. If not, see .
/* Consumer Page(0x0C)
* following are supported by Windows: http://msdn.microsoft.com/en-us/windows/hardware/gg463372.aspx
+ * see also https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/display-brightness-control
*/
#define AUDIO_MUTE 0x00E2
#define AUDIO_VOL_UP 0x00E9
@@ -45,6 +48,8 @@ along with this program. If not, see .
#define TRANSPORT_STOP 0x00B7
#define TRANSPORT_STOP_EJECT 0x00CC
#define TRANSPORT_PLAY_PAUSE 0x00CD
+#define BRIGHTNESS_UP 0x006F
+#define BRIGHTNESS_DOWN 0x0070
/* application launch */
#define AL_CC_CONFIG 0x0183
#define AL_EMAIL 0x018A
@@ -72,29 +77,35 @@ along with this program. If not, see .
#define SYSTEM_WAKE_UP 0x0083
+#define NKRO_SHARED_EP
/* key report size(NKRO or boot mode) */
-#if defined(PROTOCOL_PJRC) && defined(NKRO_ENABLE)
-# include "usb.h"
-# define KEYBOARD_REPORT_SIZE KBD2_SIZE
-# define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2)
-# define KEYBOARD_REPORT_BITS (KBD2_SIZE - 1)
-
-#elif defined(PROTOCOL_LUFA) && defined(NKRO_ENABLE)
-# include "protocol/lufa/descriptor.h"
-# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE
-# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2)
-# define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1)
-#elif defined(PROTOCOL_CHIBIOS) && defined(NKRO_ENABLE)
-# include "protocol/chibios/usb_main.h"
-# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE
-# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2)
-# define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1)
+#if defined(NKRO_ENABLE)
+ #if defined(PROTOCOL_LUFA) || defined(PROTOCOL_CHIBIOS)
+ #include "protocol/usb_descriptor.h"
+ #define KEYBOARD_REPORT_BITS (SHARED_EPSIZE - 2)
+ #elif defined(PROTOCOL_ARM_ATSAM)
+ #include "protocol/arm_atsam/usb/udi_device_epsize.h"
+ #define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1)
+ #undef NKRO_SHARED_EP
+ #undef MOUSE_SHARED_EP
+ #else
+ #error "NKRO not supported with this protocol"
+ #endif
+#endif
+#ifdef KEYBOARD_SHARED_EP
+# define KEYBOARD_REPORT_SIZE 9
#else
# define KEYBOARD_REPORT_SIZE 8
-# define KEYBOARD_REPORT_KEYS 6
#endif
+#define KEYBOARD_REPORT_KEYS 6
+
+/* VUSB hardcodes keyboard and mouse+extrakey only */
+#if defined(PROTOCOL_VUSB)
+ #undef KEYBOARD_SHARED_EP
+ #undef MOUSE_SHARED_EP
+#endif
#ifdef __cplusplus
extern "C" {
@@ -123,12 +134,18 @@ extern "C" {
typedef union {
uint8_t raw[KEYBOARD_REPORT_SIZE];
struct {
+#ifdef KEYBOARD_SHARED_EP
+ uint8_t report_id;
+#endif
uint8_t mods;
uint8_t reserved;
uint8_t keys[KEYBOARD_REPORT_KEYS];
};
#ifdef NKRO_ENABLE
- struct {
+ struct nkro_report {
+#ifdef NKRO_SHARED_EP
+ uint8_t report_id;
+#endif
uint8_t mods;
uint8_t bits[KEYBOARD_REPORT_BITS];
} nkro;
@@ -136,6 +153,9 @@ typedef union {
} __attribute__ ((packed)) report_keyboard_t;
typedef struct {
+#ifdef MOUSE_SHARED_EP
+ uint8_t report_id;
+#endif
uint8_t buttons;
int8_t x;
int8_t y;
@@ -172,7 +192,9 @@ typedef struct {
(key == KC_WWW_FORWARD ? AC_FORWARD : \
(key == KC_WWW_STOP ? AC_STOP : \
(key == KC_WWW_REFRESH ? AC_REFRESH : \
- (key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0)))))))))))))))))))))
+ (key == KC_BRIGHTNESS_UP ? BRIGHTNESS_UP : \
+ (key == KC_BRIGHTNESS_DOWN ? BRIGHTNESS_DOWN : \
+ (key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0)))))))))))))))))))))))
uint8_t has_anykey(report_keyboard_t* keyboard_report);
uint8_t get_first_key(report_keyboard_t* keyboard_report);
@@ -184,7 +206,7 @@ void add_key_bit(report_keyboard_t* keyboard_report, uint8_t code);
void del_key_bit(report_keyboard_t* keyboard_report, uint8_t code);
#endif
-void add_key_to_report(report_keyboard_t* keyboard_report, int8_t key);
+void add_key_to_report(report_keyboard_t* keyboard_report, uint8_t key);
void del_key_from_report(report_keyboard_t* keyboard_report, uint8_t key);
void clear_keys_from_report(report_keyboard_t* keyboard_report);