wake library
Dependencies: LPC1114_WakeInterruptIn
Fork of WakeUp by
Diff: Device/WakeUp_STM_RTC.cpp
- Revision:
- 23:a443fbaba1da
- Parent:
- 20:68f2ee917691
--- a/Device/WakeUp_STM_RTC.cpp Wed Nov 11 20:20:27 2015 +0000 +++ b/Device/WakeUp_STM_RTC.cpp Mon Oct 17 19:59:49 2016 +0000 @@ -35,7 +35,7 @@ wait_us(250); //The f401 seems to want a delay after init } - //PWR->CR |= PWR_CR_DBP; //Enable power domain + HAL_PWR_EnableBkUpAccess(); RTC->WPR = 0xCA; //Disable RTC write protection RTC->WPR = 0x53; @@ -93,7 +93,7 @@ RTC->CR |= RTC_CR_ALRAE | RTC_CR_ALRAIE; //Enable Alarm RTC->WPR = 0xFF; //Enable RTC write protection - //PWR->CR &= ~PWR_CR_DBP; //Disable power domain + HAL_PWR_DisableBkUpAccess(); __enable_irq(); //Alarm is set, so irqs can be enabled again @@ -106,14 +106,14 @@ void WakeUp::irq_handler(void) { //Clear RTC + EXTI interrupt flags - //PWR->CR |= PWR_CR_DBP; //Enable power domain + HAL_PWR_EnableBkUpAccess(); //Enable power domain RTC->ISR &= ~RTC_ISR_ALRAF; RTC->WPR = 0xCA; //Disable RTC write protection RTC->WPR = 0x53; RTC->CR &= ~RTC_CR_ALRAE; RTC->WPR = 0xFF; //Enable RTC write protection EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT; - //PWR->CR &= ~PWR_CR_DBP; //Disable power domain + HAL_PWR_DisableBkUpAccess(); //Disable power domain callback.call(); }