modm API documentation
modm::platform::Comp6 Class Reference

Comparator Class for STM32. More...

#include <modm/platform/comp/comp_6.hpp>

Inheritance diagram for modm::platform::Comp6:
modm::platform::CompBase

Public Types

enum  InvertingInput {
  Vref1Div4 = (0b000 << 4) | (0b11 << 22), Vref1Div2 = (0b001 << 4) | (0b11 << 22), Vref3Div4 = (0b010 << 4) | (0b11 << 22), Vref = (0b011 << 4) | (0b10 << 22),
  Dac4Ch2 = 0b100 << 4, Dac2Ch1 = 0b101 << 4, GpioD10 = 0b110 << 4, GpioB15 = 0b111 << 4
}
 
enum  NonInvertingInput { GpioB11 = 0b0 << 8, GpioD11 = 0b1 << 8 }
 
enum  BlankingSource {
  NoBlanking = 0b000 << 18, Tim8Oc5 = 0b001 << COMP_CSR_BLANKING_Pos, Tim2Oc4 = 0b010 << COMP_CSR_BLANKING_Pos, Tim15Oc2 = 0b011 << COMP_CSR_BLANKING_Pos,
  Tim1Oc5 = 0b100 << COMP_CSR_BLANKING_Pos, Tim20Oc5 = 0b101 << COMP_CSR_BLANKING_Pos, Tim15Oc1 = 0b110 << COMP_CSR_BLANKING_Pos, Tim4Oc3 = 0b111 << COMP_CSR_BLANKING_Pos
}
 
enum  Hysteresis {
  NoHysteresis = 0b000 << COMP_CSR_HYST_Pos, Hysteresis10mV = 0b001 << COMP_CSR_HYST_Pos, Hysteresis20mV = 0b010 << COMP_CSR_HYST_Pos, Hysteresis30mV = 0b011 << COMP_CSR_HYST_Pos,
  Hysteresis40mV = 0b100 << COMP_CSR_HYST_Pos, Hysteresis50mV = 0b101 << COMP_CSR_HYST_Pos, Hysteresis60mV = 0b110 << COMP_CSR_HYST_Pos, Hysteresis70mV = 0b111 << COMP_CSR_HYST_Pos,
  LowHysteresis = Hysteresis10mV, MediumHysteresis = Hysteresis40mV, HighHysteresis = Hysteresis70mV
}
 
enum  Polarity { NonInverted = 0b0 << 15, Inverted = 0b1 << 15 }
 

Static Public Member Functions

static void initialize (InvertingInput n_in, NonInvertingInput p_in, Hysteresis hyst=Hysteresis::NoHysteresis, Polarity pol=Polarity::NonInverted, bool lock_comp=false)
 
static void setEnabled (bool enabled)
 Enable/Disable the comparator.
 
static bool isEnabled ()
 Returns whether the comparator is enabled.
 
static void setInvertingInput (InvertingInput input)
 Selects what the inverting input is connected to.
 
static InvertingInput getInvertingInput ()
 Returns what is connected to the inverting input. More...
 
static void setNonInvertingInput (NonInvertingInput input)
 Selects what the non-inverting input is connected to.
 
static NonInvertingInput getNonInvertingInput ()
 Returns what is connected to the non-inverting input. More...
 
static void setPolarity (Polarity pol)
 Selects output polarity.
 
static Polarity getPolarity ()
 Returns output polarity. More...
 
static void setHysteresis (Hysteresis hyst)
 Selects the hysteresis.
 
static Hysteresis getHysteresis ()
 Returns the hysteresis. More...
 
static void setBlankingSource (BlankingSource blanking)
 Selects the blanking source.
 
static BlankingSource getBlankingSource ()
 Returns the blanking source. More...
 
static bool getOutput ()
 Returns the current Comparator output.
 
static void lock (void)
 Locks the comparator. More...
 
static bool isLocked (void)
 Returns true if the comparator is locked.
 
template<class... Signals>
static void connect ()
 

Static Protected Attributes

static constexpr uint32_t InvertingInputMask = (0b1111 << 4) | (0b11 << 22)
 
static constexpr uint32_t NonInvertingInputMask = 0b1 << 8
 
static constexpr uint32_t BlankingSourceMask = COMP_CSR_BLANKING_Msk
 
static constexpr uint32_t HysteresisMask = COMP_CSR_HYST_Msk
 
static constexpr uint32_t PolarityMask = 0b1 << 15
 

Detailed Description

Comparator Class for STM32.

Member Function Documentation

static BlankingSource modm::platform::Comp6::getBlankingSource ( )
inlinestatic

Returns the blanking source.

static Hysteresis modm::platform::Comp6::getHysteresis ( )
inlinestatic

Returns the hysteresis.

static InvertingInput modm::platform::Comp6::getInvertingInput ( )
inlinestatic

Returns what is connected to the inverting input.

static NonInvertingInput modm::platform::Comp6::getNonInvertingInput ( )
inlinestatic

Returns what is connected to the non-inverting input.

static Polarity modm::platform::Comp6::getPolarity ( )
inlinestatic

Returns output polarity.

static void modm::platform::Comp6::initialize ( InvertingInput  n_in,
NonInvertingInput  p_in,
Hysteresis  hyst = Hysteresis::NoHysteresis,
Polarity  pol = Polarity::NonInverted,
bool  lock_comp = false 
)
inlinestatic

Initialize and enable the comparator.

Enables the comperator and sets important values.

Do NOT set lock = true if you want to be able to set other values later.

static void modm::platform::Comp6::lock ( void  )
inlinestatic

Locks the comparator.

Comparator can only be unlocked by a system reset.


The documentation for this class was generated from the following file: