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§
Provided Methods§
Sourcefn set_enable(&self, enable: bool)
fn set_enable(&self, enable: bool)
Enables/disables the comparator. If enabled, this means it will generate interrupt based on its configuration.
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Returns true if the comparator has been enabled. This means it will generate interrupt based on its configuration.
Sourcefn set_mode(&self, mode: ComparatorMode)
fn set_mode(&self, mode: ComparatorMode)
Set the mode of the comparator to be either target or periodic.
Sourcefn mode(&self) -> ComparatorMode
fn mode(&self) -> ComparatorMode
Get the current mode of the comparator, which is either target or periodic.
Sourcefn set_period(&self, value: u32)
fn set_period(&self, value: u32)
Set how often the comparator should generate an interrupt when in periodic mode.
Sourcefn set_target(&self, value: u64)
fn set_target(&self, value: u64)
Set when the comparator should generate an interrupt in target mode.
Sourcefn actual_target(&self) -> u64
fn actual_target(&self) -> u64
Get the actual target value of the comparator.
Sourcefn set_interrupt_handler(&self, handler: InterruptHandler)
fn set_interrupt_handler(&self, handler: InterruptHandler)
Set the interrupt handler for this comparator.