Comparator Class for STM32.
More...
#include <modm/platform/comp/comp_1.hpp>
|
enum | InvertingInput {
Vref1Div4 = (0b000 << 4) | (0b11 << 22),
Vref1Div2 = (0b001 << 4) | (0b11 << 22),
Vref3Div4 = (0b010 << 4) | (0b11 << 22),
Vref = (0b011 << 4) | (0b10 << 22),
Dac3Ch1 = 0b100 << 4,
Dac1Ch1 = 0b101 << 4,
GpioA4 = 0b110 << 4,
GpioA0 = 0b111 << 4
} |
|
enum | NonInvertingInput { GpioA1 = 0b0 << 8,
GpioB1 = 0b1 << 8
} |
|
enum | BlankingSource {
NoBlanking = 0b000 << 18,
Tim1Oc5 = 0b001 << COMP_CSR_BLANKING_Pos,
Tim2Oc3 = 0b010 << COMP_CSR_BLANKING_Pos,
Tim3Oc3 = 0b011 << COMP_CSR_BLANKING_Pos,
Tim8Oc5 = 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 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 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 |
|
Comparator Class for STM32.
static BlankingSource modm::platform::Comp1::getBlankingSource |
( |
| ) |
|
|
inlinestatic |
Returns the blanking source.
static Hysteresis modm::platform::Comp1::getHysteresis |
( |
| ) |
|
|
inlinestatic |
static InvertingInput modm::platform::Comp1::getInvertingInput |
( |
| ) |
|
|
inlinestatic |
Returns what is connected to the inverting input.
static NonInvertingInput modm::platform::Comp1::getNonInvertingInput |
( |
| ) |
|
|
inlinestatic |
Returns what is connected to the non-inverting input.
static Polarity modm::platform::Comp1::getPolarity |
( |
| ) |
|
|
inlinestatic |
static void modm::platform::Comp1::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::Comp1::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: