STM32L486xx HAL User Manual
Data Structures | Defines | Typedefs | Enumerations | Functions
stm32l4xx_hal_comp.h File Reference

Header file of COMP HAL module. More...

#include "stm32l4xx_hal_def.h"
#include "stm32l4xx_ll_exti.h"

Go to the source code of this file.

Data Structures

struct  COMP_InitTypeDef
 COMP Init structure definition. More...
struct  __COMP_HandleTypeDef
 COMP Handle Structure definition. More...

Defines

#define COMP_STATE_BITFIELD_LOCK   (0x10U)
 HAL COMP state machine: HAL COMP states definition.
#define HAL_COMP_ERROR_NONE   (0x00U)
#define HAL_COMP_ERROR_INVALID_CALLBACK   (0x01U)
#define COMP_WINDOWMODE_DISABLE   (0x00000000U)
#define COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON   (COMP_CSR_WINMODE)
#define COMP_POWERMODE_HIGHSPEED   (0x00000000U)
#define COMP_POWERMODE_MEDIUMSPEED   (COMP_CSR_PWRMODE_0)
#define COMP_POWERMODE_ULTRALOWPOWER   (COMP_CSR_PWRMODE)
#define COMP_INPUT_PLUS_IO1   (0x00000000U)
#define COMP_INPUT_PLUS_IO2   (COMP_CSR_INPSEL_0)
#define COMP_INPUT_MINUS_1_4VREFINT   ( COMP_CSR_SCALEN | COMP_CSR_BRGEN)
#define COMP_INPUT_MINUS_1_2VREFINT   ( COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN | COMP_CSR_BRGEN)
#define COMP_INPUT_MINUS_3_4VREFINT   ( COMP_CSR_INMSEL_1 | COMP_CSR_SCALEN | COMP_CSR_BRGEN)
#define COMP_INPUT_MINUS_VREFINT   ( COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN )
#define COMP_INPUT_MINUS_DAC1_CH1   (COMP_CSR_INMSEL_2 )
#define COMP_INPUT_MINUS_DAC1_CH2   (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0)
#define COMP_INPUT_MINUS_IO1   (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 )
#define COMP_INPUT_MINUS_IO2   (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0)
#define COMP_HYSTERESIS_NONE   (0x00000000U)
#define COMP_HYSTERESIS_LOW   ( COMP_CSR_HYST_0)
#define COMP_HYSTERESIS_MEDIUM   (COMP_CSR_HYST_1 )
#define COMP_HYSTERESIS_HIGH   (COMP_CSR_HYST_1 | COMP_CSR_HYST_0)
#define COMP_OUTPUTPOL_NONINVERTED   (0x00000000U)
#define COMP_OUTPUTPOL_INVERTED   (COMP_CSR_POLARITY)
#define COMP_BLANKINGSRC_NONE   (0x00000000U)
#define COMP_BLANKINGSRC_TIM1_OC5_COMP1   (COMP_CSR_BLANKING_0)
#define COMP_BLANKINGSRC_TIM2_OC3_COMP1   (COMP_CSR_BLANKING_1)
#define COMP_BLANKINGSRC_TIM3_OC3_COMP1   (COMP_CSR_BLANKING_2)
#define COMP_BLANKINGSRC_TIM3_OC4_COMP2   (COMP_CSR_BLANKING_0)
#define COMP_BLANKINGSRC_TIM8_OC5_COMP2   (COMP_CSR_BLANKING_1)
#define COMP_BLANKINGSRC_TIM15_OC1_COMP2   (COMP_CSR_BLANKING_2)
#define COMP_OUTPUT_LEVEL_LOW   (0x00000000U)
#define COMP_OUTPUT_LEVEL_HIGH   (0x00000001U)
#define COMP_TRIGGERMODE_NONE   (0x00000000U)
#define COMP_TRIGGERMODE_IT_RISING   (COMP_EXTI_IT | COMP_EXTI_RISING)
#define COMP_TRIGGERMODE_IT_FALLING   (COMP_EXTI_IT | COMP_EXTI_FALLING)
#define COMP_TRIGGERMODE_IT_RISING_FALLING   (COMP_EXTI_IT | COMP_EXTI_RISING | COMP_EXTI_FALLING)
#define COMP_TRIGGERMODE_EVENT_RISING   (COMP_EXTI_EVENT | COMP_EXTI_RISING)
#define COMP_TRIGGERMODE_EVENT_FALLING   (COMP_EXTI_EVENT | COMP_EXTI_FALLING)
#define COMP_TRIGGERMODE_EVENT_RISING_FALLING   (COMP_EXTI_EVENT | COMP_EXTI_RISING | COMP_EXTI_FALLING)
#define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__)
 Reset COMP handle state.
