Skip to content

Commit 27c1832

Browse files
committed
[PUSB] The latest fields are now set via constructor
1 parent 9065229 commit 27c1832

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

cores/arduino/PluggableUSB.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727

2828
class PUSBListNode {
2929
public:
30-
PUSBListNode() { }
31-
int8_t numEndpoints;
32-
int8_t numInterfaces;
33-
uint8_t *endpointType;
30+
PUSBListNode(int8_t numEps, int8_t numIfs, uint8_t *epType) :
31+
numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType)
32+
{ }
3433

3534
inline uint8_t interface() const { return pluggedInterface; }
3635
inline int8_t endpoint() const { return pluggedEndpoint; }
@@ -43,6 +42,10 @@ class PUSBListNode {
4342
uint8_t pluggedInterface;
4443
int8_t pluggedEndpoint;
4544

45+
const int8_t numEndpoints;
46+
const int8_t numInterfaces;
47+
const uint8_t *endpointType;
48+
4649
public:
4750
PUSBListNode *next = NULL;
4851

libraries/HID/HID.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,9 @@ bool HID_::setup(USBSetup& setup, uint8_t i)
128128
}
129129
}
130130

131-
HID_::HID_(void)
131+
HID_::HID_(void) : PUSBListNode(1, 1, epType)
132132
{
133-
numEndpoints = 1;
134-
numInterfaces = 1;
135-
endpointType = epType;
136-
133+
// XXX: Shall this be done in PUSBListNode(...) constructor?
137134
PluggableUSB.plug(this);
138135
}
139136

0 commit comments

Comments
 (0)