| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
-
- #include "board.h"
- void debug_stop(void)
- {
- M0P_DEBUG_ACTIVE->DEBUG_ACTIVE = (1<<12) | // LPTIM1, 0:normal; 1:pause at STOP;
- (1<< 9) | // RTC, 0:normal; 1:pause at STOP;
- (1<< 8) | // WDT, 0:normal; 1:pause at STOP;
- (1<< 3); // LPTIM0, 0:normal; 1:pause at STOP;
- }
- void EnterLowPower(void)
- {
- #ifdef SLEEPDEEP_ENABLE
- // uint8_t Flag;
-
- // WaitExpireTime();
- // rt_hw_interrupt_disable(); // PRIMASK = 0x1u;
- if (DMA_Busy() | FinSh_Txbuf_Busy()){
- SCB->SCR = (0x0<<SCB_SCR_SEVONPEND_Pos) |
- (0x0<<SCB_SCR_SLEEPDEEP_Pos) | // sleep
- (0x0<<SCB_SCR_SLEEPONEXIT_Pos);
- // Flag = 0x0u;
- // rt_hw_interrupt_enable(0x0u); // PRIMASK = 0x0u;
- } else {
- SCB->SCR = (0x0<<SCB_SCR_SEVONPEND_Pos) |
- (0x1<<SCB_SCR_SLEEPDEEP_Pos) | // deepsleep or stop
- (0x0<<SCB_SCR_SLEEPONEXIT_Pos);
- // Flag = 0x1u;
- }
- #else
- SCB->SCR = (0x0<<SCB_SCR_SEVONPEND_Pos) |
- (0x0<<SCB_SCR_SLEEPDEEP_Pos) | // sleep
- (0x0<<SCB_SCR_SLEEPONEXIT_Pos);
- #endif
- #ifdef DEBUG_ENABLE
- // LED_Off();
- #endif
- __WFI();
- #ifdef DEBUG_ENABLE
- // LED_On();
- #endif
- #ifdef SLEEPDEEP_ENABLE
- // if (Flag){
- // CalExpireTime(150); // if awaked up, cant not enter deepsleep until 150us later
- // rt_hw_interrupt_enable(0x0u); // PRIMASK = 0x0u;
- // }
- #endif
- }
|