From 9d43a25d6e9336646aa8cf62cad6ae53f232d324 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 2 Apr 2019 13:04:02 +0700 Subject: [PATCH 1/5] update tinyusb to fix disconnect/suspend issue with #1681 --- lib/tinyusb | 2 +- supervisor/shared/usb/usb.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/tinyusb b/lib/tinyusb index 547cc045fa..0848c462b3 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 547cc045fa1d8862e7e00c1d7b4a0026531d0098 +Subproject commit 0848c462b3e431a9da42e96537d2b597a4579636 diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index c77f1e417c..02a5da6c55 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -92,13 +92,15 @@ void tud_mount_cb(void) { void tud_umount_cb(void) { } -uint32_t tusb_hal_millis(void) { - uint64_t ms; - uint32_t us; - current_tick(&ms, &us); - return (uint32_t) ms; +// Invoked when usb bus is suspended +// remote_wakeup_en : if host allows us to perform remote wakeup +// USB Specs: Within 7ms, device must draw an average current less than 2.5 mA from bus +void tud_suspend_cb(bool remote_wakeup_en) { } +// Invoked when usb bus is resumed +void tud_resume_cb(void) { +} // Invoked when cdc when line state changed e.g connected/disconnected // Use to reset to DFU when disconnect with 1200 bps From e5e9d2ba473deadb7d1b076c043775befb70ae6b Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 4 Apr 2019 18:58:35 -0400 Subject: [PATCH 2/5] @hathach's changes; check cdc connected during string write --- supervisor/shared/serial.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index ed210416fe..a61899576f 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -52,15 +52,13 @@ bool serial_bytes_available(void) { } void serial_write_substring(const char* text, uint32_t length) { - #if CIRCUITPY_DISPLAYIO +#if CIRCUITPY_DISPLAYIO int errcode; common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t*) text, length, &errcode); - #endif - if (!tud_cdc_connected()) { - return; - } +#endif + uint32_t count = 0; - while (count < length) { + while (count < length && tud_cdc_connected()) { count += tud_cdc_write(text + count, length - count); usb_background(); } From 50d72ed993e0d4e6d3a48a0a4e06d5b3d55f9efc Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 5 Apr 2019 11:23:47 -0400 Subject: [PATCH 3/5] shrink sparkfun_lumidrive to make room for large translations --- ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk index bd8fa17e9d..a24d08ac9f 100755 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/mpconfigboard.mk @@ -10,8 +10,10 @@ LONGINT_IMPL = MPZ CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +# Make room for frozen libraries. +CFLAGS_INLINE_LIMIT = 65 + EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "W25Q32FV" FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar - From 5f057d183a13f9ae6e286f94be0de291d47a5e1d Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 5 Apr 2019 11:32:58 -0400 Subject: [PATCH 4/5] move pybadge to faster subjob --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 97a894ad74..15addc639a 100755 --- a/.travis.yml +++ b/.travis.yml @@ -22,10 +22,10 @@ git: # just try to make the builds "about equal in run time" env: - 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 - - 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 + - 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 - TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip" TRAVIS_SDK=arm - 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 - - 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 + - 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 addons: artifacts: From 7798eb983dd8f88205b59965fb891b8415b33992 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 5 Apr 2019 11:52:38 -0400 Subject: [PATCH 5/5] updated usb_descriptor submodule per @hathach --- tools/usb_descriptor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/usb_descriptor b/tools/usb_descriptor index e2e79566a8..dac9689e27 160000 --- a/tools/usb_descriptor +++ b/tools/usb_descriptor @@ -1 +1 @@ -Subproject commit e2e79566a807b7230dddbc53a103c19b2f65e2cb +Subproject commit dac9689e274844294bbe4fd1b78defff9ff27533