From 9b9bf9532471abf373b36e9336a951ad5021fc3a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 22 Sep 2015 00:07:06 +0200 Subject: 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 --- libraries/HID/HID.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libraries/HID/HID.h') diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index b9f29b4..760090a 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -46,14 +46,14 @@ typedef struct __attribute__((packed)) { uint16_t length; - const void* descriptor; + const void* data; } HID_Descriptor; class HIDDescriptorListNode { public: HIDDescriptorListNode *next = NULL; - const HID_Descriptor * cb; - HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;} + const HID_Descriptor *descriptor; + HIDDescriptorListNode(const HID_Descriptor *d) : descriptor(d) { } }; class HID_ -- cgit v1.2.3-18-g5258 From 5a5cf764db88d148f3778a45ec1f9bae1899b3c3 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 22 Sep 2015 01:40:35 +0200 Subject: HID: merged HID_Descriptor into HIDDescriptorListNode This simplifies the object model and produce a small gain in code size and performance. --- libraries/HID/HID.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'libraries/HID/HID.h') diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h index 760090a..1a87bb7 100644 --- a/libraries/HID/HID.h +++ b/libraries/HID/HID.h @@ -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_ -- cgit v1.2.3-18-g5258