Commit Graph

24 Commits

Author SHA1 Message Date
Scott Shawcroft 8137e2d6d2
Switch all ports to auto-growing split heap
This simplifies allocating outside of the VM because the VM doesn't
take up all remaining memory by default.

On ESP we delegate to the IDF for allocations. For all other ports,
we use TLSF to manage an outer "port" heap. The IDF uses TLSF
internally and we use their fork for the other ports.

This also removes the dynamic C stack sizing. It wasn't often used
and is not possible with a fixed outer heap.

Fixes #8512. Fixes #7334.
2023-11-01 15:24:16 -07:00
Jeff Epler 910fcf1c93
usb host keyboard: add keymap support
This is confined to pure ASCII, but does support Alt Gr. This is enough
to make a French keyboard layout work:
 * home row is "qsdfghjklm"
 * numerals are all shifted
 * keys like {} require Alt Gr

While not tested, this should also support layouts like Colemak with
the necssary keymap file.

Layouts can be produced from Neradoc's keyboard layout modules on the
device & loaded at runtime. Code to do so is at
    https://gist.github.com/jepler/597c0a00e0eb014a433e03c0ae363a08
as well as a sketch of how an extended format could support dead keys &
the full Unicode BMP instead of just ASCII.
2023-07-12 07:04:56 -05:00
Scott Shawcroft 2686beab36
Basic USB host support and keyboard workflow
Connects up read, write and ctrl_transfer to TinyUSB. USB Host
support is available on iMX RT and RP2040.

Fixes #6527 (imx) and fixes #5986 (rp2).
2023-07-10 14:22:21 -07:00
s-ol 0b525a285a supervisor: Add supervisor.set_usb_identification() function 2022-05-04 11:38:38 +02:00
Scott Shawcroft 83593a1558
Start of USB host API
This allows you to list and explore connected USB devices. It
only stubs out the methods to communicate to endpoints. That will
come in a follow up once TinyUSB has it. (It's in progress.)

Related to #5986
2022-03-07 18:07:25 -08:00
Scott Shawcroft dc76306cfa
Enable a BLE workflow
nRF CircuitPython boards will now provide the file transfer
service defined here: https://github.com/adafruit/Adafruit_CircuitPython_BLE_File_Transfer

USB capable boards will only advertise if previously bonded to a
device or if the reset button is pressed during the fast blue
flashes on start up. When pressed, the board will restart again but
the blue period will not flash.

Boards without USB will always advertise.

When previously bonded, the advertisement is private so that no
other peers can connect. If advertising publicly, the tx power is
lowered to reduce the likelihood of bonding from a distance.

This PR also fixes issues with loading identities of bonded peers
so that our address can now be resolved and we can resolve others'
addresses when scanning.
2021-06-24 12:59:14 -07:00
Dan Halbert fa6c06fb38 count in/out endpoints; allow more usb modules on low-endpoint boards 2021-05-13 21:59:02 -04:00
Dan Halbert 579cdf30f1 fix more build errors 2021-05-05 16:49:29 -04:00
Dan Halbert f06d54524d merge from adafruit 2021-04-28 23:48:26 -04:00
Dan Halbert 587aedd14f rework storage allocation 2021-04-28 13:00:44 -04:00
Dan Halbert 8500e846c6 partially working 2021-04-27 23:53:23 -04:00
Dan Halbert 7a40b4daec very much WIP 2021-04-26 23:54:01 -04:00
Dan Halbert 2b4c88d633 wip: partial HID, still needs rework 2021-04-23 00:18:05 -04:00
Dan Halbert 64e0958916 wip: descriptor building 2021-04-21 23:25:36 -04:00
Jeff Epler 904e94abeb make declatations of usb_msc_ routines conditional
.. as suggested by @dhalbert
2021-03-22 15:04:57 -05:00
hathach 8d7b1f9e8c add usb_background_schedule()
unconditionally schedule usb background after
background_callback_reset()
2021-02-04 16:00:14 +07:00
Scott Shawcroft b73b30ff9f
Switch to upstream TinyUSB 2021-01-21 11:33:13 -08:00
Scott Shawcroft b76d37f24a
Merge pull request #3223 from dhalbert/unmount-before-reset
storage.erase_filesystem(): disconnect from USB and wait 1 second before resetting
2020-07-29 10:47:24 -07:00
Dan Halbert 65c22aa434 storage.erase_filesystem(): unmount and wait 1 second before resetting 2020-07-28 17:52:56 -04:00
Jeff Epler 81105cb9ef supervisor: usb: note that it's unusual to need to call usb_background 2020-07-15 11:49:44 -05:00
Jeff Epler 6160d11c5a supervisor: factor out, Handle USB via background callback 2020-07-15 11:49:44 -05:00
Gadi Rotenberg 07708f1518 Added fix to allow remount when usb enabled but msc is ejected 2020-02-12 09:57:58 +02:00
Scott Shawcroft 561fdfb279
Improve USB eject by resetting on replug 2019-12-17 19:01:03 -08: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