stm32: misc. cleanup

This commit is contained in:
xoviat
2023-09-17 18:47:22 -05:00
parent a6ef314be1
commit feaeee1e83
5 changed files with 14 additions and 17 deletions

View File

@ -82,8 +82,9 @@ impl core::ops::Sub for RtcInstant {
}
}
#[non_exhaustive]
pub struct RtcTimeProvider;
pub struct RtcTimeProvider {
_private: (),
}
impl RtcTimeProvider {
/// Return the current datetime.
@ -186,8 +187,8 @@ impl Rtc {
}
/// Acquire a [`RtcTimeProvider`] instance.
pub fn time_provider(&self) -> RtcTimeProvider {
RtcTimeProvider
pub const fn time_provider(&self) -> RtcTimeProvider {
RtcTimeProvider { _private: () }
}
/// Set the datetime to a new value.
@ -222,7 +223,7 @@ impl Rtc {
///
/// Will return an `RtcError::InvalidDateTime` if the stored value in the system is not a valid [`DayOfWeek`].
pub fn now(&self) -> Result<DateTime, RtcError> {
RtcTimeProvider.now()
self.time_provider().now()
}
/// Check if daylight savings time is active.