summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-08-24 23:30:35 +0700
committerhathach <[email protected]>2019-08-24 23:30:35 +0700
commitd4895c4af604bf3abdd164a70ad3936e2048e1bc (patch)
tree86f6bc1c473c83cfefb6762d8a94c4d8de174476 /hw
parentb3acce17cc2908f6e1ab80591a9455a9625befe3 (diff)
add board_test example for testing new board
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/board.h2
-rw-r--r--hw/bsp/feather_nrf52840_express/feather_nrf52840_express.c3
-rw-r--r--hw/bsp/pca10056/pca10056.c2
3 files changed, 7 insertions, 0 deletions
diff --git a/hw/bsp/board.h b/hw/bsp/board.h
index 9c8ec87bc..b5abfe22c 100644
--- a/hw/bsp/board.h
+++ b/hw/bsp/board.h
@@ -100,8 +100,10 @@ static inline void board_delay(uint32_t ms)
uint32_t start_ms = board_millis();
while (board_millis() - start_ms < ms)
{
+ #if TUSB_OPT_DEVICE_ENABLED
// take chance to run usb background
tud_task();
+ #endif
}
}
diff --git a/hw/bsp/feather_nrf52840_express/feather_nrf52840_express.c b/hw/bsp/feather_nrf52840_express/feather_nrf52840_express.c
index 27f939e05..ed3954c82 100644
--- a/hw/bsp/feather_nrf52840_express/feather_nrf52840_express.c
+++ b/hw/bsp/feather_nrf52840_express/feather_nrf52840_express.c
@@ -67,10 +67,12 @@ void board_init(void)
SysTick_Config(SystemCoreClock/1000);
#endif
+#if TUSB_OPT_DEVICE_ENABLED
// Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice
// 2 is highest for application
NVIC_SetPriority(USBD_IRQn, 2);
+
// USB power may already be ready at this time -> no event generated
// We need to invoke the handler based on the status initially
uint32_t usb_reg;
@@ -103,6 +105,7 @@ void board_init(void)
if ( usb_reg & POWER_USBREGSTATUS_VBUSDETECT_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_DETECTED);
if ( usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
+#endif
}
//--------------------------------------------------------------------+
diff --git a/hw/bsp/pca10056/pca10056.c b/hw/bsp/pca10056/pca10056.c
index 3c67d9426..c50b61db9 100644
--- a/hw/bsp/pca10056/pca10056.c
+++ b/hw/bsp/pca10056/pca10056.c
@@ -65,6 +65,7 @@ void board_init(void)
SysTick_Config(SystemCoreClock/1000);
#endif
+#if TUSB_OPT_DEVICE_ENABLED
// Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice
// 2 is highest for application
NVIC_SetPriority(USBD_IRQn, 2);
@@ -101,6 +102,7 @@ void board_init(void)
if ( usb_reg & POWER_USBREGSTATUS_VBUSDETECT_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_DETECTED);
if ( usb_reg & POWER_USBREGSTATUS_OUTPUTRDY_Msk ) tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
+#endif
}
//--------------------------------------------------------------------+