Trait esp32_hal::timer::TimerWithInterrupt [−][src]
pub trait TimerWithInterrupt: CountDown + Periodic + Cancel {}Show 20 methods
fn listen(&mut self, event: Event); fn unlisten(&mut self, event: Event); fn clear_interrupt(&mut self) -> &mut Self; fn set_value<T: Into<TicksU64>>(&mut self, value: T) -> &mut Self; fn get_value(&self) -> TicksU64; fn get_value_in_ns(&self) -> NanoSecondsU64; fn get_alarm(&self) -> TicksU64; fn get_alarm_in_ns(&self) -> NanoSecondsU64; fn set_alarm<T: Into<TicksU64>>(&mut self, value: T) -> &mut Self; fn set_alarm_in_ns<T: Into<NanoSecondsU64>>(
&mut self,
value: T
) -> &mut Self; fn enable(&mut self, enable: bool) -> &mut Self; fn is_enabled(&mut self) -> bool; fn stop(&mut self); fn increasing(&mut self, enable: bool) -> &mut Self; fn is_increasing(&mut self) -> bool; fn auto_reload(&mut self, enable: bool) -> &mut Self; fn enable_alarm(&mut self, enable: bool) -> &mut Self; fn alarm_active(&mut self) -> bool; fn set_divider(&mut self, divider: u32) -> Result<&mut Self, Error>; fn get_divider(&self) -> u32;
Expand description
Timer trait
Required methods
fn clear_interrupt(&mut self) -> &mut Self
fn clear_interrupt(&mut self) -> &mut Self
Clear interrupt once fired
fn get_value_in_ns(&self) -> NanoSecondsU64
fn get_value_in_ns(&self) -> NanoSecondsU64
Get timer value in ns
fn get_alarm_in_ns(&self) -> NanoSecondsU64
fn get_alarm_in_ns(&self) -> NanoSecondsU64
Get alarm value in ns
Set alarm value
Note: timer is not disabled, so there is a risk for false triggering between setting upper and lower 32 bits.
fn set_alarm_in_ns<T: Into<NanoSecondsU64>>(&mut self, value: T) -> &mut Self
fn set_alarm_in_ns<T: Into<NanoSecondsU64>>(&mut self, value: T) -> &mut Self
Set alarm value in ns
Note: timer is not disabled, so there is a risk for false triggering between setting upper and lower 32 bits.
fn is_enabled(&mut self) -> bool
fn is_enabled(&mut self) -> bool
Enable or disables the timer
fn increasing(&mut self, enable: bool) -> &mut Self
fn increasing(&mut self, enable: bool) -> &mut Self
Set to true to increase the timer value on each tick, set to false to decrease the timer value on each tick.
fn is_increasing(&mut self) -> bool
fn is_increasing(&mut self) -> bool
Returns true if the timer is increasing, otherwise decreasing
fn auto_reload(&mut self, enable: bool) -> &mut Self
fn auto_reload(&mut self, enable: bool) -> &mut Self
Set to true if the timer needs to be reloaded to initial value once the alarm is reached.
fn enable_alarm(&mut self, enable: bool) -> &mut Self
fn enable_alarm(&mut self, enable: bool) -> &mut Self
Enable alarm triggering
fn alarm_active(&mut self) -> bool
fn alarm_active(&mut self) -> bool
Is the alarm active
fn set_divider(&mut self, divider: u32) -> Result<&mut Self, Error>
fn set_divider(&mut self, divider: u32) -> Result<&mut Self, Error>
Set clock divider.
Value must be between 2 and 65536 inclusive for Timer 0 and 1 and between 3 and 65535 for TimerLact.
fn get_divider(&self) -> u32
fn get_divider(&self) -> u32
Get the current clock divider