fix build issue

This commit is contained in:
hathach committed 2019-04-19 21:45:23 +07:00
1 parent 540c39c95d
commit a18a1f53b9
6 files changed
+32 -22

No files matched your search

-18
View File
@@ -46,7 +46,6 @@ void initVariant() __attribute__((weak));
void initVariant() { }
#define LOOP_STACK_SZ (512*3)
#define USBD_STACK_SZ (150)
static void loop_task(void* arg)
{
@@ -75,20 +74,6 @@ static void loop_task(void* arg)
}
}
// 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();
}
}
// \brief Main entry point of Arduino application
int main( void )
{
@@ -99,9 +84,6 @@ int main( void )
USBDevice.addInterface( (Adafruit_USBDev_Interface&) Serial);
USBDevice.begin(USB_VID, USB_PID);
usb_init();
// Create a task for tinyusb device stack
xTaskCreate( usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
#endif
#if CFG_DEBUG >= 3
+4 -1
View File
@@ -23,6 +23,8 @@ NOTICE: This file has been modified by Nordic Semiconductor ASA.
/* NOTE: Template files (including this one) are application specific and therefore expected to
be copied into the application project folder prior to its use! */
#ifdef NRF52832_XXAA
#include <stdint.h>
#include <stdbool.h>
#include "nrf.h"
@@ -369,5 +371,6 @@ static bool errata_182(void)
return false;
}
/*lint --flb "Leave library region" */
#endif
+5 -1
View File
@@ -22,7 +22,9 @@ NOTICE: This file has been modified by Nordic Semiconductor ASA.
/* NOTE: Template files (including this one) are application specific and therefore expected to
be copied into the application project folder prior to its use! */
#ifdef NRF52840_XXAA
#include <stdint.h>
#include <stdbool.h>
#include "nrf.h"
@@ -298,3 +300,5 @@ static bool errata_136(void)
}
/*lint --flb "Leave library region" */
#endif
+23 -2
View File
@@ -32,12 +32,19 @@
#include "tusb.h"
#include "usb.h"
#include "rtos.h"
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+
#define USBD_STACK_SZ (150)
// Serial is 64-bit DeviceID -> 16 chars len
uint16_t usb_desc_str_serial[1+16] = { TUD_DESC_STR_HEADER(16) };
static void usb_device_task(void* param);
// Init usb when starting up. Softdevice is not enabled yet
void usb_init(void)
{
@@ -73,6 +80,9 @@ void usb_init(void)
// Init tinyusb stack
tusb_init();
// Create a task for tinyusb device stack
xTaskCreate( usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
}
// Must be called before sd_softdevice_enable()
@@ -93,6 +103,19 @@ void usb_softdevice_post_enable(void)
sd_power_usbremoved_enable(true);
}
// 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();
}
}
// Invoked when cdc when line state changed e.g connected/disconnected
// Use to reset to DFU when disconnect with 1200 bps
@@ -110,6 +133,4 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
}
}
#endif