X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Freport.h;h=167f382751e9dadf5724bbc0293dc3b67f783fff;hb=621ce29a53e9e94e085fbd86c0b7134e9df4bfe5;hp=8fb28b6ce350b47faf9a5199eddae6a217565686;hpb=25a7c941746d077d246468bec6bebdb01e478090;p=qmk_firmware.git diff --git a/tmk_core/common/report.h b/tmk_core/common/report.h index 8fb28b6ce..167f38275 100644 --- a/tmk_core/common/report.h +++ b/tmk_core/common/report.h @@ -73,22 +73,25 @@ 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 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_PJRC) + #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(PROTOCOL_CHIBIOS) + #include "protocol/usb_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_ARM_ATSAM) + #include "protocol/arm_atsam/usb/udi_device_epsize.h" + #define KEYBOARD_REPORT_SIZE NKRO_EPSIZE + #define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2) + #define KEYBOARD_REPORT_BITS (NKRO_EPSIZE - 1) + #else + #error "NKRO not supported with this protocol" +#endif #else # define KEYBOARD_REPORT_SIZE 8 @@ -174,6 +177,20 @@ typedef struct { (key == KC_WWW_REFRESH ? AC_REFRESH : \ (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); + +void add_key_byte(report_keyboard_t* keyboard_report, uint8_t code); +void del_key_byte(report_keyboard_t* keyboard_report, uint8_t code); +#ifdef NKRO_ENABLE +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, 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); + #ifdef __cplusplus } #endif