aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/rtc
diff options
context:
space:
mode:
authorpennae <[email protected]>2023-05-16 22:45:50 +0200
committerpennae <[email protected]>2023-05-17 21:36:19 +0200
commitf79d8cb2d3998662eb4555d424cc75f3899a3151 (patch)
tree39997a67fd4ad6a52c4384b660d567134fe272f5 /embassy-rp/src/rtc
parent0d4ab559a717cef0b9a86186142f403252f38a9b (diff)
rp/clocks: store clock frequencies in ram
don't recalculate clock frequencies every time they are asked for. while this is not very often in practice it does consume a bunch of flash space that cannot be optimized away, and was pulled in unconditionally previously. while we technically only need the configured rosc, xosc and gpin frequencies it is easier to store all frequencies (and much cheaper at runtime too).
Diffstat (limited to 'embassy-rp/src/rtc')
-rw-r--r--embassy-rp/src/rtc/mod.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/embassy-rp/src/rtc/mod.rs b/embassy-rp/src/rtc/mod.rs
index c173909c7..c213ad174 100644
--- a/embassy-rp/src/rtc/mod.rs
+++ b/embassy-rp/src/rtc/mod.rs
@@ -26,12 +26,7 @@ impl<'d, T: Instance> RealTimeClock<'d, T> {
26 into_ref!(inner); 26 into_ref!(inner);
27 27
28 // Set the RTC divider 28 // Set the RTC divider
29 unsafe { 29 unsafe { inner.regs().clkdiv_m1().write(|w| w.set_clkdiv_m1(clk_rtc_freq() - 1)) };
30 inner
31 .regs()
32 .clkdiv_m1()
33 .write(|w| w.set_clkdiv_m1(clk_rtc_freq() as u16 - 1))
34 };
35 30
36 let mut result = Self { inner }; 31 let mut result = Self { inner };
37 result.set_leap_year_check(true); // should be on by default, make sure this is the case. 32 result.set_leap_year_check(true); // should be on by default, make sure this is the case.