diff options
Diffstat (limited to 'libraries/HID/HID.h')
-rw-r--r-- | libraries/HID/HID.h | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index d0fe265..cb1125e 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -30,10 +30,8 @@ #define _USING_HID -//================================================================================ -//================================================================================ -// HID 'Driver' - +// HID 'Driver' +// ------------ #define HID_GET_REPORT 0x01 #define HID_GET_IDLE 0x02 #define HID_GET_PROTOCOL 0x03 @@ -45,24 +43,6 @@ #define HID_REPORT_DESCRIPTOR_TYPE 0x22 #define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 -class HIDDescriptorListNode { -public: - HIDDescriptorListNode *next = NULL; - HIDDescriptorListNode(const void *d, const uint16_t l) : data(d), length(l) { } - - const void* data; - uint16_t length; -}; - -class HID_ : public PUSBListNode -{ -public: - HID_(void); - int begin(void); - void SendReport(uint8_t id, const void* data, int len); - void AppendDescriptor(HIDDescriptorListNode* node); -}; - typedef struct { uint8_t len; // 9 @@ -83,6 +63,39 @@ typedef struct EndpointDescriptor in; } HIDDescriptor; +class HIDDescriptorListNode { +public: + HIDDescriptorListNode *next = NULL; + HIDDescriptorListNode(const void *d, const uint16_t l) : data(d), length(l) { } + + const void* data; + uint16_t length; +}; + +class HID_ : public PUSBListNode +{ +public: + HID_(void); + int begin(void); + void SendReport(uint8_t id, const void* data, int len); + void AppendDescriptor(HIDDescriptorListNode* node); + +private: + static int GetInterface(uint8_t* interfaceNum); + static int GetDescriptor(int8_t t); + static bool Setup(USBSetup& setup, uint8_t i); + + static HIDDescriptor hidInterface; + + static HIDDescriptorListNode* rootNode; + static uint16_t sizeof_hidReportDescriptor; + static uint8_t modules_count; + static uint8_t epType[]; + + static uint8_t protocol; + static uint8_t idle; +}; + #define D_HIDREPORT(_descriptorLength) \ { 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength & 0xFF, _descriptorLength >> 8 } |