HID: merged HID_Descriptor into HIDDescriptorListNode
This simplifies the object model and produce a small gain in code size and performance.
This commit is contained in:
parent
9b9bf95324
commit
5a5cf764db
|
@ -61,7 +61,7 @@ int HID_GetDescriptor(int8_t t)
|
|||
HIDDescriptorListNode* current = rootNode;
|
||||
int total = 0;
|
||||
while(current != NULL) {
|
||||
total += USB_SendControl(TRANSFER_PGM,current->descriptor->data,current->descriptor->length);
|
||||
total += USB_SendControl(TRANSFER_PGM,current->data,current->length);
|
||||
current = current->next;
|
||||
}
|
||||
return total;
|
||||
|
@ -82,7 +82,7 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
|
|||
current->next = node;
|
||||
}
|
||||
modules_count++;
|
||||
sizeof_hidReportDescriptor += (uint16_t)node->descriptor->length;
|
||||
sizeof_hidReportDescriptor += (uint16_t)node->length;
|
||||
}
|
||||
|
||||
void HID_::SendReport(u8 id, const void* data, int len)
|
||||
|
|
|
@ -44,16 +44,13 @@
|
|||
#define HID_REPORT_DESCRIPTOR_TYPE 0x22
|
||||
#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
|
||||
|
||||
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) { }
|
||||
HIDDescriptorListNode(const void *d, uint16_t l) : data(d), length(l) { }
|
||||
|
||||
const void* data;
|
||||
uint16_t length;
|
||||
};
|
||||
|
||||
class HID_
|
||||
|
|
Loading…
Reference in New Issue