Skip to content

Commit b9e3781

Browse files
authored
Merge pull request #1748 from dhalbert/usb-disconnect
update tinyusb to fix disconnect/suspend issue with #1681
2 parents b5bc8b3 + 7798eb9 commit b9e3781

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ git:
2222
# just try to make the builds "about equal in run time"
2323
env:
2424
- TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini" TRAVIS_SDK=arm:nrf
25-
- TRAVIS_BOARDS="metro_m0_express metro_m4_express metro_m4_airlift_lite pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo pybadge" TRAVIS_SDK=arm
25+
- TRAVIS_BOARDS="metro_m0_express metro_m4_express metro_m4_airlift_lite pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo" TRAVIS_SDK=arm
2626
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip" TRAVIS_SDK=arm
2727
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10" TRAVIS_SDK=arm
28-
- TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal sparkfun_samd21_mini sparkfun_samd21_dev" TRAVIS_SDK=arm
28+
- TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal sparkfun_samd21_mini sparkfun_samd21_dev pybadge" TRAVIS_SDK=arm
2929

3030
addons:
3131
artifacts:

lib/tinyusb

Submodule tinyusb updated 121 files

ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ LONGINT_IMPL = MPZ
1010
CHIP_VARIANT = SAMD21G18A
1111
CHIP_FAMILY = samd21
1212

13+
# Make room for frozen libraries.
14+
CFLAGS_INLINE_LIMIT = 65
15+
1316
EXTERNAL_FLASH_DEVICE_COUNT = 1
1417
EXTERNAL_FLASH_DEVICES = "W25Q32FV"
1518

1619
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar
17-

supervisor/shared/serial.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ bool serial_bytes_available(void) {
5252
}
5353

5454
void serial_write_substring(const char* text, uint32_t length) {
55-
#if CIRCUITPY_DISPLAYIO
55+
#if CIRCUITPY_DISPLAYIO
5656
int errcode;
5757
common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode);
58-
#endif
59-
if (!tud_cdc_connected()) {
60-
return;
61-
}
58+
#endif
59+
6260
uint32_t count = 0;
63-
while (count < length) {
61+
while (count < length && tud_cdc_connected()) {
6462
count += tud_cdc_write(text + count, length - count);
6563
usb_background();
6664
}

supervisor/shared/usb/usb.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,15 @@ void tud_mount_cb(void) {
9292
void tud_umount_cb(void) {
9393
}
9494

95-
uint32_t tusb_hal_millis(void) {
96-
uint64_t ms;
97-
uint32_t us;
98-
current_tick(&ms, &us);
99-
return (uint32_t) ms;
95+
// Invoked when usb bus is suspended
96+
// remote_wakeup_en : if host allows us to perform remote wakeup
97+
// USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus
98+
void tud_suspend_cb(bool remote_wakeup_en) {
10099
}
101100

101+
// Invoked when usb bus is resumed
102+
void tud_resume_cb(void) {
103+
}
102104

103105
// Invoked when cdc when line state changed e.g connected/disconnected
104106
// Use to reset to DFU when disconnect with 1200 bps

0 commit comments

Comments
 (0)