LL COMP Functions

Configuration of COMP hierarchical scope:

group COMP_LL_EF_Configuration_comparator_common

common to several COMP instances

Functions

void LL_COMP_SetCommonWindowMode ( COMP_Common_TypeDef * p_comp_common , uint32_t window_mode )

Set window mode of a pair of comparators instances (2 consecutive COMP instances COMP<x> and COMP<x+1>).

Reference Manual to LL API cross reference (Register Field Functions)

CSR WINMODE LL_COMP_SetCommonWindowMode

Parameters :
uint32_t LL_COMP_GetCommonWindowMode ( const COMP_Common_TypeDef * p_comp_common )

Get window mode of a pair of comparators instances (2 consecutive COMP instances COMP<x> and COMP<x+1>).

Reference Manual to LL API cross reference (Register Field Functions)

CSR WINMODE LL_COMP_GetCommonWindowMode

Parameters :

p_comp_common – Comparator common instance (can be set directly from CMSIS definition or by using helper macro LL_COMP_COMMON_INSTANCE() ).

Return values :

Returned – value can be one of the following values:

void LL_COMP_SetCommonWindowOutput ( COMP_Common_TypeDef * p_comp_common , uint32_t window_output )

Set window output of a pair of comparators instances (2 consecutive COMP instances COMP<x> and COMP<x+1>).

Reference Manual to LL API cross reference (Register Field Functions)

CSR WINOUT LL_COMP_SetCommonWindowOutput

Parameters :
uint32_t LL_COMP_GetCommonWindowOutput ( const COMP_Common_TypeDef * p_comp_common )

Get window output of a pair of comparators instances (2 consecutive COMP instances COMP<x> and COMP<x+1>).

Reference Manual to LL API cross reference (Register Field Functions)

CSR WINOUT LL_COMP_GetCommonWindowOutput

Parameters :

p_comp_common – Comparator common instance (can be set directly from CMSIS definition or by using helper macro LL_COMP_COMMON_INSTANCE() ).

Return values :

Returned – value can be one of the following values:

Configuration of comparator modes

group COMP_LL_EF_Configuration_comparator_modes

Functions

void LL_COMP_SetPowerMode ( COMP_TypeDef * p_comp , uint32_t power_mode )

Set comparator instance operating mode to adjust power and speed.

Reference Manual to LL API cross reference (Register Field Functions)

CSR PWRMODE LL_COMP_SetPowerMode

Parameters :
uint32_t LL_COMP_GetPowerMode ( const COMP_TypeDef * p_comp )

Get comparator instance operating mode to adjust power and speed.

Reference Manual to LL API cross reference (Register Field Functions)

CSR PWRMODE LL_COMP_GetPowerMode

Parameters :

p_comp – Comparator instance

Return values :

Returned – value can be one of the following values:

Configuration of comparator inputs

group COMP_LL_EF_Configuration_comparator_inputs

Functions

void LL_COMP_ConfigInputs ( COMP_TypeDef * p_comp , uint32_t input_minus , uint32_t input_plus )

Set comparator inputs minus (inverting) and plus (non-inverting).

Reference Manual to LL API cross reference (Register Field Functions)

CSR INPSEL LL_COMP_ConfigInputs

CSR INMSEL LL_COMP_ConfigInputs

Note

In case of comparator input selected to be connected to IO: GPIO pins are specific to each comparator instance. Refer to description of parameters or to reference manual.

Note

Voltage scaler is used when selecting comparator input based on VrefInt (VrefInt or subdivision of VrefInt). In this case, specific delay must be fulfilled for voltage stabilization when enabling comparator, refer to LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US.

Note

On this STM32 series, a voltage scaler is used when COMP input is based on VrefInt (VrefInt or subdivision of VrefInt): Voltage scaler requires a delay for voltage stabilization. Refer to device datasheet, parameter “tSTART_SCALER”.

Parameters :
void LL_COMP_SetInputPlus ( COMP_TypeDef * p_comp , uint32_t input_plus )

Set comparator input plus.

Reference Manual to LL API cross reference (Register Field Functions)

CSR INPSEL LL_COMP_SetInputPlus

Note

In case of comparator input selected to be connected to IO: GPIO pins are specific to each comparator instance. Refer to description of parameters or to reference manual.

Parameters :
uint32_t LL_COMP_GetInputPlus ( const COMP_TypeDef * p_comp )

Get comparator input plus.

Reference Manual to LL API cross reference (Register Field Functions)

CSR INPSEL LL_COMP_GetInputPlus

Note

In case of comparator input selected to be connected to IO: GPIO pins are specific to each comparator instance. Refer to description of parameters or to reference manual.

Parameters :

p_comp – Comparator instance

Return values :

Returned – value can be one of the following values:

void LL_COMP_SetInputMinus ( COMP_TypeDef * p_comp , uint32_t input_minus )

Set comparator input minus.

Reference Manual to LL API cross reference (Register Field Functions)

CSR INMSEL LL_COMP_SetInputMinus

Note

In case of comparator input selected to be connected to IO: GPIO pins are specific to each comparator instance. Refer to description of parameters or to reference manual.

Note

Voltage scaler is used when selecting comparator input based on VrefInt (VrefInt or subdivision of VrefInt). In this case, specific delay must be fulfilled for voltage stabilization when enabling comparator, refer to LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US.

Parameters :
uint32_t LL_COMP_GetInputMinus ( const COMP_TypeDef * p_comp )

Get comparator input minus.

Reference Manual to LL API cross reference (Register Field Functions)

CSR INMSEL LL_COMP_GetInputMinus

Note

In case of comparator input selected to be connected to IO: GPIO pins are specific to each comparator instance. Refer to description of parameters or to reference manual.

Parameters :

