Browse Source

nrf5x added LOWPOWER when suspend/resume

hathach 7 years ago
parent
commit
2cc4ab2aef
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/portable/nordic/nrf5x/dcd_nrf5x.c

+ 10 - 0
src/portable/nordic/nrf5x/dcd_nrf5x.c

@@ -220,8 +220,15 @@ void dcd_remote_wakeup(uint8_t rhport)
 {
 {
   (void) rhport;
   (void) rhport;
 
 
+  // Bring controller out of low power mode
+  NRF_USBD->LOWPOWER = 0;
+
+  // Initiate RESUME signal
   NRF_USBD->DPDMVALUE = USBD_DPDMVALUE_STATE_Resume;
   NRF_USBD->DPDMVALUE = USBD_DPDMVALUE_STATE_Resume;
   NRF_USBD->TASKS_DPDMDRIVE = 1;
   NRF_USBD->TASKS_DPDMDRIVE = 1;
+
+  // TODO There is no USBEVENT Resume interrupt
+  // We may manually raise DCD_EVENT_RESUME event here
 }
 }
 
 
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
@@ -393,7 +400,10 @@ void USBD_IRQHandler(void)
     {
     {
       dcd_event_bus_signal(0, DCD_EVENT_SUSPEND, true);
       dcd_event_bus_signal(0, DCD_EVENT_SUSPEND, true);
 
 
+      // Put controller into low power mode
+      NRF_USBD->LOWPOWER = 1;
 
 
+      // Leave HFXO disable to application, since it may be used by other
     }
     }
 
 
     if ( evt_cause & USBD_EVENTCAUSE_RESUME_Msk  )
     if ( evt_cause & USBD_EVENTCAUSE_RESUME_Msk  )