aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/rtc/mod.rs
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-09-25 16:26:29 -0500
committerxoviat <[email protected]>2023-09-25 16:26:29 -0500
commit04b09a2acb465dbb87dfc4e8b24b4c587f21b472 (patch)
tree726bc7b14d1acf6e9c4d18ac035da782ccd94d9d /embassy-stm32/src/rtc/mod.rs
parent481d2998ef49ef550f6fcf4e8a815b6170aed23b (diff)
stm32/rtc: use rccperi enable
Diffstat (limited to 'embassy-stm32/src/rtc/mod.rs')
-rw-r--r--embassy-stm32/src/rtc/mod.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs
index 7eafedec4..b26b5ef35 100644
--- a/embassy-stm32/src/rtc/mod.rs
+++ b/embassy-stm32/src/rtc/mod.rs
@@ -10,6 +10,7 @@ use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
10use embassy_sync::blocking_mutex::Mutex; 10use embassy_sync::blocking_mutex::Mutex;
11 11
12pub use self::datetime::{DateTime, DayOfWeek, Error as DateTimeError}; 12pub use self::datetime::{DateTime, DayOfWeek, Error as DateTimeError};
13use crate::rcc::sealed::RccPeripheral;
13pub use crate::rcc::RtcClockSource; 14pub use crate::rcc::RtcClockSource;
14use crate::time::Hertz; 15use crate::time::Hertz;
15 16
@@ -111,11 +112,12 @@ impl RtcTimeProvider {
111 } 112 }
112} 113}
113 114
114#[non_exhaustive]
115/// RTC Abstraction 115/// RTC Abstraction
116pub struct Rtc { 116pub struct Rtc {
117 #[cfg(feature = "low-power")] 117 #[cfg(feature = "low-power")]
118 stop_time: Mutex<CriticalSectionRawMutex, Cell<Option<RtcInstant>>>, 118 stop_time: Mutex<CriticalSectionRawMutex, Cell<Option<RtcInstant>>>,
119 #[cfg(not(feature = "low-power"))]
120 _private: (),
119} 121}
120 122
121#[non_exhaustive] 123#[non_exhaustive]
@@ -154,9 +156,13 @@ impl Default for RtcCalibrationCyclePeriod {
154 156
155impl Rtc { 157impl Rtc {
156 pub fn new(_rtc: impl Peripheral<P = RTC>, rtc_config: RtcConfig) -> Self { 158 pub fn new(_rtc: impl Peripheral<P = RTC>, rtc_config: RtcConfig) -> Self {
159 RTC::enable();
160
157 let mut this = Self { 161 let mut this = Self {
158 #[cfg(feature = "low-power")] 162 #[cfg(feature = "low-power")]
159 stop_time: Mutex::const_new(CriticalSectionRawMutex::new(), Cell::new(None)), 163 stop_time: Mutex::const_new(CriticalSectionRawMutex::new(), Cell::new(None)),
164 #[cfg(not(feature = "low-power"))]
165 _private: (),
160 }; 166 };
161 167
162 let frequency = Self::frequency(); 168 let frequency = Self::frequency();
@@ -292,8 +298,6 @@ pub(crate) mod sealed {
292 crate::pac::RTC 298 crate::pac::RTC
293 } 299 }
294 300
295 fn enable_peripheral_clk();
296
297 /// Read content of the backup register. 301 /// Read content of the backup register.
298 /// 302 ///
299 /// The registers retain their values during wakes from standby mode or system resets. They also 303 /// The registers retain their values during wakes from standby mode or system resets. They also