STM32H735xx HAL User Manual
Data Structures | Defines | Typedefs | Enumerations | Functions
stm32h7xx_hal_comp.h File Reference

Header file of COMP HAL module. More...

#include "stm32h7xx_hal_def.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   ((uint32_t)0x10)
 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   ((uint32_t)0x00000000)
#define COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON   (COMP_CFGRx_WINMODE)
#define COMP_POWERMODE_HIGHSPEED   ((uint32_t)0x00000000)
#define COMP_POWERMODE_MEDIUMSPEED   (COMP_CFGRx_PWRMODE_0)
#define COMP_POWERMODE_ULTRALOWPOWER   (COMP_CFGRx_PWRMODE)
#define COMP_INPUT_PLUS_IO1   ((uint32_t)0x00000000)
#define COMP_INPUT_PLUS_IO2   (COMP_CFGRx_INPSEL)
#define COMP_INPUT_MINUS_1_4VREFINT   ( COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN)
#define COMP_INPUT_MINUS_1_2VREFINT   ( COMP_CFGRx_INMSEL_0 | COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN)
#define COMP_INPUT_MINUS_3_4VREFINT   ( COMP_CFGRx_INMSEL_1 | COMP_CFGRx_SCALEN | COMP_CFGRx_BRGEN)
#define COMP_INPUT_MINUS_VREFINT   ( COMP_CFGRx_INMSEL_1 | COMP_CFGRx_INMSEL_0 | COMP_CFGRx_SCALEN )
#define COMP_INPUT_MINUS_DAC1_CH1   ( COMP_CFGRx_INMSEL_2 )
#define COMP_INPUT_MINUS_DAC1_CH2   ( COMP_CFGRx_INMSEL_2 | COMP_CFGRx_INMSEL_0 )
#define COMP_INPUT_MINUS_IO1   ( COMP_CFGRx_INMSEL_2 | COMP_CFGRx_INMSEL_1 )
#define COMP_INPUT_MINUS_IO2   ( COMP_CFGRx_INMSEL_2 | COMP_CFGRx_INMSEL_1 | COMP_CFGRx_INMSEL_0 )
#define COMP_HYSTERESIS_NONE   ((uint32_t)0x00000000)
#define COMP_HYSTERESIS_LOW   (COMP_CFGRx_HYST_0)
#define COMP_HYSTERESIS_MEDIUM   (COMP_CFGRx_HYST_1)
#define COMP_HYSTERESIS_HIGH   (COMP_CFGRx_HYST)
#define COMP_OUTPUTPOL_NONINVERTED   ((uint32_t)0x00000000)
#define COMP_OUTPUTPOL_INVERTED   (COMP_CFGRx_POLARITY)
#define COMP_BLANKINGSRC_NONE   ((uint32_t)0x00000000)
#define COMP_BLANKINGSRC_TIM1_OC5   (COMP_CFGRx_BLANKING_0)
#define COMP_BLANKINGSRC_TIM2_OC3   (COMP_CFGRx_BLANKING_1)
#define COMP_BLANKINGSRC_TIM3_OC3   (COMP_CFGRx_BLANKING_0 |COMP_CFGRx_BLANKING_1)
#define COMP_BLANKINGSRC_TIM3_OC4   (COMP_CFGRx_BLANKING_2)
#define COMP_BLANKINGSRC_TIM8_OC5   (COMP_CFGRx_BLANKING_2|COMP_CFGRx_BLANKING_0)
#define COMP_BLANKINGSRC_TIM15_OC1   (COMP_CFGRx_BLANKING_2|COMP_CFGRx_BLANKING_1)
#define COMP_OUTPUT_LEVEL_LOW   ((uint32_t)0x00000000)
#define COMP_OUTPUT_LEVEL_HIGH   ((uint32_t)0x00000001)
#define COMP_TRIGGERMODE_NONE   ((uint32_t)0x00000000)
#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 COMP_FLAG_C1I   COMP_SR_C1IF
#define COMP_FLAG_C2I   COMP_SR_C2IF
#define COMP_FLAG_LOCK   COMP_CFGRx_LOCK
#define COMP_CLEAR_C1IF   COMP_ICFR_C1IF
#define COMP_CLEAR_C2IF   COMP_ICFR_C2IF
#define COMP_IT_EN   COMP_CFGRx_ITEN
#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->CFGR, COMP_CFGRx_EN)
 Enable the specified comparator.
