diff options
| author | xoviat <[email protected]> | 2023-09-17 18:47:22 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-09-17 18:47:22 -0500 |
| commit | feaeee1e835bf3e2a6b36fc8d2d45d4cbc5c27a3 (patch) | |
| tree | afff4cc7efde8203e78715a902898cbaf6bf061a /embassy-stm32/src/rtc | |
| parent | a6ef314be150fd2e8adbfefe5f2b38126f97551a (diff) | |
stm32: misc. cleanup
Diffstat (limited to 'embassy-stm32/src/rtc')
| -rw-r--r-- | embassy-stm32/src/rtc/mod.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs index a588c8b18..07b4fe1f0 100644 --- a/embassy-stm32/src/rtc/mod.rs +++ b/embassy-stm32/src/rtc/mod.rs | |||
| @@ -82,8 +82,9 @@ impl core::ops::Sub for RtcInstant { | |||
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | #[non_exhaustive] | 85 | pub struct RtcTimeProvider { |
| 86 | pub struct RtcTimeProvider; | 86 | _private: (), |
| 87 | } | ||
| 87 | 88 | ||
| 88 | impl RtcTimeProvider { | 89 | impl RtcTimeProvider { |
| 89 | /// Return the current datetime. | 90 | /// Return the current datetime. |
| @@ -186,8 +187,8 @@ impl Rtc { | |||
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | /// Acquire a [`RtcTimeProvider`] instance. | 189 | /// Acquire a [`RtcTimeProvider`] instance. |
| 189 | pub fn time_provider(&self) -> RtcTimeProvider { | 190 | pub const fn time_provider(&self) -> RtcTimeProvider { |
| 190 | RtcTimeProvider | 191 | RtcTimeProvider { _private: () } |
| 191 | } | 192 | } |
| 192 | 193 | ||
| 193 | /// Set the datetime to a new value. | 194 | /// Set the datetime to a new value. |
| @@ -222,7 +223,7 @@ impl Rtc { | |||
| 222 | /// | 223 | /// |
| 223 | /// Will return an `RtcError::InvalidDateTime` if the stored value in the system is not a valid [`DayOfWeek`]. | 224 | /// Will return an `RtcError::InvalidDateTime` if the stored value in the system is not a valid [`DayOfWeek`]. |
| 224 | pub fn now(&self) -> Result<DateTime, RtcError> { | 225 | pub fn now(&self) -> Result<DateTime, RtcError> { |
| 225 | RtcTimeProvider.now() | 226 | self.time_provider().now() |
| 226 | } | 227 | } |
| 227 | 228 | ||
| 228 | /// Check if daylight savings time is active. | 229 | /// Check if daylight savings time is active. |
