Merge pull request #542 from adafruit/update-tinyusbcore-11d669b4d2a40eb2fc5e51b2a9707a6de9d42363
update TinyUSB Core
This commit is contained in:
5 files changed
+35
-35
No files matched your search
Submodule cores/nRF5/TinyUSB/Adafruit_TinyUSB_ArduinoCore updated: 07490772a5...238a5c0b95.
@@ -30,6 +30,16 @@
|
|||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "Adafruit_TinyUSB_Core.h"
|
#include "Adafruit_TinyUSB_Core.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
|
#define USBD_STACK_SZ (200)
|
||||||
|
|
||||||
|
// tinyusb function that handles power event (detected, ready, removed)
|
||||||
|
// We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled.
|
||||||
|
extern "C" void tusb_hal_nrf_power_event(uint32_t event);
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@@ -42,34 +52,10 @@ extern "C" void USBD_IRQHandler(void)
|
|||||||
tud_int_handler(0);
|
tud_int_handler(0);
|
||||||
|
|
||||||
#if CFG_SYSVIEW
|
#if CFG_SYSVIEW
|
||||||
SEGGER_SYSVIEW_RecordExitISR();
|
SEGGER_SYSVIEW_RecordExitISR();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
|
|
||||||
#define USBD_STACK_SZ (200)
|
|
||||||
|
|
||||||
// tinyusb function that handles power event (detected, ready, removed)
|
|
||||||
// We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled.
|
|
||||||
extern "C" void tusb_hal_nrf_power_event(uint32_t event);
|
|
||||||
|
|
||||||
// USB Device Driver task
|
|
||||||
// This top level thread process all usb events and invoke callbacks
|
|
||||||
static void usb_device_task(void* param)
|
|
||||||
{
|
|
||||||
(void) param;
|
|
||||||
|
|
||||||
// RTOS forever loop
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
// tinyusb device task
|
|
||||||
tud_task();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Core Init & Touch1200
|
// Core Init & Touch1200
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@@ -99,8 +85,12 @@ static void usb_hardware_init(void)
|
|||||||
if ( usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
|
if ( usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adafruit_TinyUSB_Core_init(void)
|
// USB Device Driver task
|
||||||
|
// This top level thread process all usb events and invoke callbacks
|
||||||
|
static void usb_device_task(void* param)
|
||||||
{
|
{
|
||||||
|
(void) param;
|
||||||
|
|
||||||
USBDevice.addInterface( (Adafruit_USBD_Interface&) Serial);
|
USBDevice.addInterface( (Adafruit_USBD_Interface&) Serial);
|
||||||
USBDevice.setID(USB_VID, USB_PID);
|
USBDevice.setID(USB_VID, USB_PID);
|
||||||
USBDevice.begin();
|
USBDevice.begin();
|
||||||
@@ -110,6 +100,16 @@ void Adafruit_TinyUSB_Core_init(void)
|
|||||||
// Init tinyusb stack
|
// Init tinyusb stack
|
||||||
tusb_init();
|
tusb_init();
|
||||||
|
|
||||||
|
// RTOS forever loop
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
// tinyusb device task
|
||||||
|
tud_task();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Adafruit_TinyUSB_Core_init(void)
|
||||||
|
{
|
||||||
// Create a task for tinyusb device stack
|
// Create a task for tinyusb device stack
|
||||||
xTaskCreate( usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
|
xTaskCreate( usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -72,14 +72,14 @@ int main( void )
|
|||||||
init();
|
init();
|
||||||
initVariant();
|
initVariant();
|
||||||
|
|
||||||
#ifdef USE_TINYUSB
|
|
||||||
Adafruit_TinyUSB_Core_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CFG_SYSVIEW
|
#if CFG_SYSVIEW
|
||||||
SEGGER_SYSVIEW_Conf();
|
SEGGER_SYSVIEW_Conf();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_TINYUSB
|
||||||
|
Adafruit_TinyUSB_Core_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Create a task for loop()
|
// Create a task for loop()
|
||||||
xTaskCreate( loop_task, "loop", LOOP_STACK_SZ, NULL, TASK_PRIO_LOW, &_loopHandle);
|
xTaskCreate( loop_task, "loop", LOOP_STACK_SZ, NULL, TASK_PRIO_LOW, &_loopHandle);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ nordic.path={build.core.path}/nordic
|
|||||||
|
|
||||||
# build.logger_flags and build.sysview_flags and intentionally empty,
|
# build.logger_flags and build.sysview_flags and intentionally empty,
|
||||||
# to allow modification via a user's own boards.local.txt or platform.local.txt files.
|
# to allow modification via a user's own boards.local.txt or platform.local.txt files.
|
||||||
build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DLFS_NAME_MAX=64 -Ofast {build.debug_flags} {build.logger_flags} {build.sysview_flags} "-I{build.core.path}/cmsis/Core/Include" "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src"
|
build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DLFS_NAME_MAX=64 -Ofast {build.debug_flags} {build.logger_flags} {build.sysview_flags} "-I{build.core.path}/cmsis/Core/Include" "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include/nrf52" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src"
|
||||||
|
|
||||||
# usb flags
|
# usb flags
|
||||||
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
|
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
|
||||||
|
|||||||
+3
-3
@@ -10,7 +10,7 @@ success_count = 0
|
|||||||
fail_count = 0
|
fail_count = 0
|
||||||
skip_count = 0
|
skip_count = 0
|
||||||
|
|
||||||
build_format = '| {:20} | {:35} | {:9} '
|
build_format = '| {:20} | {:35} | {:9} | {:6} |'
|
||||||
build_separator = '-' * 83
|
build_separator = '-' * 83
|
||||||
|
|
||||||
default_boards = [ 'cluenrf52840', 'cplaynrf52840', 'feather52832', 'feather52840', 'feather52840sense', 'itsybitsy52840' ]
|
default_boards = [ 'cluenrf52840', 'cplaynrf52840', 'feather52832', 'feather52840', 'feather52840sense', 'itsybitsy52840' ]
|
||||||
@@ -39,7 +39,7 @@ def build_examples(variant):
|
|||||||
print(build_separator)
|
print(build_separator)
|
||||||
print('| {:^79} |'.format('Board ' + variant))
|
print('| {:^79} |'.format('Board ' + variant))
|
||||||
print(build_separator)
|
print(build_separator)
|
||||||
print((build_format + '| {:6} |').format('Library', 'Example', 'Result', 'Time'))
|
print(build_format.format('Library', 'Example', 'Result', 'Time'))
|
||||||
print(build_separator)
|
print(build_separator)
|
||||||
|
|
||||||
fqbn = "adafruit:nrf52:{}:softdevice={},debug=l0".format(variant, 's140v6' if variant != 'feather52832' else 's132v6')
|
fqbn = "adafruit:nrf52:{}:softdevice={},debug=l0".format(variant, 's140v6' if variant != 'feather52832' else 's132v6')
|
||||||
@@ -83,7 +83,7 @@ def build_examples(variant):
|
|||||||
|
|
||||||
build_duration = time.monotonic() - start_time
|
build_duration = time.monotonic() - start_time
|
||||||
|
|
||||||
print((build_format + '| {:5.2f}s |').format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success, build_duration))
|
print(build_format.format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success, '{:5.2f}s'.format(build_duration)))
|
||||||
|
|
||||||
if success != "\033[33mskipped\033[0m ":
|
if success != "\033[33mskipped\033[0m ":
|
||||||
if build_result.returncode != 0:
|
if build_result.returncode != 0:
|
||||||
|
|||||||
Reference in new issue
Block a user