diff options
| -rw-r--r-- | embassy-stm32/src/rtc/v3.rs | 7 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/rtc.rs | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/embassy-stm32/src/rtc/v3.rs b/embassy-stm32/src/rtc/v3.rs index 64ecf4fbd..9f04c9b69 100644 --- a/embassy-stm32/src/rtc/v3.rs +++ b/embassy-stm32/src/rtc/v3.rs | |||
| @@ -22,10 +22,11 @@ impl<'d, T: Instance> super::Rtc<'d, T> { | |||
| 22 | let reg = crate::pac::RCC.bdcr().read(); | 22 | let reg = crate::pac::RCC.bdcr().read(); |
| 23 | assert!(!reg.lsecsson(), "RTC is not compatible with LSE CSS, yet."); | 23 | assert!(!reg.lsecsson(), "RTC is not compatible with LSE CSS, yet."); |
| 24 | 24 | ||
| 25 | let clock_source = clock_source as u8; | ||
| 25 | #[cfg(not(any(rcc_wl5, rcc_wle)))] | 26 | #[cfg(not(any(rcc_wl5, rcc_wle)))] |
| 26 | let config_rtcsel = crate::pac::rcc::vals::Rtcsel::from_bits(clock_source as u8); | 27 | let clock_source = crate::pac::rcc::vals::Rtcsel::from_bits(clock_source); |
| 27 | 28 | ||
| 28 | if !reg.rtcen() || reg.rtcsel() != clock_source as u8 { | 29 | if !reg.rtcen() || reg.rtcsel() != clock_source { |
| 29 | crate::pac::RCC.bdcr().modify(|w| w.set_bdrst(true)); | 30 | crate::pac::RCC.bdcr().modify(|w| w.set_bdrst(true)); |
| 30 | 31 | ||
| 31 | crate::pac::RCC.bdcr().modify(|w| { | 32 | crate::pac::RCC.bdcr().modify(|w| { |
| @@ -33,7 +34,7 @@ impl<'d, T: Instance> super::Rtc<'d, T> { | |||
| 33 | w.set_bdrst(false); | 34 | w.set_bdrst(false); |
| 34 | 35 | ||
| 35 | // Select RTC source | 36 | // Select RTC source |
| 36 | w.set_rtcsel(clock_source as u8); | 37 | w.set_rtcsel(clock_source); |
| 37 | 38 | ||
| 38 | w.set_rtcen(true); | 39 | w.set_rtcen(true); |
| 39 | 40 | ||
diff --git a/examples/stm32wl/src/bin/rtc.rs b/examples/stm32wl/src/bin/rtc.rs index e11825499..0d7906bde 100644 --- a/examples/stm32wl/src/bin/rtc.rs +++ b/examples/stm32wl/src/bin/rtc.rs | |||
| @@ -29,7 +29,7 @@ async fn main(_spawner: Spawner) { | |||
| 29 | 29 | ||
| 30 | let mut rtc = Rtc::new( | 30 | let mut rtc = Rtc::new( |
| 31 | p.RTC, | 31 | p.RTC, |
| 32 | RtcConfig::default().clock_config(embassy_stm32::rtc::RtcClockSource::LSE), | 32 | RtcConfig::default().clock_source(embassy_stm32::rtc::RtcClockSource::LSE), |
| 33 | ); | 33 | ); |
| 34 | info!("Got RTC! {:?}", now.timestamp()); | 34 | info!("Got RTC! {:?}", now.timestamp()); |
| 35 | 35 | ||
