Trait kernel::hil::analog_comparator::AnalogComparator
source · pub trait AnalogComparator<'a> {
type Channel;
// Required methods
fn comparison(&self, channel: &Self::Channel) -> bool;
fn start_comparing(&self, channel: &Self::Channel) -> Result<(), ErrorCode>;
fn stop_comparing(&self, channel: &Self::Channel) -> Result<(), ErrorCode>;
fn set_client(&self, client: &'a dyn Client);
}
Required Associated Types§
Required Methods§
sourcefn comparison(&self, channel: &Self::Channel) -> bool
fn comparison(&self, channel: &Self::Channel) -> bool
Do a single comparison of two inputs, depending on the AC chosen. Output will be True (1) when one is higher than the other, and False (0) otherwise. Specifically, the output is True when Vp > Vn (Vin positive
Vin negative), and False if Vp < Vn.
sourcefn start_comparing(&self, channel: &Self::Channel) -> Result<(), ErrorCode>
fn start_comparing(&self, channel: &Self::Channel) -> Result<(), ErrorCode>
Start interrupt-based comparison for the chosen channel (e.g. channel 1 for AC1). This will make it listen and send an interrupt as soon as Vp > Vn.
sourcefn stop_comparing(&self, channel: &Self::Channel) -> Result<(), ErrorCode>
fn stop_comparing(&self, channel: &Self::Channel) -> Result<(), ErrorCode>
Stop interrupt-based comparison for the chosen channel.