wake library

Dependencies:   LPC1114_WakeInterruptIn

Fork of WakeUp by Erik -

Files at this revision

API Documentation at this revision

Comitter:
rodriguise
Date:
Mon Oct 17 19:59:49 2016 +0000
Parent:
22:49ca85e8822f
Commit message:
backup

Changed in this revision

Device/WakeUp_STM_RTC.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 49ca85e8822f -r a443fbaba1da Device/WakeUp_STM_RTC.cpp
--- 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();
 }