Added SetInterface function
This might help use to set a different hid interface later via keyboard/mouse api
This commit is contained in:
parent
700ca71cf8
commit
85922c2860
2 changed files with 13 additions and 8 deletions
|
|
@ -55,21 +55,25 @@ uint8_t HID_::_hid_idle = 1;
|
|||
int HID_::HID_GetInterface(u8* interfaceNum)
|
||||
{
|
||||
interfaceNum[0] += 1; // uses 1
|
||||
_hidInterface =
|
||||
{
|
||||
_hidInterface.hid =
|
||||
#if defined(USE_BOOT_KEYBOARD_PROTOCOL)
|
||||
D_INTERFACE(HID_INTERFACE,1,3,1,1),
|
||||
D_INTERFACE(HID_INTERFACE,1,3,1,1);
|
||||
#elif defined(USE_BOOT_MOUSE_PROTOCOL)
|
||||
D_INTERFACE(HID_INTERFACE,1,3,1,2),
|
||||
D_INTERFACE(HID_INTERFACE,1,3,1,2);
|
||||
#else
|
||||
D_INTERFACE(HID_INTERFACE,1,3,0,0),
|
||||
D_INTERFACE(HID_INTERFACE,1,3,0,0);
|
||||
#endif
|
||||
D_HIDREPORT(sizeof_hidReportDescriptor),
|
||||
D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,USB_EP_SIZE,0x01)
|
||||
};
|
||||
_hidInterface.desc = D_HIDREPORT(sizeof_hidReportDescriptor);
|
||||
_hidInterface.in = D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,USB_EP_SIZE,0x01);
|
||||
return USB_SendControl(0,&_hidInterface,sizeof(_hidInterface));
|
||||
}
|
||||
|
||||
void HID_::SetInterface(InterfaceDescriptor interface)
|
||||
{
|
||||
// Change the HID Interface (required for BOOT protocol)
|
||||
_hidInterface.hid = interface;
|
||||
}
|
||||
|
||||
int HID_::HID_GetDescriptor(int8_t t)
|
||||
{
|
||||
if (HID_REPORT_DESCRIPTOR_TYPE == t) {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ private:
|
|||
int begin(void);
|
||||
void SendReport(uint8_t id, const void* data, int len);
|
||||
void AppendDescriptor(HIDDevice* device);
|
||||
void SetInterface(InterfaceDescriptor interface);
|
||||
|
||||
// Static functions
|
||||
static int HID_GetInterface(u8* interfaceNum);
|
||||
|
|
|
|||
Loading…
Reference in a new issue