Commit Graph

280 Commits

Author SHA1 Message Date
Martino Facchin 8cab209ef9 [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
Cristian Maglie 66d3eabe42 [HID] removed HIDDescriptor field
The field is now built on-the-fly on the stack and sent over USB.
This change increase Flash usage and decrease SRAM usage:

before: 6114 / 241
after:  6152 / 216 (removed HIDDescriptor field)

delta:   +38 / -25

SRAM is a much more scarse resource and this change free up to
about 10% of the "base" usage.
2015-10-02 11:59:24 +02:00
Cristian Maglie 2e328bae3b [HID] Code cleanup (no semantic changes) 2015-10-02 11:59:23 +02:00
Cristian Maglie 0b3244c5ec [HID] removed unused modules_count field 2015-10-02 11:59:23 +02:00
Cristian Maglie bad9b58ce3 [PUSB] Fixed checks on return values 2015-10-02 11:59:23 +02:00
Cristian Maglie 10512b3f9b [USB] Fixed some compiler warnings 2015-10-02 11:59:23 +02:00
Cristian Maglie dbaec17c03 [PUSB] epType array is now part of HID class 2015-10-02 11:59:23 +02:00
Cristian Maglie f8b2d8acb3 [HID] Removed static fields in HID class
There is still the epType[] array to be handled in some way.
2015-10-02 11:59:23 +02:00
Cristian Maglie 27c1832aca [PUSB] The latest fields are now set via constructor 2015-10-02 11:59:23 +02:00
Cristian Maglie 9065229595 [PUSB] callbacks are now pure virtual methods
This change allows the compiler to handle callbacks resolution.

Callbacks now must be implemented on the class that extends
PUSBListNode and this is forced by compiler by means of pure
virtual methods.

Also the calls to HID.interface() and HID.endpoint() can now
be simplified to interface() and endpoint() respectively since
the methods are no more static.
2015-10-02 11:59:23 +02:00
Cristian Maglie ab19daef28 [PUSB] Moved static members inside HID_ class
This commit prepares for the next refactoring
2015-10-02 11:59:22 +02:00
Cristian Maglie 7fee0f0a75 [PUSB] replaced u8 with uint8_t 2015-10-02 11:59:22 +02:00
Cristian Maglie 34a75d9416 [PUSB] Selected interface and endpoint are now part of PUSBListNode
The method

   int8_t PluggableUSB::addFunction(PUSBListNode *, uint8_t *)

has been changed to

   bool PluggableUSB::plug(PUSBListNode *node)

since both EP and Interfaces are now saved directly into node
2015-10-02 11:59:22 +02:00
Cristian Maglie 7811c2ceed [HID] Now HID extends directly PluggableUSBListNode
This avoid duplicate instatiation of callback and save a
considerable amount of flash.
2015-10-02 11:59:22 +02:00
Cristian Maglie c07f988609 [PUSB] Global functions PUSB_* are now methods of PluggableUSB class 2015-10-02 11:59:22 +02:00
Cristian Maglie 7302965552 [PUSB] PUSBCallback struct has been merged into PUSBListNode
This slightly simplifies PluggableUSB API.
2015-10-02 11:59:22 +02:00
Cristian Maglie a8f15a5766 [HID] Added missing return in HID.begin() 2015-09-28 17:05:36 +02:00
Cristian Maglie 691d9fb7f0 [HID] Changed 'u8' to 'uint8_t' in definitions 2015-09-28 17:05:35 +02:00
Cristian Maglie 37e2914dbb [HID] added 'const' qualifier in HID initialization
See https://github.com/arduino/Arduino/pull/3840#discussion_r40438845
2015-09-28 13:32:01 +02:00
Cristian Maglie dfe6048175 Merge branch 'pluggable_hid_impr' of https://github.com/cmaglie/Arduino 2015-09-28 12:06:35 +02:00
Arturo Guadalupi d508e4dc54 Added Arduino Zero exclusion to README 2015-09-28 11:29:18 +02:00
Cristian Maglie 5a5cf764db 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 9b9bf95324 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
Arturo Guadalupi d775df409f Modified reference to Leonardo only in the examples
According to #3786 removed the reference to Leonardo only in while(!Serial) of the examples.
Changed in in "wait for serial port to connect. Needed for native USB port only"
2015-09-21 14:58:58 +02:00
Nico 6153b93907 Remove Raw HID definitions at wrong place 2015-09-20 11:04:42 +02:00
Cristian Maglie b5911b2bc5 Fixed wrong category in EEPROM
See #3812
2015-09-18 11:23:11 +02:00
Cristian Maglie 08de587da7 Added categories to libraries
Fix #3812
2015-09-18 11:01:08 +02:00
Nate Williams 0b27210105 Wire (AVR): Fix bug with repeated START
Fix #66
2015-08-26 16:02:02 +02:00
Sandeep Mistry eab6601ebc implement Wire.end() for AVR core 2015-08-25 10:24:24 -04:00
NicoHood d1fe40060e Added 16 byte endpoint support 2015-08-12 17:48:17 +02:00
NicoHood 488ace3d13 Fixed HID Reports >255 bytes 2015-08-12 17:48:17 +02:00
Martino Facchin 99a27d0bd8 rework HID-based libraries and add Due fallback 2015-07-16 13:13:53 +02:00
Martino Facchin 3d61f6e37e 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 47efb352c9 rework HID class functions scopes 2015-07-16 13:13:52 +02:00
Martino Facchin 3cf30dff25 rename Setup typedef struct to USBSetup
was really too common
2015-07-16 13:13:52 +02:00
Martino Facchin 3d0331b8f6 fix HID headers 2015-07-16 13:13:51 +02:00
Martino Facchin 30ebf7f924 fix HID descriptors bigger than 127 bytes 2015-07-16 13:13:51 +02:00
Martino Facchin f367bcca2c move HID library to AVR specific location 2015-07-16 13:13:51 +02:00
Federico Fissore b5a130afb5 Examples: mass code format. See example_formatter.conf 2015-07-06 15:19:05 +02:00
Matthew Lowe c13cf02651 Support for repeated starts added to SAM Wire library
Additional interface method ported to avr for compatibility
Fix issue #2428.
2015-07-03 16:59:30 +02:00
Federico Fissore b40f171220 Due to website configuration changes, every url starting with http://arduino.cc has been changed to http://www.arduino.cc. Fixes #3191 2015-05-20 17:10:06 +02:00
Federico Fissore 7c585abf3f Libraries bundled with cores will take the type of that core, instead of relying on an undocumented 'types' property. Fixes #2875 2015-05-19 12:24:11 +02:00
Arturo Guadalupi 9a9760cc86 Fixes #2969:
This fixes the Wire examples that uses I2C reserved address (from 0 to 7) substituting them with 8 that is the first one available and that can be used.

I also modified the wire reference
http://www.arduino.cc/en/reference/wire
according to this fact.
2015-05-14 11:27:00 +02:00
Federico Fissore da5830c4bf LibraryManager: better type filtering 2015-03-27 14:51:19 +01:00
Martino Facchin f2debfa255 Merge pull request #2812 from facchinm/test_pr2794
EEPROM library V2
2015-03-24 09:24:00 +00:00
Martino Facchin d8656b8c52 EEPROM: examples: fix Serial for board Leonardo 2015-03-24 10:20:00 +01:00
Chris--A 5da9792cd6 Fixed EEPROM examples and added readme 2015-03-24 13:58:01 +10:00
Chris--A 26577474ef Updated EEPROM examples.
Removed hard coded lengths, which were incorrect for standard Arduino's
now.
2015-03-20 12:06:20 +10:00
Chris--A fd4323f360 Small tweaks to EEPROM lib and examples. 2015-03-19 17:13:32 +10:00
Victor Aprea 8fcf5c9406 Do not influence state of SS if it's already been set to an output previously, e.g. by user sketch
squashes and closes PR #2659
2015-03-18 10:37:40 +01:00