Struct Comparator

Source
pub struct Comparator<C, ED> { /* private fields */ }

Implementations§

Source§

impl Comparator<COMP1, Disabled>

Source

pub fn comp1<P: PositiveInput<COMP1>, N: NegativeInput<COMP1>>( comp: COMP1, positive_input: P, negative_input: N, config: Config, clocks: &Clocks, ) -> Self

Initializes a comparator

Source

pub fn enable(self) -> Comparator<COMP1, Enabled>

Enables the comparator

Source

pub fn listen(&self, edge: SignalEdge, exti: &EXTI)

Enables raising the ADC_COMP interrupt at the specified output signal edge

Source§

impl Comparator<COMP1, Enabled>

Source

pub fn output(&self) -> bool

Returns the value of the output of the comparator

Source

pub fn disable(self) -> Comparator<COMP1, Disabled>

Disables the comparator

Source§

impl<ED> Comparator<COMP1, ED>

Source

pub fn unlisten(&self, exti: &EXTI)

Disables raising interrupts for the output signal

Source

pub fn is_pending(&self, edge: SignalEdge, exti: &EXTI) -> bool

Returns true if the output signal interrupt is pending for the edge

Source

pub fn unpend(&self, exti: &EXTI)

Unpends the output signal interrupt

Source

pub fn output_pin<P: OutputPin<COMP1>>(&self, pin: P)

Configures a GPIO pin to output the signal of the comparator

Multiple GPIO pins may be configured as the output simultaneously.

Source§

impl Comparator<COMP2, Disabled>

Source

pub fn comp2<P: PositiveInput<COMP2>, N: NegativeInput<COMP2>>( comp: COMP2, positive_input: P, negative_input: N, config: Config, clocks: &Clocks, ) -> Self

Initializes a comparator

Source

pub fn enable(self) -> Comparator<COMP2, Enabled>

Enables the comparator

Source

pub fn listen(&self, edge: SignalEdge, exti: &EXTI)

Enables raising the ADC_COMP interrupt at the specified output signal edge

Source§

impl Comparator<COMP2, Enabled>

Source

pub fn output(&self) -> bool

Returns the value of the output of the comparator

Source

pub fn disable(self) -> Comparator<COMP2, Disabled>

Disables the comparator

Source§

impl<ED> Comparator<COMP2, ED>

Source

pub fn unlisten(&self, exti: &EXTI)

Disables raising interrupts for the output signal

Source

pub fn is_pending(&self, edge: SignalEdge, exti: &EXTI) -> bool

Returns true if the output signal interrupt is pending for the edge

Source

pub fn unpend(&self, exti: &EXTI)

Unpends the output signal interrupt

Source

pub fn output_pin<P: OutputPin<COMP2>>(&self, pin: P)

Configures a GPIO pin to output the signal of the comparator

Multiple GPIO pins may be configured as the output simultaneously.

Auto Trait Implementations§

§

impl<C, ED> Freeze for Comparator<C, ED>
where C: Freeze,

§

impl<C, ED> RefUnwindSafe for Comparator<C, ED>

§

impl<C, ED> Send for Comparator<C, ED>
where C: Send, ED: Send,

§

impl<C, ED> Sync for Comparator<C, ED>
where C: Sync, ED: Sync,

§

impl<C, ED> Unpin for Comparator<C, ED>
where C: Unpin, ED: Unpin,

§

impl<C, ED> UnwindSafe for Comparator<C, ED>
where C: UnwindSafe, ED: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.