Struct Rtc
pub struct Rtc<'a> { /* private fields */ }Implementations§
§impl Rtc<'_>
impl Rtc<'_>
pub const fn new(registers: StaticRef<RtcRegisters>) -> Rtc<'_>
pub fn handle_interrupt(&self)
Trait Implementations§
§impl<'a> Alarm<'a> for Rtc<'a>
impl<'a> Alarm<'a> for Rtc<'a>
§fn set_alarm_client(&self, client: &'a dyn AlarmClient)
fn set_alarm_client(&self, client: &'a dyn AlarmClient)
Specify the callback for when the counter reaches the alarm
value. If there was a previously installed callback this call
replaces it.
§fn set_alarm(
&self,
reference: <Rtc<'a> as Time>::Ticks,
dt: <Rtc<'a> as Time>::Ticks,
)
fn set_alarm( &self, reference: <Rtc<'a> as Time>::Ticks, dt: <Rtc<'a> as Time>::Ticks, )
Specify when the callback should be called and enable it. The
callback will be enqueued when
Time::now() == reference + dt. The
callback itself may not run exactly at this time, due to delays.
However, it it assured to execute after reference + dt: it can
be delayed but will never fire early. The method takes reference
and dt rather than a single value denoting the counter value so it
can distinguish between alarms which have very recently already
passed and those in the far far future (see #1651).§fn get_alarm(&self) -> <Rtc<'a> as Time>::Ticks
fn get_alarm(&self) -> <Rtc<'a> as Time>::Ticks
Return the current alarm value. This is undefined at boot and
otherwise returns
now + dt from the last call to set_alarm.§fn disarm(&self) -> Result<(), ErrorCode>
fn disarm(&self) -> Result<(), ErrorCode>
Disable the alarm and stop it from firing in the future.
Valid
Result<(), ErrorCode> codes are: Read more§fn is_armed(&self) -> bool
fn is_armed(&self) -> bool
Returns whether the alarm is currently armed. Note that this
does not reliably indicate whether there will be a future
callback: it is possible that the alarm has triggered (and
disarmed) and a callback is pending and has not been called yet.
In this case it possible for
is_armed to return false yet to
receive a callback.§fn minimum_dt(&self) -> <Rtc<'a> as Time>::Ticks
fn minimum_dt(&self) -> <Rtc<'a> as Time>::Ticks
Return the minimum dt value that is supported. Any dt smaller than
this will automatically be increased to this minimum value.
§impl<'a> Counter<'a> for Rtc<'a>
impl<'a> Counter<'a> for Rtc<'a>
§fn start(&self) -> Result<(), ErrorCode>
fn start(&self) -> Result<(), ErrorCode>
Starts the free-running hardware counter. Valid
Result<(), ErrorCode> values are: Read more§fn stop(&self) -> Result<(), ErrorCode>
fn stop(&self) -> Result<(), ErrorCode>
Stops the free-running hardware counter. Valid
Result<(), ErrorCode> values are: Read more§fn reset(&self) -> Result<(), ErrorCode>
fn reset(&self) -> Result<(), ErrorCode>
Resets the counter to 0. This may introduce jitter on the counter.
Resetting the counter has no effect on any pending overflow callbacks.
If a client needs to reset and clear pending callbacks it should
call
stop before reset.
Valid Result<(), ErrorCode> values are: Read more§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Returns whether the counter is currently running.
§impl<'a> CounterOverflow<'a> for Rtc<'a>
impl<'a> CounterOverflow<'a> for Rtc<'a>
§fn set_overflow_client(&self, client: &'a dyn OverflowClient)
fn set_overflow_client(&self, client: &'a dyn OverflowClient)
👎Deprecated since 2.3.0:
set_overflow_client never used so moved to an independent trait. Set to be removed in future releases unless a concrete use case is raised.
Auto Trait Implementations§
impl<'a> !Freeze for Rtc<'a>
impl<'a> !RefUnwindSafe for Rtc<'a>
impl<'a> !Send for Rtc<'a>
impl<'a> !Sync for Rtc<'a>
impl<'a> !UnwindSafe for Rtc<'a>
impl<'a> Unpin for Rtc<'a>
impl<'a> UnsafeUnpin for Rtc<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> ConvertTicks<<T as Time>::Ticks> for Twhere
T: Time + ?Sized,
impl<T> ConvertTicks<<T as Time>::Ticks> for Twhere
T: Time + ?Sized,
§fn ticks_from_seconds(&self, s: u32) -> <T as Time>::Ticks
fn ticks_from_seconds(&self, s: u32) -> <T as Time>::Ticks
Returns the number of ticks in the provided number of seconds,
rounding down any fractions. If the value overflows Ticks it
returns
Ticks::max_value().§fn ticks_from_ms(&self, ms: u32) -> <T as Time>::Ticks
fn ticks_from_ms(&self, ms: u32) -> <T as Time>::Ticks
Returns the number of ticks in the provided number of milliseconds,
rounding down any fractions. If the value overflows Ticks it
returns
Ticks::max_value().§fn ticks_from_us(&self, us: u32) -> <T as Time>::Ticks
fn ticks_from_us(&self, us: u32) -> <T as Time>::Ticks
Returns the number of ticks in the provided number of microseconds,
rounding down any fractions. If the value overflows Ticks it
returns
Ticks::max_value().§fn ticks_to_seconds(&self, tick: <T as Time>::Ticks) -> u32
fn ticks_to_seconds(&self, tick: <T as Time>::Ticks) -> u32
Returns the number of seconds in the provided number of ticks,
rounding down any fractions. If the value overflows u32,
u32::MAX
is returned,§fn ticks_to_ms(&self, tick: <T as Time>::Ticks) -> u32
fn ticks_to_ms(&self, tick: <T as Time>::Ticks) -> u32
Returns the number of milliseconds in the provided number of ticks,
rounding down any fractions. If the value overflows u32,
u32::MAX
is returned,§fn ticks_to_us(&self, tick: <T as Time>::Ticks) -> u32
fn ticks_to_us(&self, tick: <T as Time>::Ticks) -> u32
Returns the number of microseconds in the provided number of ticks,
rounding down any fractions. If the value overflows u32,
u32::MAX
is returned,