Skip to content

Commit f1012ea

Browse files
committed
use USE_TINYUSB instead of USBCON for consistency, USBCON still defined to be compatible with 3rd party lib
1 parent e89b863 commit f1012ea

File tree

10 files changed

+22
-17
lines changed

10 files changed

+22
-17
lines changed

cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_TinyUSB_Core.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
* THE SOFTWARE.
2323
*/
24-
#ifdef USBCON
24+
25+
#ifdef USE_TINYUSB
2526

2627
#include "nrfx.h"
2728
#include "nrfx_power.h"
@@ -111,4 +112,4 @@ void Adafruit_TinyUSB_Core_init(void)
111112
xTaskCreate( usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
112113
}
113114

114-
#endif
115+
#endif // USE_TINYUSB

cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_TinyUSB_Core.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#ifndef ADAFRUIT_TINYUSB_CORE_H_
2626
#define ADAFRUIT_TINYUSB_CORE_H_
2727

28+
#ifndef USE_TINYUSB
29+
#error TinyUSB is not selected, please select it in Tools->Menu->USB Stack
30+
#endif
31+
2832
#include "tusb.h"
2933

3034
#ifdef __cplusplus

cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* THE SOFTWARE.
2323
*/
2424

25-
#ifdef USBCON
25+
#ifdef USE_TINYUSB
2626

2727
#include "Arduino.h"
2828
#include "Adafruit_USBD_CDC.h"
@@ -137,4 +137,4 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
137137

138138
}
139139

140-
#endif // USBCON
140+
#endif // USE_TINYUSB

cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_Device.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* THE SOFTWARE.
2323
*/
2424

25-
#ifdef USBCON
25+
#ifdef USE_TINYUSB
2626

2727
#include "Adafruit_USBD_Device.h"
2828

@@ -184,4 +184,4 @@ bool Adafruit_USBD_Device::begin(void)
184184
return true;
185185
}
186186

187-
#endif
187+
#endif // USE_TINYUSB

cores/nRF5/Adafruit_TinyUSB_Core/tusb_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
//--------------------------------------------------------------------
3535
#define CFG_TUSB_MCU OPT_MCU_NRF5X
3636

37-
#ifdef NRF52840_XXAA
37+
#ifdef USE_TINYUSB
3838
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
3939
#else
4040
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_NONE

cores/nRF5/Arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void suspendLoop(void);
6767
#include "utility/utilities.h"
6868
#include "utility/AdaCallback.h"
6969

70-
#ifdef USBCON
70+
#ifdef USE_TINYUSB
7171
#include "Adafruit_TinyUSB_Core.h"
7272
#endif
7373

cores/nRF5/delay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void delay( uint32_t ms )
3939
{
4040
uint32_t ticks = ms2tick(ms);
4141

42-
#ifdef USBCON
42+
#ifdef USE_TINYUSB
4343
// Take chance to flush usb cdc
4444
uint32_t flush_tick = xTaskGetTickCount();
4545
tud_cdc_write_flush();

cores/nRF5/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void loop_task(void* arg)
5757
{
5858
loop();
5959

60-
#ifdef USBCON
60+
#ifdef USE_TINYUSB
6161
tud_cdc_write_flush();
6262
#endif
6363

@@ -72,7 +72,7 @@ int main( void )
7272
init();
7373
initVariant();
7474

75-
#ifdef USBCON
75+
#ifdef USE_TINYUSB
7676
Adafruit_TinyUSB_Core_init();
7777
#endif
7878

libraries/Bluefruit52Lib/src/bluefruit.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#define CFG_SOC_TASK_STACKSIZE (200)
5555
#endif
5656

57-
#ifdef USBCON
57+
#ifdef USE_TINYUSB
5858
#include "nrfx_power.h"
5959

6060
/* tinyusb function that handles power event (detected, ready, removed)
@@ -290,7 +290,7 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
290290
_prph_count = prph_count;
291291
_central_count = central_count;
292292

293-
#ifdef USBCON
293+
#ifdef USE_TINYUSB
294294
usb_softdevice_pre_enable();
295295
#endif
296296

@@ -319,7 +319,7 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
319319

320320
VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb), false );
321321

322-
#ifdef USBCON
322+
#ifdef USE_TINYUSB
323323
usb_softdevice_post_enable();
324324
#endif
325325

@@ -461,7 +461,7 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
461461
VERIFY_STATUS(sd_ble_gap_device_name_set(&sec_mode, (uint8_t const *) CFG_DEFAULT_NAME, strlen(CFG_DEFAULT_NAME)), false);
462462

463463
//------------- USB -------------//
464-
#ifdef USBCON
464+
#ifdef USE_TINYUSB
465465
sd_power_usbdetected_enable(true);
466466
sd_power_usbpwrrdy_enable(true);
467467
sd_power_usbremoved_enable(true);
@@ -713,7 +713,7 @@ void adafruit_soc_task(void* arg)
713713
if ( flash_nrf5x_event_cb ) flash_nrf5x_event_cb(soc_evt);
714714
break;
715715

716-
#ifdef USBCON
716+
#ifdef USE_TINYUSB
717717
/*------------- usb power event handler -------------*/
718718
case NRF_EVT_POWER_USB_DETECTED:
719719
case NRF_EVT_POWER_USB_POWER_READY:

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ nordic.path={build.core.path}/nordic
6262
build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_FEATHER52 -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -Os {build.debug_flags} "-I{build.core.path}/cmsis/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}/Adafruit_TinyUSB_Core" "-I{build.core.path}/Adafruit_TinyUSB_Core/tinyusb/src"
6363

6464
# usb flags
65-
build.flags.usb= -DUSBCON -DUSB_VID={build.vid} -DUSB_PID={build.pid}
65+
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid}
6666

6767
# These can be overridden in platform.local.txt
6868
compiler.c.extra_flags=

0 commit comments

Comments
 (0)