Skip to content

Commit ef60b5d

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 f5e505d commit ef60b5d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

libraries/HID/HID.cpp

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

libraries/HID/HID.h

+4-4
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

0 commit comments

Comments
 (0)