X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Freport.h;h=f6c0a315de9307de6c62ac6e2489e3ce2e62e750;hb=5a8dbc63ea29eb454ad5f36de5c6c33172230f88;hp=0995189b399087668dd3373ff50d85b39b5279ba;hpb=4324e163360db4c6ebd25cab74d09d42b3021278;p=tmk_firmware.git diff --git a/common/report.h b/common/report.h index 0995189..f6c0a31 100644 --- a/common/report.h +++ b/common/report.h @@ -43,6 +43,7 @@ along with this program. If not, see . #define TRANSPORT_NEXT_TRACK 0x00B5 #define TRANSPORT_PREV_TRACK 0x00B6 #define TRANSPORT_STOP 0x00B7 +#define TRANSPORT_STOP_EJECT 0x00CC #define TRANSPORT_PLAY_PAUSE 0x00CD /* application launch */ #define AL_CC_CONFIG 0x0183 @@ -60,6 +61,7 @@ along with this program. If not, see . /* supplement for Bluegiga iWRAP HID(not supported by Windows?) */ #define AL_LOCK 0x019E #define TRANSPORT_RECORD 0x00B2 +#define TRANSPORT_FAST_FORWARD 0x00B3 #define TRANSPORT_REWIND 0x00B4 #define TRANSPORT_EJECT 0x00B8 #define AC_MINIMIZE 0x0206 @@ -71,15 +73,21 @@ along with this program. If not, see . /* key report size(NKRO or boot mode) */ -#if defined(HOST_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 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) + #else -# define REPORT_KEYS 6 +# define KEYBOARD_REPORT_SIZE 8 +# define KEYBOARD_REPORT_KEYS 6 #endif @@ -87,11 +95,47 @@ along with this program. If not, see . extern "C" { #endif +/* + * keyboard report is 8-byte array retains state of 8 modifiers and 6 keys. + * + * byte |0 |1 |2 |3 |4 |5 |6 |7 + * -----+--------+--------+--------+--------+--------+--------+--------+-------- + * desc |mods |reserved|keys[0] |keys[1] |keys[2] |keys[3] |keys[4] |keys[5] + * + * It is exended to 16 bytes to retain 120keys+8mods when NKRO mode. + * + * byte |0 |1 |2 |3 |4 |5 |6 |7 ... |15 + * -----+--------+--------+--------+--------+--------+--------+--------+-------- +-------- + * desc |mods |bits[0] |bits[1] |bits[2] |bits[3] |bits[4] |bits[5] |bits[6] ... |bit[14] + * + * mods retains state of 8 modifiers. + * + * bit |0 |1 |2 |3 |4 |5 |6 |7 + * -----+--------+--------+--------+--------+--------+--------+--------+-------- + * desc |Lcontrol|Lshift |Lalt |Lgui |Rcontrol|Rshift |Ralt |Rgui + * + */ +typedef union { + uint8_t raw[KEYBOARD_REPORT_SIZE]; + struct { + uint8_t mods; + uint8_t reserved; + uint8_t keys[KEYBOARD_REPORT_KEYS]; + }; +#ifdef NKRO_ENABLE + struct { + uint8_t mods; + uint8_t bits[KEYBOARD_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; @@ -115,7 +159,10 @@ typedef struct { (key == KC_AUDIO_VOL_DOWN ? AUDIO_VOL_DOWN : \ (key == KC_MEDIA_NEXT_TRACK ? TRANSPORT_NEXT_TRACK : \ (key == KC_MEDIA_PREV_TRACK ? TRANSPORT_PREV_TRACK : \ + (key == KC_MEDIA_FAST_FORWARD ? TRANSPORT_FAST_FORWARD : \ + (key == KC_MEDIA_REWIND ? TRANSPORT_REWIND : \ (key == KC_MEDIA_STOP ? TRANSPORT_STOP : \ + (key == KC_MEDIA_EJECT ? TRANSPORT_STOP_EJECT : \ (key == KC_MEDIA_PLAY_PAUSE ? TRANSPORT_PLAY_PAUSE : \ (key == KC_MEDIA_SELECT ? AL_CC_CONFIG : \ (key == KC_MAIL ? AL_EMAIL : \ @@ -127,7 +174,7 @@ 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_WWW_FAVORITES ? AC_BOOKMARKS : 0))))))))))))))))))))) #ifdef __cplusplus }