aboutsummaryrefslogtreecommitdiff
path: root/libraries/HID/HID.h
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@arduino.cc>2015-09-30 16:19:21 +0200
committerCristian Maglie <c.maglie@arduino.cc>2015-10-02 11:59:22 +0200
commitab19daef2878e6fdbbe29f69dd0006bdb2508cc3 (patch)
treeab28c438a7c5e11e939ecfaa3d869efb9c9e6460 /libraries/HID/HID.h
parent7fee0f0a756fda618e399e6b1dce058b9e2b5fa1 (diff)
[PUSB] Moved static members inside HID_ class
This commit prepares for the next refactoring
Diffstat (limited to 'libraries/HID/HID.h')
-rw-r--r--libraries/HID/HID.h57
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 }