Skip to content

Commit f8b2d8a

Browse files
committed
[HID] Removed static fields in HID class
There is still the epType[] array to be handled in some way.
1 parent 27c1832 commit f8b2d8a

File tree

2 files changed

+13
-26
lines changed

2 files changed

+13
-26
lines changed

libraries/HID/HID.cpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,6 @@
2323

2424
HID_ HID;
2525

26-
//================================================================================
27-
//================================================================================
28-
// HID Interface
29-
30-
HIDDescriptor HID_::hidInterface;
31-
32-
HIDDescriptorListNode* HID_::rootNode = NULL;
33-
uint16_t HID_::sizeof_hidReportDescriptor = 0;
34-
uint8_t HID_::modules_count = 0;
35-
uint8_t HID_::epType[] = { EP_TYPE_INTERRUPT_IN };
36-
37-
//================================================================================
38-
//================================================================================
39-
// Driver
40-
41-
uint8_t HID_::protocol = 1;
42-
uint8_t HID_::idle = 1;
43-
4426
int HID_::getInterface(uint8_t* interfaceNum)
4527
{
4628
interfaceNum[0] += 1; // uses 1
@@ -128,7 +110,13 @@ bool HID_::setup(USBSetup& setup, uint8_t i)
128110
}
129111
}
130112

131-
HID_::HID_(void) : PUSBListNode(1, 1, epType)
113+
// XXX: I've found no way to pass literal value directly in
114+
// the PUSBListNode constructor
115+
static uint8_t epTypeDef[] = { EP_TYPE_INTERRUPT_IN };
116+
117+
HID_::HID_(void) : PUSBListNode(1, 1, epTypeDef),
118+
rootNode(NULL), sizeof_hidReportDescriptor(0),
119+
modules_count(0), protocol(1), idle(1)
132120
{
133121
// XXX: Shall this be done in PUSBListNode(...) constructor?
134122
PluggableUSB.plug(this);

libraries/HID/HID.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,14 @@ class HID_ : public PUSBListNode
8787
bool setup(USBSetup& setup, uint8_t i);
8888

8989
private:
90-
static HIDDescriptor hidInterface;
90+
HIDDescriptor hidInterface;
9191

92-
static HIDDescriptorListNode* rootNode;
93-
static uint16_t sizeof_hidReportDescriptor;
94-
static uint8_t modules_count;
95-
static uint8_t epType[];
92+
HIDDescriptorListNode* rootNode;
93+
uint16_t sizeof_hidReportDescriptor;
94+
uint8_t modules_count;
9695

97-
static uint8_t protocol;
98-
static uint8_t idle;
96+
uint8_t protocol;
97+
uint8_t idle;
9998
};
10099

101100
#define D_HIDREPORT(_descriptorLength) \

0 commit comments

Comments
 (0)