Commit Graph

19 Commits

Author SHA1 Message Date
Cristian Maglie a151349a01 [HID] renamed HIDDescriptorListNode to HIDSubDescriptor 2015-10-12 12:24:07 +02:00
Martino Facchin 65b8430fec [PUSB] Fix static initialization order fiasco
For details see:
https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use
2015-10-02 11:59:24 +02:00
Nico bd1124eb0f Fixed typo in Keyboard API 2015-09-28 14:21:01 +02:00
Cristian Maglie 401c4f0cf8 HID: merged HID_Descriptor into HIDDescriptorListNode
This simplifies the object model and produce a small gain in code
size and performance.
2015-09-22 16:51:30 +02:00
Cristian Maglie f0cf13c89b 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
2015-09-22 16:49:14 +02:00
Martino Facchin 92a05d2e25 USB libraries: replace non-portable u8 with uint8_t 2015-09-04 16:12:56 +02:00
Cristian Maglie 2659ec6faa Fixed library.properties for Mouse and Keyboard libraries 2015-07-21 16:40:18 +02:00
Martino Facchin f9b9cd03d4 Keyboard: fix endif disappeard during rebase 2015-07-16 16:20:16 +02:00
Martino Facchin af290fc5a3 rework HID-based libraries and add Due fallback 2015-07-16 13:13:53 +02:00
Martino Facchin e1a0350062 allow HID submodules to create runtime descriptors
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!
2015-07-16 13:13:52 +02:00
Martino Facchin 5defaeaa97 rework HID class functions scopes 2015-07-16 13:13:52 +02:00
Martino Facchin dee43a19d7 fix HID headers 2015-07-16 13:13:51 +02:00
Martino Facchin e211f1ea76 remove setupUSB weak hook and replace with global constructors
thanks @matthijskooijman
2015-07-16 13:13:49 +02:00
Martino Facchin 071323196d enforce single use of HID submodule 2015-07-16 13:13:45 +02:00
Martino Facchin 344896ed70 Fix HID derived libraries and add automatic setupUSB() weak hook 2015-07-16 13:12:15 +02:00
Martino Facchin fe825c8f9b standalone Keyboard library 2015-07-16 13:12:15 +02:00
Tom Igoe 9af71ad6e8 Moved Mouse and Keyboard examples for Leonardo into the core examples folder 2011-11-28 15:03:06 -05:00
Tom Igoe 8ccb3bdeb3 Moved Keyboard examples to an examples folder inside the Keyboard library folder 2011-11-23 14:35:18 -05:00
Tom Igoe dc21e1da8a Added examples for the Keyboard library of the Leonardo 2011-10-24 10:55:44 -04:00