Alarm

Trait Alarm 

Source
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§

Source

fn clear_interrupt(&mut self)

Clear the interrupt flag.

The interrupt is unable to trigger a 2nd time until this interrupt is cleared.

Source

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.

Source

fn disable_interrupt(&mut self)

Disable this alarm, preventing it from triggering an interrupt.

Source

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.

Source

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.

Source

fn finished(&self) -> bool

Return true if this alarm is finished. The returned value is undefined if the alarm has not been scheduled yet.

Source

fn cancel(&mut self) -> Result<(), ScheduleAlarmError>

Cancel an activated alarm.

Implementors§

Source§

impl<D> Alarm for Alarm0<D>
where D: TimerDevice,

Source§

impl<D> Alarm for Alarm1<D>
where D: TimerDevice,

Source§

impl<D> Alarm for Alarm2<D>
where D: TimerDevice,

Source§

impl<D> Alarm for Alarm3<D>
where D: TimerDevice,