pub struct Alarm<'d, MODE, DM, COMP = AnyComparator<'d>, UNIT = AnyUnit<'d>>where
DM: Mode,{ /* private fields */ }Expand description
A single alarm.
Implementations§
Source§impl<'d, T, COMP: Comparator, UNIT: Unit> Alarm<'d, T, Blocking, COMP, UNIT>
impl<'d, T, COMP: Comparator, UNIT: Unit> Alarm<'d, T, Blocking, COMP, UNIT>
Sourcepub fn new(comparator: COMP, unit: &FrozenUnit<'d, UNIT>) -> Self
pub fn new(comparator: COMP, unit: &FrozenUnit<'d, UNIT>) -> Self
Creates a new alarm from a comparator and unit, in blocking mode.
Source§impl<'d, T, COMP: Comparator, UNIT: Unit> Alarm<'d, T, Async, COMP, UNIT>
impl<'d, T, COMP: Comparator, UNIT: Unit> Alarm<'d, T, Async, COMP, UNIT>
Sourcepub fn new_async(comparator: COMP, unit: &FrozenUnit<'d, UNIT>) -> Self
pub fn new_async(comparator: COMP, unit: &FrozenUnit<'d, UNIT>) -> Self
Creates a new alarm from a comparator and unit, in async mode.
Source§impl<'d, DM, COMP: Comparator, UNIT: Unit> Alarm<'d, Target, DM, COMP, UNIT>where
DM: Mode,
impl<'d, DM, COMP: Comparator, UNIT: Unit> Alarm<'d, Target, DM, COMP, UNIT>where
DM: Mode,
Sourcepub fn set_target(&self, timestamp: u64)
pub fn set_target(&self, timestamp: u64)
Set the target value of this Alarm
Sourcepub fn wait_until(&self, timestamp: u64)
pub fn wait_until(&self, timestamp: u64)
Block waiting until the timer reaches the timestamp
Source§impl<'d, DM, COMP: Comparator, UNIT: Unit> Alarm<'d, Periodic, DM, COMP, UNIT>where
DM: Mode,
impl<'d, DM, COMP: Comparator, UNIT: Unit> Alarm<'d, Periodic, DM, COMP, UNIT>where
DM: Mode,
Sourcepub fn set_period(&self, period: MicrosDurationU32)
pub fn set_period(&self, period: MicrosDurationU32)
Set the period of this Alarm
Trait Implementations§
Source§impl<T, DM, COMP: Comparator, UNIT: Unit> Debug for Alarm<'_, T, DM, COMP, UNIT>where
DM: Mode,
impl<T, DM, COMP: Comparator, UNIT: Unit> Debug for Alarm<'_, T, DM, COMP, UNIT>where
DM: Mode,
Source§impl<COMP: Comparator, UNIT: Unit> DelayNs for Alarm<'_, Target, Async, COMP, UNIT>
impl<COMP: Comparator, UNIT: Unit> DelayNs for Alarm<'_, Target, Async, COMP, UNIT>
Source§async fn delay_ns(&mut self, nanos: u32)
async fn delay_ns(&mut self, nanos: u32)
Pauses execution for at minimum
ns nanoseconds. Pause can be longer
if the implementation requires it due to precision/timing issues.Source§impl<T, COMP: Comparator, UNIT: Unit> InterruptConfigurable for Alarm<'_, T, Blocking, COMP, UNIT>
impl<T, COMP: Comparator, UNIT: Unit> InterruptConfigurable for Alarm<'_, T, Blocking, COMP, UNIT>
Source§fn set_interrupt_handler(&mut self, handler: InterruptHandler)
fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Set the interrupt handler Read more
Source§impl<T, DM, COMP: Comparator, UNIT: Unit> Peripheral for Alarm<'_, T, DM, COMP, UNIT>where
DM: Mode,
impl<T, DM, COMP: Comparator, UNIT: Unit> Peripheral for Alarm<'_, T, DM, COMP, UNIT>where
DM: Mode,
Source§impl<T, DM, COMP: Comparator, UNIT: Unit> Timer for Alarm<'_, T, DM, COMP, UNIT>where
DM: Mode,
impl<T, DM, COMP: Comparator, UNIT: Unit> Timer for Alarm<'_, T, DM, COMP, UNIT>where
DM: Mode,
Source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Is the timer running?
Source§fn load_value(&self, value: MicrosDurationU64) -> Result<(), Error>
fn load_value(&self, value: MicrosDurationU64) -> Result<(), Error>
Load a target value into the timer.
Source§fn enable_auto_reload(&self, auto_reload: bool)
fn enable_auto_reload(&self, auto_reload: bool)
Enable auto reload of the loaded value.
Source§fn enable_interrupt(&self, state: bool)
fn enable_interrupt(&self, state: bool)
Enable or disable the timer’s interrupt.
Source§fn clear_interrupt(&self)
fn clear_interrupt(&self)
Clear the timer’s interrupt.
Source§fn is_interrupt_set(&self) -> bool
fn is_interrupt_set(&self) -> bool
Has the timer triggered?
Source§fn set_interrupt_handler(&self, handler: InterruptHandler)
fn set_interrupt_handler(&self, handler: InterruptHandler)
Set the interrupt handler Read more
Auto Trait Implementations§
impl<'d, MODE, DM, COMP, UNIT> Freeze for Alarm<'d, MODE, DM, COMP, UNIT>where
COMP: Freeze,
impl<'d, MODE, DM, COMP, UNIT> RefUnwindSafe for Alarm<'d, MODE, DM, COMP, UNIT>
impl<'d, MODE, DM, COMP, UNIT> Send for Alarm<'d, MODE, DM, COMP, UNIT>
impl<'d, MODE, DM, COMP, UNIT> Sync for Alarm<'d, MODE, DM, COMP, UNIT>
impl<'d, MODE, DM, COMP, UNIT> Unpin for Alarm<'d, MODE, DM, COMP, UNIT>
impl<'d, MODE, DM, COMP, UNIT> UnwindSafe for Alarm<'d, MODE, DM, COMP, UNIT>
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