mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
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
This commit is contained in:
parent
6cfd50ea8d
commit
f0cf13c89b
@ -61,7 +61,7 @@ int HID_GetDescriptor(int8_t t)
|
|||||||
HIDDescriptorListNode* current = rootNode;
|
HIDDescriptorListNode* current = rootNode;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
while(current != NULL) {
|
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;
|
current = current->next;
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
@ -82,7 +82,7 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
|
|||||||
current->next = node;
|
current->next = node;
|
||||||
}
|
}
|
||||||
modules_count++;
|
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)
|
void HID_::SendReport(u8 id, const void* data, int len)
|
||||||
|
@ -46,14 +46,14 @@
|
|||||||
|
|
||||||
typedef struct __attribute__((packed)) {
|
typedef struct __attribute__((packed)) {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
const void* descriptor;
|
const void* data;
|
||||||
} HID_Descriptor;
|
} HID_Descriptor;
|
||||||
|
|
||||||
class HIDDescriptorListNode {
|
class HIDDescriptorListNode {
|
||||||
public:
|
public:
|
||||||
HIDDescriptorListNode *next = NULL;
|
HIDDescriptorListNode *next = NULL;
|
||||||
const HID_Descriptor * cb;
|
const HID_Descriptor *descriptor;
|
||||||
HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;}
|
HIDDescriptorListNode(const HID_Descriptor *d) : descriptor(d) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class HID_
|
class HID_
|
||||||
|
@ -68,7 +68,7 @@ int HID_GetDescriptor(int8_t t)
|
|||||||
HIDDescriptorListNode* current = rootNode;
|
HIDDescriptorListNode* current = rootNode;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
while(current != NULL) {
|
while(current != NULL) {
|
||||||
total += USBD_SendControl(0,current->cb->descriptor,current->cb->length);
|
total += USBD_SendControl(0,current->descriptor->data,current->descriptor->length);
|
||||||
current = current->next;
|
current = current->next;
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
@ -89,7 +89,7 @@ void HID_::AppendDescriptor(HIDDescriptorListNode *node)
|
|||||||
current->next = node;
|
current->next = node;
|
||||||
}
|
}
|
||||||
modules_count++;
|
modules_count++;
|
||||||
sizeof_hidReportDescriptor += node->cb->length;
|
sizeof_hidReportDescriptor += node->descriptor->length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HID_::SendReport(uint8_t id, const void* data, int len)
|
void HID_::SendReport(uint8_t id, const void* data, int len)
|
||||||
|
@ -44,14 +44,14 @@
|
|||||||
|
|
||||||
typedef struct __attribute__((packed)) {
|
typedef struct __attribute__((packed)) {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
const void* descriptor;
|
const void* data;
|
||||||
} HID_Descriptor;
|
} HID_Descriptor;
|
||||||
|
|
||||||
class HIDDescriptorListNode {
|
class HIDDescriptorListNode {
|
||||||
public:
|
public:
|
||||||
HIDDescriptorListNode *next = NULL;
|
HIDDescriptorListNode *next = NULL;
|
||||||
const HID_Descriptor * cb;
|
const HID_Descriptor *descriptor;
|
||||||
HIDDescriptorListNode(const HID_Descriptor *ncb) {cb = ncb;}
|
HIDDescriptorListNode(const HID_Descriptor *d) : descriptor(d) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class HID_
|
class HID_
|
||||||
|
@ -62,11 +62,11 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
|
|||||||
|
|
||||||
Keyboard_::Keyboard_(void)
|
Keyboard_::Keyboard_(void)
|
||||||
{
|
{
|
||||||
static HID_Descriptor cb = {
|
static HID_Descriptor descriptor = {
|
||||||
.length = sizeof(_hidReportDescriptor),
|
.length = sizeof(_hidReportDescriptor),
|
||||||
.descriptor = _hidReportDescriptor,
|
.data = _hidReportDescriptor,
|
||||||
};
|
};
|
||||||
static HIDDescriptorListNode node(&cb);
|
static HIDDescriptorListNode node(&descriptor);
|
||||||
HID.AppendDescriptor(&node);
|
HID.AppendDescriptor(&node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,11 +62,11 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
|
|||||||
|
|
||||||
Mouse_::Mouse_(void) : _buttons(0)
|
Mouse_::Mouse_(void) : _buttons(0)
|
||||||
{
|
{
|
||||||
const static HID_Descriptor cb = {
|
const static HID_Descriptor descriptor = {
|
||||||
.length = sizeof(_hidReportDescriptor),
|
.length = sizeof(_hidReportDescriptor),
|
||||||
.descriptor = _hidReportDescriptor,
|
.data = _hidReportDescriptor,
|
||||||
};
|
};
|
||||||
static HIDDescriptorListNode node(&cb);
|
static HIDDescriptorListNode node(&descriptor);
|
||||||
HID.AppendDescriptor(&node);
|
HID.AppendDescriptor(&node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user