Commit Graph

86 Commits

Author SHA1 Message Date
Dan Halbert
bb77f1d130 wip: initial code changes, starting from @tannewt's sleepio branch 2020-11-16 11:56:20 -05:00
Scott Shawcroft
bda3267432
Save flash space
* No weak link for modules. It only impacts _os and _time and is
  already disabled for non-full builds.
* Turn off PA00 and PA01 because they are the crystal on the Metro
  M0 Express.
* Change ejected default to false to move it to BSS. It is set on
  USB connection anyway.
* Set sinc_filter to const. Doesn't help flash but keeps it out of
  RAM.
2020-11-13 18:57:52 -08:00
Dan Halbert
345d84ffde improve USB CDC disconnect/reconnect checking 2020-10-30 22:25:50 -04:00
Scott Shawcroft
9a4efed8cb
Start tweaking the workflow to sleep 2020-10-27 17:55:03 -07:00
Jeff Epler
28043c94b5 supervisor: Improve serial connection detection
These changes remove the caveat from supervisor.runtime.serial_connected.

It appears that _tud_cdc_connected() only tracks explicit changes to the
"DTR" bit, which leads to disconnects not being registered.

Instead:
 * when line state is changed explicitly, track the dtr value in
   _serial_connected
 * when the USB bus is suspended, set _serial_connected to False

Testing performed (using sam e54 xplained):  Run a program to show
the state of `serial_connected` on the LED:
```
import digitalio
import supervisor
import board

led = digitalio.DigitalInOut(board.LED)
while True:
    led.switch_to_output(not supervisor.runtime.serial_connected)
```

Try all the following:
 * open, close serial terminal program
    - LED status tracks whether terminal is open
 * turn on/off data lines using the switchable charge-only cable
    - LED turns off when switch is in "charger" position
    - LED turns back on when switch is in Data position and terminal is
      opened (but doesn't turn back on just because switch position is
      changed)
2020-09-17 18:32:06 -05:00
Jeff Epler
d4801b8c54
Merge pull request #3225 from hathach/improve-highspeed-usb
Improve highspeed usb
2020-07-30 07:15:20 -05: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
hathach
1f4fcb399b
move CFG_TUSB_RHPORT0_MODE into generated header 2020-07-29 16:05:31 +07:00
hathach
d8fef207d2 remove obsolete CFG in tusb_config.h 2020-07-29 15:45:01 +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
9fd10322fe supervisor: rename some locals for clarity
It's perfectly OK for these variables with static linkage to have the
same name, but it's inconvenient for humans like me.
2020-07-20 08:45:31 -05:00
Jeff Epler
6160d11c5a supervisor: factor out, Handle USB via background callback 2020-07-15 11:49:44 -05:00
Sean Cross
d1a7fdd9d4 supervisor: support debugging tinyusb
Allow for passing `-DCFG_TUSB_DEBUG=1` or `-DCFG_TUSB_DEBUG=2` on the
command line to enable debugging tinyusb within circuitpython.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-21 21:35:30 +08: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
755d404edf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-27 16:45:10 -07:00
Scott Shawcroft
dcb0e50f04
Fix USB midi and hid disable. 2020-04-21 14:15:44 -07:00
Scott Shawcroft
7e3d4c61b5
Update TinyUSB and add interrupt hooks. 2020-04-17 14:16:49 -07:00
Scott Shawcroft
6f60afe8c5
First try at lowering the power consumption 2020-03-13 11:12:30 -07:00
Scott Shawcroft
876c646d09
Fix Mac crash when waking up with an ejected CIRCUITPY
We now correctly set the reason for the unit not being ready and
always start the unit.

Fixes #2567
2020-02-24 15:40:52 -08: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
Dan Halbert
91d791afd0 cleanup adapter.address; add uniquish suffix to BLE device name 2019-07-31 00:30:24 -04:00
hathach
5d03cda01a whitespace 2019-07-24 16:49:13 +07:00
hathach
c921f6637f update tinyusb lib to 0.5.x 2019-07-24 16:46:31 +07:00
Scott Shawcroft
796fc3f5ab
Update font location and shrink a bunch of builds 2019-04-12 15:25:48 -07:00
hathach
9d43a25d6e update tinyusb to fix disconnect/suspend issue with #1681 2019-04-04 17:59:20 -04:00
Scott Shawcroft
1a0596a2fb
Add option to disable the concurrent write protection
This allows writing to the filesystem from the host computer and
CircuitPython by increasing the risk of filesystem corruption.
2019-02-21 10:45:41 -08:00
Lionel Debroux
943216deda Make several const char / const char * arrays static to save a bit of space.
Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
2019-02-07 20:10:43 +01:00
hathach
a51f2b0716 refactor nrfx from supervisor/usb.c 2019-01-30 22:30:23 +07:00
hathach
164e1e2341 re-init usb hardware when enable/disable SD 2019-01-30 14:13:07 +07:00
hathach
d1fb384a4a
update tinyusb, work better with sd 2019-01-29 21:03:18 +07:00
Scott Shawcroft
b5e40f52c2
Add USB MIDI support for SAMD and nRF.
The API should be identical to using a UART for MIDI.

Fixes #672
2019-01-09 14:02:11 -08:00
Scott Shawcroft
324301e3bc
Update tinyusb to include control fixes. 2018-11-23 13:28:10 -08:00
Scott Shawcroft
43f7ca7985
Incorporate feedback:
* Clean up board defines.
* Add flush on eject and stay ejected.
* Swith back to NONE protocol for CDC.
2018-11-09 11:33:56 -08:00
Scott Shawcroft
168e23e466
Build refinement to handle warnings and quiet output 2018-11-09 00:11:43 -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