Skip to content

Commit f0cf13c

Browse files
committed
HID: Renamed fields in HIDDescriptorListNode and HID_Descriptor
In particular HIDDescriptorListNode.cb has been renamed to HIDDescriptorListNode.descriptor because it contains decriptor data and not callbacks. Moreover the HID_Descriptor.descriptor field has been renamed to HID_Descriptor.data so the structure has now two fields length and data. typedef struct __attribute__((packed)) { uint16_t length; const void* data; } HID_Descriptor; class HIDDescriptorListNode { public: HIDDescriptorListNode *next = NULL; const HID_Descriptor *descriptor; HIDDescriptorListNode(const HID_Descriptor *d) : descriptor(d) { } }; This imply a change in the use of the node from: node->cb->lenght node->cd->descriptor to node->descriptor->length node->descriptor->data
1 parent 6cfd50e commit f0cf13c

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int HID_GetDescriptor(int8_t t)
6161
HIDDescriptorListNode* current = rootNode;
6262
int total = 0;
6363
while(current != NULL) {
64-
total += USB_SendControl(TRANSFER_PGM,current->cb->descriptor,current->cb->length);
64+
total += USB_SendControl(TRANSFER_PGM,current->descriptor->data,current->descriptor->length);
6565
current = current->next;
6666
}
6767
return total;
@@ -82,7 +82,7 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
8282
current->next = node;
8383
}
8484
modules_count++;
85-
sizeof_hidReportDescriptor += (uint16_t)node->cb->length;
85+
sizeof_hidReportDescriptor += (uint16_t)node->descriptor->length;
8686
}
8787

8888
void HID_::SendReport(u8 id, const void* data, int len)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@
4646

4747
typedef struct __attribute__((packed)) {
4848
uint16_t length;
49-
const void* descriptor;
49+
const void* data;
5050
} HID_Descriptor;
5151

5252
class HIDDescriptorListNode {
5353
public:
5454
HIDDescriptorListNode *next = NULL;
55-
const HID_Descriptor * cb;
56-
HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;}
55+
const HID_Descriptor *descriptor;
56+
HIDDescriptorListNode(const HID_Descriptor *d) : descriptor(d) { }
5757
};
5858

5959
class HID_

hardware/arduino/sam/libraries/HID/HID.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int HID_GetDescriptor(int8_t t)
6868
HIDDescriptorListNode* current = rootNode;
6969
int total = 0;
7070
while(current != NULL) {
71-
total += USBD_SendControl(0,current->cb->descriptor,current->cb->length);
71+
total += USBD_SendControl(0,current->descriptor->data,current->descriptor->length);
7272
current = current->next;
7373
}
7474
return total;
@@ -89,7 +89,7 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
8989
current->next = node;
9090
}
9191
modules_count++;
92-
sizeof_hidReportDescriptor += node->cb->length;
92+
sizeof_hidReportDescriptor += node->descriptor->length;
9393
}
9494

9595
void HID_::SendReport(uint8_t id, const void* data, int len)
@@ -165,4 +165,4 @@ HID_::HID_(void)
165165
int HID_::begin(void)
166166
{
167167
return 0;
168-
}
168+
}

hardware/arduino/sam/libraries/HID/HID.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444

4545
typedef struct __attribute__((packed)) {
4646
uint8_t length;
47-
const void* descriptor;
47+
const void* data;
4848
} HID_Descriptor;
4949

5050
class HIDDescriptorListNode {
5151
public:
5252
HIDDescriptorListNode *next = NULL;
53-
const HID_Descriptor * cb;
54-
HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;}
53+
const HID_Descriptor *descriptor;
54+
HIDDescriptorListNode(const HID_Descriptor *d) : descriptor(d) { }
5555
};
5656

5757
class HID_
@@ -90,4 +90,4 @@ typedef struct
9090

9191
#define WEAK __attribute__ ((weak))
9292

93-
#endif
93+
#endif

libraries/Keyboard/src/Keyboard.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
6262

6363
Keyboard_::Keyboard_(void)
6464
{
65-
static HID_Descriptor cb = {
65+
static HID_Descriptor descriptor = {
6666
.length = sizeof(_hidReportDescriptor),
67-
.descriptor = _hidReportDescriptor,
67+
.data = _hidReportDescriptor,
6868
};
69-
static HIDDescriptorListNode node(&cb);
69+
static HIDDescriptorListNode node(&descriptor);
7070
HID.AppendDescriptor(&node);
7171
}
7272

libraries/Mouse/src/Mouse.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
6262

6363
Mouse_::Mouse_(void) : _buttons(0)
6464
{
65-
const static HID_Descriptor cb = {
65+
const static HID_Descriptor descriptor = {
6666
.length = sizeof(_hidReportDescriptor),
67-
.descriptor = _hidReportDescriptor,
67+
.data = _hidReportDescriptor,
6868
};
69-
static HIDDescriptorListNode node(&cb);
69+
static HIDDescriptorListNode node(&descriptor);
7070
HID.AppendDescriptor(&node);
7171
}
7272

0 commit comments

Comments
 (0)