use USE_TINYUSB instead of USBCON for consistency, USBCON still defined to be compatible with 3rd party lib

This commit is contained in:
hathach committed 2019-05-09 23:56:52 +07:00
1 parent e89b863b04
commit f1012eaa31
10 files changed
+22 -17

No files matched your search

@@ -21,7 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifdef USBCON
#ifdef USE_TINYUSB
#include "nrfx.h"
#include "nrfx_power.h"
@@ -111,4 +112,4 @@ void Adafruit_TinyUSB_Core_init(void)
xTaskCreate( usb_device_task, "usbd", USBD_STACK_SZ, NULL, TASK_PRIO_HIGH, NULL);
}
#endif
#endif // USE_TINYUSB
@@ -25,6 +25,10 @@
#ifndef ADAFRUIT_TINYUSB_CORE_H_
#define ADAFRUIT_TINYUSB_CORE_H_
#ifndef USE_TINYUSB
#error TinyUSB is not selected, please select it in Tools->Menu->USB Stack
#endif
#include "tusb.h"
#ifdef __cplusplus
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#ifdef USBCON
#ifdef USE_TINYUSB
#include "Arduino.h"
#include "Adafruit_USBD_CDC.h"
@@ -137,4 +137,4 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
}
#endif // USBCON
#endif // USE_TINYUSB
@@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#ifdef USBCON
#ifdef USE_TINYUSB
#include "Adafruit_USBD_Device.h"
@@ -184,4 +184,4 @@ bool Adafruit_USBD_Device::begin(void)
return true;
}
#endif
#endif // USE_TINYUSB
@@ -34,7 +34,7 @@
//--------------------------------------------------------------------
#define CFG_TUSB_MCU OPT_MCU_NRF5X
#ifdef NRF52840_XXAA
#ifdef USE_TINYUSB
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_NONE
+1 -1
View File
@@ -67,7 +67,7 @@ void suspendLoop(void);
#include "utility/utilities.h"
#include "utility/AdaCallback.h"
#ifdef USBCON
#ifdef USE_TINYUSB
#include "Adafruit_TinyUSB_Core.h"
#endif
+1 -1
View File
@@ -39,7 +39,7 @@ void delay( uint32_t ms )
{
uint32_t ticks = ms2tick(ms);
#ifdef USBCON
#ifdef USE_TINYUSB
// Take chance to flush usb cdc
uint32_t flush_tick = xTaskGetTickCount();
tud_cdc_write_flush();
+2 -2
View File
@@ -57,7 +57,7 @@ static void loop_task(void* arg)
{
loop();
#ifdef USBCON
#ifdef USE_TINYUSB
tud_cdc_write_flush();
#endif
@@ -72,7 +72,7 @@ int main( void )
init();
initVariant();
#ifdef USBCON
#ifdef USE_TINYUSB
Adafruit_TinyUSB_Core_init();
#endif
+5 -5
View File
@@ -54,7 +54,7 @@
#define CFG_SOC_TASK_STACKSIZE (200)
#endif
#ifdef USBCON
#ifdef USE_TINYUSB
#include "nrfx_power.h"
/* tinyusb function that handles power event (detected, ready, removed)
@@ -290,7 +290,7 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
_prph_count = prph_count;
_central_count = central_count;
#ifdef USBCON
#ifdef USE_TINYUSB
usb_softdevice_pre_enable();
#endif
@@ -319,7 +319,7 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
VERIFY_STATUS( sd_softdevice_enable(&clock_cfg, nrf_error_cb), false );
#ifdef USBCON
#ifdef USE_TINYUSB
usb_softdevice_post_enable();
#endif
@@ -461,7 +461,7 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
VERIFY_STATUS(sd_ble_gap_device_name_set(&sec_mode, (uint8_t const *) CFG_DEFAULT_NAME, strlen(CFG_DEFAULT_NAME)), false);
//------------- USB -------------//
#ifdef USBCON
#ifdef USE_TINYUSB
sd_power_usbdetected_enable(true);
sd_power_usbpwrrdy_enable(true);
sd_power_usbremoved_enable(true);
@@ -713,7 +713,7 @@ void adafruit_soc_task(void* arg)
if ( flash_nrf5x_event_cb ) flash_nrf5x_event_cb(soc_evt);
break;
#ifdef USBCON
#ifdef USE_TINYUSB
/*------------- usb power event handler -------------*/
case NRF_EVT_POWER_USB_DETECTED:
case NRF_EVT_POWER_USB_POWER_READY:
+1 -1
View File
@@ -62,7 +62,7 @@ nordic.path={build.core.path}/nordic
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"
# usb flags
build.flags.usb= -DUSBCON -DUSB_VID={build.vid} -DUSB_PID={build.pid}
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid}
# These can be overridden in platform.local.txt
compiler.c.extra_flags=