2015-07-27 13:56:29 +00:00
/**
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @ file stm32l4xx_hal_comp . h
* @ author MCD Application Team
* @ brief Header file of COMP HAL module .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @ attention
*
2019-07-18 08:20:59 +00:00
* < h2 > < center > & copy ; Copyright ( c ) 2017 STMicroelectronics .
* All rights reserved . < / center > < / h2 >
2015-07-27 13:56:29 +00:00
*
2019-07-18 08:20:59 +00:00
* This software component is licensed by ST under BSD 3 - Clause license ,
* the " License " ; You may not use this file except in compliance with the
* License . You may obtain a copy of the License at :
* opensource . org / licenses / BSD - 3 - Clause
2015-07-27 13:56:29 +00:00
*
2019-07-18 08:20:59 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2015-07-27 13:56:29 +00:00
*/
/* Define to prevent recursive inclusion -------------------------------------*/
2019-07-18 08:20:59 +00:00
# ifndef STM32L4xx_HAL_COMP_H
# define STM32L4xx_HAL_COMP_H
2015-07-27 13:56:29 +00:00
# ifdef __cplusplus
2019-07-18 08:20:59 +00:00
extern " C " {
2015-07-27 13:56:29 +00:00
# endif
/* Includes ------------------------------------------------------------------*/
# include "stm32l4xx_hal_def.h"
2018-01-05 16:29:05 +00:00
# include "stm32l4xx_ll_exti.h"
2015-07-27 13:56:29 +00:00
/** @addtogroup STM32L4xx_HAL_Driver
* @ {
*/
2019-07-18 08:20:59 +00:00
# if defined (COMP1) || defined (COMP2)
2015-07-27 13:56:29 +00:00
/** @addtogroup COMP
* @ {
*/
2019-07-18 08:20:59 +00:00
/* Exported types ------------------------------------------------------------*/
2015-07-27 13:56:29 +00:00
/** @defgroup COMP_Exported_Types COMP Exported Types
* @ {
*/
2019-07-18 08:20:59 +00:00
/**
* @ brief COMP Init structure definition
2015-07-27 13:56:29 +00:00
*/
typedef struct
{
2019-07-18 08:20:59 +00:00
# if defined(COMP2)
2016-06-03 13:33:27 +00:00
uint32_t WindowMode ; /*!< Set window mode of a pair of comparators instances
( 2 consecutive instances odd and even COMP < x > and COMP < x + 1 > ) .
Note : HAL COMP driver allows to set window mode from any COMP instance of the pair of COMP instances composing window mode .
This parameter can be a value of @ ref COMP_WindowMode */
2019-07-18 08:20:59 +00:00
# endif /* COMP2 */
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
uint32_t Mode ; /*!< Set comparator operating mode to adjust power and speed.
2019-07-18 08:20:59 +00:00
Note : For the characteristics of comparator power modes
2016-06-03 13:33:27 +00:00
( propagation delay and power consumption ) , refer to device datasheet .
This parameter can be a value of @ ref COMP_PowerMode */
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
uint32_t NonInvertingInput ; /*!< Set comparator input plus (non-inverting input).
This parameter can be a value of @ ref COMP_InputPlus */
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
uint32_t InvertingInput ; /*!< Set comparator input minus (inverting input).
This parameter can be a value of @ ref COMP_InputMinus */
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
uint32_t Hysteresis ; /*!< Set comparator hysteresis mode of the input minus.
This parameter can be a value of @ ref COMP_Hysteresis */
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
uint32_t OutputPol ; /*!< Set comparator output polarity.
This parameter can be a value of @ ref COMP_OutputPolarity */
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
uint32_t BlankingSrce ; /*!< Set comparator blanking source.
This parameter can be a value of @ ref COMP_BlankingSrce */
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
uint32_t TriggerMode ; /*!< Set the comparator output triggering External Interrupt Line (EXTI).
This parameter can be a value of @ ref COMP_EXTI_TriggerMode */
2015-07-27 13:56:29 +00:00
2019-07-18 08:20:59 +00:00
} COMP_InitTypeDef ;
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
/**
* @ brief HAL COMP state machine : HAL COMP states definition
2015-07-27 13:56:29 +00:00
*/
2018-01-05 16:29:05 +00:00
# define COMP_STATE_BITFIELD_LOCK (0x10U)
2015-07-27 13:56:29 +00:00
typedef enum
{
2018-01-05 16:29:05 +00:00
HAL_COMP_STATE_RESET = 0x00U , /*!< COMP not yet initialized */
2016-06-03 13:33:27 +00:00
HAL_COMP_STATE_RESET_LOCKED = ( HAL_COMP_STATE_RESET | COMP_STATE_BITFIELD_LOCK ) , /*!< COMP not yet initialized and configuration is locked */
2018-01-05 16:29:05 +00:00
HAL_COMP_STATE_READY = 0x01U , /*!< COMP initialized and ready for use */
2016-06-03 13:33:27 +00:00
HAL_COMP_STATE_READY_LOCKED = ( HAL_COMP_STATE_READY | COMP_STATE_BITFIELD_LOCK ) , /*!< COMP initialized but configuration is locked */
2018-01-05 16:29:05 +00:00
HAL_COMP_STATE_BUSY = 0x02U , /*!< COMP is running */
2016-06-03 13:33:27 +00:00
HAL_COMP_STATE_BUSY_LOCKED = ( HAL_COMP_STATE_BUSY | COMP_STATE_BITFIELD_LOCK ) /*!< COMP is running and configuration is locked */
2019-07-18 08:20:59 +00:00
} HAL_COMP_StateTypeDef ;
2015-07-27 13:56:29 +00:00
2019-07-18 08:20:59 +00:00
/**
2015-07-27 13:56:29 +00:00
* @ brief COMP Handle Structure definition
*/
2019-07-18 08:20:59 +00:00
# if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
typedef struct __COMP_HandleTypeDef
# else
2015-07-27 13:56:29 +00:00
typedef struct
2019-07-18 08:20:59 +00:00
# endif
2015-07-27 13:56:29 +00:00
{
COMP_TypeDef * Instance ; /*!< Register base address */
COMP_InitTypeDef Init ; /*!< COMP required parameters */
HAL_LockTypeDef Lock ; /*!< Locking object */
__IO HAL_COMP_StateTypeDef State ; /*!< COMP communication state */
2019-07-18 08:20:59 +00:00
__IO uint32_t ErrorCode ; /*!< COMP error code */
# if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
void ( * TriggerCallback ) ( struct __COMP_HandleTypeDef * hcomp ) ; /*!< COMP trigger callback */
void ( * MspInitCallback ) ( struct __COMP_HandleTypeDef * hcomp ) ; /*!< COMP Msp Init callback */
void ( * MspDeInitCallback ) ( struct __COMP_HandleTypeDef * hcomp ) ; /*!< COMP Msp DeInit callback */
# endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
2015-07-27 13:56:29 +00:00
} COMP_HandleTypeDef ;
2019-07-18 08:20:59 +00:00
# if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
/**
* @ brief HAL COMP Callback ID enumeration definition
*/
typedef enum
{
HAL_COMP_TRIGGER_CB_ID = 0x00U , /*!< COMP trigger callback ID */
HAL_COMP_MSPINIT_CB_ID = 0x01U , /*!< COMP Msp Init callback ID */
HAL_COMP_MSPDEINIT_CB_ID = 0x02U /*!< COMP Msp DeInit callback ID */
} HAL_COMP_CallbackIDTypeDef ;
/**
* @ brief HAL COMP Callback pointer definition
*/
typedef void ( * pCOMP_CallbackTypeDef ) ( COMP_HandleTypeDef * hcomp ) ; /*!< pointer to a COMP callback function */
# endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup COMP_Exported_Constants COMP Exported Constants
* @ {
*/
2019-07-18 08:20:59 +00:00
/** @defgroup COMP_Error_Code COMP Error Code
* @ {
*/
# define HAL_COMP_ERROR_NONE (0x00UL) /*!< No error */
# if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
# define HAL_COMP_ERROR_INVALID_CALLBACK (0x01UL) /*!< Invalid Callback error */
# endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
/**
* @ }
*/
# if defined(COMP2)
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_WindowMode COMP Window Mode
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
# define COMP_WINDOWMODE_DISABLE (0x00000000UL) /*!< Window mode disable: Comparators instances pair COMP1 and COMP2 are independent */
2016-06-03 13:33:27 +00:00
# define COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CSR_WINMODE) /*!< Window mode enable: Comparators instances pair COMP1 and COMP2 have their input plus connected together. The common input is COMP1 input plus (COMP2 input plus is no more accessible). */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2019-07-18 08:20:59 +00:00
# endif
2015-07-27 13:56:29 +00:00
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_PowerMode COMP power mode
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
/* Note: For the characteristics of comparator power modes */
2016-06-03 13:33:27 +00:00
/* (propagation delay and power consumption), */
/* refer to device datasheet. */
2019-07-18 08:20:59 +00:00
# define COMP_POWERMODE_HIGHSPEED (0x00000000UL) /*!< High Speed */
2016-06-03 13:33:27 +00:00
# define COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_PWRMODE_0) /*!< Medium Speed */
# define COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_PWRMODE) /*!< Ultra-low power mode */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_InputPlus COMP input plus (non-inverting input)
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
# define COMP_INPUT_PLUS_IO1 (0x00000000UL) /*!< Comparator input plus connected to IO1 (pin PC5 for COMP1, pin PB4 for COMP2) */
2016-06-03 13:33:27 +00:00
# define COMP_INPUT_PLUS_IO2 (COMP_CSR_INPSEL_0) /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PB6 for COMP2) */
# if defined(COMP_CSR_INPSEL_1)
# define COMP_INPUT_PLUS_IO3 (COMP_CSR_INPSEL_1) /*!< Comparator input plus connected to IO3 (pin PA1 for COMP1, pin PA3 for COMP2) */
# endif
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_InputMinus COMP input minus (inverting input)
2015-07-27 13:56:29 +00:00
* @ {
*/
2016-06-03 13:33:27 +00:00
# define COMP_INPUT_MINUS_1_4VREFINT ( COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 1/4 VrefInt */
# define COMP_INPUT_MINUS_1_2VREFINT ( COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 1/2 VrefInt */
# define COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 3/4 VrefInt */
# define COMP_INPUT_MINUS_VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN ) /*!< Comparator input minus connected to VrefInt */
# define COMP_INPUT_MINUS_DAC1_CH1 (COMP_CSR_INMSEL_2 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) */
2017-05-18 12:10:29 +00:00
# if defined(DAC_CHANNEL2_SUPPORT)
2016-06-03 13:33:27 +00:00
# define COMP_INPUT_MINUS_DAC1_CH2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) */
2017-05-18 12:10:29 +00:00
# endif
2018-01-05 16:29:05 +00:00
# define COMP_INPUT_MINUS_IO1 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PB1 for COMP1, pin PB3 for COMP2) */
2016-06-03 13:33:27 +00:00
# define COMP_INPUT_MINUS_IO2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO2 (pin PC4 for COMP1, pin PB7 for COMP2) */
# if defined(COMP_CSR_INMESEL_1)
# define COMP_INPUT_MINUS_IO3 ( COMP_CSR_INMESEL_0 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO3 (pin PA0 for COMP1, pin PA2 for COMP2) */
# define COMP_INPUT_MINUS_IO4 (COMP_CSR_INMESEL_1 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO4 (pin PA4 for COMP1, pin PA4 for COMP2) */
# define COMP_INPUT_MINUS_IO5 (COMP_CSR_INMESEL_1 | COMP_CSR_INMESEL_0 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO5 (pin PA5 for COMP1, pin PA5 for COMP2) */
# endif
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_Hysteresis COMP hysteresis
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
# define COMP_HYSTERESIS_NONE (0x00000000UL) /*!< No hysteresis */
2018-01-05 16:29:05 +00:00
# define COMP_HYSTERESIS_LOW ( COMP_CSR_HYST_0) /*!< Hysteresis level low */
# define COMP_HYSTERESIS_MEDIUM (COMP_CSR_HYST_1 ) /*!< Hysteresis level medium */
# define COMP_HYSTERESIS_HIGH (COMP_CSR_HYST_1 | COMP_CSR_HYST_0) /*!< Hysteresis level high */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_OutputPolarity COMP output Polarity
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
# define COMP_OUTPUTPOL_NONINVERTED (0x00000000UL) /*!< COMP output level is not inverted (comparator output is high when the input plus is at a higher voltage than the input minus) */
2016-06-03 13:33:27 +00:00
# define COMP_OUTPUTPOL_INVERTED (COMP_CSR_POLARITY) /*!< COMP output level is inverted (comparator output is low when the input plus is at a higher voltage than the input minus) */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_BlankingSrce COMP blanking source
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
# define COMP_BLANKINGSRC_NONE (0x00000000UL) /*!<Comparator output without blanking */
2018-01-05 16:29:05 +00:00
# define COMP_BLANKINGSRC_TIM1_OC5_COMP1 (COMP_CSR_BLANKING_0) /*!< Comparator output blanking source TIM1 OC5 (specific to COMP instance: COMP1) */
# define COMP_BLANKINGSRC_TIM2_OC3_COMP1 (COMP_CSR_BLANKING_1) /*!< Comparator output blanking source TIM2 OC3 (specific to COMP instance: COMP1) */
# define COMP_BLANKINGSRC_TIM3_OC3_COMP1 (COMP_CSR_BLANKING_2) /*!< Comparator output blanking source TIM3 OC3 (specific to COMP instance: COMP1) */
# define COMP_BLANKINGSRC_TIM3_OC4_COMP2 (COMP_CSR_BLANKING_0) /*!< Comparator output blanking source TIM3 OC4 (specific to COMP instance: COMP2) */
# define COMP_BLANKINGSRC_TIM8_OC5_COMP2 (COMP_CSR_BLANKING_1) /*!< Comparator output blanking source TIM8 OC5 (specific to COMP instance: COMP2) */
# define COMP_BLANKINGSRC_TIM15_OC1_COMP2 (COMP_CSR_BLANKING_2) /*!< Comparator output blanking source TIM15 OC1 (specific to COMP instance: COMP2) */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
/** @defgroup COMP_OutputLevel COMP Output Level
* @ {
2016-06-03 13:33:27 +00:00
*/
/* Note: Comparator output level values are fixed to "0" and "1", */
/* corresponding COMP register bit is managed by HAL function to match */
/* with these values (independently of bit position in register). */
2015-07-27 13:56:29 +00:00
/* When output polarity is not inverted, comparator output is low when
2016-06-03 13:33:27 +00:00
the input plus is at a lower voltage than the input minus */
2019-07-18 08:20:59 +00:00
# define COMP_OUTPUT_LEVEL_LOW (0x00000000UL)
2015-07-27 13:56:29 +00:00
/* When output polarity is not inverted, comparator output is high when
2016-06-03 13:33:27 +00:00
the input plus is at a higher voltage than the input minus */
2019-07-18 08:20:59 +00:00
# define COMP_OUTPUT_LEVEL_HIGH (0x00000001UL)
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_EXTI_TriggerMode COMP output to EXTI
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
# define COMP_TRIGGERMODE_NONE (0x00000000UL) /*!< Comparator output triggering no External Interrupt Line */
2016-06-03 13:33:27 +00:00
# define COMP_TRIGGERMODE_IT_RISING (COMP_EXTI_IT | COMP_EXTI_RISING) /*!< Comparator output triggering External Interrupt Line event with interruption, on rising edge */
# define COMP_TRIGGERMODE_IT_FALLING (COMP_EXTI_IT | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event with interruption, on falling edge */
# define COMP_TRIGGERMODE_IT_RISING_FALLING (COMP_EXTI_IT | COMP_EXTI_RISING | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event with interruption, on both rising and falling edges */
# define COMP_TRIGGERMODE_EVENT_RISING (COMP_EXTI_EVENT | COMP_EXTI_RISING) /*!< Comparator output triggering External Interrupt Line event only (without interruption), on rising edge */
# define COMP_TRIGGERMODE_EVENT_FALLING (COMP_EXTI_EVENT | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event only (without interruption), on falling edge */
# define COMP_TRIGGERMODE_EVENT_RISING_FALLING (COMP_EXTI_EVENT | COMP_EXTI_RISING | COMP_EXTI_FALLING) /*!< Comparator output triggering External Interrupt Line event only (without interruption), on both rising and falling edges */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/* Exported macro ------------------------------------------------------------*/
2015-07-27 13:56:29 +00:00
/** @defgroup COMP_Exported_Macros COMP Exported Macros
* @ {
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_Handle_Management COMP Handle Management
* @ {
*/
2015-07-27 13:56:29 +00:00
/** @brief Reset COMP handle state.
2016-06-03 13:33:27 +00:00
* @ param __HANDLE__ COMP handle
2015-07-27 13:56:29 +00:00
* @ retval None
*/
2019-07-18 08:20:59 +00:00
# if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
# define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) do{ \
( __HANDLE__ ) - > State = HAL_COMP_STATE_RESET ; \
( __HANDLE__ ) - > MspInitCallback = NULL ; \
( __HANDLE__ ) - > MspDeInitCallback = NULL ; \
} while ( 0 )
# else
2016-06-03 13:33:27 +00:00
# define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET)
2019-07-18 08:20:59 +00:00
# endif
/**
* @ brief Clear COMP error code ( set it to no error code " HAL_COMP_ERROR_NONE " ) .
* @ param __HANDLE__ COMP handle
* @ retval None
*/
# define COMP_CLEAR_ERRORCODE(__HANDLE__) ((__HANDLE__)->ErrorCode = HAL_COMP_ERROR_NONE)
2015-07-27 13:56:29 +00:00
/**
* @ brief Enable the specified comparator .
2016-06-03 13:33:27 +00:00
* @ param __HANDLE__ COMP handle
2015-07-27 13:56:29 +00:00
* @ retval None
*/
2016-06-03 13:33:27 +00:00
# define __HAL_COMP_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
2015-07-27 13:56:29 +00:00
/**
* @ brief Disable the specified comparator .
2016-06-03 13:33:27 +00:00
* @ param __HANDLE__ COMP handle
2015-07-27 13:56:29 +00:00
* @ retval None
*/
2016-06-03 13:33:27 +00:00
# define __HAL_COMP_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
2015-07-27 13:56:29 +00:00
/**
* @ brief Lock the specified comparator configuration .
2016-06-03 13:33:27 +00:00
* @ note Using this macro induce HAL COMP handle state machine being no
* more in line with COMP instance state .
* To keep HAL COMP handle state machine updated , it is recommended
* to use function " HAL_COMP_Lock') " .
* @ param __HANDLE__ COMP handle
2015-07-27 13:56:29 +00:00
* @ retval None
*/
2016-06-03 13:33:27 +00:00
# define __HAL_COMP_LOCK(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK)
/**
* @ brief Check whether the specified comparator is locked .
* @ param __HANDLE__ COMP handle
* @ retval Value 0 if COMP instance is not locked , value 1 if COMP instance is locked
*/
# define __HAL_COMP_IS_LOCKED(__HANDLE__) (READ_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK) == COMP_CSR_LOCK)
/**
* @ }
*/
/** @defgroup COMP_Exti_Management COMP external interrupt line management
* @ {
*/
2015-07-27 13:56:29 +00:00
/**
* @ brief Enable the COMP1 EXTI line rising edge trigger .
* @ retval None
2016-06-03 13:33:27 +00:00
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
* @ brief Disable the COMP1 EXTI line rising edge trigger .
* @ retval None
2016-06-03 13:33:27 +00:00
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
* @ brief Enable the COMP1 EXTI line falling edge trigger .
* @ retval None
2016-06-03 13:33:27 +00:00
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
* @ brief Disable the COMP1 EXTI line falling edge trigger .
* @ retval None
2016-06-03 13:33:27 +00:00
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
* @ brief Enable the COMP1 EXTI line rising & falling edge trigger .
* @ retval None
2016-06-03 13:33:27 +00:00
*/
2015-07-27 13:56:29 +00:00
# define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
2018-01-05 16:29:05 +00:00
LL_EXTI_EnableRisingTrig_0_31 ( COMP_EXTI_LINE_COMP1 ) ; \
LL_EXTI_EnableFallingTrig_0_31 ( COMP_EXTI_LINE_COMP1 ) ; \
2015-07-27 13:56:29 +00:00
} while ( 0 )
/**
* @ brief Disable the COMP1 EXTI line rising & falling edge trigger .
* @ retval None
2019-07-18 08:20:59 +00:00
*/
2015-07-27 13:56:29 +00:00
# define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
2018-01-05 16:29:05 +00:00
LL_EXTI_DisableRisingTrig_0_31 ( COMP_EXTI_LINE_COMP1 ) ; \
LL_EXTI_DisableFallingTrig_0_31 ( COMP_EXTI_LINE_COMP1 ) ; \
2015-07-27 13:56:29 +00:00
} while ( 0 )
/**
* @ brief Enable the COMP1 EXTI line in interrupt mode .
* @ retval None
2016-06-03 13:33:27 +00:00
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_ENABLE_IT() LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
* @ brief Disable the COMP1 EXTI line in interrupt mode .
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_DISABLE_IT() LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
* @ brief Generate a software interrupt on the COMP1 EXTI line .
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_GENERATE_SWIT() LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
2016-06-03 13:33:27 +00:00
* @ brief Enable the COMP1 EXTI line in event mode .
2015-07-27 13:56:29 +00:00
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_ENABLE_EVENT() LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
2016-06-03 13:33:27 +00:00
* @ brief Disable the COMP1 EXTI line in event mode .
2015-07-27 13:56:29 +00:00
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_DISABLE_EVENT() LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
/**
2016-06-03 13:33:27 +00:00
* @ brief Check whether the COMP1 EXTI line flag is set .
2015-07-27 13:56:29 +00:00
* @ retval RESET or SET
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_GET_FLAG() LL_EXTI_IsActiveFlag_0_31(COMP_EXTI_LINE_COMP1)
2016-06-03 13:33:27 +00:00
2015-07-27 13:56:29 +00:00
/**
* @ brief Clear the COMP1 EXTI flag .
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() LL_EXTI_ClearFlag_0_31(COMP_EXTI_LINE_COMP1)
2015-07-27 13:56:29 +00:00
2019-07-18 08:20:59 +00:00
# if defined(COMP2)
2015-07-27 13:56:29 +00:00
/**
* @ brief Enable the COMP2 EXTI line rising edge trigger .
* @ retval None
2018-01-05 16:29:05 +00:00
*/
# define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() LL_EXTI_EnableRisingTrig_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
* @ brief Disable the COMP2 EXTI line rising edge trigger .
* @ retval None
2018-01-05 16:29:05 +00:00
*/
# define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() LL_EXTI_DisableRisingTrig_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
* @ brief Enable the COMP2 EXTI line falling edge trigger .
* @ retval None
2018-01-05 16:29:05 +00:00
*/
# define __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() LL_EXTI_EnableFallingTrig_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
* @ brief Disable the COMP2 EXTI line falling edge trigger .
* @ retval None
2018-01-05 16:29:05 +00:00
*/
# define __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() LL_EXTI_DisableFallingTrig_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
* @ brief Enable the COMP2 EXTI line rising & falling edge trigger .
* @ retval None
2018-01-05 16:29:05 +00:00
*/
2015-07-27 13:56:29 +00:00
# define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
2018-01-05 16:29:05 +00:00
LL_EXTI_EnableRisingTrig_0_31 ( COMP_EXTI_LINE_COMP2 ) ; \
LL_EXTI_EnableFallingTrig_0_31 ( COMP_EXTI_LINE_COMP2 ) ; \
2015-07-27 13:56:29 +00:00
} while ( 0 )
/**
* @ brief Disable the COMP2 EXTI line rising & falling edge trigger .
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
LL_EXTI_DisableRisingTrig_0_31 ( COMP_EXTI_LINE_COMP2 ) ; \
LL_EXTI_DisableFallingTrig_0_31 ( COMP_EXTI_LINE_COMP2 ) ; \
2015-07-27 13:56:29 +00:00
} while ( 0 )
/**
* @ brief Enable the COMP2 EXTI line in interrupt mode .
* @ retval None
2016-06-03 13:33:27 +00:00
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP2_EXTI_ENABLE_IT() LL_EXTI_EnableIT_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
* @ brief Disable the COMP2 EXTI line in interrupt mode .
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP2_EXTI_DISABLE_IT() LL_EXTI_DisableIT_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
* @ brief Generate a software interrupt on the COMP2 EXTI line .
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP2_EXTI_GENERATE_SWIT() LL_EXTI_GenerateSWI_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
2016-06-03 13:33:27 +00:00
* @ brief Enable the COMP2 EXTI line in event mode .
2015-07-27 13:56:29 +00:00
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP2_EXTI_ENABLE_EVENT() LL_EXTI_EnableEvent_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
2016-06-03 13:33:27 +00:00
* @ brief Disable the COMP2 EXTI line in event mode .
2015-07-27 13:56:29 +00:00
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP2_EXTI_DISABLE_EVENT() LL_EXTI_DisableEvent_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
/**
2016-06-03 13:33:27 +00:00
* @ brief Check whether the COMP2 EXTI line flag is set .
2015-07-27 13:56:29 +00:00
* @ retval RESET or SET
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP2_EXTI_GET_FLAG() LL_EXTI_IsActiveFlag_0_31(COMP_EXTI_LINE_COMP2)
2016-06-03 13:33:27 +00:00
2015-07-27 13:56:29 +00:00
/**
* @ brief Clear the COMP2 EXTI flag .
* @ retval None
*/
2018-01-05 16:29:05 +00:00
# define __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() LL_EXTI_ClearFlag_0_31(COMP_EXTI_LINE_COMP2)
2015-07-27 13:56:29 +00:00
2019-07-18 08:20:59 +00:00
# endif /* COMP2 */
2016-06-03 13:33:27 +00:00
/**
* @ }
2015-07-27 13:56:29 +00:00
*/
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/* Private types -------------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup COMP_Private_Constants COMP Private Constants
2015-07-27 13:56:29 +00:00
* @ {
*/
2018-01-05 16:29:05 +00:00
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_ExtiLine COMP EXTI Lines
2015-07-27 13:56:29 +00:00
* @ {
*/
2018-01-05 16:29:05 +00:00
# define COMP_EXTI_LINE_COMP1 (LL_EXTI_LINE_21) /*!< EXTI line 21 connected to COMP1 output */
2019-07-18 08:20:59 +00:00
# if defined(COMP2)
2018-01-05 16:29:05 +00:00
# define COMP_EXTI_LINE_COMP2 (LL_EXTI_LINE_22) /*!< EXTI line 22 connected to COMP2 output */
2019-07-18 08:20:59 +00:00
# endif /* COMP2 */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_ExtiLine COMP EXTI Lines
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
# define COMP_EXTI_IT (0x00000001UL) /*!< EXTI line event with interruption */
# define COMP_EXTI_EVENT (0x00000002UL) /*!< EXTI line event only (without interruption) */
# define COMP_EXTI_RISING (0x00000010UL) /*!< EXTI line event on rising edge */
# define COMP_EXTI_FALLING (0x00000020UL) /*!< EXTI line event on falling edge */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/**
* @ }
*/
/* Private macros ------------------------------------------------------------*/
/** @defgroup COMP_Private_Macros COMP Private Macros
* @ {
*/
2019-07-18 08:20:59 +00:00
/** @defgroup COMP_GET_EXTI_LINE COMP private macros to get EXTI line associated with comparators
2015-07-27 13:56:29 +00:00
* @ {
*/
2016-06-03 13:33:27 +00:00
/**
* @ brief Get the specified EXTI line for a comparator instance .
* @ param __INSTANCE__ specifies the COMP instance .
* @ retval value of @ ref COMP_ExtiLine
*/
2019-07-18 08:20:59 +00:00
# if defined(COMP2)
# define COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1 \
: COMP_EXTI_LINE_COMP2 )
# else
# define COMP_GET_EXTI_LINE(__INSTANCE__) COMP_EXTI_LINE_COMP1
# endif /* COMP2 */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/** @defgroup COMP_IS_COMP_Definitions COMP private macros to check input parameters
2015-07-27 13:56:29 +00:00
* @ {
*/
2019-07-18 08:20:59 +00:00
# if defined(COMP2)
2016-06-03 13:33:27 +00:00
# define IS_COMP_WINDOWMODE(__WINDOWMODE__) (((__WINDOWMODE__) == COMP_WINDOWMODE_DISABLE) || \
( ( __WINDOWMODE__ ) = = COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON ) )
2019-07-18 08:20:59 +00:00
# endif
2016-06-03 13:33:27 +00:00
# define IS_COMP_POWERMODE(__POWERMODE__) (((__POWERMODE__) == COMP_POWERMODE_HIGHSPEED) || \
( ( __POWERMODE__ ) = = COMP_POWERMODE_MEDIUMSPEED ) | | \
( ( __POWERMODE__ ) = = COMP_POWERMODE_ULTRALOWPOWER ) )
# if defined(COMP_CSR_INPSEL_1)
# define IS_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) (((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO1) || \
( ( __INPUT_PLUS__ ) = = COMP_INPUT_PLUS_IO2 ) | | \
( ( __INPUT_PLUS__ ) = = COMP_INPUT_PLUS_IO3 ) )
# else
# define IS_COMP_INPUT_PLUS(__COMP_INSTANCE__, __INPUT_PLUS__) (((__INPUT_PLUS__) == COMP_INPUT_PLUS_IO1) || \
( ( __INPUT_PLUS__ ) = = COMP_INPUT_PLUS_IO2 ) )
# endif
2018-01-05 16:29:05 +00:00
/* Note: On this STM32 serie, comparator input minus parameters are */
2016-06-03 13:33:27 +00:00
/* the same on all COMP instances. */
/* However, comparator instance kept as macro parameter for */
/* compatibility with other STM32 families. */
2017-05-18 12:10:29 +00:00
# if defined(COMP_CSR_INMESEL_1) && defined(DAC_CHANNEL2_SUPPORT)
2016-06-03 13:33:27 +00:00
# define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_1_2VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_3_4VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_DAC1_CH1 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_DAC1_CH2 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO1 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO2 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO3 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO4 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO5 ) )
2017-05-18 12:10:29 +00:00
# elif defined(COMP_CSR_INMESEL_1)
# define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_1_2VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_3_4VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_DAC1_CH1 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO1 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO2 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO3 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO4 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO5 ) )
# elif defined(DAC_CHANNEL2_SUPPORT)
2016-06-03 13:33:27 +00:00
# define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_1_2VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_3_4VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_DAC1_CH1 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_DAC1_CH2 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO1 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO2 ) )
2017-05-18 12:10:29 +00:00
# else
# define IS_COMP_INPUT_MINUS(__COMP_INSTANCE__, __INPUT_MINUS__) (((__INPUT_MINUS__) == COMP_INPUT_MINUS_1_4VREFINT) || \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_1_2VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_3_4VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_VREFINT ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_DAC1_CH1 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO1 ) | | \
( ( __INPUT_MINUS__ ) = = COMP_INPUT_MINUS_IO2 ) )
2016-06-03 13:33:27 +00:00
# endif
# define IS_COMP_HYSTERESIS(__HYSTERESIS__) (((__HYSTERESIS__) == COMP_HYSTERESIS_NONE) || \
( ( __HYSTERESIS__ ) = = COMP_HYSTERESIS_LOW ) | | \
( ( __HYSTERESIS__ ) = = COMP_HYSTERESIS_MEDIUM ) | | \
( ( __HYSTERESIS__ ) = = COMP_HYSTERESIS_HIGH ) )
# define IS_COMP_OUTPUTPOL(__POL__) (((__POL__) == COMP_OUTPUTPOL_NONINVERTED) || \
( ( __POL__ ) = = COMP_OUTPUTPOL_INVERTED ) )
2019-07-18 08:20:59 +00:00
# if defined(COMP2)
2018-01-05 16:29:05 +00:00
# define IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__) \
( ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_NONE ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM1_OC5_COMP1 ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM2_OC3_COMP1 ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM3_OC3_COMP1 ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM3_OC4_COMP2 ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM8_OC5_COMP2 ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM15_OC1_COMP2 ) \
)
2019-07-18 08:20:59 +00:00
# else
# if defined(TIM3)
# define IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__) \
( ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_NONE ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM1_OC5_COMP1 ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM2_OC3_COMP1 ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM3_OC3_COMP1 ) \
)
# else
# define IS_COMP_BLANKINGSRCE(__OUTPUT_BLANKING_SOURCE__) \
( ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_NONE ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM1_OC5_COMP1 ) \
| | ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM2_OC3_COMP1 ) \
)
# endif /* TIM3 */
# endif /* COMP2 */
2018-01-05 16:29:05 +00:00
2019-07-18 08:20:59 +00:00
# if defined(COMP2)
2018-01-05 16:29:05 +00:00
# define IS_COMP_BLANKINGSRC_INSTANCE(__INSTANCE__, __OUTPUT_BLANKING_SOURCE__) \
( ( ( ( __INSTANCE__ ) = = COMP1 ) & & \
( ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_NONE ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM1_OC5_COMP1 ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM2_OC3_COMP1 ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM3_OC3_COMP1 ) ) ) \
| | \
( ( ( __INSTANCE__ ) = = COMP2 ) & & \
( ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_NONE ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM3_OC4_COMP2 ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM8_OC5_COMP2 ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM15_OC1_COMP2 ) ) ) )
2019-07-18 08:20:59 +00:00
# else
# if defined(TIM3)
# define IS_COMP_BLANKINGSRC_INSTANCE(__INSTANCE__, __OUTPUT_BLANKING_SOURCE__) \
( ( ( __INSTANCE__ ) = = COMP1 ) & & \
( ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_NONE ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM1_OC5_COMP1 ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM2_OC3_COMP1 ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM3_OC3_COMP1 ) ) )
# else
# define IS_COMP_BLANKINGSRC_INSTANCE(__INSTANCE__, __OUTPUT_BLANKING_SOURCE__) \
( ( ( __INSTANCE__ ) = = COMP1 ) & & \
( ( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_NONE ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM1_OC5_COMP1 ) | | \
( ( __OUTPUT_BLANKING_SOURCE__ ) = = COMP_BLANKINGSRC_TIM2_OC3_COMP1 ) ) )
# endif /* TIM3 */
# endif /* COMP2 */
2017-05-18 12:10:29 +00:00
2016-06-03 13:33:27 +00:00
# define IS_COMP_TRIGGERMODE(__MODE__) (((__MODE__) == COMP_TRIGGERMODE_NONE) || \
( ( __MODE__ ) = = COMP_TRIGGERMODE_IT_RISING ) | | \
( ( __MODE__ ) = = COMP_TRIGGERMODE_IT_FALLING ) | | \
( ( __MODE__ ) = = COMP_TRIGGERMODE_IT_RISING_FALLING ) | | \
( ( __MODE__ ) = = COMP_TRIGGERMODE_EVENT_RISING ) | | \
( ( __MODE__ ) = = COMP_TRIGGERMODE_EVENT_FALLING ) | | \
( ( __MODE__ ) = = COMP_TRIGGERMODE_EVENT_RISING_FALLING ) )
# define IS_COMP_OUTPUT_LEVEL(__OUTPUT_LEVEL__) (((__OUTPUT_LEVEL__) == COMP_OUTPUT_LEVEL_LOW) || \
( ( __OUTPUT_LEVEL__ ) = = COMP_OUTPUT_LEVEL_HIGH ) )
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/* Exported functions --------------------------------------------------------*/
/** @addtogroup COMP_Exported_Functions
2015-07-27 13:56:29 +00:00
* @ {
*/
2016-06-03 13:33:27 +00:00
/** @addtogroup COMP_Exported_Functions_Group1
2015-07-27 13:56:29 +00:00
* @ {
*/
2016-06-03 13:33:27 +00:00
/* Initialization and de-initialization functions **********************************/
HAL_StatusTypeDef HAL_COMP_Init ( COMP_HandleTypeDef * hcomp ) ;
2019-07-18 08:20:59 +00:00
HAL_StatusTypeDef HAL_COMP_DeInit ( COMP_HandleTypeDef * hcomp ) ;
2016-06-03 13:33:27 +00:00
void HAL_COMP_MspInit ( COMP_HandleTypeDef * hcomp ) ;
void HAL_COMP_MspDeInit ( COMP_HandleTypeDef * hcomp ) ;
2019-07-18 08:20:59 +00:00
# if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
/* Callbacks Register/UnRegister functions ***********************************/
HAL_StatusTypeDef HAL_COMP_RegisterCallback ( COMP_HandleTypeDef * hcomp , HAL_COMP_CallbackIDTypeDef CallbackID ,
pCOMP_CallbackTypeDef pCallback ) ;
HAL_StatusTypeDef HAL_COMP_UnRegisterCallback ( COMP_HandleTypeDef * hcomp , HAL_COMP_CallbackIDTypeDef CallbackID ) ;
# endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/* IO operation functions *****************************************************/
/** @addtogroup COMP_Exported_Functions_Group2
* @ {
*/
HAL_StatusTypeDef HAL_COMP_Start ( COMP_HandleTypeDef * hcomp ) ;
HAL_StatusTypeDef HAL_COMP_Stop ( COMP_HandleTypeDef * hcomp ) ;
void HAL_COMP_IRQHandler ( COMP_HandleTypeDef * hcomp ) ;
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/* Peripheral Control functions ************************************************/
/** @addtogroup COMP_Exported_Functions_Group3
2015-07-27 13:56:29 +00:00
* @ {
*/
2016-06-03 13:33:27 +00:00
HAL_StatusTypeDef HAL_COMP_Lock ( COMP_HandleTypeDef * hcomp ) ;
uint32_t HAL_COMP_GetOutputLevel ( COMP_HandleTypeDef * hcomp ) ;
/* Callback in interrupt mode */
void HAL_COMP_TriggerCallback ( COMP_HandleTypeDef * hcomp ) ;
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
2016-06-03 13:33:27 +00:00
/* Peripheral State functions **************************************************/
/** @addtogroup COMP_Exported_Functions_Group4
2015-07-27 13:56:29 +00:00
* @ {
*/
2016-06-03 13:33:27 +00:00
HAL_COMP_StateTypeDef HAL_COMP_GetState ( COMP_HandleTypeDef * hcomp ) ;
2019-07-18 08:20:59 +00:00
uint32_t HAL_COMP_GetError ( COMP_HandleTypeDef * hcomp ) ;
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
/**
* @ }
*/
/**
* @ }
*/
2019-07-18 08:20:59 +00:00
# endif /* COMP1 || COMP2 */
2015-07-27 13:56:29 +00:00
/**
* @ }
*/
# ifdef __cplusplus
}
# endif
2019-07-18 08:20:59 +00:00
# endif /* STM32L4xx_HAL_COMP_H */
2015-07-27 13:56:29 +00:00
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/