p_comp – Comparator instance

Return values :

Returned – value can be one of the following values:

uint32_t LL_COMP_IsInputScalerEnabled ( const COMP_TypeDef * p_comp )

Get comparator input voltage scaler bridge configuration.

Reference Manual to LL API cross reference (Register Field Functions)

CSR INMSEL LL_COMP_IsInputScalerEnabled

Note

Voltage scaler is used when selecting comparator input based on VrefInt (VrefInt or subdivision of VrefInt). In this case, specific delay must be fulfilled for voltage stabilization when enabling comparator, refer to LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US.

Parameters :

p_comp – Comparator instance

Return values :

State – of scaler bridge configuration (value “1” for enabled, value “0” for disabled).

void LL_COMP_SetInputHysteresis ( COMP_TypeDef * p_comp , uint32_t input_hysteresis )

Set comparator input hysteresis.

Reference Manual to LL API cross reference (Register Field Functions)

CSR HYST LL_COMP_SetInputHysteresis

Note

Hysteresys applied on comparator input minus.

Parameters :
uint32_t LL_COMP_GetInputHysteresis ( const COMP_TypeDef * p_comp )

Get comparator instance hysteresis mode of the minus (inverting) input.

Reference Manual to LL API cross reference (Register Field Functions)

CSR HYST LL_COMP_GetInputHysteresis

Parameters :

p_comp – Comparator instance

Return values :

Returned – value can be one of the following values:

Functions

void LL_COMP_SetOutputPolarity ( COMP_TypeDef * p_comp , uint32_t output_polarity )

Set comparator instance output polarity.

Reference Manual to LL API cross reference (Register Field Functions)

CSR POLARITY LL_COMP_SetOutputPolarity

Parameters :
uint32_t LL_COMP_GetOutputPolarity ( const COMP_TypeDef * p_comp )

Get comparator instance output polarity.

Reference Manual to LL API cross reference (Register Field Functions)

CSR POLARITY LL_COMP_GetOutputPolarity

Parameters :

p_comp – Comparator instance

Return values :

Returned – value can be one of the following values:

void LL_COMP_SetOutputBlankingSource ( COMP_TypeDef * p_comp , uint32_t blanking_source )

Set comparator instance blanking source.

Reference Manual to LL API cross reference (Register Field Functions)

CSR BLANKSEL LL_COMP_SetOutputBlankingSource

Note

Availability of parameters of blanking source from peripherals depends on their availability on the selected device.

Note

Blanking source can be specific to each comparator instance. Refer to description of parameters or to reference manual.

Parameters :
uint32_t LL_COMP_GetOutputBlankingSource ( const COMP_TypeDef * p_comp )

Get comparator instance blanking source.

Reference Manual to LL API cross reference (Register Field Functions)

CSR BLANKSEL LL_COMP_GetOutputBlankingSource

Note

Availability of parameters of blanking source from peripherals depends on their availability on the selected device.

Note

Blanking source can be specific to each comparator instance. Refer to description of parameters or to reference manual.

Parameters :

p_comp – Comparator instance

Return values :

Returned – value can be one of the following values:

Functions

void LL_COMP_Enable ( COMP_TypeDef * p_comp )

Enable comparator instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR EN LL_COMP_Enable

Note

After enable, comparator requires a delay to reach reach propagation delay specification, refer to LL_COMP_DELAY_STARTUP_US.

Note

Voltage scaler is used when selecting comparator input based on VrefInt (VrefInt or subdivision of VrefInt). In this case, specific delay must be fulfilled for voltage stabilization when enabling comparator, refer to LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US. To get scaler bridge configuration, refer to LL_COMP_IsInputScalerEnabled() .

Parameters :

p_comp – Comparator instance

void LL_COMP_Disable ( COMP_TypeDef * p_comp )

Disable comparator instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR EN LL_COMP_Disable

Parameters :

p_comp – Comparator instance

uint32_t LL_COMP_IsEnabled ( const COMP_TypeDef * p_comp )

Get comparator enable state.

Reference Manual to LL API cross reference (Register Field Functions)

CSR EN LL_COMP_IsEnabled

Parameters :

p_comp – Comparator instance

Return values :

Value – “0” for comparator disabled, value “1” for comparator enabled.

void LL_COMP_Lock ( COMP_TypeDef * p_comp )

Lock comparator instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR LOCK LL_COMP_Lock

Note

Once locked, comparator configuration can be accessed in read-only.

Note

The only way to unlock the comparator is a device system reset.

Parameters :

p_comp – Comparator instance

uint32_t LL_COMP_IsLocked ( const COMP_TypeDef * p_comp )

Get comparator lock state.

Reference Manual to LL API cross reference (Register Field Functions)

CSR LOCK LL_COMP_IsLocked

Note

Once locked, comparator configuration can be accessed in read-only.

Note

The only way to unlock the comparator is a device system reset.

Parameters :

p_comp – Comparator instance

Return values :

Value – “0” for comparator unlocked, value “1” for comparator locked.

uint32_t LL_COMP_ReadOutputLevel ( const COMP_TypeDef * p_comp )

Read comparator instance output level.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VALUE LL_COMP_ReadOutputLevel

Note

The comparator output level depends on the selected polarity (Refer to function LL_COMP_SetOutputPolarity() ). If the comparator polarity is not inverted:

  • Comparator output is low when the input plus is at a lower voltage than the input minus

  • Comparator output is high when the input plus is at a higher voltage than the input minus If the comparator polarity is inverted:

  • Comparator output is high when the input plus is at a lower voltage than the input minus

  • Comparator output is low when the input plus is at a higher voltage than the input minus

Parameters :

p_comp – Comparator instance

Return values :

Returned – value can be one of the following values: