Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LPC1114_WakeInterruptIn
Fork of WakeUp by
Revision 20:68f2ee917691, committed 2015-10-30
- Comitter:
- Sissors
- Date:
- Fri Oct 30 21:29:40 2015 +0000
- Parent:
- 19:9d355da2770e
- Child:
- 21:30845899cca2
- Commit message:
- Added L476 support (changing some names/adding some defines).
;
; It shouldn't break it for other STM targets, but if it does, send me a message.
Changed in this revision
| Device/WakeUp_STM_RTC.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Device/WakeUp_STM_RTC.cpp Wed Jul 01 19:33:12 2015 +0000
+++ b/Device/WakeUp_STM_RTC.cpp Fri Oct 30 21:29:40 2015 +0000
@@ -4,7 +4,6 @@
#include "rtc_api.h"
#define BYTE2BCD(byte) ((byte % 10) | ((byte / 10) << 4))
-#define EXTI_RTC_LINE (1 << 17)
//Most things are pretty similar between the different STM targets.
//Only the IRQ number the alarm is connected to differs. Any errors
@@ -15,6 +14,15 @@
#define RTC_IRQ RTC_IRQn
#endif
+// Some things to handle Disco L476VG (and similar ones)
+#if defined(TARGET_STM32L4)
+#define IMR IMR1
+#define EMR EMR1
+#define RTSR RTSR1
+#define FTSR FTSR2
+#define PR PR1
+#endif
+
//Disabling the Backup Powerdomain does not seem to work nicely anymore if you want to use other RTC functions afterwards.
//For now I have disabled it in code, if you find WakeUp increases your powerconsumption, try enabling it again (code is still there, just commented)
@@ -67,10 +75,10 @@
struct tm *timeinfo = localtime(&secs);
//Enable rising edge EXTI interrupt of the RTC
- EXTI->IMR |= EXTI_RTC_LINE;
- EXTI->EMR &= ~EXTI_RTC_LINE;
- EXTI->RTSR |= EXTI_RTC_LINE;
- EXTI->FTSR &= ~EXTI_RTC_LINE;
+ EXTI->IMR |= RTC_EXTI_LINE_ALARM_EVENT;
+ EXTI->EMR &= ~RTC_EXTI_LINE_ALARM_EVENT;
+ EXTI->RTSR |= RTC_EXTI_LINE_ALARM_EVENT;
+ EXTI->FTSR &= ~RTC_EXTI_LINE_ALARM_EVENT;
//Calculate alarm register values
uint32_t alarmreg = 0;
@@ -104,7 +112,7 @@
RTC->WPR = 0x53;
RTC->CR &= ~RTC_CR_ALRAE;
RTC->WPR = 0xFF; //Enable RTC write protection
- EXTI->PR = EXTI_RTC_LINE;
+ EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT;
//PWR->CR &= ~PWR_CR_DBP; //Disable power domain
callback.call();
}
