LL COMP Constants

Comparator common modes - Window mode

group COMP_LL_EC_COMMON_WINDOWMODE

Defines

LL_COMP_WINDOW_DISABLE (0x00000000UL)

Window mode disable: comparators pair are independent

LL_COMP_WINDOW_INPUT_PLUS_ODD (COMP_CSR_WINMODE | LL_COMP_WINDOW_COMP_EVEN_REGOFFSET_MASK )

Window mode enable: comparators instances pair have their input plus connected together. The common input is the one of instance index odd (COMP1, …). Input plus of the other comparator is no more accessible.

LL_COMP_WINDOW_INPUT_PLUS_EVEN (COMP_CSR_WINMODE | LL_COMP_WINDOW_COMP_ODD_REGOFFSET_MASK )

Window mode enable: comparators instances pair have their input plus connected together. The common input is the one of instance index even (COMP2, …). Input plus of the other comparator is no more accessible.

Comparator common modes - Window output

group COMP_LL_EC_COMMON_WINDOWOUTPUT

Defines

LL_COMP_WINDOW_OUTPUT_INDEPT (0x00000000UL

Comparators window output default mode: both comparators output are independent, indicating each their own state. Note: To know signal state versus window thresholds, read each comparator output and perform a logical “exclusive or” operation.

LL_COMP_WINDOW_OUTPUT_XOR_ODD (COMP_CSR_WINOUT | LL_COMP_WINDOW_COMP_ODD_REGOFFSET_MASK )

Window output synthesized on COMP1 output: COMP1 output is no more indicating its own state, but global window mode state. Logical high means monitored signal is within comparators window. Note: impacts only comparator output signal level (propagated to GPIO, EXTI lines, timers, …), does not impact output digital state ( LL_COMP_ReadOutputLevel() ) always reflecting each comparator output state.

LL_COMP_WINDOW_OUTPUT_XOR_EVEN (COMP_CSR_WINOUT | LL_COMP_WINDOW_COMP_EVEN_REGOFFSET_MASK )

Window output synthesized on COMP2 output: COMP2 output is no more indicating its own state, but global window mode state. Logical high means monitored signal is within comparators window. Note: impacts only comparator output signal level (propagated to GPIO, EXTI lines, timers, …), does not impact output digital state ( LL_COMP_ReadOutputLevel() ) always reflecting each comparator output state.

LL_COMP_WINDOW_OUTPUT_XOR_BOTH (COMP_CSR_WINOUT | LL_COMP_WINDOW_COMP_EVEN_REGOFFSET_MASK

\

|

LL_COMP_WINDOW_OUT_XOR_BOTH_MASK )

Window output synthesized on both comparators output of pair of comparator selected (COMP1 and COMP2): both comparators outputs are no more indicating their own state, but global window mode state (XOR: logical “exclusive or”). Logical high means monitored signal is within comparators window thresholds). This is a specific configuration (technically possible but not relevant from application point of view: 2 comparators output used for the same signal level), standard configuration for window mode is one of the settings above. Note: impacts only comparator output signal level (propagated to GPIO, EXTI lines, timers, …), does not impact output digital state ( LL_COMP_ReadOutputLevel() ) always reflecting each comparator output state.

Comparator modes - Power mode

group COMP_LL_EC_POWERMODE

Defines

LL_COMP_POWERMODE_HIGHSPEED (0x00000000UL)

Comparator power mode to high speed

LL_COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_PWRMODE_0)

Comparator power mode to medium speed

LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_PWRMODE_1 | COMP_CSR_PWRMODE_0)

Comparator power mode to ultra-low power

Comparator inputs - Input plus (input non-inverting) selection

group COMP_LL_EC_INPUT_PLUS

Defines

LL_COMP_INPUT_PLUS_IO1 (0x00000000UL)

Comparator input plus connected to IO1 (for GPIO mapping, refer to datasheet parameters “COMPx_INP1”)

LL_COMP_INPUT_PLUS_IO2 (COMP_CSR_INPSEL_0)

Comparator input plus connected to IO2 (for GPIO mapping, refer to datasheet parameters “COMPx_INP2”)

LL_COMP_INPUT_PLUS_IO3 (COMP_CSR_INPSEL_1)

Comparator input plus connected to IO3 (for GPIO mapping, refer to datasheet parameters “COMPx_INP3”)

Comparator inputs - Input minus (input inverting) selection

group COMP_LL_EC_INPUT_MINUS

Defines

LL_COMP_INPUT_MINUS_VREFINT (COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0)

Comparator input minus connected to VrefInt (for VrefInt voltage value, refer to datasheet).

LL_COMP_INPUT_MINUS_1_4VREFINT (0x00000000UL)

