Struct stm32l0xx_hal::rtc::Rtc
source · [−]pub struct Rtc { /* private fields */ }
Expand description
Entry point to the RTC API.
Implementations
sourceimpl Rtc
impl Rtc
sourcepub fn new(
rtc: RTC,
rcc: &mut Rcc,
pwr: &PWR,
init: Option<NaiveDateTime>
) -> Result<Self, Error>
pub fn new(
rtc: RTC,
rcc: &mut Rcc,
pwr: &PWR,
init: Option<NaiveDateTime>
) -> Result<Self, Error>
Initializes the RTC API.
The init
argument will only be used, if the real-time clock is not
already configured. If the clock is not yet configured, and init is set
to None
, then the datetime corresponding to 2000-01-01 00:00:00
will be used for initialization.
Errors
Returns Error::InvalidInputData
if the init
datetime is outside
of the valid range (years 2000-2099).
Panics
Panics, if the ABP1 clock frequency is lower than the RTC clock frequency. The RTC is currently hardcoded to use the LSE as clock source which runs at 32768 Hz.
sourcepub fn set(&mut self, instant: NaiveDateTime) -> Result<(), Error>
pub fn set(&mut self, instant: NaiveDateTime) -> Result<(), Error>
Sets the date/time.
Note: Only dates in the range 2001-01-01 00:00:00
to
2099-12-31 23:59:59
are supported. If a date outside this range is
passed in, Error::InvalidInputData
will be returned.
sourcepub fn now(&mut self) -> NaiveDateTime
pub fn now(&mut self) -> NaiveDateTime
Read and return the current date/time from the RTC.
sourcepub fn enable_interrupts(&mut self, interrupts: Interrupts)
pub fn enable_interrupts(&mut self, interrupts: Interrupts)
Enable interrupts
The interrupts set to true
in interrupts
will be enabled. Those set
to false will not be modified.
sourcepub fn disable_interrupts(&mut self, interrupts: Interrupts)
pub fn disable_interrupts(&mut self, interrupts: Interrupts)
Disable interrupts
The interrupts set to true
in interrupts
will be disabled. Those set
to false will not be modified.
sourcepub fn wakeup_timer(&mut self) -> WakeupTimer<'_>
pub fn wakeup_timer(&mut self) -> WakeupTimer<'_>
Access the wakeup timer
Auto Trait Implementations
impl RefUnwindSafe for Rtc
impl Send for Rtc
impl !Sync for Rtc
impl Unpin for Rtc
impl UnwindSafe for Rtc
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more