Skip to content

Commit a18a1f5

Browse files
committed
fix build issue
1 parent 540c39c commit a18a1f5

File tree

6 files changed

+32
-22
lines changed

6 files changed

+32
-22
lines changed

cores/nRF5/main.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ void initVariant() __attribute__((weak));
4646
void initVariant() { }
4747

4848
#define LOOP_STACK_SZ (512*3)
49-
#define USBD_STACK_SZ (150)
5049

5150
static void loop_task(void* arg)
5251
{
@@ -75,20 +74,6 @@ static void loop_task(void* arg)
7574
}
7675
}
7776

78-
// USB Device Driver task
79-
// This top level thread process all usb events and invoke callbacks
80-
static void usb_device_task(void* param)
81-
{
82-
(void) param;
83-
84-
// RTOS forever loop
85-
while (1)
86-
{
87-
// tinyusb device task
88-
tud_task();
89-
}
90-
}
91-
9277
// \brief Main entry point of Arduino application
9378
int main( void )
9479
{
@@ -99,9 +84,6 @@ int main( void )
9984
USBDevice.addInterface( (Adafruit_USBDev_Interface&) Serial);
10085
USBDevice.begin(USB_VID, USB_PID);
10186
usb_init();
102-
103-
// Create a task for tinyusb device stack
104-
xTaskCreate( usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
10587
#endif
10688

10789
#if CFG_DEBUG >= 3

cores/nRF5/nordic/nrfx/mdk/system_nrf52.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ NOTICE: This file has been modified by Nordic Semiconductor ASA.
2323
/* NOTE: Template files (including this one) are application specific and therefore expected to
2424
be copied into the application project folder prior to its use! */
2525

26+
#ifdef NRF52832_XXAA
27+
2628
#include <stdint.h>
2729
#include <stdbool.h>
2830
#include "nrf.h"
@@ -369,5 +371,6 @@ static bool errata_182(void)
369371
return false;
370372
}
371373

372-
373374
/*lint --flb "Leave library region" */
375+
376+
#endif

cores/nRF5/nordic/nrfx/mdk/system_nrf52840.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ NOTICE: This file has been modified by Nordic Semiconductor ASA.
2222

2323
/* NOTE: Template files (including this one) are application specific and therefore expected to
2424
be copied into the application project folder prior to its use! */
25-
25+
26+
#ifdef NRF52840_XXAA
27+
2628
#include <stdint.h>
2729
#include <stdbool.h>
2830
#include "nrf.h"
@@ -298,3 +300,5 @@ static bool errata_136(void)
298300
}
299301

300302
/*lint --flb "Leave library region" */
303+
#endif
304+

cores/nRF5/usb/usb.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@
3232
#include "tusb.h"
3333
#include "usb.h"
3434

35+
#include "rtos.h"
36+
3537
//--------------------------------------------------------------------+
3638
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
3739
//--------------------------------------------------------------------+
40+
41+
#define USBD_STACK_SZ (150)
42+
3843
// Serial is 64-bit DeviceID -> 16 chars len
3944
uint16_t usb_desc_str_serial[1+16] = { TUD_DESC_STR_HEADER(16) };
4045

46+
static void usb_device_task(void* param);
47+
4148
// Init usb when starting up. Softdevice is not enabled yet
4249
void usb_init(void)
4350
{
@@ -73,6 +80,9 @@ void usb_init(void)
7380

7481
// Init tinyusb stack
7582
tusb_init();
83+
84+
// Create a task for tinyusb device stack
85+
xTaskCreate( usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
7686
}
7787

7888
// Must be called before sd_softdevice_enable()
@@ -93,6 +103,19 @@ void usb_softdevice_post_enable(void)
93103
sd_power_usbremoved_enable(true);
94104
}
95105

106+
// USB Device Driver task
107+
// This top level thread process all usb events and invoke callbacks
108+
static void usb_device_task(void* param)
109+
{
110+
(void) param;
111+
112+
// RTOS forever loop
113+
while (1)
114+
{
115+
// tinyusb device task
116+
tud_task();
117+
}
118+
}
96119

97120
// Invoked when cdc when line state changed e.g connected/disconnected
98121
// 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)
110133
}
111134
}
112135

113-
114-
115136
#endif

0 commit comments

Comments
 (0)