pub struct Rtc<'d> {
pub rwdt: Rwdt,
/* private fields */
}Expand description
RTC clock.
Fields§
§rwdt: RwdtReset Watchdog Timer.
Implementations§
Source§impl<'d> Rtc<'d>
impl<'d> Rtc<'d>
Sourcepub fn new(rtc_timer: RTC_TIMER<'d>) -> Self
pub fn new(rtc_timer: RTC_TIMER<'d>) -> Self
Create a new instance in crate::Blocking mode.
Optionally an interrupt handler can be bound.
Sourcepub fn time_since_power_up(&self) -> Duration
pub fn time_since_power_up(&self) -> Duration
Get the time elapsed since the last power-on reset.
It should be noted that any reset or sleep, other than a power-up reset, will not stop or reset the RTC timer.
Sourcepub fn current_time_us(&self) -> u64
pub fn current_time_us(&self) -> u64
Get the current time in microseconds.
§Example
This example shows how to get the weekday of the current time in
New York using the jiff crate. This example works in core-only
environments without dynamic memory allocation.
use jiff::{
Timestamp,
tz::{self, TimeZone},
};
static TZ: TimeZone = tz::get!("America/New_York");
let rtc = Rtc::new(peripherals.RTC_TIMER);
let now = Timestamp::from_microsecond(rtc.current_time_us() as i64)?;
let weekday_in_new_york = now.to_zoned(TZ.clone()).weekday();Sourcepub fn set_current_time_us(&self, current_time_us: u64)
pub fn set_current_time_us(&self, current_time_us: u64)
Set the current time in microseconds.
Sourcepub fn disable_rom_message_printing(&self)
pub fn disable_rom_message_printing(&self)
Temporarily disable log messages of the ROM bootloader.
If you need to permanently disable the ROM bootloader messages, you’ll need to set the corresponding eFuse.
Sourcepub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Available on crate feature unstable only.
pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
unstable only.Register an interrupt handler for the RTC.
Note that this will replace any previously registered interrupt handlers.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Trait Implementations§
Source§impl InterruptConfigurable for Rtc<'_>
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl InterruptConfigurable for Rtc<'_>
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.