pub trait Alarm: Sealed {
// Required methods
fn clear_interrupt(&mut self);
fn enable_interrupt(&mut self);
fn disable_interrupt(&mut self);
fn schedule(
&mut self,
countdown: Duration<u32, 1, 1000000>,
) -> Result<(), ScheduleAlarmError>;
fn schedule_at(
&mut self,
timestamp: Instant<u64, 1, 1000000>,
) -> Result<(), ScheduleAlarmError>;
fn finished(&self) -> bool;
fn cancel(&mut self) -> Result<(), ScheduleAlarmError>;
}Expand description
Alarm abstraction.
Required Methods§
Sourcefn clear_interrupt(&mut self)
fn clear_interrupt(&mut self)
Clear the interrupt flag.
The interrupt is unable to trigger a 2nd time until this interrupt is cleared.
Sourcefn enable_interrupt(&mut self)
fn enable_interrupt(&mut self)
Enable this alarm to trigger an interrupt.
After this interrupt is triggered, make sure to clear the interrupt with clear_interrupt.
Sourcefn disable_interrupt(&mut self)
fn disable_interrupt(&mut self)
Disable this alarm, preventing it from triggering an interrupt.
Sourcefn schedule(
&mut self,
countdown: Duration<u32, 1, 1000000>,
) -> Result<(), ScheduleAlarmError>
fn schedule( &mut self, countdown: Duration<u32, 1, 1000000>, ) -> Result<(), ScheduleAlarmError>
Schedule the alarm to be finished after countdown. If enable_interrupt is called,
this will trigger interrupt whenever this time elapses.
Sourcefn schedule_at(
&mut self,
timestamp: Instant<u64, 1, 1000000>,
) -> Result<(), ScheduleAlarmError>
fn schedule_at( &mut self, timestamp: Instant<u64, 1, 1000000>, ) -> Result<(), ScheduleAlarmError>
Schedule the alarm to be finished at the given timestamp. If enable_interrupt is called, this will trigger interrupt whenever this timestamp is reached.
The rp235x is unable to schedule an event taking place in more than
u32::MAX microseconds.
Sourcefn finished(&self) -> bool
fn finished(&self) -> bool
Return true if this alarm is finished. The returned value is undefined if the alarm has not been scheduled yet.
Sourcefn cancel(&mut self) -> Result<(), ScheduleAlarmError>
fn cancel(&mut self) -> Result<(), ScheduleAlarmError>
Cancel an activated alarm.