X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Freport.h;h=62190469a42bbd10d1c2ee82a26c4fb6a84d8293;hb=fa545c87f74833856761572ef631d20accc1d026;hp=91982840af441a775c88be4171c293ec1bbec1d5;hpb=daa4a4235fd4a88b3b6f64e4a2cf590f28f4b65b;p=tmk_firmware.git diff --git a/common/report.h b/common/report.h index 9198284..6219046 100644 --- a/common/report.h +++ b/common/report.h @@ -74,19 +74,19 @@ along with this program. If not, see . /* key report size(NKRO or boot mode) */ #if defined(PROTOCOL_PJRC) && defined(NKRO_ENABLE) # include "usb.h" -# define REPORT_SIZE KBD2_SIZE -# define REPORT_KEYS (KBD2_SIZE - 2) -# define REPORT_BITS (KBD2_SIZE - 1) +# 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 REPORT_SIZE NKRO_EPSIZE -# define REPORT_KEYS (NKRO_EPSIZE - 2) -# define REPORT_BITS (NKRO_EPSIZE - 1) +# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE +# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) +# define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) #else -# define REPORT_SIZE 8 -# define REPORT_KEYS 6 +# define KEYBOARD_REPORT_SIZE 8 +# define KEYBOARD_REPORT_KEYS 6 #endif @@ -94,17 +94,37 @@ 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[REPORT_SIZE]; + uint8_t raw[KEYBOARD_REPORT_SIZE]; struct { uint8_t mods; uint8_t reserved; - uint8_t keys[REPORT_KEYS]; + uint8_t keys[KEYBOARD_REPORT_KEYS]; }; #ifdef NKRO_ENABLE struct { uint8_t mods; - uint8_t bits[REPORT_BITS]; + uint8_t bits[KEYBOARD_REPORT_BITS]; } nkro; #endif } __attribute__ ((packed)) report_keyboard_t;