#define COMP_CLEAR_ERRORCODE(__HANDLE__)   ((__HANDLE__)->ErrorCode = HAL_COMP_ERROR_NONE)
 Clear COMP error code (set it to no error code "HAL_COMP_ERROR_NONE").
#define __HAL_COMP_ENABLE(__HANDLE__)   SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
 Enable the specified comparator.
#define __HAL_COMP_DISABLE(__HANDLE__)   CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
 Disable the specified comparator.
#define __HAL_COMP_LOCK(__HANDLE__)   SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK)
 Lock the specified comparator configuration.
#define __HAL_COMP_IS_LOCKED(__HANDLE__)   (READ_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK) == COMP_CSR_LOCK)
 Check whether the specified comparator is locked.
#define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE()   LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP1)
 Enable the COMP1 EXTI line rising edge trigger.
#define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE()   LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP1)
 Disable the COMP1 EXTI line rising edge trigger.
#define __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE()   LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP1)
 Enable the COMP1 EXTI line falling edge trigger.
#define __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE()   LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP1)
 Disable the COMP1 EXTI line falling edge trigger.
#define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_FALLING_EDGE()
 Enable the COMP1 EXTI line rising & falling edge trigger.
#define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_FALLING_EDGE()
 Disable the COMP1 EXTI line rising & falling edge trigger.
#define __HAL_COMP_COMP1_EXTI_ENABLE_IT()   LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP1)
 Enable the COMP1 EXTI line in interrupt mode.
#define __HAL_COMP_COMP1_EXTI_DISABLE_IT()   LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP1)
 Disable the COMP1 EXTI line in interrupt mode.
#define __HAL_COMP_COMP1_EXTI_GENERATE_SWIT()   LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP1)
 Generate a software interrupt on the COMP1 EXTI line.
#define __HAL_COMP_COMP1_EXTI_ENABLE_EVENT()   LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP1)
 Enable the COMP1 EXTI line in event mode.
#define __HAL_COMP_COMP1_EXTI_DISABLE_EVENT()   LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP1)
 Disable the COMP1 EXTI line in event mode.
#define __HAL_COMP_COMP1_EXTI_GET_FLAG()   LL_EXTI_IsActiveFlag_0_31(COMP_EXTI_LINE_COMP1)
 Check whether the COMP1 EXTI line flag is set.
#define __HAL_COMP_COMP1_EXTI_CLEAR_FLAG()   LL_EXTI_ClearFlag_0_31(COMP_EXTI_LINE_COMP1)
 Clear the COMP1 EXTI flag.
#define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE()   LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP2)
 Enable the COMP2 EXTI line rising edge trigger.
#define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE()   LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP2)
 Disable the COMP2 EXTI line rising edge trigger.
#define __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE()   LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP2)
 Enable the COMP2 EXTI line falling edge trigger.
#define __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE()   LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP2)
 Disable the COMP2 EXTI line falling edge trigger.
#define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_FALLING_EDGE()
 Enable the COMP2 EXTI line rising & falling edge trigger.
#define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_FALLING_EDGE()
 Disable the COMP2 EXTI line rising & falling edge trigger.
#define __HAL_COMP_COMP2_EXTI_ENABLE_IT()   LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP2)
 Enable the COMP2 EXTI line in interrupt mode.
#define __HAL_COMP_COMP2_EXTI_DISABLE_IT()   LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP2)
 Disable the COMP2 EXTI line in interrupt mode.
#define __HAL_COMP_COMP2_EXTI_GENERATE_SWIT()   LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP2)
 Generate a software interrupt on the COMP2 EXTI line.
#define __HAL_COMP_COMP2_EXTI_ENABLE_EVENT()   LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP2)
 Enable the COMP2 EXTI line in event mode.
#define __HAL_COMP_COMP2_EXTI_DISABLE_EVENT()   LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP2)
 Disable the COMP2 EXTI line in event mode.
#define __HAL_COMP_COMP2_EXTI_GET_FLAG()   LL_EXTI_IsActiveFlag_0_31(COMP_EXTI_LINE_COMP2)
 Check whether the COMP2 EXTI line flag is set.
#define __HAL_COMP_COMP2_EXTI_CLEAR_FLAG()   LL_EXTI_ClearFlag_0_31(COMP_EXTI_LINE_COMP2)
 Clear the COMP2 EXTI flag.
