summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-08-05 22:09:37 +0700
committerhathach <[email protected]>2019-08-05 22:09:37 +0700
commitd1df04151936886d8c8b950830f804d422507b6f (patch)
treeff4c7d109f67600b143cdcf6e7ab8d894d036b12 /src
parentd211035a0a50cd5ac5ee17ea1194bf92b4b6bd2a (diff)
nrf5x remove the depenedent on nrfx_power.h
Diffstat (limited to 'src')
-rw-r--r--src/portable/nordic/nrf5x/dcd_nrf5x.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c
index 213f255ae..931c1ab86 100644
--- a/src/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -34,8 +34,6 @@
#include "nrf_usbd.h"
#include "nrfx_usbd_errata.h"
-#include "nrfx_power.h"
-
#ifdef SOFTDEVICE_PRESENT
// For enable/disable hfclk with SoftDevice
#include "nrf_sdm.h"
@@ -607,7 +605,6 @@ static void hfclk_disable(void)
nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTOP);
}
-//--------------------------------------------------------------------+
// Power & Clock Peripheral on nRF5x to manage USB
//
// USB Bus power is managed by Power module, there are 3 VBUS power events:
@@ -618,12 +615,18 @@ static void hfclk_disable(void)
// Therefore this function must be called to handle USB power event by
// - nrfx_power_usbevt_init() : if Softdevice is not used or enabled
// - SoftDevice SOC event : if SD is used and enabled
-//--------------------------------------------------------------------+
void tusb_hal_nrf_power_event (uint32_t event)
{
+ // Value is chosen to be as same as NRFX_POWER_USB_EVT_* in nrfx_power.h
+ enum {
+ POWER_USB_EVT_DETECTED = 0,
+ POWER_USB_EVT_REMOVED = 1,
+ POWER_USB_EVT_READY = 2
+ };
+
switch ( event )
{
- case NRFX_POWER_USB_EVT_DETECTED:
+ case POWER_USB_EVT_DETECTED:
if ( !NRF_USBD->ENABLE )
{
/* Prepare for READY event receiving */
@@ -671,7 +674,7 @@ void tusb_hal_nrf_power_event (uint32_t event)
}
break;
- case NRFX_POWER_USB_EVT_READY:
+ case POWER_USB_EVT_READY:
/* Waiting for USBD peripheral enabled */
while ( !(USBD_EVENTCAUSE_READY_Msk & NRF_USBD->EVENTCAUSE) ) { }
@@ -737,7 +740,7 @@ void tusb_hal_nrf_power_event (uint32_t event)
nrf_usbd_pullup_enable();
break;
- case NRFX_POWER_USB_EVT_REMOVED:
+ case POWER_USB_EVT_REMOVED:
if ( NRF_USBD->ENABLE )
{
// Abort all transfers