File tree Expand file tree Collapse file tree 6 files changed +13
-28
lines changed
Expand file tree Collapse file tree 6 files changed +13
-28
lines changed Original file line number Diff line number Diff 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->descriptor -> data ,current-> descriptor ->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->descriptor -> length ;
85+ sizeof_hidReportDescriptor += (uint16_t )node->length ;
8686}
8787
8888void HID_::SendReport (u8 id, const void * data, int len)
Original file line number Diff line number Diff line change 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 * data;
50- } HID_Descriptor;
51-
5247class HIDDescriptorListNode {
5348public:
5449 HIDDescriptorListNode *next = NULL ;
55- const HID_Descriptor *descriptor;
56- HIDDescriptorListNode (const HID_Descriptor *d) : descriptor(d) { }
50+ HIDDescriptorListNode (const void *d, uint16_t l) : data(d), length(l) { }
51+
52+ const void * data;
53+ uint16_t length;
5754};
5855
5956class HID_
Original file line number Diff line number Diff 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->descriptor -> data ,current-> descriptor ->length );
71+ total += USBD_SendControl (0 ,current->data ,current->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->descriptor -> length ;
92+ sizeof_hidReportDescriptor += node->length ;
9393}
9494
9595void HID_::SendReport (uint8_t id, const void * data, int len)
Original file line number Diff line number Diff line change 4242#define HID_REPORT_DESCRIPTOR_TYPE 0x22
4343#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
4444
45- typedef struct __attribute__ ((packed)) {
46- uint8_t length;
47- const void * data;
48- } HID_Descriptor;
49-
5045class HIDDescriptorListNode {
5146public:
5247 HIDDescriptorListNode *next = NULL ;
53- const HID_Descriptor *descriptor;
54- HIDDescriptorListNode (const HID_Descriptor *d) : descriptor(d) { }
48+ HIDDescriptorListNode (const void *d, uint16_t l) : data(d), length(l) { }
49+ uint8_t length;
50+ const void * data;
5551};
5652
5753class HID_
Original file line number Diff line number Diff line change @@ -62,11 +62,7 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
6262
6363Keyboard_::Keyboard_ (void )
6464{
65- static HID_Descriptor descriptor = {
66- .length = sizeof (_hidReportDescriptor),
67- .data = _hidReportDescriptor,
68- };
69- static HIDDescriptorListNode node (&descriptor);
65+ static HIDDescriptorListNode node (_hidReportDescriptor, sizeof (_hidReportDescriptor));
7066 HID.AppendDescriptor (&node);
7167}
7268
Original file line number Diff line number Diff line change @@ -62,11 +62,7 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
6262
6363Mouse_::Mouse_ (void ) : _buttons(0 )
6464{
65- const static HID_Descriptor descriptor = {
66- .length = sizeof (_hidReportDescriptor),
67- .data = _hidReportDescriptor,
68- };
69- static HIDDescriptorListNode node (&descriptor);
65+ static HIDDescriptorListNode node (_hidReportDescriptor, sizeof (_hidReportDescriptor));
7066 HID.AppendDescriptor (&node);
7167}
7268
You can’t perform that action at this time.
0 commit comments