aboutsummaryrefslogtreecommitdiff
path: root/lib/stm32/l1/rcc.c
diff options
context:
space:
mode:
authorKarl Palsson2013-01-23 00:01:46 +0000
committerKarl Palsson2013-01-23 00:01:46 +0000
commitd9fb4f7401b8bf546cc7e6ddeb9f22d343f0622d (patch)
treeb0932bb63bbfcc74e95e48c1ecf228eaddc0039e /lib/stm32/l1/rcc.c
parente5b32503825c53d278d09a34d7165020e1b5cad4 (diff)
Add examples making use of the RTC
Add an example using the RTC to help with a lower power design. This is a sister example to the existing "button-irq-printf", which is functionally identical, but uses far less power. There's more tricks that can be done to lower the power even further, but this shows a few of the early steps that can be done, using the RTC wakeup instead of a timer.
Diffstat (limited to 'lib/stm32/l1/rcc.c')
-rw-r--r--lib/stm32/l1/rcc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/stm32/l1/rcc.c b/lib/stm32/l1/rcc.c
index c1d8fa9..9b2df24 100644
--- a/lib/stm32/l1/rcc.c
+++ b/lib/stm32/l1/rcc.c
@@ -437,6 +437,12 @@ u32 rcc_system_clock_source(void)
return ((RCC_CFGR & 0x000c) >> 2);
}
+void rcc_rtc_select_clock(u32 clock)
+{
+ RCC_CSR &= ~(RCC_CSR_RTCSEL_MASK << RCC_CSR_RTCSEL_SHIFT);
+ RCC_CSR |= (clock << RCC_CSR_RTCSEL_SHIFT);
+}
+
void rcc_clock_setup_msi(const clock_scale_t *clock)
{
/* Enable internal multi-speed oscillator. */