Merge branch 'lufa_desc_fix'
This commit is contained in:
commit
3c1700ee4e
10 changed files with 134 additions and 126 deletions
|
|
@ -75,6 +75,10 @@ ifeq (yes,$(strip $(NKRO_ENABLE)))
|
||||||
OPT_DEFS += -DNKRO_ENABLE
|
OPT_DEFS += -DNKRO_ENABLE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq (yes,$(strip $(NKRO_6KRO_ENABLE)))
|
||||||
|
OPT_DEFS += -DNKRO_6KRO_ENABLE
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq (yes,$(strip $(USB_6KRO_ENABLE)))
|
ifeq (yes,$(strip $(USB_6KRO_ENABLE)))
|
||||||
OPT_DEFS += -DUSB_6KRO_ENABLE
|
OPT_DEFS += -DUSB_6KRO_ENABLE
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
static inline void add_key_byte(uint8_t code);
|
static inline void add_key_byte(uint8_t code);
|
||||||
static inline void del_key_byte(uint8_t code);
|
static inline void del_key_byte(uint8_t code);
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
static inline void add_key_bit(uint8_t code);
|
static inline void add_key_bit(uint8_t code);
|
||||||
static inline void del_key_bit(uint8_t code);
|
static inline void del_key_bit(uint8_t code);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -75,7 +75,7 @@ void send_keyboard_report(void) {
|
||||||
/* key */
|
/* key */
|
||||||
void add_key(uint8_t key)
|
void add_key(uint8_t key)
|
||||||
{
|
{
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
if (keyboard_protocol && keyboard_nkro) {
|
if (keyboard_protocol && keyboard_nkro) {
|
||||||
add_key_bit(key);
|
add_key_bit(key);
|
||||||
return;
|
return;
|
||||||
|
|
@ -86,7 +86,7 @@ void add_key(uint8_t key)
|
||||||
|
|
||||||
void del_key(uint8_t key)
|
void del_key(uint8_t key)
|
||||||
{
|
{
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
if (keyboard_protocol && keyboard_nkro) {
|
if (keyboard_protocol && keyboard_nkro) {
|
||||||
del_key_bit(key);
|
del_key_bit(key);
|
||||||
return;
|
return;
|
||||||
|
|
@ -159,7 +159,7 @@ uint8_t has_anymod(void)
|
||||||
|
|
||||||
uint8_t get_first_key(void)
|
uint8_t get_first_key(void)
|
||||||
{
|
{
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
if (keyboard_protocol && keyboard_nkro) {
|
if (keyboard_protocol && keyboard_nkro) {
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
|
for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
|
||||||
|
|
@ -286,7 +286,7 @@ static inline void del_key_byte(uint8_t code)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
static inline void add_key_bit(uint8_t code)
|
static inline void add_key_bit(uint8_t code)
|
||||||
{
|
{
|
||||||
if ((code>>3) < KEYBOARD_REPORT_BITS) {
|
if ((code>>3) < KEYBOARD_REPORT_BITS) {
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ void bootmagic(void)
|
||||||
}
|
}
|
||||||
eeconfig_write_keymap(keymap_config.raw);
|
eeconfig_write_keymap(keymap_config.raw);
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
keyboard_nkro = keymap_config.nkro;
|
keyboard_nkro = keymap_config.nkro;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ static void command_common_help(void)
|
||||||
"e: eeprom\n"
|
"e: eeprom\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
"n: NKRO\n"
|
"n: NKRO\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -314,7 +314,7 @@ static bool command_common(uint8_t code)
|
||||||
#ifdef COMMAND_ENABLE
|
#ifdef COMMAND_ENABLE
|
||||||
" COMMAND"
|
" COMMAND"
|
||||||
#endif
|
#endif
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
" NKRO"
|
" NKRO"
|
||||||
#endif
|
#endif
|
||||||
#ifdef KEYMAP_SECTION_ENABLE
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
|
|
@ -336,7 +336,7 @@ static bool command_common(uint8_t code)
|
||||||
print_val_hex8(host_keyboard_leds());
|
print_val_hex8(host_keyboard_leds());
|
||||||
print_val_hex8(keyboard_protocol);
|
print_val_hex8(keyboard_protocol);
|
||||||
print_val_hex8(keyboard_idle);
|
print_val_hex8(keyboard_idle);
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
print_val_hex8(keyboard_nkro);
|
print_val_hex8(keyboard_nkro);
|
||||||
#endif
|
#endif
|
||||||
print_val_hex32(timer_read32());
|
print_val_hex32(timer_read32());
|
||||||
|
|
@ -355,7 +355,7 @@ static bool command_common(uint8_t code)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
case KC_N:
|
case KC_N:
|
||||||
clear_keyboard(); //Prevents stuck keys.
|
clear_keyboard(); //Prevents stuck keys.
|
||||||
keyboard_nkro = !keyboard_nkro;
|
keyboard_nkro = !keyboard_nkro;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
bool keyboard_nkro = true;
|
bool keyboard_nkro = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
extern bool keyboard_nkro;
|
extern bool keyboard_nkro;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2)
|
# define KEYBOARD_REPORT_KEYS (KBD2_SIZE - 2)
|
||||||
# define KEYBOARD_REPORT_BITS (KBD2_SIZE - 1)
|
# define KEYBOARD_REPORT_BITS (KBD2_SIZE - 1)
|
||||||
|
|
||||||
#elif defined(PROTOCOL_LUFA) && defined(NKRO_ENABLE)
|
#elif defined(PROTOCOL_LUFA) && (defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE))
|
||||||
# include "protocol/lufa/descriptor.h"
|
# include "protocol/lufa/descriptor.h"
|
||||||
# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE
|
# define KEYBOARD_REPORT_SIZE NKRO_EPSIZE
|
||||||
# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2)
|
# define KEYBOARD_REPORT_KEYS (NKRO_EPSIZE - 2)
|
||||||
|
|
@ -142,7 +142,7 @@ typedef union {
|
||||||
uint8_t reserved;
|
uint8_t reserved;
|
||||||
uint8_t keys[KEYBOARD_REPORT_KEYS];
|
uint8_t keys[KEYBOARD_REPORT_KEYS];
|
||||||
};
|
};
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
struct {
|
struct {
|
||||||
uint8_t mods;
|
uint8_t mods;
|
||||||
uint8_t bits[KEYBOARD_REPORT_BITS];
|
uint8_t bits[KEYBOARD_REPORT_BITS];
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
|
const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
|
||||||
{
|
{
|
||||||
|
#ifndef NKRO_ENABLE
|
||||||
|
/* 6KRO - Boot protocol */
|
||||||
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
||||||
HID_RI_USAGE(8, 0x06), /* Keyboard */
|
HID_RI_USAGE(8, 0x06), /* Keyboard */
|
||||||
HID_RI_COLLECTION(8, 0x01), /* Application */
|
HID_RI_COLLECTION(8, 0x01), /* Application */
|
||||||
|
|
@ -81,17 +83,54 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
|
||||||
HID_RI_REPORT_SIZE(8, 0x08),
|
HID_RI_REPORT_SIZE(8, 0x08),
|
||||||
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE),
|
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE),
|
||||||
HID_RI_END_COLLECTION(0),
|
HID_RI_END_COLLECTION(0),
|
||||||
|
#else
|
||||||
|
/* NKRO - Report protocol */
|
||||||
|
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
||||||
|
HID_RI_USAGE(8, 0x06), /* Keyboard */
|
||||||
|
HID_RI_COLLECTION(8, 0x01), /* Application */
|
||||||
|
HID_RI_USAGE_PAGE(8, 0x07), /* Key Codes */
|
||||||
|
HID_RI_USAGE_MINIMUM(8, 0xE0), /* Keyboard Left Control */
|
||||||
|
HID_RI_USAGE_MAXIMUM(8, 0xE7), /* Keyboard Right GUI */
|
||||||
|
HID_RI_LOGICAL_MINIMUM(8, 0x00),
|
||||||
|
HID_RI_LOGICAL_MAXIMUM(8, 0x01),
|
||||||
|
HID_RI_REPORT_COUNT(8, 0x08),
|
||||||
|
HID_RI_REPORT_SIZE(8, 0x01),
|
||||||
|
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
|
||||||
|
|
||||||
|
HID_RI_USAGE_PAGE(8, 0x08), /* LEDs */
|
||||||
|
HID_RI_USAGE_MINIMUM(8, 0x01), /* Num Lock */
|
||||||
|
HID_RI_USAGE_MAXIMUM(8, 0x05), /* Kana */
|
||||||
|
HID_RI_REPORT_COUNT(8, 0x05),
|
||||||
|
HID_RI_REPORT_SIZE(8, 0x01),
|
||||||
|
HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
|
||||||
|
HID_RI_REPORT_COUNT(8, 0x01),
|
||||||
|
HID_RI_REPORT_SIZE(8, 0x03),
|
||||||
|
HID_RI_OUTPUT(8, HID_IOF_CONSTANT),
|
||||||
|
|
||||||
|
HID_RI_USAGE_PAGE(8, 0x07), /* Key Codes */
|
||||||
|
HID_RI_USAGE_MINIMUM(8, 0x00), /* Keyboard 0 */
|
||||||
|
HID_RI_USAGE_MAXIMUM(8, (NKRO_EPSIZE-1)*8-1), /* Keyboard Right GUI */
|
||||||
|
HID_RI_LOGICAL_MINIMUM(8, 0x00),
|
||||||
|
HID_RI_LOGICAL_MAXIMUM(8, 0x01),
|
||||||
|
HID_RI_REPORT_COUNT(8, (NKRO_EPSIZE-1)*8),
|
||||||
|
HID_RI_REPORT_SIZE(8, 0x01),
|
||||||
|
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
|
||||||
|
HID_RI_END_COLLECTION(0),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MOUSE_ENABLE
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
|
const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
|
||||||
{
|
{
|
||||||
|
#ifdef MOUSE_ENABLE
|
||||||
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
||||||
HID_RI_USAGE(8, 0x02), /* Mouse */
|
HID_RI_USAGE(8, 0x02), /* Mouse */
|
||||||
HID_RI_COLLECTION(8, 0x01), /* Application */
|
HID_RI_COLLECTION(8, 0x01), /* Application */
|
||||||
HID_RI_USAGE(8, 0x01), /* Pointer */
|
HID_RI_USAGE(8, 0x01), /* Pointer */
|
||||||
HID_RI_COLLECTION(8, 0x00), /* Physical */
|
HID_RI_COLLECTION(8, 0x00), /* Physical */
|
||||||
|
|
||||||
|
HID_RI_REPORT_ID(8, REPORT_ID_MOUSE),
|
||||||
|
|
||||||
HID_RI_USAGE_PAGE(8, 0x09), /* Button */
|
HID_RI_USAGE_PAGE(8, 0x09), /* Button */
|
||||||
HID_RI_USAGE_MINIMUM(8, 0x01), /* Button 1 */
|
HID_RI_USAGE_MINIMUM(8, 0x01), /* Button 1 */
|
||||||
HID_RI_USAGE_MAXIMUM(8, 0x08), /* Button 8 */
|
HID_RI_USAGE_MAXIMUM(8, 0x08), /* Button 8 */
|
||||||
|
|
@ -147,12 +186,9 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
|
||||||
|
|
||||||
HID_RI_END_COLLECTION(0),
|
HID_RI_END_COLLECTION(0),
|
||||||
HID_RI_END_COLLECTION(0),
|
HID_RI_END_COLLECTION(0),
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTRAKEY_ENABLE
|
#ifdef EXTRAKEY_ENABLE
|
||||||
const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] =
|
|
||||||
{
|
|
||||||
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
||||||
HID_RI_USAGE(8, 0x80), /* System Control */
|
HID_RI_USAGE(8, 0x80), /* System Control */
|
||||||
HID_RI_COLLECTION(8, 0x01), /* Application */
|
HID_RI_COLLECTION(8, 0x01), /* Application */
|
||||||
|
|
@ -178,6 +214,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] =
|
||||||
HID_RI_REPORT_COUNT(8, 1),
|
HID_RI_REPORT_COUNT(8, 1),
|
||||||
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE),
|
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE),
|
||||||
HID_RI_END_COLLECTION(0),
|
HID_RI_END_COLLECTION(0),
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -203,7 +240,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] =
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
const USB_Descriptor_HIDReport_Datatype_t PROGMEM NKROReport[] =
|
const USB_Descriptor_HIDReport_Datatype_t PROGMEM NKROReport[] =
|
||||||
{
|
{
|
||||||
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
||||||
|
|
@ -322,14 +359,19 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
||||||
|
|
||||||
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM),
|
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM),
|
||||||
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||||
|
#ifdef NKRO_ENABLE
|
||||||
|
.EndpointSize = NKRO_EPSIZE,
|
||||||
|
.PollingIntervalMS = 0x01
|
||||||
|
#else
|
||||||
.EndpointSize = KEYBOARD_EPSIZE,
|
.EndpointSize = KEYBOARD_EPSIZE,
|
||||||
.PollingIntervalMS = 0x0A
|
.PollingIntervalMS = 0x0A
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mouse
|
* Mouse
|
||||||
*/
|
*/
|
||||||
#ifdef MOUSE_ENABLE
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
.Mouse_Interface =
|
.Mouse_Interface =
|
||||||
{
|
{
|
||||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||||
|
|
@ -340,8 +382,13 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
||||||
.TotalEndpoints = 1,
|
.TotalEndpoints = 1,
|
||||||
|
|
||||||
.Class = HID_CSCP_HIDClass,
|
.Class = HID_CSCP_HIDClass,
|
||||||
|
#if defined(MOUSE_ENABLE)
|
||||||
.SubClass = HID_CSCP_BootSubclass,
|
.SubClass = HID_CSCP_BootSubclass,
|
||||||
.Protocol = HID_CSCP_MouseBootProtocol,
|
.Protocol = HID_CSCP_MouseBootProtocol,
|
||||||
|
#else
|
||||||
|
.SubClass = HID_CSCP_NonBootSubclass,
|
||||||
|
.Protocol = HID_CSCP_NonBootProtocol,
|
||||||
|
#endif
|
||||||
|
|
||||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||||
},
|
},
|
||||||
|
|
@ -364,49 +411,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
||||||
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM),
|
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM),
|
||||||
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||||
.EndpointSize = MOUSE_EPSIZE,
|
.EndpointSize = MOUSE_EPSIZE,
|
||||||
.PollingIntervalMS = 0x0A
|
.PollingIntervalMS = 0x01
|
||||||
},
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Extra
|
|
||||||
*/
|
|
||||||
#ifdef EXTRAKEY_ENABLE
|
|
||||||
.Extrakey_Interface =
|
|
||||||
{
|
|
||||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
|
||||||
|
|
||||||
.InterfaceNumber = EXTRAKEY_INTERFACE,
|
|
||||||
.AlternateSetting = 0x00,
|
|
||||||
|
|
||||||
.TotalEndpoints = 1,
|
|
||||||
|
|
||||||
.Class = HID_CSCP_HIDClass,
|
|
||||||
.SubClass = HID_CSCP_NonBootSubclass,
|
|
||||||
.Protocol = HID_CSCP_NonBootProtocol,
|
|
||||||
|
|
||||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
|
||||||
},
|
|
||||||
|
|
||||||
.Extrakey_HID =
|
|
||||||
{
|
|
||||||
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
|
|
||||||
|
|
||||||
.HIDSpec = VERSION_BCD(1,1,1),
|
|
||||||
.CountryCode = 0x00,
|
|
||||||
.TotalReportDescriptors = 1,
|
|
||||||
.HIDReportType = HID_DTYPE_Report,
|
|
||||||
.HIDReportLength = sizeof(ExtrakeyReport)
|
|
||||||
},
|
|
||||||
|
|
||||||
.Extrakey_INEndpoint =
|
|
||||||
{
|
|
||||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
|
||||||
|
|
||||||
.EndpointAddress = (ENDPOINT_DIR_IN | EXTRAKEY_IN_EPNUM),
|
|
||||||
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
|
||||||
.EndpointSize = EXTRAKEY_EPSIZE,
|
|
||||||
.PollingIntervalMS = 0x0A
|
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -465,7 +470,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
||||||
/*
|
/*
|
||||||
* NKRO
|
* NKRO
|
||||||
*/
|
*/
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
.NKRO_Interface =
|
.NKRO_Interface =
|
||||||
{
|
{
|
||||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||||
|
|
@ -582,25 +587,19 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||||
Address = &ConfigurationDescriptor.Keyboard_HID;
|
Address = &ConfigurationDescriptor.Keyboard_HID;
|
||||||
Size = sizeof(USB_HID_Descriptor_HID_t);
|
Size = sizeof(USB_HID_Descriptor_HID_t);
|
||||||
break;
|
break;
|
||||||
#ifdef MOUSE_ENABLE
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
case MOUSE_INTERFACE:
|
case MOUSE_INTERFACE:
|
||||||
Address = &ConfigurationDescriptor.Mouse_HID;
|
Address = &ConfigurationDescriptor.Mouse_HID;
|
||||||
Size = sizeof(USB_HID_Descriptor_HID_t);
|
Size = sizeof(USB_HID_Descriptor_HID_t);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef EXTRAKEY_ENABLE
|
|
||||||
case EXTRAKEY_INTERFACE:
|
|
||||||
Address = &ConfigurationDescriptor.Extrakey_HID;
|
|
||||||
Size = sizeof(USB_HID_Descriptor_HID_t);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_ENABLE
|
||||||
case CONSOLE_INTERFACE:
|
case CONSOLE_INTERFACE:
|
||||||
Address = &ConfigurationDescriptor.Console_HID;
|
Address = &ConfigurationDescriptor.Console_HID;
|
||||||
Size = sizeof(USB_HID_Descriptor_HID_t);
|
Size = sizeof(USB_HID_Descriptor_HID_t);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
case NKRO_INTERFACE:
|
case NKRO_INTERFACE:
|
||||||
Address = &ConfigurationDescriptor.NKRO_HID;
|
Address = &ConfigurationDescriptor.NKRO_HID;
|
||||||
Size = sizeof(USB_HID_Descriptor_HID_t);
|
Size = sizeof(USB_HID_Descriptor_HID_t);
|
||||||
|
|
@ -614,25 +613,19 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||||
Address = &KeyboardReport;
|
Address = &KeyboardReport;
|
||||||
Size = sizeof(KeyboardReport);
|
Size = sizeof(KeyboardReport);
|
||||||
break;
|
break;
|
||||||
#ifdef MOUSE_ENABLE
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
case MOUSE_INTERFACE:
|
case MOUSE_INTERFACE:
|
||||||
Address = &MouseReport;
|
Address = &MouseReport;
|
||||||
Size = sizeof(MouseReport);
|
Size = sizeof(MouseReport);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef EXTRAKEY_ENABLE
|
|
||||||
case EXTRAKEY_INTERFACE:
|
|
||||||
Address = &ExtrakeyReport;
|
|
||||||
Size = sizeof(ExtrakeyReport);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_ENABLE
|
||||||
case CONSOLE_INTERFACE:
|
case CONSOLE_INTERFACE:
|
||||||
Address = &ConsoleReport;
|
Address = &ConsoleReport;
|
||||||
Size = sizeof(ConsoleReport);
|
Size = sizeof(ConsoleReport);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
case NKRO_INTERFACE:
|
case NKRO_INTERFACE:
|
||||||
Address = &NKROReport;
|
Address = &NKROReport;
|
||||||
Size = sizeof(NKROReport);
|
Size = sizeof(NKROReport);
|
||||||
|
|
|
||||||
|
|
@ -57,20 +57,13 @@ typedef struct
|
||||||
USB_HID_Descriptor_HID_t Keyboard_HID;
|
USB_HID_Descriptor_HID_t Keyboard_HID;
|
||||||
USB_Descriptor_Endpoint_t Keyboard_INEndpoint;
|
USB_Descriptor_Endpoint_t Keyboard_INEndpoint;
|
||||||
|
|
||||||
#ifdef MOUSE_ENABLE
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
// Mouse HID Interface
|
// Mouse HID Interface
|
||||||
USB_Descriptor_Interface_t Mouse_Interface;
|
USB_Descriptor_Interface_t Mouse_Interface;
|
||||||
USB_HID_Descriptor_HID_t Mouse_HID;
|
USB_HID_Descriptor_HID_t Mouse_HID;
|
||||||
USB_Descriptor_Endpoint_t Mouse_INEndpoint;
|
USB_Descriptor_Endpoint_t Mouse_INEndpoint;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTRAKEY_ENABLE
|
|
||||||
// Extrakey HID Interface
|
|
||||||
USB_Descriptor_Interface_t Extrakey_Interface;
|
|
||||||
USB_HID_Descriptor_HID_t Extrakey_HID;
|
|
||||||
USB_Descriptor_Endpoint_t Extrakey_INEndpoint;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_ENABLE
|
||||||
// Console HID Interface
|
// Console HID Interface
|
||||||
USB_Descriptor_Interface_t Console_Interface;
|
USB_Descriptor_Interface_t Console_Interface;
|
||||||
|
|
@ -79,7 +72,7 @@ typedef struct
|
||||||
USB_Descriptor_Endpoint_t Console_OUTEndpoint;
|
USB_Descriptor_Endpoint_t Console_OUTEndpoint;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
// NKRO HID Interface
|
// NKRO HID Interface
|
||||||
USB_Descriptor_Interface_t NKRO_Interface;
|
USB_Descriptor_Interface_t NKRO_Interface;
|
||||||
USB_HID_Descriptor_HID_t NKRO_HID;
|
USB_HID_Descriptor_HID_t NKRO_HID;
|
||||||
|
|
@ -91,25 +84,19 @@ typedef struct
|
||||||
/* index of interface */
|
/* index of interface */
|
||||||
#define KEYBOARD_INTERFACE 0
|
#define KEYBOARD_INTERFACE 0
|
||||||
|
|
||||||
#ifdef MOUSE_ENABLE
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
# define MOUSE_INTERFACE (KEYBOARD_INTERFACE + 1)
|
# define MOUSE_INTERFACE (KEYBOARD_INTERFACE + 1)
|
||||||
#else
|
#else
|
||||||
# define MOUSE_INTERFACE KEYBOARD_INTERFACE
|
# define MOUSE_INTERFACE KEYBOARD_INTERFACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTRAKEY_ENABLE
|
|
||||||
# define EXTRAKEY_INTERFACE (MOUSE_INTERFACE + 1)
|
|
||||||
#else
|
|
||||||
# define EXTRAKEY_INTERFACE MOUSE_INTERFACE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_ENABLE
|
||||||
# define CONSOLE_INTERFACE (EXTRAKEY_INTERFACE + 1)
|
# define CONSOLE_INTERFACE (MOUSE_INTERFACE + 1)
|
||||||
#else
|
#else
|
||||||
# define CONSOLE_INTERFACE EXTRAKEY_INTERFACE
|
# define CONSOLE_INTERFACE MOUSE_INTERFACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
# define NKRO_INTERFACE (CONSOLE_INTERFACE + 1)
|
# define NKRO_INTERFACE (CONSOLE_INTERFACE + 1)
|
||||||
#else
|
#else
|
||||||
# define NKRO_INTERFACE CONSOLE_INTERFACE
|
# define NKRO_INTERFACE CONSOLE_INTERFACE
|
||||||
|
|
@ -123,26 +110,20 @@ typedef struct
|
||||||
// Endopoint number and size
|
// Endopoint number and size
|
||||||
#define KEYBOARD_IN_EPNUM 1
|
#define KEYBOARD_IN_EPNUM 1
|
||||||
|
|
||||||
#ifdef MOUSE_ENABLE
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1)
|
# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1)
|
||||||
#else
|
#else
|
||||||
# define MOUSE_IN_EPNUM KEYBOARD_IN_EPNUM
|
# define MOUSE_IN_EPNUM KEYBOARD_IN_EPNUM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTRAKEY_ENABLE
|
|
||||||
# define EXTRAKEY_IN_EPNUM (MOUSE_IN_EPNUM + 1)
|
|
||||||
#else
|
|
||||||
# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_ENABLE
|
||||||
# define CONSOLE_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1)
|
# define CONSOLE_IN_EPNUM (MOUSE_IN_EPNUM + 1)
|
||||||
# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 1)
|
# define CONSOLE_OUT_EPNUM (MOUSE_IN_EPNUM + 1)
|
||||||
#else
|
#else
|
||||||
# define CONSOLE_OUT_EPNUM EXTRAKEY_IN_EPNUM
|
# define CONSOLE_OUT_EPNUM MOUSE_IN_EPNUM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
# define NKRO_IN_EPNUM (CONSOLE_OUT_EPNUM + 1)
|
# define NKRO_IN_EPNUM (CONSOLE_OUT_EPNUM + 1)
|
||||||
#else
|
#else
|
||||||
# define NKRO_IN_EPNUM CONSOLE_OUT_EPNUM
|
# define NKRO_IN_EPNUM CONSOLE_OUT_EPNUM
|
||||||
|
|
@ -150,13 +131,18 @@ typedef struct
|
||||||
|
|
||||||
/* Check number of endpoints. ATmega32u2 has only four except for control endpoint. */
|
/* Check number of endpoints. ATmega32u2 has only four except for control endpoint. */
|
||||||
#if defined(__AVR_ATmega32U2__) && NKRO_IN_EPNUM > 4
|
#if defined(__AVR_ATmega32U2__) && NKRO_IN_EPNUM > 4
|
||||||
# error "Endpoints are not available enough to support all functions. Disable some of build options in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO)"
|
# error "Endpoints are not available enough to support all functions. Disable some of build options in Makefile.(MOUSEKEY, CONSOLE, NKRO)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define KEYBOARD_EPSIZE 8
|
#define KEYBOARD_EPSIZE 8
|
||||||
|
|
||||||
|
#if defined(MOUSE_EXT_REPORT)
|
||||||
|
#define MOUSE_EPSIZE 10
|
||||||
|
#else
|
||||||
#define MOUSE_EPSIZE 8
|
#define MOUSE_EPSIZE 8
|
||||||
#define EXTRAKEY_EPSIZE 8
|
#endif
|
||||||
|
|
||||||
#define CONSOLE_EPSIZE 32
|
#define CONSOLE_EPSIZE 32
|
||||||
#define NKRO_EPSIZE 32
|
#define NKRO_EPSIZE 32
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@
|
||||||
uint8_t keyboard_idle = 0;
|
uint8_t keyboard_idle = 0;
|
||||||
/* 0: Boot Protocol, 1: Report Protocol(default) */
|
/* 0: Boot Protocol, 1: Report Protocol(default) */
|
||||||
uint8_t keyboard_protocol = 1;
|
uint8_t keyboard_protocol = 1;
|
||||||
|
uint8_t mouse_protocol = 1;
|
||||||
static uint8_t keyboard_led_stats = 0;
|
static uint8_t keyboard_led_stats = 0;
|
||||||
|
|
||||||
static report_keyboard_t keyboard_report_sent;
|
static report_keyboard_t keyboard_report_sent;
|
||||||
|
|
@ -329,20 +330,19 @@ void EVENT_USB_Device_ConfigurationChanged(void)
|
||||||
|
|
||||||
/* Setup Keyboard HID Report Endpoints */
|
/* Setup Keyboard HID Report Endpoints */
|
||||||
ConfigSuccess &= ENDPOINT_CONFIG(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
ConfigSuccess &= ENDPOINT_CONFIG(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
||||||
KEYBOARD_EPSIZE, ENDPOINT_BANK_SINGLE);
|
#ifdef NKRO_ENABLE
|
||||||
|
NKRO_EPSIZE,
|
||||||
|
#else
|
||||||
|
KEYBOARD_EPSIZE,
|
||||||
|
#endif
|
||||||
|
ENDPOINT_BANK_SINGLE);
|
||||||
|
|
||||||
#ifdef MOUSE_ENABLE
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
/* Setup Mouse HID Report Endpoint */
|
/* Setup Mouse HID Report Endpoint */
|
||||||
ConfigSuccess &= ENDPOINT_CONFIG(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
ConfigSuccess &= ENDPOINT_CONFIG(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
||||||
MOUSE_EPSIZE, ENDPOINT_BANK_SINGLE);
|
MOUSE_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTRAKEY_ENABLE
|
|
||||||
/* Setup Extra HID Report Endpoint */
|
|
||||||
ConfigSuccess &= ENDPOINT_CONFIG(EXTRAKEY_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
|
||||||
EXTRAKEY_EPSIZE, ENDPOINT_BANK_SINGLE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
#ifdef CONSOLE_ENABLE
|
||||||
/* Setup Console HID Report Endpoints */
|
/* Setup Console HID Report Endpoints */
|
||||||
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
||||||
|
|
@ -353,7 +353,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
/* Setup NKRO HID Report Endpoints */
|
/* Setup NKRO HID Report Endpoints */
|
||||||
ConfigSuccess &= ENDPOINT_CONFIG(NKRO_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
ConfigSuccess &= ENDPOINT_CONFIG(NKRO_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
||||||
NKRO_EPSIZE, ENDPOINT_BANK_SINGLE);
|
NKRO_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||||
|
|
@ -414,7 +414,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
||||||
// Interface
|
// Interface
|
||||||
switch (USB_ControlRequest.wIndex) {
|
switch (USB_ControlRequest.wIndex) {
|
||||||
case KEYBOARD_INTERFACE:
|
case KEYBOARD_INTERFACE:
|
||||||
#ifdef NKRO_ENABLE
|
#ifdef NKRO_6KRO_ENABLE
|
||||||
case NKRO_INTERFACE:
|
case NKRO_INTERFACE:
|
||||||
#endif
|
#endif
|
||||||
Endpoint_ClearSETUP();
|
Endpoint_ClearSETUP();
|
||||||
|
|
@ -450,6 +450,13 @@ void EVENT_USB_Device_ControlRequest(void)
|
||||||
print("[p]");
|
print("[p]");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (USB_ControlRequest.wIndex == MOUSE_INTERFACE) {
|
||||||
|
Endpoint_ClearSETUP();
|
||||||
|
while (!(Endpoint_IsINReady()));
|
||||||
|
Endpoint_Write_8(mouse_protocol);
|
||||||
|
Endpoint_ClearIN();
|
||||||
|
Endpoint_ClearStatusStage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -466,6 +473,13 @@ void EVENT_USB_Device_ControlRequest(void)
|
||||||
print("[P]");
|
print("[P]");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (USB_ControlRequest.wIndex == MOUSE_INTERFACE) {
|
||||||
|
Endpoint_ClearSETUP();
|
||||||
|
Endpoint_ClearStatusStage();
|
||||||
|
|
||||||
|
mouse_protocol = (USB_ControlRequest.wValue & 0xFF);
|
||||||
|
clear_keyboard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -515,10 +529,14 @@ static void send_keyboard(report_keyboard_t *report)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Select the Keyboard Report Endpoint */
|
/* Select the Keyboard Report Endpoint */
|
||||||
#ifdef NKRO_ENABLE
|
#if defined(NKRO_ENABLE) || defined(NKRO_6KRO_ENABLE)
|
||||||
if (keyboard_protocol && keyboard_nkro) {
|
if (keyboard_protocol && keyboard_nkro) {
|
||||||
/* Report protocol - NKRO */
|
/* Report protocol - NKRO */
|
||||||
|
#if defined(NKRO_6KRO_ENABLE)
|
||||||
Endpoint_SelectEndpoint(NKRO_IN_EPNUM);
|
Endpoint_SelectEndpoint(NKRO_IN_EPNUM);
|
||||||
|
#else
|
||||||
|
Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Check if write ready for a polling interval around 1ms */
|
/* Check if write ready for a polling interval around 1ms */
|
||||||
while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(8);
|
while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(8);
|
||||||
|
|
@ -563,7 +581,14 @@ static void send_mouse(report_mouse_t *report)
|
||||||
if (!Endpoint_IsReadWriteAllowed()) return;
|
if (!Endpoint_IsReadWriteAllowed()) return;
|
||||||
|
|
||||||
/* Write Mouse Report Data */
|
/* Write Mouse Report Data */
|
||||||
Endpoint_Write_Stream_LE(report, sizeof(report_mouse_t), NULL);
|
if (mouse_protocol) {
|
||||||
|
// Report
|
||||||
|
Endpoint_Write_8(REPORT_ID_MOUSE);
|
||||||
|
Endpoint_Write_Stream_LE(report, sizeof(report_mouse_t), NULL);
|
||||||
|
} else {
|
||||||
|
// Boot
|
||||||
|
Endpoint_Write_Stream_LE(report, 3, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Finalize the stream transfer to send the last packet */
|
/* Finalize the stream transfer to send the last packet */
|
||||||
Endpoint_ClearIN();
|
Endpoint_ClearIN();
|
||||||
|
|
@ -582,7 +607,7 @@ static void send_system(uint16_t data)
|
||||||
.report_id = REPORT_ID_SYSTEM,
|
.report_id = REPORT_ID_SYSTEM,
|
||||||
.usage = data - SYSTEM_POWER_DOWN + 1
|
.usage = data - SYSTEM_POWER_DOWN + 1
|
||||||
};
|
};
|
||||||
Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM);
|
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
|
||||||
|
|
||||||
/* Check if write ready for a polling interval around 10ms */
|
/* Check if write ready for a polling interval around 10ms */
|
||||||
while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
|
while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
|
||||||
|
|
@ -605,7 +630,7 @@ static void send_consumer(uint16_t data)
|
||||||
.report_id = REPORT_ID_CONSUMER,
|
.report_id = REPORT_ID_CONSUMER,
|
||||||
.usage = data
|
.usage = data
|
||||||
};
|
};
|
||||||
Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM);
|
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
|
||||||
|
|
||||||
/* Check if write ready for a polling interval around 10ms */
|
/* Check if write ready for a polling interval around 10ms */
|
||||||
while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
|
while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue