esp_hal::timer::systimer

Trait Comparator

Source
pub trait Comparator {
    // Required method
    fn channel(&self) -> u8;

    // Provided methods
    fn set_enable(&self, enable: bool) { ... }
    fn is_enabled(&self) -> bool { ... }
    fn set_unit(&self, is_unit0: bool) { ... }
    fn set_mode(&self, mode: ComparatorMode) { ... }
    fn mode(&self) -> ComparatorMode { ... }
    fn set_period(&self, value: u32) { ... }
    fn set_target(&self, value: u64) { ... }
    fn actual_target(&self) -> u64 { ... }
    fn set_interrupt_handler(&self, handler: InterruptHandler) { ... }
}
Expand description

A comparator that can generate alarms/interrupts based on values of a unit.

Required Methods§

Source

fn channel(&self) -> u8

Returns the comparators number.

Provided Methods§

Source

fn set_enable(&self, enable: bool)

Enables/disables the comparator. If enabled, this means it will generate interrupt based on its configuration.

Source

fn is_enabled(&self) -> bool

Returns true if the comparator has been enabled. This means it will generate interrupt based on its configuration.

Source

fn set_unit(&self, is_unit0: bool)

Sets the unit this comparator uses as a reference count.

Source

fn set_mode(&self, mode: ComparatorMode)

Set the mode of the comparator to be either target or periodic.

Source

fn mode(&self) -> ComparatorMode

Get the current mode of the comparator, which is either target or periodic.

Source

fn set_period(&self, value: u32)

Set how often the comparator should generate an interrupt when in periodic mode.

Source

fn set_target(&self, value: u64)

Set when the comparator should generate an interrupt in target mode.

Source

fn actual_target(&self) -> u64

Get the actual target value of the comparator.

Source

fn set_interrupt_handler(&self, handler: InterruptHandler)

Set the interrupt handler for this comparator.

Implementors§

Source§

impl Comparator for AnyComparator<'_>

Source§

impl<const CHANNEL: u8> Comparator for SpecificComparator<'_, CHANNEL>