#define COMP_EXTI_LINE_COMP1   (LL_EXTI_LINE_21)
#define COMP_EXTI_LINE_COMP2   (LL_EXTI_LINE_22)
#define COMP_EXTI_IT   (0x01U)
#define COMP_EXTI_EVENT   (0x02U)
#define COMP_EXTI_RISING   (0x10U)
#define COMP_EXTI_FALLING   (0x20U)
#define COMP_GET_EXTI_LINE(__INSTANCE__)
 Get the specified EXTI line for a comparator instance.
#define IS_COMP_WINDOWMODE(__WINDOWMODE__)
#define IS_COMP_POWERMODE(__POWERMODE__)
#define IS_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__)
#define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__)
#define IS_COMP_HYSTERESIS(__HYSTERESIS__)
#define IS_COMP_OUTPUTPOL(__POL__)
#define IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__)
#define IS_COMP_BLANKINGSRC_INSTANCE(__INSTANCE__, __OUTPUT_BLANKING_SOURCE__)
#define IS_COMP_TRIGGERMODE(__MODE__)
#define IS_COMP_OUTPUT_LEVEL(__OUTPUT_LEVEL__)

Typedefs

typedef struct __COMP_HandleTypeDef COMP_HandleTypeDef
 COMP Handle Structure definition.
typedef void(* pCOMP_CallbackTypeDef )(COMP_HandleTypeDef *hcomp)
 HAL COMP Callback pointer definition.

Enumerations

enum  HAL_COMP_StateTypeDef {
  HAL_COMP_STATE_RESET = 0x00U, HAL_COMP_STATE_RESET_LOCKED = (HAL_COMP_STATE_RESET | COMP_STATE_BITFIELD_LOCK), HAL_COMP_STATE_READY = 0x01U, HAL_COMP_STATE_READY_LOCKED = (HAL_COMP_STATE_READY | COMP_STATE_BITFIELD_LOCK),
  HAL_COMP_STATE_BUSY = 0x02U, HAL_COMP_STATE_BUSY_LOCKED = (HAL_COMP_STATE_BUSY | COMP_STATE_BITFIELD_LOCK)
}
enum  HAL_COMP_CallbackIDTypeDef { HAL_COMP_TRIGGER_CB_ID = 0x00U, HAL_COMP_MSPINIT_CB_ID = 0x01U, HAL_COMP_MSPDEINIT_CB_ID = 0x02U }
 HAL COMP Callback ID enumeration definition. More...

Functions

HAL_StatusTypeDef HAL_COMP_Init (COMP_HandleTypeDef *hcomp)
 Initialize the COMP according to the specified parameters in the COMP_InitTypeDef and initialize the associated handle.
HAL_StatusTypeDef HAL_COMP_DeInit (COMP_HandleTypeDef *hcomp)
 DeInitialize the COMP peripheral.
__weak void HAL_COMP_MspInit (COMP_HandleTypeDef *hcomp)
 Initialize the COMP MSP.
__weak void HAL_COMP_MspDeInit (COMP_HandleTypeDef *hcomp)
 DeInitialize the COMP MSP.
HAL_StatusTypeDef HAL_COMP_RegisterCallback (COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID, pCOMP_CallbackTypeDef pCallback)
 Register a User COMP Callback To be used instead of the weak predefined callback.
HAL_StatusTypeDef HAL_COMP_UnRegisterCallback (COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID)
 Unregister a COMP Callback COMP callback is redirected to the weak predefined callback.
HAL_StatusTypeDef HAL_COMP_Start (COMP_HandleTypeDef *hcomp)
 Start the comparator.
HAL_StatusTypeDef HAL_COMP_Stop (COMP_HandleTypeDef *hcomp)
 Stop the comparator.
void HAL_COMP_IRQHandler (COMP_HandleTypeDef *hcomp)
 Comparator IRQ handler.
HAL_StatusTypeDef HAL_COMP_Lock (COMP_HandleTypeDef *hcomp)
 Lock the selected comparator configuration.
uint32_t HAL_COMP_GetOutputLevel (COMP_HandleTypeDef *hcomp)
 Return the output level (high or low) of the selected comparator.
__weak void HAL_COMP_TriggerCallback (COMP_HandleTypeDef *hcomp)
 Comparator trigger callback.
HAL_COMP_StateTypeDef HAL_COMP_GetState (COMP_HandleTypeDef *hcomp)
 Return the COMP handle state.
uint32_t HAL_COMP_GetError (COMP_HandleTypeDef *hcomp)
 Return the COMP error code.

Detailed Description

Header file of COMP HAL module.

Author:
MCD Application Team
Attention:

© COPYRIGHT(c) 2017 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file stm32l4xx_hal_comp.h.