stm32: fix rtc and examples
This commit is contained in:
parent
28618d12a1
commit
ae608cf2fa
2 changed files with 5 additions and 4 deletions
|
@ -22,10 +22,11 @@ impl<'d, T: Instance> super::Rtc<'d, T> {
|
|||
let reg = crate::pac::RCC.bdcr().read();
|
||||
assert!(!reg.lsecsson(), "RTC is not compatible with LSE CSS, yet.");
|
||||
|
||||
let clock_source = clock_source as u8;
|
||||
#[cfg(not(any(rcc_wl5, rcc_wle)))]
|
||||
let config_rtcsel = crate::pac::rcc::vals::Rtcsel::from_bits(clock_source as u8);
|
||||
let clock_source = crate::pac::rcc::vals::Rtcsel::from_bits(clock_source);
|
||||
|
||||
if !reg.rtcen() || reg.rtcsel() != clock_source as u8 {
|
||||
if !reg.rtcen() || reg.rtcsel() != clock_source {
|
||||
crate::pac::RCC.bdcr().modify(|w| w.set_bdrst(true));
|
||||
|
||||
crate::pac::RCC.bdcr().modify(|w| {
|
||||
|
@ -33,7 +34,7 @@ impl<'d, T: Instance> super::Rtc<'d, T> {
|
|||
w.set_bdrst(false);
|
||||
|
||||
// Select RTC source
|
||||
w.set_rtcsel(clock_source as u8);
|
||||
w.set_rtcsel(clock_source);
|
||||
|
||||
w.set_rtcen(true);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ async fn main(_spawner: Spawner) {
|
|||
|
||||
let mut rtc = Rtc::new(
|
||||
p.RTC,
|
||||
RtcConfig::default().clock_config(embassy_stm32::rtc::RtcClockSource::LSE),
|
||||
RtcConfig::default().clock_source(embassy_stm32::rtc::RtcClockSource::LSE),
|
||||
);
|
||||
info!("Got RTC! {:?}", now.timestamp());
|
||||
|
||||
|
|
Loading…
Reference in a new issue