Skip to content

Commit 9b9bf95

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 d775df4 commit 9b9bf95

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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->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)

libraries/HID/HID.h

+3-3
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_

0 commit comments

Comments
 (0)