Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
107:4f6c30876dfa
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 107:4f6c30876dfa 1 /**
Kojto 107:4f6c30876dfa 2 ******************************************************************************
Kojto 107:4f6c30876dfa 3 * @file stm32l4xx_hal_comp.h
Kojto 107:4f6c30876dfa 4 * @author MCD Application Team
Kojto 107:4f6c30876dfa 5 * @version V1.0.0
Kojto 107:4f6c30876dfa 6 * @date 26-June-2015
Kojto 107:4f6c30876dfa 7 * @brief Header file of COMP HAL module.
Kojto 107:4f6c30876dfa 8 ******************************************************************************
Kojto 107:4f6c30876dfa 9 * @attention
Kojto 107:4f6c30876dfa 10 *
Kojto 107:4f6c30876dfa 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 107:4f6c30876dfa 12 *
Kojto 107:4f6c30876dfa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 107:4f6c30876dfa 14 * are permitted provided that the following conditions are met:
Kojto 107:4f6c30876dfa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 107:4f6c30876dfa 16 * this list of conditions and the following disclaimer.
Kojto 107:4f6c30876dfa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 107:4f6c30876dfa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 107:4f6c30876dfa 19 * and/or other materials provided with the distribution.
Kojto 107:4f6c30876dfa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 107:4f6c30876dfa 21 * may be used to endorse or promote products derived from this software
Kojto 107:4f6c30876dfa 22 * without specific prior written permission.
Kojto 107:4f6c30876dfa 23 *
Kojto 107:4f6c30876dfa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 107:4f6c30876dfa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 107:4f6c30876dfa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 107:4f6c30876dfa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 107:4f6c30876dfa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 107:4f6c30876dfa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 107:4f6c30876dfa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 107:4f6c30876dfa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 107:4f6c30876dfa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 107:4f6c30876dfa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 107:4f6c30876dfa 34 *
Kojto 107:4f6c30876dfa 35 ******************************************************************************
Kojto 107:4f6c30876dfa 36 */
Kojto 107:4f6c30876dfa 37
Kojto 107:4f6c30876dfa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 107:4f6c30876dfa 39 #ifndef __STM32L4xx_HAL_COMP_H
Kojto 107:4f6c30876dfa 40 #define __STM32L4xx_HAL_COMP_H
Kojto 107:4f6c30876dfa 41
Kojto 107:4f6c30876dfa 42 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 43 extern "C" {
Kojto 107:4f6c30876dfa 44 #endif
Kojto 107:4f6c30876dfa 45
Kojto 107:4f6c30876dfa 46 /* Includes ------------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 47 #include "stm32l4xx_hal_def.h"
Kojto 107:4f6c30876dfa 48
Kojto 107:4f6c30876dfa 49 /** @addtogroup STM32L4xx_HAL_Driver
Kojto 107:4f6c30876dfa 50 * @{
Kojto 107:4f6c30876dfa 51 */
Kojto 107:4f6c30876dfa 52
Kojto 107:4f6c30876dfa 53 /** @addtogroup COMP
Kojto 107:4f6c30876dfa 54 * @{
Kojto 107:4f6c30876dfa 55 */
Kojto 107:4f6c30876dfa 56
Kojto 107:4f6c30876dfa 57 /* Exported types ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 58 /** @defgroup COMP_Exported_Types COMP Exported Types
Kojto 107:4f6c30876dfa 59 * @{
Kojto 107:4f6c30876dfa 60 */
Kojto 107:4f6c30876dfa 61
Kojto 107:4f6c30876dfa 62 /**
Kojto 107:4f6c30876dfa 63 * @brief COMP Init structure definition
Kojto 107:4f6c30876dfa 64 */
Kojto 107:4f6c30876dfa 65 typedef struct
Kojto 107:4f6c30876dfa 66 {
Kojto 107:4f6c30876dfa 67
Kojto 107:4f6c30876dfa 68 uint32_t InvertingInput; /*!< Selects the inverting input of the comparator.
Kojto 107:4f6c30876dfa 69 This parameter can be a value of @ref COMP_InvertingInput */
Kojto 107:4f6c30876dfa 70
Kojto 107:4f6c30876dfa 71 uint32_t NonInvertingInput; /*!< Selects the non inverting input of the comparator.
Kojto 107:4f6c30876dfa 72 This parameter can be a value of @ref COMP_NonInvertingInput */
Kojto 107:4f6c30876dfa 73
Kojto 107:4f6c30876dfa 74 uint32_t OutputPol; /*!< Selects the output polarity of the comparator.
Kojto 107:4f6c30876dfa 75 This parameter can be a value of @ref COMP_OutputPolarity */
Kojto 107:4f6c30876dfa 76
Kojto 107:4f6c30876dfa 77 uint32_t Hysteresis; /*!< Selects the hysteresis voltage of the comparator.
Kojto 107:4f6c30876dfa 78 This parameter can be a value of @ref COMP_Hysteresis */
Kojto 107:4f6c30876dfa 79
Kojto 107:4f6c30876dfa 80 uint32_t BlankingSrce; /*!< Selects the output blanking source of the comparator.
Kojto 107:4f6c30876dfa 81 This parameter can be a value of @ref COMP_BlankingSrce */
Kojto 107:4f6c30876dfa 82
Kojto 107:4f6c30876dfa 83 uint32_t Mode; /*!< Selects the operating consumption mode of the comparator
Kojto 107:4f6c30876dfa 84 to adjust the speed/consumption.
Kojto 107:4f6c30876dfa 85 This parameter can be a value of @ref COMP_Mode */
Kojto 107:4f6c30876dfa 86
Kojto 107:4f6c30876dfa 87 uint32_t WindowMode; /*!< Selects the window mode of the comparator 2.
Kojto 107:4f6c30876dfa 88 This parameter can be a value of @ref COMP_WindowMode */
Kojto 107:4f6c30876dfa 89
Kojto 107:4f6c30876dfa 90 uint32_t TriggerMode; /*!< Selects the trigger mode of the comparator (interrupt mode).
Kojto 107:4f6c30876dfa 91 This parameter can be a value of @ref COMP_TriggerMode */
Kojto 107:4f6c30876dfa 92
Kojto 107:4f6c30876dfa 93 }COMP_InitTypeDef;
Kojto 107:4f6c30876dfa 94
Kojto 107:4f6c30876dfa 95 /**
Kojto 107:4f6c30876dfa 96 * @brief HAL State structures definition
Kojto 107:4f6c30876dfa 97 */
Kojto 107:4f6c30876dfa 98 typedef enum
Kojto 107:4f6c30876dfa 99 {
Kojto 107:4f6c30876dfa 100 HAL_COMP_STATE_RESET = 0x00, /*!< COMP not yet initialized or disabled */
Kojto 107:4f6c30876dfa 101 HAL_COMP_STATE_READY = 0x01, /*!< COMP initialized and ready for use */
Kojto 107:4f6c30876dfa 102 HAL_COMP_STATE_READY_LOCKED = 0x11, /*!< COMP initialized but the configuration is locked */
Kojto 107:4f6c30876dfa 103 HAL_COMP_STATE_BUSY = 0x02, /*!< COMP is running */
Kojto 107:4f6c30876dfa 104 HAL_COMP_STATE_BUSY_LOCKED = 0x12 /*!< COMP is running and the configuration is locked */
Kojto 107:4f6c30876dfa 105 }HAL_COMP_StateTypeDef;
Kojto 107:4f6c30876dfa 106
Kojto 107:4f6c30876dfa 107 /**
Kojto 107:4f6c30876dfa 108 * @brief COMP Handle Structure definition
Kojto 107:4f6c30876dfa 109 */
Kojto 107:4f6c30876dfa 110 typedef struct
Kojto 107:4f6c30876dfa 111 {
Kojto 107:4f6c30876dfa 112 COMP_TypeDef *Instance; /*!< Register base address */
Kojto 107:4f6c30876dfa 113 COMP_InitTypeDef Init; /*!< COMP required parameters */
Kojto 107:4f6c30876dfa 114 HAL_LockTypeDef Lock; /*!< Locking object */
Kojto 107:4f6c30876dfa 115 __IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */
Kojto 107:4f6c30876dfa 116 } COMP_HandleTypeDef;
Kojto 107:4f6c30876dfa 117
Kojto 107:4f6c30876dfa 118 /**
Kojto 107:4f6c30876dfa 119 * @}
Kojto 107:4f6c30876dfa 120 */
Kojto 107:4f6c30876dfa 121
Kojto 107:4f6c30876dfa 122 /* Exported constants --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 123 /** @defgroup COMP_Exported_Constants COMP Exported Constants
Kojto 107:4f6c30876dfa 124 * @{
Kojto 107:4f6c30876dfa 125 */
Kojto 107:4f6c30876dfa 126
Kojto 107:4f6c30876dfa 127 /** @defgroup COMP_InvertingInput COMP Inverting Input
Kojto 107:4f6c30876dfa 128 * @{
Kojto 107:4f6c30876dfa 129 */
Kojto 107:4f6c30876dfa 130 #define COMP_INVERTINGINPUT_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
Kojto 107:4f6c30876dfa 131 #define COMP_INVERTINGINPUT_1_2VREFINT COMP_CSR_INMSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input */
Kojto 107:4f6c30876dfa 132 #define COMP_INVERTINGINPUT_3_4VREFINT COMP_CSR_INMSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input */
Kojto 107:4f6c30876dfa 133 #define COMP_INVERTINGINPUT_VREFINT (COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< VREFINT connected to comparator1 inverting input */
Kojto 107:4f6c30876dfa 134 #define COMP_INVERTINGINPUT_DAC1 COMP_CSR_INMSEL_2 /*!< DAC_OUT1 connected to comparator inverting input */
Kojto 107:4f6c30876dfa 135 #define COMP_INVERTINGINPUT_DAC2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0) /*!< DAC_OUT2 connected to comparator inverting input */
Kojto 107:4f6c30876dfa 136 #define COMP_INVERTINGINPUT_IO1 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1) /*!< I/O1 connected to comparator inverting input */
Kojto 107:4f6c30876dfa 137 #define COMP_INVERTINGINPUT_IO2 COMP_CSR_INMSEL /*!< I/O2 connected to comparator inverting input */
Kojto 107:4f6c30876dfa 138 /**
Kojto 107:4f6c30876dfa 139 * @}
Kojto 107:4f6c30876dfa 140 */
Kojto 107:4f6c30876dfa 141
Kojto 107:4f6c30876dfa 142 /** @defgroup COMP_NonInvertingInput COMP NonInverting Input
Kojto 107:4f6c30876dfa 143 * @{
Kojto 107:4f6c30876dfa 144 */
Kojto 107:4f6c30876dfa 145 #define COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< I/O1 connected to comparator non inverting input */
Kojto 107:4f6c30876dfa 146 #define COMP_NONINVERTINGINPUT_IO2 COMP_CSR_INPSEL /*!< I/O2 connected to comparator non inverting input */
Kojto 107:4f6c30876dfa 147 /**
Kojto 107:4f6c30876dfa 148 * @}
Kojto 107:4f6c30876dfa 149 */
Kojto 107:4f6c30876dfa 150
Kojto 107:4f6c30876dfa 151 /** @defgroup COMP_OutputPolarity COMP Output Polarity
Kojto 107:4f6c30876dfa 152 * @{
Kojto 107:4f6c30876dfa 153 */
Kojto 107:4f6c30876dfa 154 #define COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */
Kojto 107:4f6c30876dfa 155 #define COMP_OUTPUTPOL_INVERTED COMP_CSR_POLARITY /*!< COMP output on GPIO is inverted */
Kojto 107:4f6c30876dfa 156 /**
Kojto 107:4f6c30876dfa 157 * @}
Kojto 107:4f6c30876dfa 158 */
Kojto 107:4f6c30876dfa 159
Kojto 107:4f6c30876dfa 160 /** @defgroup COMP_Mode COMP Mode
Kojto 107:4f6c30876dfa 161 * @{
Kojto 107:4f6c30876dfa 162 */
Kojto 107:4f6c30876dfa 163 /* Please refer to the electrical characteristics in the device datasheet for
Kojto 107:4f6c30876dfa 164 the power consumption values */
Kojto 107:4f6c30876dfa 165 #define COMP_MODE_HIGHSPEED ((uint32_t)0x00000000) /*!< High Speed */
Kojto 107:4f6c30876dfa 166 #define COMP_MODE_MEDIUMSPEED COMP_CSR_PWRMODE_0 /*!< Medium Speed */
Kojto 107:4f6c30876dfa 167 #define COMP_MODE_ULTRALOWPOWER COMP_CSR_PWRMODE /*!< Ultra-low power mode */
Kojto 107:4f6c30876dfa 168 /**
Kojto 107:4f6c30876dfa 169 * @}
Kojto 107:4f6c30876dfa 170 */
Kojto 107:4f6c30876dfa 171
Kojto 107:4f6c30876dfa 172 /** @defgroup COMP_Hysteresis COMP Hysteresis
Kojto 107:4f6c30876dfa 173 * @{
Kojto 107:4f6c30876dfa 174 */
Kojto 107:4f6c30876dfa 175 #define COMP_HYSTERESIS_NONE ((uint32_t)0x00000000) /*!< No hysteresis */
Kojto 107:4f6c30876dfa 176 #define COMP_HYSTERESIS_LOW COMP_CSR_HYST_0 /*!< Hysteresis level low */
Kojto 107:4f6c30876dfa 177 #define COMP_HYSTERESIS_MEDIUM COMP_CSR_HYST_1 /*!< Hysteresis level medium */
Kojto 107:4f6c30876dfa 178 #define COMP_HYSTERESIS_HIGH COMP_CSR_HYST /*!< Hysteresis level high */
Kojto 107:4f6c30876dfa 179 /**
Kojto 107:4f6c30876dfa 180 * @}
Kojto 107:4f6c30876dfa 181 */
Kojto 107:4f6c30876dfa 182
Kojto 107:4f6c30876dfa 183 /** @defgroup COMP_BlankingSrce COMP Blanking Source
Kojto 107:4f6c30876dfa 184 * @{
Kojto 107:4f6c30876dfa 185 */
Kojto 107:4f6c30876dfa 186 /* No blanking source can be selected for all comparators */
Kojto 107:4f6c30876dfa 187 #define COMP_BLANKINGSRCE_NONE ((uint32_t)0x00000000) /*!< No blanking source */
Kojto 107:4f6c30876dfa 188 /* Blanking source for COMP1 */
Kojto 107:4f6c30876dfa 189 #define COMP_BLANKINGSRCE_TIM1OC5 COMP_CSR_BLANKING_0 /*!< TIM1 OC5 selected as blanking source for comparator */
Kojto 107:4f6c30876dfa 190 #define COMP_BLANKINGSRCE_TIM2OC3 COMP_CSR_BLANKING_1 /*!< TIM2 OC3 selected as blanking source for comparator */
Kojto 107:4f6c30876dfa 191 #define COMP_BLANKINGSRCE_TIM3OC3 COMP_CSR_BLANKING_2 /*!< TIM3 OC3 selected as blanking source for comparator */
Kojto 107:4f6c30876dfa 192 /* Blanking source for COMP2 */
Kojto 107:4f6c30876dfa 193 #define COMP_BLANKINGSRCE_TIM3OC4 COMP_CSR_BLANKING_0 /*!< TIM3 OC4 selected as blanking source for comparator */
Kojto 107:4f6c30876dfa 194 #define COMP_BLANKINGSRCE_TIM8OC5 COMP_CSR_BLANKING_1 /*!< TIM8 OC5 selected as blanking source for comparator */
Kojto 107:4f6c30876dfa 195 #define COMP_BLANKINGSRCE_TIM15OC1 COMP_CSR_BLANKING_2 /*!< TIM15 OC1 selected as blanking source for comparator */
Kojto 107:4f6c30876dfa 196 /**
Kojto 107:4f6c30876dfa 197 * @}
Kojto 107:4f6c30876dfa 198 */
Kojto 107:4f6c30876dfa 199
Kojto 107:4f6c30876dfa 200 /** @defgroup COMP_WindowMode COMP Window Mode
Kojto 107:4f6c30876dfa 201 * @{
Kojto 107:4f6c30876dfa 202 */
Kojto 107:4f6c30876dfa 203 #define COMP_WINDOWMODE_DISABLE ((uint32_t)0x00000000) /*!< Window mode disable: Input plus of Comparator 2 not connected to Comparator 1 */
Kojto 107:4f6c30876dfa 204 #define COMP_WINDOWMODE_ENABLE COMP_CSR_WINMODE /*!< Window mode enable: Input plus of Comparator 2 is connected to input plus of Comparator 1 */
Kojto 107:4f6c30876dfa 205 /**
Kojto 107:4f6c30876dfa 206 * @}
Kojto 107:4f6c30876dfa 207 */
Kojto 107:4f6c30876dfa 208
Kojto 107:4f6c30876dfa 209 /** @defgroup COMP_OutputLevel COMP Output Level
Kojto 107:4f6c30876dfa 210 * @{
Kojto 107:4f6c30876dfa 211 */
Kojto 107:4f6c30876dfa 212 /* When output polarity is not inverted, comparator output is low when
Kojto 107:4f6c30876dfa 213 the non-inverting input is at a lower voltage than the inverting input*/
Kojto 107:4f6c30876dfa 214 #define COMP_OUTPUTLEVEL_LOW ((uint32_t)0x00000000)
Kojto 107:4f6c30876dfa 215 /* When output polarity is not inverted, comparator output is high when
Kojto 107:4f6c30876dfa 216 the non-inverting input is at a higher voltage than the inverting input */
Kojto 107:4f6c30876dfa 217 #define COMP_OUTPUTLEVEL_HIGH COMP_CSR_VALUE
Kojto 107:4f6c30876dfa 218 /**
Kojto 107:4f6c30876dfa 219 * @}
Kojto 107:4f6c30876dfa 220 */
Kojto 107:4f6c30876dfa 221
Kojto 107:4f6c30876dfa 222 /** @defgroup COMP_TriggerMode COMP Trigger Mode
Kojto 107:4f6c30876dfa 223 * @{
Kojto 107:4f6c30876dfa 224 */
Kojto 107:4f6c30876dfa 225 #define COMP_TRIGGERMODE_NONE ((uint32_t)0x00000000) /*!< No External Interrupt trigger detection */
Kojto 107:4f6c30876dfa 226 #define COMP_TRIGGERMODE_IT_RISING ((uint32_t)0x00000001) /*!< External Interrupt Mode with Rising edge trigger detection */
Kojto 107:4f6c30876dfa 227 #define COMP_TRIGGERMODE_IT_FALLING ((uint32_t)0x00000002) /*!< External Interrupt Mode with Falling edge trigger detection */
Kojto 107:4f6c30876dfa 228 #define COMP_TRIGGERMODE_IT_RISING_FALLING ((uint32_t)0x00000003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
Kojto 107:4f6c30876dfa 229 #define COMP_TRIGGERMODE_EVENT_RISING ((uint32_t)0x00000010) /*!< Event Mode with Rising edge trigger detection */
Kojto 107:4f6c30876dfa 230 #define COMP_TRIGGERMODE_EVENT_FALLING ((uint32_t)0x00000020) /*!< Event Mode with Falling edge trigger detection */
Kojto 107:4f6c30876dfa 231 #define COMP_TRIGGERMODE_EVENT_RISING_FALLING ((uint32_t)0x00000030) /*!< Event Mode with Rising/Falling edge trigger detection */
Kojto 107:4f6c30876dfa 232 /**
Kojto 107:4f6c30876dfa 233 * @}
Kojto 107:4f6c30876dfa 234 */
Kojto 107:4f6c30876dfa 235
Kojto 107:4f6c30876dfa 236 /** @defgroup COMP_Flag COMP Flag
Kojto 107:4f6c30876dfa 237 * @{
Kojto 107:4f6c30876dfa 238 */
Kojto 107:4f6c30876dfa 239 #define COMP_FLAG_LOCK COMP_CSR_LOCK /*!< Lock flag */
Kojto 107:4f6c30876dfa 240
Kojto 107:4f6c30876dfa 241 /**
Kojto 107:4f6c30876dfa 242 * @}
Kojto 107:4f6c30876dfa 243 */
Kojto 107:4f6c30876dfa 244
Kojto 107:4f6c30876dfa 245 /**
Kojto 107:4f6c30876dfa 246 * @}
Kojto 107:4f6c30876dfa 247 */
Kojto 107:4f6c30876dfa 248
Kojto 107:4f6c30876dfa 249 /* Exported macros -----------------------------------------------------------*/
Kojto 107:4f6c30876dfa 250 /** @defgroup COMP_Exported_Macros COMP Exported Macros
Kojto 107:4f6c30876dfa 251 * @{
Kojto 107:4f6c30876dfa 252 */
Kojto 107:4f6c30876dfa 253
Kojto 107:4f6c30876dfa 254 /** @brief Reset COMP handle state.
Kojto 107:4f6c30876dfa 255 * @param __HANDLE__: COMP handle.
Kojto 107:4f6c30876dfa 256 * @retval None
Kojto 107:4f6c30876dfa 257 */
Kojto 107:4f6c30876dfa 258 #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET)
Kojto 107:4f6c30876dfa 259
Kojto 107:4f6c30876dfa 260 /**
Kojto 107:4f6c30876dfa 261 * @brief Enable the specified comparator.
Kojto 107:4f6c30876dfa 262 * @param __HANDLE__: COMP handle.
Kojto 107:4f6c30876dfa 263 * @retval None
Kojto 107:4f6c30876dfa 264 */
Kojto 107:4f6c30876dfa 265 #define __HAL_COMP_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
Kojto 107:4f6c30876dfa 266
Kojto 107:4f6c30876dfa 267 /**
Kojto 107:4f6c30876dfa 268 * @brief Disable the specified comparator.
Kojto 107:4f6c30876dfa 269 * @param __HANDLE__: COMP handle.
Kojto 107:4f6c30876dfa 270 * @retval None
Kojto 107:4f6c30876dfa 271 */
Kojto 107:4f6c30876dfa 272 #define __HAL_COMP_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
Kojto 107:4f6c30876dfa 273
Kojto 107:4f6c30876dfa 274 /**
Kojto 107:4f6c30876dfa 275 * @brief Lock the specified comparator configuration.
Kojto 107:4f6c30876dfa 276 * @param __HANDLE__: COMP handle.
Kojto 107:4f6c30876dfa 277 * @retval None
Kojto 107:4f6c30876dfa 278 */
Kojto 107:4f6c30876dfa 279 #define __HAL_COMP_LOCK(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK)
Kojto 107:4f6c30876dfa 280
Kojto 107:4f6c30876dfa 281 /**
Kojto 107:4f6c30876dfa 282 * @brief Enable the COMP1 EXTI line rising edge trigger.
Kojto 107:4f6c30876dfa 283 * @retval None
Kojto 107:4f6c30876dfa 284 */
Kojto 107:4f6c30876dfa 285 #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 286
Kojto 107:4f6c30876dfa 287 /**
Kojto 107:4f6c30876dfa 288 * @brief Disable the COMP1 EXTI line rising edge trigger.
Kojto 107:4f6c30876dfa 289 * @retval None
Kojto 107:4f6c30876dfa 290 */
Kojto 107:4f6c30876dfa 291 #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 292
Kojto 107:4f6c30876dfa 293 /**
Kojto 107:4f6c30876dfa 294 * @brief Enable the COMP1 EXTI line falling edge trigger.
Kojto 107:4f6c30876dfa 295 * @retval None
Kojto 107:4f6c30876dfa 296 */
Kojto 107:4f6c30876dfa 297 #define __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 298
Kojto 107:4f6c30876dfa 299 /**
Kojto 107:4f6c30876dfa 300 * @brief Disable the COMP1 EXTI line falling edge trigger.
Kojto 107:4f6c30876dfa 301 * @retval None
Kojto 107:4f6c30876dfa 302 */
Kojto 107:4f6c30876dfa 303 #define __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 304
Kojto 107:4f6c30876dfa 305 /**
Kojto 107:4f6c30876dfa 306 * @brief Enable the COMP1 EXTI line rising & falling edge trigger.
Kojto 107:4f6c30876dfa 307 * @retval None
Kojto 107:4f6c30876dfa 308 */
Kojto 107:4f6c30876dfa 309 #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
Kojto 107:4f6c30876dfa 310 __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE(); \
Kojto 107:4f6c30876dfa 311 __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE(); \
Kojto 107:4f6c30876dfa 312 } while(0)
Kojto 107:4f6c30876dfa 313
Kojto 107:4f6c30876dfa 314 /**
Kojto 107:4f6c30876dfa 315 * @brief Disable the COMP1 EXTI line rising & falling edge trigger.
Kojto 107:4f6c30876dfa 316 * @retval None
Kojto 107:4f6c30876dfa 317 */
Kojto 107:4f6c30876dfa 318 #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
Kojto 107:4f6c30876dfa 319 __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE(); \
Kojto 107:4f6c30876dfa 320 __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE(); \
Kojto 107:4f6c30876dfa 321 } while(0)
Kojto 107:4f6c30876dfa 322
Kojto 107:4f6c30876dfa 323 /**
Kojto 107:4f6c30876dfa 324 * @brief Enable the COMP1 EXTI line in interrupt mode.
Kojto 107:4f6c30876dfa 325 * @retval None
Kojto 107:4f6c30876dfa 326 */
Kojto 107:4f6c30876dfa 327 #define __HAL_COMP_COMP1_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 328
Kojto 107:4f6c30876dfa 329 /**
Kojto 107:4f6c30876dfa 330 * @brief Disable the COMP1 EXTI line in interrupt mode.
Kojto 107:4f6c30876dfa 331 * @retval None
Kojto 107:4f6c30876dfa 332 */
Kojto 107:4f6c30876dfa 333 #define __HAL_COMP_COMP1_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 334
Kojto 107:4f6c30876dfa 335 /**
Kojto 107:4f6c30876dfa 336 * @brief Generate a software interrupt on the COMP1 EXTI line.
Kojto 107:4f6c30876dfa 337 * @retval None
Kojto 107:4f6c30876dfa 338 */
Kojto 107:4f6c30876dfa 339 #define __HAL_COMP_COMP1_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 340
Kojto 107:4f6c30876dfa 341 /**
Kojto 107:4f6c30876dfa 342 * @brief Enable the COMP1 EXTI Line in event mode.
Kojto 107:4f6c30876dfa 343 * @retval None
Kojto 107:4f6c30876dfa 344 */
Kojto 107:4f6c30876dfa 345 #define __HAL_COMP_COMP1_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 346
Kojto 107:4f6c30876dfa 347 /**
Kojto 107:4f6c30876dfa 348 * @brief Disable the COMP1 EXTI Line in event mode.
Kojto 107:4f6c30876dfa 349 * @retval None
Kojto 107:4f6c30876dfa 350 */
Kojto 107:4f6c30876dfa 351 #define __HAL_COMP_COMP1_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 352
Kojto 107:4f6c30876dfa 353 /**
Kojto 107:4f6c30876dfa 354 * @brief Check whether the COMP1 EXTI line flag is set or not.
Kojto 107:4f6c30876dfa 355 * @retval RESET or SET
Kojto 107:4f6c30876dfa 356 */
Kojto 107:4f6c30876dfa 357 #define __HAL_COMP_COMP1_EXTI_GET_FLAG() READ_BIT(EXTI->PR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 358
Kojto 107:4f6c30876dfa 359 /**
Kojto 107:4f6c30876dfa 360 * @brief Clear the COMP1 EXTI flag.
Kojto 107:4f6c30876dfa 361 * @retval None
Kojto 107:4f6c30876dfa 362 */
Kojto 107:4f6c30876dfa 363 #define __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, COMP_EXTI_LINE_COMP1)
Kojto 107:4f6c30876dfa 364
Kojto 107:4f6c30876dfa 365 /**
Kojto 107:4f6c30876dfa 366 * @brief Enable the COMP2 EXTI line rising edge trigger.
Kojto 107:4f6c30876dfa 367 * @retval None
Kojto 107:4f6c30876dfa 368 */
Kojto 107:4f6c30876dfa 369 #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 370
Kojto 107:4f6c30876dfa 371 /**
Kojto 107:4f6c30876dfa 372 * @brief Disable the COMP2 EXTI line rising edge trigger.
Kojto 107:4f6c30876dfa 373 * @retval None
Kojto 107:4f6c30876dfa 374 */
Kojto 107:4f6c30876dfa 375 #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 376
Kojto 107:4f6c30876dfa 377 /**
Kojto 107:4f6c30876dfa 378 * @brief Enable the COMP2 EXTI line falling edge trigger.
Kojto 107:4f6c30876dfa 379 * @retval None
Kojto 107:4f6c30876dfa 380 */
Kojto 107:4f6c30876dfa 381 #define __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 382
Kojto 107:4f6c30876dfa 383 /**
Kojto 107:4f6c30876dfa 384 * @brief Disable the COMP2 EXTI line falling edge trigger.
Kojto 107:4f6c30876dfa 385 * @retval None
Kojto 107:4f6c30876dfa 386 */
Kojto 107:4f6c30876dfa 387 #define __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 388
Kojto 107:4f6c30876dfa 389 /**
Kojto 107:4f6c30876dfa 390 * @brief Enable the COMP2 EXTI line rising & falling edge trigger.
Kojto 107:4f6c30876dfa 391 * @retval None
Kojto 107:4f6c30876dfa 392 */
Kojto 107:4f6c30876dfa 393 #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
Kojto 107:4f6c30876dfa 394 __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE(); \
Kojto 107:4f6c30876dfa 395 __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE(); \
Kojto 107:4f6c30876dfa 396 } while(0)
Kojto 107:4f6c30876dfa 397
Kojto 107:4f6c30876dfa 398 /**
Kojto 107:4f6c30876dfa 399 * @brief Disable the COMP2 EXTI line rising & falling edge trigger.
Kojto 107:4f6c30876dfa 400 * @retval None
Kojto 107:4f6c30876dfa 401 */
Kojto 107:4f6c30876dfa 402 #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
Kojto 107:4f6c30876dfa 403 __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE(); \
Kojto 107:4f6c30876dfa 404 __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE(); \
Kojto 107:4f6c30876dfa 405 } while(0)
Kojto 107:4f6c30876dfa 406
Kojto 107:4f6c30876dfa 407 /**
Kojto 107:4f6c30876dfa 408 * @brief Enable the COMP2 EXTI line in interrupt mode.
Kojto 107:4f6c30876dfa 409 * @retval None
Kojto 107:4f6c30876dfa 410 */
Kojto 107:4f6c30876dfa 411 #define __HAL_COMP_COMP2_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 412
Kojto 107:4f6c30876dfa 413 /**
Kojto 107:4f6c30876dfa 414 * @brief Disable the COMP2 EXTI line in interrupt mode.
Kojto 107:4f6c30876dfa 415 * @retval None
Kojto 107:4f6c30876dfa 416 */
Kojto 107:4f6c30876dfa 417 #define __HAL_COMP_COMP2_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 418
Kojto 107:4f6c30876dfa 419 /**
Kojto 107:4f6c30876dfa 420 * @brief Generate a software interrupt on the COMP2 EXTI line.
Kojto 107:4f6c30876dfa 421 * @retval None
Kojto 107:4f6c30876dfa 422 */
Kojto 107:4f6c30876dfa 423 #define __HAL_COMP_COMP2_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 424
Kojto 107:4f6c30876dfa 425 /**
Kojto 107:4f6c30876dfa 426 * @brief Enable the COMP2 EXTI Line in event mode.
Kojto 107:4f6c30876dfa 427 * @retval None
Kojto 107:4f6c30876dfa 428 */
Kojto 107:4f6c30876dfa 429 #define __HAL_COMP_COMP2_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 430
Kojto 107:4f6c30876dfa 431 /**
Kojto 107:4f6c30876dfa 432 * @brief Disable the COMP2 EXTI Line in event mode.
Kojto 107:4f6c30876dfa 433 * @retval None
Kojto 107:4f6c30876dfa 434 */
Kojto 107:4f6c30876dfa 435 #define __HAL_COMP_COMP2_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 436
Kojto 107:4f6c30876dfa 437 /**
Kojto 107:4f6c30876dfa 438 * @brief Check whether the COMP2 EXTI line flag is set or not.
Kojto 107:4f6c30876dfa 439 * @retval RESET or SET
Kojto 107:4f6c30876dfa 440 */
Kojto 107:4f6c30876dfa 441 #define __HAL_COMP_COMP2_EXTI_GET_FLAG() READ_BIT(EXTI->PR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 442
Kojto 107:4f6c30876dfa 443 /**
Kojto 107:4f6c30876dfa 444 * @brief Clear the COMP2 EXTI flag.
Kojto 107:4f6c30876dfa 445 * @retval None
Kojto 107:4f6c30876dfa 446 */
Kojto 107:4f6c30876dfa 447 #define __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 448
Kojto 107:4f6c30876dfa 449 /** @brief Check whether the specified COMP flag is set or not.
Kojto 107:4f6c30876dfa 450 * @param __HANDLE__: specifies the COMP Handle.
Kojto 107:4f6c30876dfa 451 * @param __FLAG__: specifies the flag to check.
Kojto 107:4f6c30876dfa 452 * This parameter can be one of the following values:
Kojto 107:4f6c30876dfa 453 * @arg COMP_FLAG_LOCK: lock flag
Kojto 107:4f6c30876dfa 454 * @retval The new state of __FLAG__ (TRUE or FALSE).
Kojto 107:4f6c30876dfa 455 */
Kojto 107:4f6c30876dfa 456 #define __HAL_COMP_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->CSR & (__FLAG__)) == (__FLAG__))
Kojto 107:4f6c30876dfa 457
Kojto 107:4f6c30876dfa 458 /**
Kojto 107:4f6c30876dfa 459 * @}
Kojto 107:4f6c30876dfa 460 */
Kojto 107:4f6c30876dfa 461
Kojto 107:4f6c30876dfa 462 /* Exported functions --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 463 /** @addtogroup COMP_Exported_Functions
Kojto 107:4f6c30876dfa 464 * @{
Kojto 107:4f6c30876dfa 465 */
Kojto 107:4f6c30876dfa 466
Kojto 107:4f6c30876dfa 467 /** @addtogroup COMP_Exported_Functions_Group1
Kojto 107:4f6c30876dfa 468 * @{
Kojto 107:4f6c30876dfa 469 */
Kojto 107:4f6c30876dfa 470 /* Initialization and de-initialization functions **********************************/
Kojto 107:4f6c30876dfa 471 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 472 HAL_StatusTypeDef HAL_COMP_DeInit (COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 473 void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 474 void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 475 /**
Kojto 107:4f6c30876dfa 476 * @}
Kojto 107:4f6c30876dfa 477 */
Kojto 107:4f6c30876dfa 478
Kojto 107:4f6c30876dfa 479 /* IO operation functions *****************************************************/
Kojto 107:4f6c30876dfa 480 /** @addtogroup COMP_Exported_Functions_Group2
Kojto 107:4f6c30876dfa 481 * @{
Kojto 107:4f6c30876dfa 482 */
Kojto 107:4f6c30876dfa 483 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 484 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 485 HAL_StatusTypeDef HAL_COMP_Start_IT(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 486 HAL_StatusTypeDef HAL_COMP_Stop_IT(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 487 void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 488 /* Callback in Interrupt mode */
Kojto 107:4f6c30876dfa 489 void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 490 /**
Kojto 107:4f6c30876dfa 491 * @}
Kojto 107:4f6c30876dfa 492 */
Kojto 107:4f6c30876dfa 493
Kojto 107:4f6c30876dfa 494 /* Peripheral Control functions ************************************************/
Kojto 107:4f6c30876dfa 495 /** @addtogroup COMP_Exported_Functions_Group3
Kojto 107:4f6c30876dfa 496 * @{
Kojto 107:4f6c30876dfa 497 */
Kojto 107:4f6c30876dfa 498 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 499 uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 500 /**
Kojto 107:4f6c30876dfa 501 * @}
Kojto 107:4f6c30876dfa 502 */
Kojto 107:4f6c30876dfa 503
Kojto 107:4f6c30876dfa 504 /* Peripheral State functions **************************************************/
Kojto 107:4f6c30876dfa 505 /** @addtogroup COMP_Exported_Functions_Group4
Kojto 107:4f6c30876dfa 506 * @{
Kojto 107:4f6c30876dfa 507 */
Kojto 107:4f6c30876dfa 508 HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp);
Kojto 107:4f6c30876dfa 509 /**
Kojto 107:4f6c30876dfa 510 * @}
Kojto 107:4f6c30876dfa 511 */
Kojto 107:4f6c30876dfa 512
Kojto 107:4f6c30876dfa 513 /**
Kojto 107:4f6c30876dfa 514 * @}
Kojto 107:4f6c30876dfa 515 */
Kojto 107:4f6c30876dfa 516
Kojto 107:4f6c30876dfa 517 /* Private types -------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 518 /* Private constants ---------------------------------------------------------*/
Kojto 107:4f6c30876dfa 519 /** @defgroup COMP_Private_Constants COMP Private Constants
Kojto 107:4f6c30876dfa 520 * @{
Kojto 107:4f6c30876dfa 521 */
Kojto 107:4f6c30876dfa 522 /** @defgroup COMP_ExtiLine COMP EXTI Lines
Kojto 107:4f6c30876dfa 523 * @{
Kojto 107:4f6c30876dfa 524 */
Kojto 107:4f6c30876dfa 525 #define COMP_EXTI_LINE_COMP1 ((uint32_t)0x00200000) /*!< EXTI line 21 connected to COMP1 output */
Kojto 107:4f6c30876dfa 526 #define COMP_EXTI_LINE_COMP2 ((uint32_t)0x00400000) /*!< EXTI line 22 connected to COMP2 output */
Kojto 107:4f6c30876dfa 527 /**
Kojto 107:4f6c30876dfa 528 * @}
Kojto 107:4f6c30876dfa 529 */
Kojto 107:4f6c30876dfa 530
Kojto 107:4f6c30876dfa 531 /**
Kojto 107:4f6c30876dfa 532 * @}
Kojto 107:4f6c30876dfa 533 */
Kojto 107:4f6c30876dfa 534
Kojto 107:4f6c30876dfa 535 /* Private macros ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 536 /** @defgroup COMP_Private_Macros COMP Private Macros
Kojto 107:4f6c30876dfa 537 * @{
Kojto 107:4f6c30876dfa 538 */
Kojto 107:4f6c30876dfa 539 /** @defgroup COMP_GET_EXTI_LINE COMP Private macros to get EXTI line associated with Comparators
Kojto 107:4f6c30876dfa 540 * @{
Kojto 107:4f6c30876dfa 541 */
Kojto 107:4f6c30876dfa 542 /**
Kojto 107:4f6c30876dfa 543 * @brief Get the specified EXTI line for a comparator instance.
Kojto 107:4f6c30876dfa 544 * @param __INSTANCE__: specifies the COMP instance.
Kojto 107:4f6c30876dfa 545 * @retval value of @ref COMP_ExtiLine
Kojto 107:4f6c30876dfa 546 */
Kojto 107:4f6c30876dfa 547 #define COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1 : \
Kojto 107:4f6c30876dfa 548 COMP_EXTI_LINE_COMP2)
Kojto 107:4f6c30876dfa 549 /**
Kojto 107:4f6c30876dfa 550 * @}
Kojto 107:4f6c30876dfa 551 */
Kojto 107:4f6c30876dfa 552
Kojto 107:4f6c30876dfa 553 /** @defgroup COMP_IS_COMP_Definitions COMP Private macros to check input parameters
Kojto 107:4f6c30876dfa 554 * @{
Kojto 107:4f6c30876dfa 555 */
Kojto 107:4f6c30876dfa 556
Kojto 107:4f6c30876dfa 557 #define IS_COMP_INVERTINGINPUT(__INPUT__) (((__INPUT__) == COMP_INVERTINGINPUT_1_4VREFINT) || \
Kojto 107:4f6c30876dfa 558 ((__INPUT__) == COMP_INVERTINGINPUT_1_2VREFINT) || \
Kojto 107:4f6c30876dfa 559 ((__INPUT__) == COMP_INVERTINGINPUT_3_4VREFINT) || \
Kojto 107:4f6c30876dfa 560 ((__INPUT__) == COMP_INVERTINGINPUT_VREFINT) || \
Kojto 107:4f6c30876dfa 561 ((__INPUT__) == COMP_INVERTINGINPUT_DAC1) || \
Kojto 107:4f6c30876dfa 562 ((__INPUT__) == COMP_INVERTINGINPUT_DAC2) || \
Kojto 107:4f6c30876dfa 563 ((__INPUT__) == COMP_INVERTINGINPUT_IO1) || \
Kojto 107:4f6c30876dfa 564 ((__INPUT__) == COMP_INVERTINGINPUT_IO2))
Kojto 107:4f6c30876dfa 565
Kojto 107:4f6c30876dfa 566 #define IS_COMP_NONINVERTINGINPUT(__INPUT__) (((__INPUT__) == COMP_NONINVERTINGINPUT_IO1) || \
Kojto 107:4f6c30876dfa 567 ((__INPUT__) == COMP_NONINVERTINGINPUT_IO2))
Kojto 107:4f6c30876dfa 568
Kojto 107:4f6c30876dfa 569 #define IS_COMP_OUTPUTPOL(__POL__) (((__POL__) == COMP_OUTPUTPOL_NONINVERTED) || \
Kojto 107:4f6c30876dfa 570 ((__POL__) == COMP_OUTPUTPOL_INVERTED))
Kojto 107:4f6c30876dfa 571
Kojto 107:4f6c30876dfa 572 #define IS_COMP_MODE(__MODE__) (((__MODE__) == COMP_MODE_HIGHSPEED) || \
Kojto 107:4f6c30876dfa 573 ((__MODE__) == COMP_MODE_MEDIUMSPEED) || \
Kojto 107:4f6c30876dfa 574 ((__MODE__) == COMP_MODE_ULTRALOWPOWER))
Kojto 107:4f6c30876dfa 575
Kojto 107:4f6c30876dfa 576 #define IS_COMP_HYSTERESIS(__HYSTERESIS__) (((__HYSTERESIS__) == COMP_HYSTERESIS_NONE) || \
Kojto 107:4f6c30876dfa 577 ((__HYSTERESIS__) == COMP_HYSTERESIS_LOW) || \
Kojto 107:4f6c30876dfa 578 ((__HYSTERESIS__) == COMP_HYSTERESIS_MEDIUM) || \
Kojto 107:4f6c30876dfa 579 ((__HYSTERESIS__) == COMP_HYSTERESIS_HIGH))
Kojto 107:4f6c30876dfa 580
Kojto 107:4f6c30876dfa 581 #define IS_COMP_BLANKINGSRCE(__SOURCE__) (((__SOURCE__) == COMP_BLANKINGSRCE_NONE) || \
Kojto 107:4f6c30876dfa 582 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM1OC5) || \
Kojto 107:4f6c30876dfa 583 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM2OC3) || \
Kojto 107:4f6c30876dfa 584 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM3OC3) || \
Kojto 107:4f6c30876dfa 585 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM3OC4) || \
Kojto 107:4f6c30876dfa 586 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM8OC5) || \
Kojto 107:4f6c30876dfa 587 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM15OC1))
Kojto 107:4f6c30876dfa 588
Kojto 107:4f6c30876dfa 589 #define IS_COMP_BLANKINGSRCE_INSTANCE(__INSTANCE__, __BLANKINGSRCE__) \
Kojto 107:4f6c30876dfa 590 ((((__INSTANCE__) == COMP1) && \
Kojto 107:4f6c30876dfa 591 (((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_NONE) || \
Kojto 107:4f6c30876dfa 592 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM1OC5) || \
Kojto 107:4f6c30876dfa 593 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM2OC3) || \
Kojto 107:4f6c30876dfa 594 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM3OC3))) \
Kojto 107:4f6c30876dfa 595 || \
Kojto 107:4f6c30876dfa 596 (((__INSTANCE__) == COMP2) && \
Kojto 107:4f6c30876dfa 597 (((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_NONE) || \
Kojto 107:4f6c30876dfa 598 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM3OC4) || \
Kojto 107:4f6c30876dfa 599 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM8OC5) || \
Kojto 107:4f6c30876dfa 600 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM15OC1))))
Kojto 107:4f6c30876dfa 601
Kojto 107:4f6c30876dfa 602 #define IS_COMP_WINDOWMODE(__WINDOWMODE__) (((__WINDOWMODE__) == COMP_WINDOWMODE_DISABLE) || \
Kojto 107:4f6c30876dfa 603 ((__WINDOWMODE__) == COMP_WINDOWMODE_ENABLE))
Kojto 107:4f6c30876dfa 604
Kojto 107:4f6c30876dfa 605 #define IS_COMP_TRIGGERMODE(__MODE__) (((__MODE__) == COMP_TRIGGERMODE_NONE) || \
Kojto 107:4f6c30876dfa 606 ((__MODE__) == COMP_TRIGGERMODE_IT_RISING) || \
Kojto 107:4f6c30876dfa 607 ((__MODE__) == COMP_TRIGGERMODE_IT_FALLING) || \
Kojto 107:4f6c30876dfa 608 ((__MODE__) == COMP_TRIGGERMODE_IT_RISING_FALLING) || \
Kojto 107:4f6c30876dfa 609 ((__MODE__) == COMP_TRIGGERMODE_EVENT_RISING) || \
Kojto 107:4f6c30876dfa 610 ((__MODE__) == COMP_TRIGGERMODE_EVENT_FALLING) || \
Kojto 107:4f6c30876dfa 611 ((__MODE__) == COMP_TRIGGERMODE_EVENT_RISING_FALLING))
Kojto 107:4f6c30876dfa 612
Kojto 107:4f6c30876dfa 613 /**
Kojto 107:4f6c30876dfa 614 * @}
Kojto 107:4f6c30876dfa 615 */
Kojto 107:4f6c30876dfa 616
Kojto 107:4f6c30876dfa 617 /**
Kojto 107:4f6c30876dfa 618 * @}
Kojto 107:4f6c30876dfa 619 */
Kojto 107:4f6c30876dfa 620
Kojto 107:4f6c30876dfa 621 /* Private functions ---------------------------------------------------------*/
Kojto 107:4f6c30876dfa 622
Kojto 107:4f6c30876dfa 623 /**
Kojto 107:4f6c30876dfa 624 * @}
Kojto 107:4f6c30876dfa 625 */
Kojto 107:4f6c30876dfa 626
Kojto 107:4f6c30876dfa 627 /**
Kojto 107:4f6c30876dfa 628 * @}
Kojto 107:4f6c30876dfa 629 */
Kojto 107:4f6c30876dfa 630
Kojto 107:4f6c30876dfa 631 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 632 }
Kojto 107:4f6c30876dfa 633 #endif
Kojto 107:4f6c30876dfa 634
Kojto 107:4f6c30876dfa 635 #endif /* __STM32L4xx_HAL_COMP_H */
Kojto 107:4f6c30876dfa 636
Kojto 107:4f6c30876dfa 637 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/