Expand description
Real-time clock (RTC).
A 32-bit seconds counter with a 20-bit prescaler and one alarm compare register (RM §6.1). The counter and prescaler sit in the backup domain, so they keep running across system resets while VBAT is present and dropping the handle does not stop the clock (RM §6.2.2).
Rtc::new enables the requested oscillator, selects it as RTCCLK and
writes the prescaler for a 1 Hz time base (RM §3.3.5.3). If the RTC is
already running from the same source, it is left as it is: counter and
prescaler are kept, so the elapsed time is preserved.
Register writes go through the configuration sequence of RM §6.2.3: poll
CTLRL.RTOFF, set CNF, write, clear CNF, poll RTOFF.
Structs§
- Rtc
- RTC handle. The clock keeps counting after this is dropped.
Enums§
- Clock
Source - Source of the 1 Hz RTC time base.
- Error
- RTC configuration error.