Skip to content

Commit 865ac2f

Browse files
committed
Merge pull request #3960 from cmaglie/pusb-rename
[PluggableUSB] rename two class
2 parents 80b7900 + a151349 commit 865ac2f

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

hardware/arduino/avr/cores/arduino/PluggableUSB.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern uint8_t _initEndpoints[];
2828
int PluggableUSB_::getInterface(uint8_t* interfaceCount)
2929
{
3030
int sent = 0;
31-
PUSBListNode* node;
31+
PluggableUSBModule* node;
3232
for (node = rootNode; node; node = node->next) {
3333
int res = node->getInterface(interfaceCount);
3434
if (res < 0)
@@ -40,7 +40,7 @@ int PluggableUSB_::getInterface(uint8_t* interfaceCount)
4040

4141
int PluggableUSB_::getDescriptor(USBSetup& setup)
4242
{
43-
PUSBListNode* node;
43+
PluggableUSBModule* node;
4444
for (node = rootNode; node; node = node->next) {
4545
int ret = node->getDescriptor(setup);
4646
// ret!=0 -> request has been processed
@@ -52,7 +52,7 @@ int PluggableUSB_::getDescriptor(USBSetup& setup)
5252

5353
bool PluggableUSB_::setup(USBSetup& setup)
5454
{
55-
PUSBListNode* node;
55+
PluggableUSBModule* node;
5656
for (node = rootNode; node; node = node->next) {
5757
if (node->setup(setup)) {
5858
return true;
@@ -61,7 +61,7 @@ bool PluggableUSB_::setup(USBSetup& setup)
6161
return false;
6262
}
6363

64-
bool PluggableUSB_::plug(PUSBListNode *node)
64+
bool PluggableUSB_::plug(PluggableUSBModule *node)
6565
{
6666
if ((lastEp + node->numEndpoints) > USB_ENDPOINTS) {
6767
return false;
@@ -70,7 +70,7 @@ bool PluggableUSB_::plug(PUSBListNode *node)
7070
if (!rootNode) {
7171
rootNode = node;
7272
} else {
73-
PUSBListNode *current = rootNode;
73+
PluggableUSBModule *current = rootNode;
7474
while (current->next) {
7575
current = current->next;
7676
}

hardware/arduino/avr/cores/arduino/PluggableUSB.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
#if defined(USBCON)
2727

28-
class PUSBListNode {
28+
class PluggableUSBModule {
2929
public:
30-
PUSBListNode(uint8_t numEps, uint8_t numIfs, uint8_t *epType) :
30+
PluggableUSBModule(uint8_t numEps, uint8_t numIfs, uint8_t *epType) :
3131
numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType)
3232
{ }
3333

@@ -43,23 +43,23 @@ class PUSBListNode {
4343
const uint8_t numInterfaces;
4444
const uint8_t *endpointType;
4545

46-
PUSBListNode *next = NULL;
46+
PluggableUSBModule *next = NULL;
4747

4848
friend class PluggableUSB_;
4949
};
5050

5151
class PluggableUSB_ {
5252
public:
5353
PluggableUSB_();
54-
bool plug(PUSBListNode *node);
54+
bool plug(PluggableUSBModule *node);
5555
int getInterface(uint8_t* interfaceCount);
5656
int getDescriptor(USBSetup& setup);
5757
bool setup(USBSetup& setup);
5858

5959
private:
6060
uint8_t lastIf;
6161
uint8_t lastEp;
62-
PUSBListNode* rootNode;
62+
PluggableUSBModule* rootNode;
6363
};
6464

6565
// Replacement for global singleton.

hardware/arduino/avr/libraries/HID/HID.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int HID_::getDescriptor(USBSetup& setup)
4747
if (setup.wIndex != pluggedInterface) { return 0; }
4848

4949
int total = 0;
50-
HIDDescriptorListNode* node;
50+
HIDSubDescriptor* node;
5151
for (node = rootNode; node; node = node->next) {
5252
int res = USB_SendControl(TRANSFER_PGM, node->data, node->length);
5353
if (res == -1)
@@ -57,12 +57,12 @@ int HID_::getDescriptor(USBSetup& setup)
5757
return total;
5858
}
5959

60-
void HID_::AppendDescriptor(HIDDescriptorListNode *node)
60+
void HID_::AppendDescriptor(HIDSubDescriptor *node)
6161
{
6262
if (!rootNode) {
6363
rootNode = node;
6464
} else {
65-
HIDDescriptorListNode *current = rootNode;
65+
HIDSubDescriptor *current = rootNode;
6666
while (current->next) {
6767
current = current->next;
6868
}
@@ -128,7 +128,7 @@ bool HID_::setup(USBSetup& setup)
128128
return false;
129129
}
130130

131-
HID_::HID_(void) : PUSBListNode(1, 1, epType),
131+
HID_::HID_(void) : PluggableUSBModule(1, 1, epType),
132132
rootNode(NULL), descriptorSize(0),
133133
protocol(1), idle(1)
134134
{

hardware/arduino/avr/libraries/HID/HID.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -74,33 +74,33 @@ typedef struct
7474
EndpointDescriptor in;
7575
} HIDDescriptor;
7676

77-
class HIDDescriptorListNode {
77+
class HIDSubDescriptor {
7878
public:
79-
HIDDescriptorListNode *next = NULL;
80-
HIDDescriptorListNode(const void *d, const uint16_t l) : data(d), length(l) { }
79+
HIDSubDescriptor *next = NULL;
80+
HIDSubDescriptor(const void *d, const uint16_t l) : data(d), length(l) { }
8181

8282
const void* data;
8383
const uint16_t length;
8484
};
8585

86-
class HID_ : public PUSBListNode
86+
class HID_ : public PluggableUSBModule
8787
{
8888
public:
8989
HID_(void);
9090
int begin(void);
9191
void SendReport(uint8_t id, const void* data, int len);
92-
void AppendDescriptor(HIDDescriptorListNode* node);
92+
void AppendDescriptor(HIDSubDescriptor* node);
9393

9494
protected:
95-
// Implementation of the PUSBListNode
95+
// Implementation of the PluggableUSBModule
9696
int getInterface(uint8_t* interfaceCount);
9797
int getDescriptor(USBSetup& setup);
9898
bool setup(USBSetup& setup);
9999

100100
private:
101101
uint8_t epType[1];
102102

103-
HIDDescriptorListNode* rootNode;
103+
HIDSubDescriptor* rootNode;
104104
uint16_t descriptorSize;
105105

106106
uint8_t protocol;

libraries/Keyboard/src/Keyboard.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
6262

6363
Keyboard_::Keyboard_(void)
6464
{
65-
static HIDDescriptorListNode node(_hidReportDescriptor, sizeof(_hidReportDescriptor));
65+
static HIDSubDescriptor node(_hidReportDescriptor, sizeof(_hidReportDescriptor));
6666
HID().AppendDescriptor(&node);
6767
}
6868

libraries/Mouse/src/Mouse.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
6262

6363
Mouse_::Mouse_(void) : _buttons(0)
6464
{
65-
static HIDDescriptorListNode node(_hidReportDescriptor, sizeof(_hidReportDescriptor));
65+
static HIDSubDescriptor node(_hidReportDescriptor, sizeof(_hidReportDescriptor));
6666
HID().AppendDescriptor(&node);
6767
}
6868

0 commit comments

Comments
 (0)