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:
109:9296ab0bfc11
.

Who changed what in which revision?

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