Skip to content

Commit 58135cb

Browse files
committed
Merge branch 'pluggable_hid_impr' of https://github.com/cmaglie/Arduino
2 parents 27d6dd3 + 10bd8de commit 58135cb

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

Diff for: libraries/HID/HID.cpp

+2-2
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->data,current->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->length;
8686
}
8787

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

Diff for: libraries/HID/HID.h

+4-7
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,13 @@
4444
#define HID_REPORT_DESCRIPTOR_TYPE 0x22
4545
#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
4646

47-
typedef struct __attribute__((packed)) {
48-
uint16_t length;
49-
const void* descriptor;
50-
} HID_Descriptor;
51-
5247
class HIDDescriptorListNode {
5348
public:
5449
HIDDescriptorListNode *next = NULL;
55-
const HID_Descriptor * cb;
56-
HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;}
50+
HIDDescriptorListNode(const void *d, uint16_t l) : data(d), length(l) { }
51+
52+
const void* data;
53+
uint16_t length;
5754
};
5855

5956
class HID_

0 commit comments

Comments
 (0)