Struct nrf52811_hal::comp::Comp
source · pub struct Comp { /* private fields */ }
Expand description
A safe wrapper around the COMP
peripheral.
Implementations§
source§impl Comp
impl Comp
sourcepub fn new<P>(comp: COMP, input_pin: &P) -> Compwhere
P: CompInputPin,
pub fn new<P>(comp: COMP, input_pin: &P) -> Compwhere
P: CompInputPin,
Takes ownership of the COMP
peripheral, returning a safe wrapper.
sourcepub fn power_mode(&self, mode: PowerMode) -> &Comp
pub fn power_mode(&self, mode: PowerMode) -> &Comp
Sets the speed and power mode of the comparator.
sourcepub fn aref_pin<P>(&self, ref_pin: &P) -> &Compwhere
P: CompRefPin,
pub fn aref_pin<P>(&self, ref_pin: &P) -> &Compwhere
P: CompRefPin,
Sets analog reference pin.
sourcepub fn differential<P>(&self, ref_pin: &P) -> &Compwhere
P: CompRefPin,
pub fn differential<P>(&self, ref_pin: &P) -> &Compwhere
P: CompRefPin,
Sets comparator mode to differential with external Vref pin.
sourcepub fn hysteresis_threshold_up(&self, value: u8) -> &Comp
pub fn hysteresis_threshold_up(&self, value: u8) -> &Comp
Upward hysteresis threshold in single ended mode Vup = (value+1)/64*Vref
.
sourcepub fn hysteresis_threshold_down(&self, value: u8) -> &Comp
pub fn hysteresis_threshold_down(&self, value: u8) -> &Comp
Downward hysteresis threshold in single ended mode Vdown = (value+1)/64*Vref
.
sourcepub fn hysteresis(&self, enabled: bool) -> &Comp
pub fn hysteresis(&self, enabled: bool) -> &Comp
Enables/disables differential comparator hysteresis (50mV).
sourcepub fn enable_interrupt(&self, event: Transition) -> &Comp
pub fn enable_interrupt(&self, event: Transition) -> &Comp
Enables COMP_LPCOMP
interrupt triggering on the specified event.
sourcepub fn disable_interrupt(&self, event: Transition) -> &Comp
pub fn disable_interrupt(&self, event: Transition) -> &Comp
Disables COMP_LPCOMP
interrupt triggering on the specified event.
sourcepub fn event_up(&self) -> &Reg<EVENTS_UP_SPEC>
pub fn event_up(&self) -> &Reg<EVENTS_UP_SPEC>
Returns reference to Up
transition event endpoint for PPI.
sourcepub fn event_down(&self) -> &Reg<EVENTS_DOWN_SPEC>
pub fn event_down(&self) -> &Reg<EVENTS_DOWN_SPEC>
Returns reference to Down
transition event endpoint for PPI.
sourcepub fn event_cross(&self) -> &Reg<EVENTS_CROSS_SPEC>
pub fn event_cross(&self) -> &Reg<EVENTS_CROSS_SPEC>
Returns reference to Cross
transition event endpoint for PPI.
sourcepub fn reset_event(&self, event: Transition)
pub fn reset_event(&self, event: Transition)
Marks event as handled.
sourcepub fn reset_events(&self)
pub fn reset_events(&self)
Marks all events as handled.
sourcepub fn read(&self) -> CompResult
pub fn read(&self) -> CompResult
Returns the output state of the comparator.