Commit Graph

30 Commits

Author SHA1 Message Date
Dan Halbert d289329344 Handle HID OUT reports with no report ID 2023-03-28 11:38:38 -04:00
Maxim Kulkin aab5fac67b shared-module/usb_hid: Fix behavior of Device.get_last_received_report()
Documentation states that get_last_received_report() function should
return None if there was no report received previously, otherwise it
should return report. Moreover, same report should be returned only
once. That makes it possible to reliably process incoming OUT/Feature
reports.

This patch adds an array that stores flags if report with particular
ID was received and updates get_last_received_report() to match its
documentation.
2022-08-24 01:34:51 -04:00
Scott Shawcroft 9d10a3da66
Conditionalize LTO 2022-05-27 12:59:54 -07:00
Dan Halbert a01dec1df9 message consolidation and more use of validators 2022-05-19 15:38:37 -04:00
Reece Robinson 4b0f80f081 Enable support for extended HID usage page and usage. Related to Support HID Usage Pages and Usages >255 #5529 2022-04-05 13:54:07 +12:00
Dan Halbert 24c6295ed4 Boot protocol and feature reports: compiles; needs to be tested 2021-10-04 22:48:18 -04:00
Scott Shawcroft 771b4c7464
Add two space saving knobs
* Reduce the number of supported HID reports of IDs per descriptor.
  This saves ~200 bytes in the default HID objects.
* (Not enabled) Compute QSTR attrs on init. This trades 1k RAM for
  flash. Flash is the default (1).
2021-08-31 13:02:34 -07:00
Dan Halbert 1bcf66ff8d Check buffer existence in tud callbacks (addresses #5020) 2021-08-17 15:34:48 -04:00
Dan Halbert 38f42818e9 fix gc; update KEYBOARD report descriptor
The default KEYBOARD report descriptor had a signed/unsigned error,
and also could have allowed more keycodes. So I changed it, using the
very vanilla descriptor from a very plain extremely common commercial
keyboard, modifying it only have 5 LED's instead of 3, and added a
report ID.
2021-08-16 18:59:41 -04:00
Dan Halbert 3dc2b4c2d3 at least original functionality with new API 2021-08-14 12:36:40 -04:00
Dan Halbert 4f8ff12afa wip 2021-08-14 12:36:40 -04:00
ajs256 3c8b8cdba7 `make translate` 2021-05-10 16:57:38 -07:00
ajs256 7cd8e98962 Make two error messages sentence case 2021-05-10 16:51:13 -07:00
Dan Halbert be7b2b00a8 uncrustify with newer version of uncrustify 2021-04-30 10:40:12 -04:00
Dan Halbert abfb020d41 MSC, CDC, HID keyboard definitely working 2021-04-29 17:41:43 -04:00
Dan Halbert f06d54524d merge from adafruit 2021-04-28 23:48:26 -04:00
Dan Halbert f98a54628b wip: compiles 2021-04-27 14:37:36 -04:00
Dan Halbert 7a40b4daec very much WIP 2021-04-26 23:54:01 -04:00
Dan Halbert 556a126917 wip: getting closer 2021-04-23 21:44:13 -04:00
Dan Halbert 2b4c88d633 wip: partial HID, still needs rework 2021-04-23 00:18:05 -04:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Kamil Tomaszewski ef3a61432b Add the missing argument to the HID functions 2021-02-24 19:09:17 +01:00
Yihui Xiong 8bab7b664c support to get HID OUT report 2020-08-19 20:18:17 +08:00
Scott Shawcroft 6f60afe8c5
First try at lowering the power consumption 2020-03-13 11:12:30 -07:00
Jeff Epler 7f744a2369 Supervisor: move most of systick to the supervisor
This code is shared by most parts, except where not all the #ifdefs
inside the tick function were present in all ports.  This mostly would
have broken gamepad tick support on non-samd ports.

The "ms32" and "ms64" variants of the tick functions are introduced
because there is no 64-bit atomic read.  Disabling interrupts avoids
a low probability bug where milliseconds could be off by ~49.5 days
once every ~49.5 days (2^32 ms).

Avoiding disabling interrupts when only the low 32 bits are needed is a minor
optimization.

Testing performed: on metro m4 express, USB still works and
time.monotonic_ns() still counts up
2019-11-18 11:01:23 -06:00
Dan Halbert 42f5edbd33 WIP 2019-09-03 14:44:46 -04:00
Jeff Epler be5205d020 usb_hid: Allow USB work to progress while waiting for tud_hid_ready
Otherwise, examples like the one attached to the related issue fail
because tud_hid_ready never returns true.

Testing performed: Adapted the example to nrf particle xenon (it was
handy), removed dependency on IR, verified that the problem occurred
before this change, and that it was fixed after this change.

Closes: #2048
2019-08-10 09:33:45 -05:00
hathach c921f6637f update tinyusb lib to 0.5.x 2019-07-24 16:46:31 +07:00
Scott Shawcroft 9232ec50f1
Fix HID buffer lookup
The previous code assumed HID report ids were consecutive. This is
not true in the CircuitPython descriptor where report ids are fixed
for each report type.

Fixes #1617
2019-03-27 15:23:20 -07:00
Scott Shawcroft 9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00