Comparator input minus connected to 1/4 VrefInt (for VrefInt voltage value, refer to datasheet).

LL_COMP_INPUT_MINUS_1_2VREFINT (COMP_CSR_INMSEL_0)

Comparator input minus connected to 1/2 VrefInt (for VrefInt voltage value, refer to datasheet).

LL_COMP_INPUT_MINUS_3_4VREFINT (COMP_CSR_INMSEL_1)

Comparator input minus connected to 3/4 VrefInt (for VrefInt voltage value, refer to datasheet).

LL_COMP_INPUT_MINUS_IO1 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1)

Comparator input plus connected to IO1 (for GPIO mapping, refer to datasheet parameters “COMPx_INM1”)

LL_COMP_INPUT_MINUS_IO2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0)

Comparator input plus connected to IO2 (for GPIO mapping, refer to datasheet parameters “COMPx_INM2”)

LL_COMP_INPUT_MINUS_DAC1_CH1 (COMP_CSR_INMSEL_2)

Comparator input minus connected to DAC1 channel 1

LL_COMP_INPUT_MINUS_DAC1_CH2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0)

Comparator input minus connected to DAC1 channel 2

Comparator input - Hysteresis

group COMP_LL_EC_INPUT_HYSTERESIS

Defines

LL_COMP_HYSTERESIS_NONE (0x00000000UL)

No hysteresis

LL_COMP_HYSTERESIS_LOW (COMP_CSR_HYST_0)

Hysteresis level low

LL_COMP_HYSTERESIS_MEDIUM (COMP_CSR_HYST_1)

Hysteresis level medium

LL_COMP_HYSTERESIS_HIGH (COMP_CSR_HYST_1 | COMP_CSR_HYST_0)

Hysteresis level high

Comparator output - Output polarity

group COMP_LL_EC_OUTPUT_POLARITY

Defines

LL_COMP_OUTPUTPOL_NONINVERTED (0x00000000UL)

Comparator output polarity not inverted: comparator output at high level when input voltages: plus higher than minus

LL_COMP_OUTPUTPOL_INVERTED (COMP_CSR_POLARITY)

Comparator output polarity not inverted: comparator output at low level when input voltages: plus higher than minus

Comparator output - Blanking source

group COMP_LL_EC_OUTPUT_BLANKING_SOURCE

Defines

LL_COMP_BLANKINGSRC_NONE (0x00000000UL)

Comparator output without blanking

LL_COMP_BLANKINGSRC_TIM1_OC5 (COMP_CSR_BLANKSEL_0)

Comparator output blanking source TIM1 OC5 (specific to comparator instance: COMP1)

LL_COMP_BLANKINGSRC_TIM2_OC3 (COMP_CSR_BLANKSEL_1)

Comparator output blanking source TIM2 OC3 (specific to comparator instance: COMP1)

LL_COMP_BLANKINGSRC_TIM3_OC3 (COMP_CSR_BLANKSEL_2)

Comparator output blanking source TIM3 OC3 (specific to comparator instance: COMP1)

LL_COMP_BLANKINGSRC_TIM3_OC4 (COMP_CSR_BLANKSEL_0)

Comparator output blanking source TIM3 OC4 (specific to comparator instance: COMP2)

LL_COMP_BLANKINGSRC_TIM8_OC5 (COMP_CSR_BLANKSEL_1)

Comparator output blanking source TIM8 OC5 (specific to comparator instance: COMP2)

LL_COMP_BLANKINGSRC_TIM15_OC1 (COMP_CSR_BLANKSEL_2)

Comparator output blanking source TIM15 OC1 (specific to comparator instance: COMP2)

Comparator output - Output level

group COMP_LL_EC_OUTPUT_LEVEL

Defines

LL_COMP_OUTPUT_LEVEL_LOW (0x00000000UL)

Comparator output level low (with polarity not inverted)

LL_COMP_OUTPUT_LEVEL_HIGH (0x00000001UL)

Comparator output level high (with polarity not inverted)

Definitions of COMP hardware constraints delays

group COMP_LL_EC_HW_DELAYS

Note

Only COMP peripheral HW delays are defined in COMP LL driver driver, not timeout values.

Defines

LL_COMP_DELAY_STARTUP_US (80UL)

Delay for comparator startup time. Delay set to maximum value (refer to device datasheet, parameter “tSTART”). Unit: us. Note: At comparator enable, delay required to reach propagation delay specification.

LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US (220UL)

Delay for comparator voltage scaler stabilization time Delay set to maximum value (refer to device datasheet, parameter “tSTART_SCALER”). Unit: us. Note: Voltage scaler is used when selecting comparator input based on VrefInt (VrefInt or subdivision of VrefInt). Note: To get scaler bridge configuration, refer to LL_COMP_IsInputScalerEnabled() .