#define __HAL_COMP_DISABLE(__HANDLE__)   CLEAR_BIT((__HANDLE__)->Instance->CFGR, COMP_CFGRx_EN)
 Disable the specified comparator.
#define __HAL_COMP_LOCK(__HANDLE__)   SET_BIT((__HANDLE__)->Instance->CFGR, COMP_CFGRx_LOCK)
 Lock the specified comparator configuration.
#define __HAL_COMP_IS_LOCKED(__HANDLE__)   (READ_BIT((__HANDLE__)->Instance->CFGR, COMP_CFGRx_LOCK) == COMP_CFGRx_LOCK)
 Check whether the specified comparator is locked.
#define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE()   SET_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP1)
 Enable the COMP1 EXTI line rising edge trigger.
#define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE()   CLEAR_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP1)
 Disable the COMP1 EXTI line rising edge trigger.
#define __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE()   SET_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP1)
 Enable the COMP1 EXTI line falling edge trigger.
#define __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE()   CLEAR_BIT(EXTI->FTSR1, 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()   SET_BIT(EXTI_D1->IMR1, COMP_EXTI_LINE_COMP1)
 Enable the COMP1 EXTI line in interrupt mode.
#define __HAL_COMP_COMP1_EXTI_DISABLE_IT()   CLEAR_BIT(EXTI_D1->IMR1, COMP_EXTI_LINE_COMP1)
 Disable the COMP1 EXTI line in interrupt mode.
#define __HAL_COMP_COMP1_EXTI_ENABLE_EVENT()   SET_BIT(EXTI_D1->EMR1, COMP_EXTI_LINE_COMP1)
 Enable the COMP1 EXTI Line in event mode.
#define __HAL_COMP_COMP1_EXTI_DISABLE_EVENT()   CLEAR_BIT(EXTI_D1->EMR1, COMP_EXTI_LINE_COMP1)
 Disable the COMP1 EXTI Line in event mode.
#define __HAL_COMP_COMP1_EXTI_GET_FLAG()   READ_BIT(EXTI_D1->PR1, COMP_EXTI_LINE_COMP1)
 Check whether the COMP1 EXTI line flag is set or not.
#define __HAL_COMP_COMP1_EXTI_CLEAR_FLAG()   WRITE_REG(EXTI_D1->PR1, COMP_EXTI_LINE_COMP1)
 Clear the COMP1 EXTI flag.
#define __HAL_COMP_COMP1_EXTI_GENERATE_SWIT()   SET_BIT(EXTI->SWIER1, COMP_EXTI_LINE_COMP1)
 Generate a software interrupt on the COMP1 EXTI line.
#define __HAL_COMP_COMP1_EXTID3_ENABLE_EVENT()   SET_BIT(EXTI->D3PMR1, COMP_EXTI_LINE_COMP1)
 Enable the COMP1 D3 EXTI Line in event mode.
#define __HAL_COMP_COMP1_EXTID3_DISABLE_EVENT()   CLEAR_BIT(EXTI->D3PMR1, COMP_EXTI_LINE_COMP1)
 Disable the COMP1 D3 EXTI Line in event mode.
#define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE()   SET_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP2)
 Enable the COMP2 EXTI line rising edge trigger.
#define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE()   CLEAR_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP2)
 Disable the COMP2 EXTI line rising edge trigger.
#define __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE()   SET_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP2)
 Enable the COMP2 EXTI line falling edge trigger.
#define __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE()   CLEAR_BIT(EXTI->FTSR1, 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()   SET_BIT(EXTI_D1->IMR1, COMP_EXTI_LINE_COMP2)
 Enable the COMP2 EXTI line.
#define __HAL_COMP_COMP2_EXTI_DISABLE_IT()   CLEAR_BIT(EXTI_D1->IMR1, COMP_EXTI_LINE_COMP2)
 Disable the COMP2 EXTI line.
#define __HAL_COMP_COMP2_EXTI_ENABLE_EVENT()   SET_BIT(EXTI_D1->EMR1, COMP_EXTI_LINE_COMP2)
 Enable the COMP2 EXTI Line in event mode.
