diff options
author | Cristian Maglie <c.maglie@arduino.cc> | 2015-09-22 00:07:06 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@arduino.cc> | 2015-09-22 16:49:14 +0200 |
commit | 9b9bf9532471abf373b36e9336a951ad5021fc3a (patch) | |
tree | 0a41829a342488d7dfac744bfa73ff2203d59c0b | |
parent | d775df409f857ba3a1cc24ecfacbe1321e6fb2ea (diff) |
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
-rw-r--r-- | libraries/HID/HID.cpp | 4 | ||||
-rw-r--r-- | libraries/HID/HID.h | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp index c5954ed..c1b5fdf 100644 --- a/libraries/HID/HID.cpp +++ b/libraries/HID/HID.cpp @@ -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->cb->descriptor,current->cb->length); + total += USB_SendControl(TRANSFER_PGM,current->descriptor->data,current->descriptor->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->cb->length; + sizeof_hidReportDescriptor += (uint16_t)node->descriptor->length; } void HID_::SendReport(u8 id, const void* data, int len) 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_ |