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).
This commit is contained in:
@ -26,12 +26,7 @@ impl<'d, T: Instance> RealTimeClock<'d, T> {
|
||||
into_ref!(inner);
|
||||
|
||||
// Set the RTC divider
|
||||
unsafe {
|
||||
inner
|
||||
.regs()
|
||||
.clkdiv_m1()
|
||||
.write(|w| w.set_clkdiv_m1(clk_rtc_freq() as u16 - 1))
|
||||
};
|
||||
unsafe { inner.regs().clkdiv_m1().write(|w| w.set_clkdiv_m1(clk_rtc_freq() - 1)) };
|
||||
|
||||
let mut result = Self { inner };
|
||||
result.set_leap_year_check(true); // should be on by default, make sure this is the case.
|
||||
|
Reference in New Issue
Block a user