#define __HAL_COMP_COMP2_EXTI_DISABLE_EVENT()   CLEAR_BIT(EXTI_D1->EMR1, COMP_EXTI_LINE_COMP2)
 Disable the COMP2 EXTI Line in event mode.
#define __HAL_COMP_COMP2_EXTI_GET_FLAG()   READ_BIT(EXTI_D1->PR1, COMP_EXTI_LINE_COMP2)
 Check whether the COMP2 EXTI line flag is set or not.
#define __HAL_COMP_COMP2_EXTI_CLEAR_FLAG()   WRITE_REG(EXTI_D1->PR1, COMP_EXTI_LINE_COMP2)
 Clear the the COMP2 EXTI flag.
#define __HAL_COMP_COMP2_EXTID3_ENABLE_EVENT()   SET_BIT(EXTI->D3PMR1, COMP_EXTI_LINE_COMP2)
 Enable the COMP2 D3 EXTI Line in event mode.
#define __HAL_COMP_COMP2_EXTID3_DISABLE_EVENT()   CLEAR_BIT(EXTI->D3PMR1, COMP_EXTI_LINE_COMP2)
 Disable the COMP2 D3 EXTI Line in event mode.
#define __HAL_COMP_COMP2_EXTI_GENERATE_SWIT()   SET_BIT(EXTI->SWIER1, COMP_EXTI_LINE_COMP2)
 Generate a software interrupt on the COMP2 EXTI line.
#define __HAL_COMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)   ((((__HANDLE__)->Instance->CFGR & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
 Checks if the specified COMP interrupt source is enabled or disabled.
#define __HAL_COMP_GET_FLAG(__FLAG__)   ((COMP12->SR & (__FLAG__)) == (__FLAG__))
 Checks whether the specified COMP flag is set or not.
#define __HAL_COMP_CLEAR_FLAG(__FLAG__)   (COMP12->ICFR = (__FLAG__))
 Clears the specified COMP pending flag.
#define __HAL_COMP_CLEAR_C1IFLAG()   __HAL_COMP_CLEAR_FLAG( COMP_CLEAR_C1IF)
 Clear the COMP C1I flag.
#define __HAL_COMP_CLEAR_C2IFLAG()   __HAL_COMP_CLEAR_FLAG( COMP_CLEAR_C2IF)
 Clear the COMP C2I flag.
#define __HAL_COMP_ENABLE_IT(__HANDLE__, __INTERRUPT__)   ( ((__HANDLE__)->Instance->CFGR) |= (__INTERRUPT__) )
 Enable the specified COMP interrupt.
#define __HAL_COMP_DISABLE_IT(__HANDLE__, __INTERRUPT__)   (((__HANDLE__)->Instance->CFGR) &= ~(__INTERRUPT__))
 Disable the specified COMP interrupt.
#define __HAL_COMP_ENABLE_OR(__AF__)   SET_BIT(COMP12->OR, (__AF__))
 Enable the specified bit in the Option register.
#define __HAL_COMP_DISABLE_OR(__AF__)   CLEAR_BIT(COMP12->OR, (__AF__))
 Disable the specified bit in the Option register.
#define COMP_EXTI_LINE_COMP1   (EXTI_IMR1_IM20)
#define COMP_EXTI_LINE_COMP2   (EXTI_IMR1_IM21)
#define COMP_EXTI_IT   ((uint32_t) 0x01)
#define COMP_EXTI_EVENT   ((uint32_t) 0x02)
#define COMP_EXTI_RISING   ((uint32_t) 0x10)
#define COMP_EXTI_FALLING   ((uint32_t) 0x20)
#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(__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 = 0x00, HAL_COMP_STATE_RESET_LOCKED = (HAL_COMP_STATE_RESET | COMP_STATE_BITFIELD_LOCK), HAL_COMP_STATE_READY = 0x01, HAL_COMP_STATE_READY_LOCKED = (HAL_COMP_STATE_READY | COMP_STATE_BITFIELD_LOCK),
  HAL_COMP_STATE_BUSY = 0x02, 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.
HAL_StatusTypeDef HAL_COMP_Start_IT (COMP_HandleTypeDef *hcomp)
 Enable the interrupt and start the comparator.
HAL_StatusTypeDef HAL_COMP_Stop_IT (COMP_HandleTypeDef *hcomp)
 Disable the interrupt and 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. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file stm32h7xx_hal_comp.h.