STM32L4xx_HAL_Driver  1.14.0
Operation on comparator instance

Functions

__STATIC_INLINE void LL_COMP_Enable (COMP_TypeDef *COMPx)
 Enable comparator instance. More...
 
__STATIC_INLINE void LL_COMP_Disable (COMP_TypeDef *COMPx)
 Disable comparator instance. CSR EN LL_COMP_Disable. More...
 
__STATIC_INLINE uint32_t LL_COMP_IsEnabled (COMP_TypeDef *COMPx)
 Get comparator enable state (0: COMP is disabled, 1: COMP is enabled) CSR EN LL_COMP_IsEnabled. More...
 
__STATIC_INLINE void LL_COMP_Lock (COMP_TypeDef *COMPx)
 Lock comparator instance. More...
 
__STATIC_INLINE uint32_t LL_COMP_IsLocked (COMP_TypeDef *COMPx)
 Get comparator lock state (0: COMP is unlocked, 1: COMP is locked). More...
 
__STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel (COMP_TypeDef *COMPx)
 Read comparator instance output level. More...
 

Detailed Description

Function Documentation

◆ LL_COMP_Disable()

__STATIC_INLINE void LL_COMP_Disable ( COMP_TypeDef *  COMPx)

Disable comparator instance. CSR EN LL_COMP_Disable.

Parameters
COMPxComparator instance
Return values
None

Definition at line 770 of file stm32l4xx_ll_comp.h.

771 {
772  CLEAR_BIT(COMPx->CSR, COMP_CSR_EN);
773 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)

◆ LL_COMP_Enable()

__STATIC_INLINE void LL_COMP_Enable ( COMP_TypeDef *  COMPx)

Enable comparator instance.

Note
After enable from off state, comparator requires a delay to reach reach propagation delay specification. Refer to device datasheet, parameter "tSTART". CSR EN LL_COMP_Enable
Parameters
COMPxComparator instance
Return values
None

Definition at line 759 of file stm32l4xx_ll_comp.h.

760 {
761  SET_BIT(COMPx->CSR, COMP_CSR_EN);
762 }

◆ LL_COMP_IsEnabled()

__STATIC_INLINE uint32_t LL_COMP_IsEnabled ( COMP_TypeDef *  COMPx)

Get comparator enable state (0: COMP is disabled, 1: COMP is enabled) CSR EN LL_COMP_IsEnabled.

Parameters
COMPxComparator instance
Return values
Stateof bit (1 or 0).

Definition at line 782 of file stm32l4xx_ll_comp.h.

783 {
784  return ((READ_BIT(COMPx->CSR, COMP_CSR_EN) == (COMP_CSR_EN)) ? 1UL : 0UL);
785 }

◆ LL_COMP_IsLocked()

__STATIC_INLINE uint32_t LL_COMP_IsLocked ( COMP_TypeDef *  COMPx)

Get comparator lock state (0: COMP is unlocked, 1: COMP is locked).

Note
Once locked, comparator configuration can be accessed in read-only.
The only way to unlock the comparator is a device hardware reset. CSR LOCK LL_COMP_IsLocked
Parameters
COMPxComparator instance
Return values
Stateof bit (1 or 0).

Definition at line 809 of file stm32l4xx_ll_comp.h.

810 {
811  return ((READ_BIT(COMPx->CSR, COMP_CSR_LOCK) == (COMP_CSR_LOCK)) ? 1UL : 0UL);
812 }

◆ LL_COMP_Lock()

__STATIC_INLINE void LL_COMP_Lock ( COMP_TypeDef *  COMPx)

Lock comparator instance.

Note
Once locked, comparator configuration can be accessed in read-only.
The only way to unlock the comparator is a device hardware reset. CSR LOCK LL_COMP_Lock
Parameters
COMPxComparator instance
Return values
None

Definition at line 795 of file stm32l4xx_ll_comp.h.

796 {
797  SET_BIT(COMPx->CSR, COMP_CSR_LOCK);
798 }

◆ LL_COMP_ReadOutputLevel()

__STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel ( COMP_TypeDef *  COMPx)

Read comparator instance output level.

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 CSR VALUE LL_COMP_ReadOutputLevel
Parameters
COMPxComparator instance
Return values
Returnedvalue can be one of the following values:
  • LL_COMP_OUTPUT_LEVEL_LOW
  • LL_COMP_OUTPUT_LEVEL_HIGH

Definition at line 834 of file stm32l4xx_ll_comp.h.

835 {
836  return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_VALUE)
837  >> LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS);
838 }