Commit Graph

81 Commits

Author SHA1 Message Date
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
9d1fcc3b14 merge from main 2021-04-25 10:27:52 -04:00
Artyom Skrobov
4e3c1d4a4c [build] Allow USB to be set to 0
Unify USB-related makefile var and C def as CIRCUITPY_USB.

Always define it as 0 or 1, same as all other settings.

USB_AVAILABLE was conditionally defined in supervisor.mk,
but never actually used to #ifdef USB-related code.

Loosely related to #4546
2021-04-23 11:13:34 -04:00
Dan Halbert
64e0958916 wip: descriptor building 2021-04-21 23:25:36 -04:00
Dan Halbert
51ccf8dc30 wip: revert usb_descriptor changes; use raw descriptors instead 2021-04-19 23:24:18 -04:00
Scott Shawcroft
eacb7dbe58
Don't block serial output in interrupt
The interrupt may have a higher priority than the serial output's
(USB) interrupt and may never make room. This makes prints from
interrupts (like the BLE event calls) best effort for what can be
queued up. The rest of the output will be dropped.
2021-04-09 12:56:03 -07:00
Scott Shawcroft
01c153cd7e
Fix devices include by splitting type from defines 2021-03-25 11:37:08 -07:00
Scott Shawcroft
aec0ef3cbf
Switch devices.h to nvm.toml data 2021-03-25 09:57:18 -07:00
Scott Shawcroft
5d2b60cbf6
Redo RP2040 flash settings
This switches stage2 to C and uses Jinja to change the C code based
on flash settings from https://github.com/adafruit/nvm.toml. It
produces the fastest settings for the given set of external flashes.
Flash size is no longer hard coded so switching flashes with similar
capabilities but different sizes should *just work*.

This PR also places "ITCM" code in RAM to save the XIP cache for
code execution. Further optimization is possible. A blink code.py
still requires a number of flash fetches every blink.

Fixes #4041
2021-03-18 16:55:42 -07:00
Jeff Epler
32475ce98c Automatically count EXTERNAL_FLASH_DEVICES (mk2)
Instead of counting words in make, which is slightly awful, notice that
possible_devices is local to external_flash.c, so we can declare the array
with an automatic bound, and then get the count as the element-count
(MP_ARRAY_SIZE) of the array.

Since EXTERNAL_FLASH_DEVICE_COUNT is no longer a global macro, switch
a few sites to using EXTERNAL_FLASH_DEVICES in `#if` checks instead.
2021-03-07 12:51:47 -06:00
Jeff Epler
f1ada8e880 Automatically count EXTERNAL_FLASH_DEVICES 2021-03-07 11:48:39 -06:00
Dan Halbert
d54b5861a3 wip 2021-02-12 19:01:14 -05:00
Dan Halbert
f0564b4986 merge from upstream; complicated webusb merge 2021-02-11 18:50:02 -05:00
Dan Halbert
0802b22ed6 usb descriptors all set; rework of enabling for USB devices 2021-02-04 19:23:40 -05:00
Kevin Banks
c4a795b1e7 Changed URL 2021-02-04 16:31:18 -06:00
Kevin Banks
fbfb7b68cc Most of the code we need has been pulled in from the tinyusb webusb_serial demo. Still LOTS to do regarding descriptors. 2021-01-25 20:37:58 -06:00
Scott Shawcroft
9a4efed8cb
Start tweaking the workflow to sleep 2020-10-27 17:55:03 -07:00
Dan Halbert
f714f53552 Merge remote-tracking branch 'adafruit/main' into ble_hci 2020-08-21 10:45:05 -04:00
Dan Halbert
0e30dd8bcc merge from upstream; working; includes debug_out code for debugging via Saleae for posterity 2020-08-20 20:29:57 -04:00
Jeff Epler
23aefe9509 Add usb-endpoint-count checking
.. however, the number of endpoints is only set for SAMD (8).
Other ports need to set the value.  Otherwise, the build will show
the message
```
Unable to check whether maximum number of endpoints is respected
```
2020-08-19 16:47:40 -05:00
Scott Shawcroft
d01f5dc0bd
Turn off terminalio for ja and ko
The font is missing many characters and the build needs the space.
We can optimize font storage when we get a good font.

The serial output will work as usual.
2020-08-17 17:17:59 -07:00
Dan Halbert
0a60aee3e4 wip: compiles 2020-08-02 11:36:38 -04:00
hathach
6063828279 replace USB_MSC_MAX_PACKET_SIZE with USB_HIGHSPEED in descriptor gen tool 2020-07-29 15:38:55 +07:00
Jeff Epler
1474fccd2f supervisor: Add a linked list of background callbacks
In time, we should transition interrupt driven background tasks out of the
overall run_background_tasks into distinct background callbacks,
so that the number of checks that occur with each tick is reduced.
2020-07-15 09:26:47 -05:00
Dan Halbert
759929c24a hci early wip; refactor supervisor bluetooth.c for nrf: tested 2020-06-25 20:57:17 -04:00
Jeff Epler
bf460ddf25
supervisor.mk: Conditionally assign USB_DEVICES
This restores the ability to remove CDC and/or MSC, at the price of
giving up the new automatic check that USB_DEVICES is correct.
Since devices have to have CDC and MSC to be "CircuitPython",
this is not a facility that is going to be used by any in-tree drivers.
2020-06-24 09:44:45 -05:00
Jeff Epler
f232aef786 supervisor.mk: Compute USB_DEVICES; remove from boards and ports
Since Actions passed on the previous commit, where this computed value
was checked against the specified value (if any), this is no net change,
except that we no longer need to specify it for particular boards or
ports.
2020-06-23 12:59:01 -05:00
Jeff Epler
8bbd539031 supervisor.mk: Compute what USB_DEVICES should be, and check it against what it is 2020-06-15 19:14:57 -05:00
Scott Shawcroft
6aaab005c5
Initial ESP32S2 port.
Basic blinky works but doesn't check pins.
2020-05-15 15:36:16 -07:00
Scott Shawcroft
dcb0e50f04
Fix USB midi and hid disable. 2020-04-21 14:15:44 -07:00
Dan Halbert
68f9aee992 reset NeoPixels on CPB on soft reload 2020-01-23 20:16:31 -05:00
Dan Halbert
013c840862 working on all ports 2019-12-10 20:27:30 -05:00
Dan Halbert
40434d6919 wip 2019-12-05 22:45:53 -05: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
Thea Flowers
67ff1c92f0
Allow boards to change the "CircuitPython" text in their USB interface description.
In cases where more than one board is connected to a single computer it can become pretty hard to figure out which board you're actually talking to. For example, if you have several MIDI-compatible boards they all show up as "CircuitPython MIDI". This change allows boards to replace the "CircuitPython" part of their USB descriptors with more specific text, for example, "CircuitPython Feather" or just "Feather". This will let folks more easily tell boards apart.

The new option is named `USB_INTERFACE_NAME` and is available in `mkconfigboard.mk`. For example:

```
USB_INTERFACE_NAME = "Feather"
```
2019-11-12 13:29:35 -08:00
Scott Shawcroft
ae30a1e5aa
Refine _bleio
This PR refines the _bleio API. It was originally motivated by
the addition of a new CircuitPython service that enables reading
and modifying files on the device. Moving the BLE lifecycle outside
of the VM motivated a number of changes to remove heap allocations
in some APIs.

It also motivated unifying connection initiation to the Adapter class
rather than the Central and Peripheral classes which have been removed.
Adapter now handles the GAP portion of BLE including advertising, which
has moved but is largely unchanged, and scanning, which has been enhanced
to return an iterator of filtered results.

Once a connection is created (either by us (aka Central) or a remote
device (aka Peripheral)) it is represented by a new Connection class.
This class knows the current connection state and can discover and
instantiate remote Services along with their Characteristics and
Descriptors.

Relates to #586
2019-10-21 18:57:03 -07:00
Dan Halbert
be8136dc6d Merge remote-tracking branch 'adafruit/master' into bonding1 2019-10-15 15:55:21 -04:00
kamtom480
f6e553f89f
Merge branch 'master' into circuitpython-number-endpoint 2019-10-08 09:41:29 +02:00
Kamil Tomaszewski
29844db332 Use boolean type for renumber_endpoints 2019-10-08 09:26:02 +02:00
Kamil Tomaszewski
badf32e88d Add HID OUT 2019-10-07 13:40:44 +02:00
Kamil Tomaszewski
1205d3e305 Add validation 2019-10-07 12:31:42 +02:00
Kamil Tomaszewski
7aefcc449a Add an alternative way to number the USB endpoints
Two options available:
- relative numbering (USB_RELATIVE_EP_NUM = 1) - default
- absolute numbering (USB_RELATIVE_EP_NUM = 0) - new!
2019-10-07 12:31:42 +02:00
Dan Halbert
fc19e03128 WIP: bonding 2019-10-06 21:30:26 -04:00
Kamil Tomaszewski
ef42abb818 Add a way to change max packet size for MSC 2019-10-04 13:49:33 +02:00
Dan Halbert
f3af2a6fb7 Merge remote-tracking branch 'adafruit/master' into choose-usb-devices-xac 2019-09-04 21:56:13 -04:00
Dan Halbert
195de97c67 use only one endpoint pair for MSC except on SAMD21 2019-09-04 21:45:16 -04:00
Hierophect
479b047618 Reverted descriptor changes pending HID restructuring 2019-09-04 13:58:18 -04:00
Dan Halbert
42f5edbd33 WIP 2019-09-03 14:44:46 -04:00
Hierophect
e490e6361f Add warnings, cosmetic fixes, remove vestigial modules 2019-08-19 10:47:18 -04:00