Age | Commit message (Collapse) | Author |
|
|
|
See https://github.com/arduino/Arduino/pull/3840#discussion_r40438845
|
|
This simplifies the object model and produce a small gain in code
size and performance.
|
|
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
|
|
|
|
|
|
with this PR you can add
\#include Keyboard.h
\#include Mouse.h
\#include HID.h
in the top of the sketch and you will expose a Mouse+Keyboard
From the library pow, simply add
static HID_Descriptor cb = {
.length = sizeof(_hidReportDescriptor),
.descriptor = _hidReportDescriptor,
};
static HIDDescriptorListNode node(&cb);
HID.AppendDescriptor(&node);
in the class' constructor and you are done!
|
|
|
|
|
|
|
|
|