/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
85:024bf7f99721
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx_hal_comp.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
bogdanm 92:4fc01daae5a5 5 * @version V1.1.0
bogdanm 92:4fc01daae5a5 6 * @date 03-Oct-2014
bogdanm 85:024bf7f99721 7 * @brief Header file of COMP HAL module.
bogdanm 85:024bf7f99721 8 ******************************************************************************
bogdanm 85:024bf7f99721 9 * @attention
bogdanm 85:024bf7f99721 10 *
bogdanm 85:024bf7f99721 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 12 *
bogdanm 85:024bf7f99721 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 14 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 16 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 19 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 21 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 22 * without specific prior written permission.
bogdanm 85:024bf7f99721 23 *
bogdanm 85:024bf7f99721 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 34 *
bogdanm 85:024bf7f99721 35 ******************************************************************************
bogdanm 85:024bf7f99721 36 */
bogdanm 85:024bf7f99721 37
bogdanm 85:024bf7f99721 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 85:024bf7f99721 39 #ifndef __STM32F0xx_HAL_COMP_H
bogdanm 85:024bf7f99721 40 #define __STM32F0xx_HAL_COMP_H
bogdanm 85:024bf7f99721 41
bogdanm 85:024bf7f99721 42 #ifdef __cplusplus
bogdanm 85:024bf7f99721 43 extern "C" {
bogdanm 85:024bf7f99721 44 #endif
bogdanm 85:024bf7f99721 45
bogdanm 85:024bf7f99721 46 #if defined(STM32F051x8) || defined(STM32F058xx) || \
bogdanm 92:4fc01daae5a5 47 defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
bogdanm 92:4fc01daae5a5 48 defined(STM32F091xC) || defined(STM32F098xx)
bogdanm 85:024bf7f99721 49
bogdanm 85:024bf7f99721 50 /* Includes ------------------------------------------------------------------*/
bogdanm 85:024bf7f99721 51 #include "stm32f0xx_hal_def.h"
bogdanm 85:024bf7f99721 52
bogdanm 85:024bf7f99721 53 /** @addtogroup STM32F0xx_HAL_Driver
bogdanm 85:024bf7f99721 54 * @{
bogdanm 85:024bf7f99721 55 */
bogdanm 85:024bf7f99721 56
bogdanm 92:4fc01daae5a5 57 /** @addtogroup COMP COMP HAL Module Driver
bogdanm 85:024bf7f99721 58 * @{
bogdanm 85:024bf7f99721 59 */
bogdanm 85:024bf7f99721 60
bogdanm 85:024bf7f99721 61 /* Exported types ------------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 62 /** @defgroup COMP_Exported_Types COMP Exported Types
bogdanm 92:4fc01daae5a5 63 * @{
bogdanm 92:4fc01daae5a5 64 */
bogdanm 92:4fc01daae5a5 65
bogdanm 85:024bf7f99721 66 /**
bogdanm 85:024bf7f99721 67 * @brief COMP Init structure definition
bogdanm 92:4fc01daae5a5 68 */
bogdanm 85:024bf7f99721 69 typedef struct
bogdanm 85:024bf7f99721 70 {
bogdanm 85:024bf7f99721 71
bogdanm 85:024bf7f99721 72 uint32_t InvertingInput; /*!< Selects the inverting input of the comparator.
bogdanm 85:024bf7f99721 73 This parameter can be a value of @ref COMP_InvertingInput */
bogdanm 85:024bf7f99721 74
bogdanm 92:4fc01daae5a5 75 uint32_t NonInvertingInput; /*!< Selects the non inverting input of the comparator.
bogdanm 92:4fc01daae5a5 76 This parameter can be a value of @ref COMP_NonInvertingInput */
bogdanm 92:4fc01daae5a5 77
bogdanm 85:024bf7f99721 78 uint32_t Output; /*!< Selects the output redirection of the comparator.
bogdanm 85:024bf7f99721 79 This parameter can be a value of @ref COMP_Output */
bogdanm 85:024bf7f99721 80
bogdanm 85:024bf7f99721 81 uint32_t OutputPol; /*!< Selects the output polarity of the comparator.
bogdanm 85:024bf7f99721 82 This parameter can be a value of @ref COMP_OutputPolarity */
bogdanm 85:024bf7f99721 83
bogdanm 85:024bf7f99721 84 uint32_t Hysteresis; /*!< Selects the hysteresis voltage of the comparator.
bogdanm 85:024bf7f99721 85 This parameter can be a value of @ref COMP_Hysteresis */
bogdanm 85:024bf7f99721 86
bogdanm 85:024bf7f99721 87 uint32_t Mode; /*!< Selects the operating comsumption mode of the comparator
bogdanm 85:024bf7f99721 88 to adjust the speed/consumption.
bogdanm 85:024bf7f99721 89 This parameter can be a value of @ref COMP_Mode */
bogdanm 85:024bf7f99721 90
bogdanm 85:024bf7f99721 91 uint32_t WindowMode; /*!< Selects the window mode of the comparator 1 & 2.
bogdanm 85:024bf7f99721 92 This parameter can be a value of @ref COMP_WindowMode */
bogdanm 85:024bf7f99721 93
bogdanm 85:024bf7f99721 94 uint32_t TriggerMode; /*!< Selects the trigger mode of the comparator (interrupt mode).
bogdanm 85:024bf7f99721 95 This parameter can be a value of @ref COMP_TriggerMode */
bogdanm 85:024bf7f99721 96
bogdanm 85:024bf7f99721 97 }COMP_InitTypeDef;
bogdanm 85:024bf7f99721 98
bogdanm 85:024bf7f99721 99 /**
bogdanm 85:024bf7f99721 100 * @brief HAL State structures definition
bogdanm 85:024bf7f99721 101 */
bogdanm 85:024bf7f99721 102 typedef enum
bogdanm 85:024bf7f99721 103 {
bogdanm 85:024bf7f99721 104 HAL_COMP_STATE_RESET = 0x00, /*!< COMP not yet initialized or disabled */
bogdanm 85:024bf7f99721 105 HAL_COMP_STATE_READY = 0x01, /*!< COMP initialized and ready for use */
bogdanm 85:024bf7f99721 106 HAL_COMP_STATE_READY_LOCKED = 0x11, /*!< COMP initialized but the configuration is locked */
bogdanm 85:024bf7f99721 107 HAL_COMP_STATE_BUSY = 0x02, /*!< COMP is running */
bogdanm 85:024bf7f99721 108 HAL_COMP_STATE_BUSY_LOCKED = 0x12 /*!< COMP is running and the configuration is locked */
bogdanm 85:024bf7f99721 109 }HAL_COMP_StateTypeDef;
bogdanm 85:024bf7f99721 110
bogdanm 85:024bf7f99721 111 /**
bogdanm 92:4fc01daae5a5 112 * @brief COMP Handle Structure definition
bogdanm 85:024bf7f99721 113 */
bogdanm 85:024bf7f99721 114 typedef struct
bogdanm 85:024bf7f99721 115 {
bogdanm 85:024bf7f99721 116 COMP_TypeDef *Instance; /*!< Register base address */
bogdanm 85:024bf7f99721 117 COMP_InitTypeDef Init; /*!< COMP required parameters */
bogdanm 85:024bf7f99721 118 HAL_LockTypeDef Lock; /*!< Locking object */
bogdanm 85:024bf7f99721 119 __IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */
bogdanm 85:024bf7f99721 120 }COMP_HandleTypeDef;
bogdanm 85:024bf7f99721 121
bogdanm 92:4fc01daae5a5 122 /**
bogdanm 92:4fc01daae5a5 123 * @}
bogdanm 92:4fc01daae5a5 124 */
bogdanm 92:4fc01daae5a5 125
bogdanm 85:024bf7f99721 126 /* Exported constants --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 127 /** @defgroup COMP_Exported_Constants COMP Exported Constants
bogdanm 85:024bf7f99721 128 * @{
bogdanm 85:024bf7f99721 129 */
bogdanm 85:024bf7f99721 130
bogdanm 92:4fc01daae5a5 131 /** @defgroup COMP_OutputPolarity COMP OutputPolarity
bogdanm 85:024bf7f99721 132 * @{
bogdanm 85:024bf7f99721 133 */
bogdanm 85:024bf7f99721 134 #define COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */
bogdanm 85:024bf7f99721 135 #define COMP_OUTPUTPOL_INVERTED COMP_CSR_COMP1POL /*!< COMP output on GPIO is inverted */
bogdanm 85:024bf7f99721 136
bogdanm 85:024bf7f99721 137 #define IS_COMP_OUTPUTPOL(POL) (((POL) == COMP_OUTPUTPOL_NONINVERTED) || \
bogdanm 85:024bf7f99721 138 ((POL) == COMP_OUTPUTPOL_INVERTED))
bogdanm 85:024bf7f99721 139 /**
bogdanm 85:024bf7f99721 140 * @}
bogdanm 85:024bf7f99721 141 */
bogdanm 85:024bf7f99721 142
bogdanm 92:4fc01daae5a5 143 /** @defgroup COMP_Hysteresis COMP Hysteresis
bogdanm 85:024bf7f99721 144 * @{
bogdanm 85:024bf7f99721 145 */
bogdanm 85:024bf7f99721 146 #define COMP_HYSTERESIS_NONE ((uint32_t)0x00000000) /*!< No hysteresis */
bogdanm 85:024bf7f99721 147 #define COMP_HYSTERESIS_LOW COMP_CSR_COMP1HYST_0 /*!< Hysteresis level low */
bogdanm 85:024bf7f99721 148 #define COMP_HYSTERESIS_MEDIUM COMP_CSR_COMP1HYST_1 /*!< Hysteresis level medium */
bogdanm 85:024bf7f99721 149 #define COMP_HYSTERESIS_HIGH COMP_CSR_COMP1HYST /*!< Hysteresis level high */
bogdanm 85:024bf7f99721 150
bogdanm 85:024bf7f99721 151 #define IS_COMP_HYSTERESIS(HYSTERESIS) (((HYSTERESIS) == COMP_HYSTERESIS_NONE) || \
bogdanm 85:024bf7f99721 152 ((HYSTERESIS) == COMP_HYSTERESIS_LOW) || \
bogdanm 85:024bf7f99721 153 ((HYSTERESIS) == COMP_HYSTERESIS_MEDIUM) || \
bogdanm 85:024bf7f99721 154 ((HYSTERESIS) == COMP_HYSTERESIS_HIGH))
bogdanm 85:024bf7f99721 155 /**
bogdanm 85:024bf7f99721 156 * @}
bogdanm 85:024bf7f99721 157 */
bogdanm 85:024bf7f99721 158
bogdanm 92:4fc01daae5a5 159 /** @defgroup COMP_Mode COMP Mode
bogdanm 85:024bf7f99721 160 * @{
bogdanm 85:024bf7f99721 161 */
bogdanm 85:024bf7f99721 162 /* Please refer to the electrical characteristics in the device datasheet for
bogdanm 85:024bf7f99721 163 the power consumption values */
bogdanm 85:024bf7f99721 164 #define COMP_MODE_HIGHSPEED ((uint32_t)0x00000000) /*!< High Speed */
bogdanm 85:024bf7f99721 165 #define COMP_MODE_MEDIUMSPEED COMP_CSR_COMP1MODE_0 /*!< Medium Speed */
bogdanm 85:024bf7f99721 166 #define COMP_MODE_LOWPOWER COMP_CSR_COMP1MODE_1 /*!< Low power mode */
bogdanm 85:024bf7f99721 167 #define COMP_MODE_ULTRALOWPOWER COMP_CSR_COMP1MODE /*!< Ultra-low power mode */
bogdanm 85:024bf7f99721 168
bogdanm 85:024bf7f99721 169 #define IS_COMP_MODE(MODE) (((MODE) == COMP_MODE_HIGHSPEED) || \
bogdanm 85:024bf7f99721 170 ((MODE) == COMP_MODE_MEDIUMSPEED) || \
bogdanm 85:024bf7f99721 171 ((MODE) == COMP_MODE_LOWPOWER) || \
bogdanm 85:024bf7f99721 172 ((MODE) == COMP_MODE_ULTRALOWPOWER))
bogdanm 85:024bf7f99721 173
bogdanm 85:024bf7f99721 174 /**
bogdanm 85:024bf7f99721 175 * @}
bogdanm 85:024bf7f99721 176 */
bogdanm 85:024bf7f99721 177
bogdanm 92:4fc01daae5a5 178 /** @defgroup COMP_InvertingInput COMP InvertingInput
bogdanm 85:024bf7f99721 179 * @{
bogdanm 85:024bf7f99721 180 */
bogdanm 85:024bf7f99721 181
bogdanm 85:024bf7f99721 182 #define COMP_INVERTINGINPUT_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
bogdanm 85:024bf7f99721 183 #define COMP_INVERTINGINPUT_1_2VREFINT COMP_CSR_COMP1INSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input */
bogdanm 85:024bf7f99721 184 #define COMP_INVERTINGINPUT_3_4VREFINT COMP_CSR_COMP1INSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input */
bogdanm 85:024bf7f99721 185 #define COMP_INVERTINGINPUT_VREFINT (COMP_CSR_COMP1INSEL_1|COMP_CSR_COMP1INSEL_0) /*!< VREFINT connected to comparator inverting input */
bogdanm 85:024bf7f99721 186 #define COMP_INVERTINGINPUT_DAC1 COMP_CSR_COMP1INSEL_2 /*!< DAC_OUT1 (PA4) connected to comparator inverting input */
bogdanm 85:024bf7f99721 187 #define COMP_INVERTINGINPUT_DAC1SWITCHCLOSED (COMP_CSR_COMP1INSEL_2|COMP_CSR_COMP1SW1) /*!< DAC_OUT1 (PA4) connected to comparator inverting input
bogdanm 85:024bf7f99721 188 and close switch (PA0 for COMP1 only) */
bogdanm 85:024bf7f99721 189 #define COMP_INVERTINGINPUT_DAC2 (COMP_CSR_COMP1INSEL_2|COMP_CSR_COMP1INSEL_0) /*!< DAC_OUT2 (PA5) connected to comparator inverting input */
bogdanm 85:024bf7f99721 190 #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 */
bogdanm 85:024bf7f99721 191
bogdanm 85:024bf7f99721 192 #define IS_COMP_INVERTINGINPUT(INPUT) (((INPUT) == COMP_INVERTINGINPUT_1_4VREFINT) || \
bogdanm 85:024bf7f99721 193 ((INPUT) == COMP_INVERTINGINPUT_1_2VREFINT) || \
bogdanm 85:024bf7f99721 194 ((INPUT) == COMP_INVERTINGINPUT_3_4VREFINT) || \
bogdanm 85:024bf7f99721 195 ((INPUT) == COMP_INVERTINGINPUT_VREFINT) || \
bogdanm 85:024bf7f99721 196 ((INPUT) == COMP_INVERTINGINPUT_DAC1) || \
bogdanm 85:024bf7f99721 197 ((INPUT) == COMP_INVERTINGINPUT_DAC1SWITCHCLOSED) || \
bogdanm 85:024bf7f99721 198 ((INPUT) == COMP_INVERTINGINPUT_DAC2) || \
bogdanm 85:024bf7f99721 199 ((INPUT) == COMP_INVERTINGINPUT_IO1))
bogdanm 85:024bf7f99721 200 /**
bogdanm 85:024bf7f99721 201 * @}
bogdanm 85:024bf7f99721 202 */
bogdanm 85:024bf7f99721 203
bogdanm 92:4fc01daae5a5 204 /** @defgroup COMP_NonInvertingInput COMP NonInvertingInput
bogdanm 92:4fc01daae5a5 205 * @{
bogdanm 92:4fc01daae5a5 206 */
bogdanm 92:4fc01daae5a5 207 #define COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< I/O1 (PA1 for COMP1, PA3 for COMP2)
bogdanm 92:4fc01daae5a5 208 connected to comparator non inverting input */
bogdanm 92:4fc01daae5a5 209 #define COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED COMP_CSR_COMP1SW1 /*!< DAC ouput connected to comparator COMP1 non inverting input */
bogdanm 92:4fc01daae5a5 210
bogdanm 92:4fc01daae5a5 211 #define IS_COMP_NONINVERTINGINPUT(INPUT) (((INPUT) == COMP_NONINVERTINGINPUT_IO1) || \
bogdanm 92:4fc01daae5a5 212 ((INPUT) == COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED))
bogdanm 92:4fc01daae5a5 213 /**
bogdanm 92:4fc01daae5a5 214 * @}
bogdanm 92:4fc01daae5a5 215 */
bogdanm 92:4fc01daae5a5 216
bogdanm 92:4fc01daae5a5 217 /** @defgroup COMP_Output COMP Output
bogdanm 85:024bf7f99721 218 * @{
bogdanm 85:024bf7f99721 219 */
bogdanm 85:024bf7f99721 220
bogdanm 85:024bf7f99721 221 /* Output Redirection common for COMP1 and COMP2 */
bogdanm 85:024bf7f99721 222 #define COMP_OUTPUT_NONE ((uint32_t)0x00000000) /*!< COMP output isn't connected to other peripherals */
bogdanm 85:024bf7f99721 223 #define COMP_OUTPUT_TIM1BKIN COMP_CSR_COMP1OUTSEL_0 /*!< COMP output connected to TIM1 Break Input (BKIN) */
bogdanm 85:024bf7f99721 224 #define COMP_OUTPUT_TIM1IC1 COMP_CSR_COMP1OUTSEL_1 /*!< COMP output connected to TIM1 Input Capture 1 */
bogdanm 85:024bf7f99721 225 #define COMP_OUTPUT_TIM1OCREFCLR (COMP_CSR_COMP1OUTSEL_1|COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM1 OCREF Clear */
bogdanm 85:024bf7f99721 226 #define COMP_OUTPUT_TIM2IC4 COMP_CSR_COMP1OUTSEL_2 /*!< COMP output connected to TIM2 Input Capture 4 */
bogdanm 85:024bf7f99721 227 #define COMP_OUTPUT_TIM2OCREFCLR (COMP_CSR_COMP1OUTSEL_2|COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM2 OCREF Clear */
bogdanm 85:024bf7f99721 228 #define COMP_OUTPUT_TIM3IC1 (COMP_CSR_COMP1OUTSEL_2|COMP_CSR_COMP1OUTSEL_1) /*!< COMP output connected to TIM3 Input Capture 1 */
bogdanm 85:024bf7f99721 229 #define COMP_OUTPUT_TIM3OCREFCLR COMP_CSR_COMP1OUTSEL /*!< COMP output connected to TIM3 OCREF Clear */
bogdanm 85:024bf7f99721 230
bogdanm 85:024bf7f99721 231 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OUTPUT_NONE) || \
bogdanm 85:024bf7f99721 232 ((OUTPUT) == COMP_OUTPUT_TIM1BKIN) || \
bogdanm 85:024bf7f99721 233 ((OUTPUT) == COMP_OUTPUT_TIM1IC1) || \
bogdanm 85:024bf7f99721 234 ((OUTPUT) == COMP_OUTPUT_TIM1OCREFCLR) || \
bogdanm 85:024bf7f99721 235 ((OUTPUT) == COMP_OUTPUT_TIM2IC4) || \
bogdanm 85:024bf7f99721 236 ((OUTPUT) == COMP_OUTPUT_TIM2OCREFCLR) || \
bogdanm 85:024bf7f99721 237 ((OUTPUT) == COMP_OUTPUT_TIM3IC1) || \
bogdanm 85:024bf7f99721 238 ((OUTPUT) == COMP_OUTPUT_TIM3OCREFCLR))
bogdanm 85:024bf7f99721 239
bogdanm 85:024bf7f99721 240 /**
bogdanm 85:024bf7f99721 241 * @}
bogdanm 85:024bf7f99721 242 */
bogdanm 85:024bf7f99721 243
bogdanm 92:4fc01daae5a5 244 /** @defgroup COMP_OutputLevel COMP OutputLevel
bogdanm 85:024bf7f99721 245 * @{
bogdanm 85:024bf7f99721 246 */
bogdanm 85:024bf7f99721 247 /* When output polarity is not inverted, comparator output is low when
bogdanm 85:024bf7f99721 248 the non-inverting input is at a lower voltage than the inverting input*/
bogdanm 85:024bf7f99721 249 #define COMP_OUTPUTLEVEL_LOW ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 250 /* When output polarity is not inverted, comparator output is high when
bogdanm 85:024bf7f99721 251 the non-inverting input is at a higher voltage than the inverting input */
bogdanm 85:024bf7f99721 252 #define COMP_OUTPUTLEVEL_HIGH COMP_CSR_COMP1OUT
bogdanm 85:024bf7f99721 253 /**
bogdanm 85:024bf7f99721 254 * @}
bogdanm 85:024bf7f99721 255 */
bogdanm 85:024bf7f99721 256
bogdanm 92:4fc01daae5a5 257 /** @defgroup COMP_TriggerMode COMP TriggerMode
bogdanm 85:024bf7f99721 258 * @{
bogdanm 85:024bf7f99721 259 */
bogdanm 85:024bf7f99721 260 #define COMP_TRIGGERMODE_NONE ((uint32_t)0x00000000) /*!< No External Interrupt trigger detection */
bogdanm 85:024bf7f99721 261 #define COMP_TRIGGERMODE_IT_RISING ((uint32_t)0x00000001) /*!< External Interrupt Mode with Rising edge trigger detection */
bogdanm 85:024bf7f99721 262 #define COMP_TRIGGERMODE_IT_FALLING ((uint32_t)0x00000002) /*!< External Interrupt Mode with Falling edge trigger detection */
bogdanm 85:024bf7f99721 263 #define COMP_TRIGGERMODE_IT_RISING_FALLING ((uint32_t)0x00000003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
bogdanm 85:024bf7f99721 264
bogdanm 85:024bf7f99721 265 #define IS_COMP_TRIGGERMODE(MODE) (((MODE) == COMP_TRIGGERMODE_NONE) || \
bogdanm 85:024bf7f99721 266 ((MODE) == COMP_TRIGGERMODE_IT_RISING) || \
bogdanm 85:024bf7f99721 267 ((MODE) == COMP_TRIGGERMODE_IT_FALLING) || \
bogdanm 85:024bf7f99721 268 ((MODE) == COMP_TRIGGERMODE_IT_RISING_FALLING))
bogdanm 85:024bf7f99721 269 /**
bogdanm 85:024bf7f99721 270 * @}
bogdanm 85:024bf7f99721 271 */
bogdanm 85:024bf7f99721 272
bogdanm 92:4fc01daae5a5 273 /** @defgroup COMP_WindowMode COMP WindowMode
bogdanm 85:024bf7f99721 274 * @{
bogdanm 85:024bf7f99721 275 */
bogdanm 85:024bf7f99721 276 #define COMP_WINDOWMODE_DISABLED ((uint32_t)0x00000000) /*!< Window mode disabled */
bogdanm 85:024bf7f99721 277 #define COMP_WINDOWMODE_ENABLED COMP_CSR_WNDWEN /*!< Window mode enabled: non inverting input of comparator 2
bogdanm 85:024bf7f99721 278 is connected to the non inverting input of comparator 1 (PA1) */
bogdanm 85:024bf7f99721 279
bogdanm 85:024bf7f99721 280 #define IS_COMP_WINDOWMODE(WINDOWMODE) (((WINDOWMODE) == COMP_WINDOWMODE_DISABLED) || \
bogdanm 85:024bf7f99721 281 ((WINDOWMODE) == COMP_WINDOWMODE_ENABLED))
bogdanm 85:024bf7f99721 282 /**
bogdanm 85:024bf7f99721 283 * @}
bogdanm 85:024bf7f99721 284 */
bogdanm 85:024bf7f99721 285
bogdanm 92:4fc01daae5a5 286 /** @defgroup COMP_ExtiLineEvent COMP ExtiLineEvent
bogdanm 85:024bf7f99721 287 * Elements values convention: XXXX0000
bogdanm 85:024bf7f99721 288 * - XXXX : Interrupt mask in the EMR/IMR/RTSR/FTSR register
bogdanm 85:024bf7f99721 289 * @{
bogdanm 85:024bf7f99721 290 */
bogdanm 85:024bf7f99721 291 #define COMP_EXTI_LINE_COMP1_EVENT ((uint32_t)0x00200000) /*!< External interrupt line 21 Connected to COMP1 */
bogdanm 85:024bf7f99721 292 #define COMP_EXTI_LINE_COMP2_EVENT ((uint32_t)0x00400000) /*!< External interrupt line 22 Connected to COMP2 */
bogdanm 85:024bf7f99721 293
bogdanm 85:024bf7f99721 294 /**
bogdanm 85:024bf7f99721 295 * @}
bogdanm 85:024bf7f99721 296 */
bogdanm 85:024bf7f99721 297
bogdanm 92:4fc01daae5a5 298 /** @defgroup COMP_Lock COMP Lock
bogdanm 92:4fc01daae5a5 299 * @{
bogdanm 92:4fc01daae5a5 300 */
bogdanm 85:024bf7f99721 301 #define COMP_LOCK_DISABLE ((uint32_t)0x00000000)
bogdanm 85:024bf7f99721 302 #define COMP_LOCK_ENABLE COMP_CSR_COMP1LOCK
bogdanm 85:024bf7f99721 303
bogdanm 85:024bf7f99721 304 #define COMP_STATE_BIT_LOCK ((uint32_t)0x10)
bogdanm 92:4fc01daae5a5 305 /**
bogdanm 92:4fc01daae5a5 306 * @}
bogdanm 92:4fc01daae5a5 307 */
bogdanm 92:4fc01daae5a5 308
bogdanm 85:024bf7f99721 309
bogdanm 85:024bf7f99721 310 /**
bogdanm 85:024bf7f99721 311 * @}
bogdanm 85:024bf7f99721 312 */
bogdanm 85:024bf7f99721 313
bogdanm 85:024bf7f99721 314 /* Exported macros -----------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 315 /** @defgroup COMP_Exported_Macros COMP Exported Macros
bogdanm 92:4fc01daae5a5 316 * @{
bogdanm 92:4fc01daae5a5 317 */
bogdanm 85:024bf7f99721 318
bogdanm 85:024bf7f99721 319 /** @brief Reset COMP handle state
bogdanm 85:024bf7f99721 320 * @param __HANDLE__: COMP handle.
bogdanm 85:024bf7f99721 321 * @retval None
bogdanm 85:024bf7f99721 322 */
bogdanm 85:024bf7f99721 323 #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET)
bogdanm 85:024bf7f99721 324
bogdanm 85:024bf7f99721 325 /**
bogdanm 85:024bf7f99721 326 * @brief Checks whether the specified EXTI line flag is set or not.
bogdanm 85:024bf7f99721 327 * @param __FLAG__: specifies the COMP Exti sources to be checked.
bogdanm 85:024bf7f99721 328 * This parameter can be a value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 329 * @retval The state of __FLAG__ (SET or RESET).
bogdanm 85:024bf7f99721 330 */
bogdanm 85:024bf7f99721 331 #define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (EXTI->PR & (__FLAG__))
bogdanm 85:024bf7f99721 332
bogdanm 85:024bf7f99721 333 /**
bogdanm 85:024bf7f99721 334 * @brief Clear the COMP Exti flags.
bogdanm 85:024bf7f99721 335 * @param __FLAG__: specifies the COMP Exti sources to be cleared.
bogdanm 85:024bf7f99721 336 * This parameter can be a value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 337 * @retval None.
bogdanm 85:024bf7f99721 338 */
bogdanm 92:4fc01daae5a5 339 #define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (EXTI->PR = (__FLAG__))
bogdanm 85:024bf7f99721 340
bogdanm 85:024bf7f99721 341 /**
bogdanm 85:024bf7f99721 342 * @brief Enable the COMP Exti Line.
bogdanm 85:024bf7f99721 343 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
bogdanm 85:024bf7f99721 344 * This parameter can be a value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 345 * @retval None.
bogdanm 85:024bf7f99721 346 */
bogdanm 85:024bf7f99721 347 #define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (EXTI->IMR |= (__EXTILINE__))
bogdanm 85:024bf7f99721 348
bogdanm 85:024bf7f99721 349 /**
bogdanm 85:024bf7f99721 350 * @brief Disable the COMP Exti Line.
bogdanm 85:024bf7f99721 351 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
bogdanm 85:024bf7f99721 352 * This parameter can be a value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 353 * @retval None.
bogdanm 85:024bf7f99721 354 */
bogdanm 85:024bf7f99721 355 #define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (EXTI->IMR &= ~(__EXTILINE__))
bogdanm 85:024bf7f99721 356
bogdanm 85:024bf7f99721 357 /**
bogdanm 85:024bf7f99721 358 * @brief Enable the Exti Line rising edge trigger.
bogdanm 85:024bf7f99721 359 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
bogdanm 85:024bf7f99721 360 * This parameter can be a value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 361 * @retval None.
bogdanm 85:024bf7f99721 362 */
bogdanm 85:024bf7f99721 363 #define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (EXTI->RTSR |= (__EXTILINE__))
bogdanm 85:024bf7f99721 364
bogdanm 85:024bf7f99721 365 /**
bogdanm 85:024bf7f99721 366 * @brief Disable the Exti Line rising edge trigger.
bogdanm 85:024bf7f99721 367 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
bogdanm 85:024bf7f99721 368 * This parameter can be a value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 369 * @retval None.
bogdanm 85:024bf7f99721 370 */
bogdanm 85:024bf7f99721 371 #define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (EXTI->RTSR &= ~(__EXTILINE__))
bogdanm 85:024bf7f99721 372
bogdanm 85:024bf7f99721 373 /**
bogdanm 85:024bf7f99721 374 * @brief Enable the Exti Line falling edge trigger.
bogdanm 85:024bf7f99721 375 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
bogdanm 85:024bf7f99721 376 * This parameter can be a value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 377 * @retval None.
bogdanm 85:024bf7f99721 378 */
bogdanm 85:024bf7f99721 379 #define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (EXTI->FTSR |= (__EXTILINE__))
bogdanm 85:024bf7f99721 380
bogdanm 85:024bf7f99721 381 /**
bogdanm 85:024bf7f99721 382 * @brief Disable the Exti Line falling edge trigger.
bogdanm 85:024bf7f99721 383 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
bogdanm 85:024bf7f99721 384 * This parameter can be a value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 385 * @retval None.
bogdanm 85:024bf7f99721 386 */
bogdanm 85:024bf7f99721 387 #define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (EXTI->FTSR &= ~(__EXTILINE__))
bogdanm 85:024bf7f99721 388
bogdanm 85:024bf7f99721 389 /**
bogdanm 85:024bf7f99721 390 * @brief Get the specified EXTI line for a comparator instance
bogdanm 85:024bf7f99721 391 * @param __INSTANCE__: specifies the COMP instance.
bogdanm 85:024bf7f99721 392 * @retval value of @ref COMP_ExtiLineEvent
bogdanm 85:024bf7f99721 393 */
bogdanm 85:024bf7f99721 394 #define __HAL_COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1_EVENT : \
bogdanm 85:024bf7f99721 395 COMP_EXTI_LINE_COMP2_EVENT)
bogdanm 92:4fc01daae5a5 396 /**
bogdanm 92:4fc01daae5a5 397 * @}
bogdanm 92:4fc01daae5a5 398 */
bogdanm 85:024bf7f99721 399
bogdanm 85:024bf7f99721 400 /* Exported functions --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 401 /** @addtogroup COMP_Exported_Functions COMP Exported Functions
bogdanm 92:4fc01daae5a5 402 * @{
bogdanm 92:4fc01daae5a5 403 */
bogdanm 92:4fc01daae5a5 404 /** @addtogroup COMP_Exported_Functions_Group1 Initialization/de-initialization functions
bogdanm 92:4fc01daae5a5 405 * @brief Initialization and Configuration functions
bogdanm 92:4fc01daae5a5 406 * @{
bogdanm 92:4fc01daae5a5 407 */
bogdanm 85:024bf7f99721 408 /* Initialization and de-initialization functions ****************************/
bogdanm 85:024bf7f99721 409 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 410 HAL_StatusTypeDef HAL_COMP_DeInit (COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 411 void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 412 void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp);
bogdanm 92:4fc01daae5a5 413 /**
bogdanm 92:4fc01daae5a5 414 * @}
bogdanm 92:4fc01daae5a5 415 */
bogdanm 85:024bf7f99721 416
bogdanm 92:4fc01daae5a5 417 /** @addtogroup COMP_Exported_Functions_Group2 I/O operation functions
bogdanm 92:4fc01daae5a5 418 * @brief Data transfers functions
bogdanm 92:4fc01daae5a5 419 * @{
bogdanm 92:4fc01daae5a5 420 */
bogdanm 85:024bf7f99721 421 /* IO operation functions *****************************************************/
bogdanm 85:024bf7f99721 422 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 423 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 424 HAL_StatusTypeDef HAL_COMP_Start_IT(COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 425 HAL_StatusTypeDef HAL_COMP_Stop_IT(COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 426 void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp);
bogdanm 92:4fc01daae5a5 427 /**
bogdanm 92:4fc01daae5a5 428 * @}
bogdanm 92:4fc01daae5a5 429 */
bogdanm 85:024bf7f99721 430
bogdanm 92:4fc01daae5a5 431 /** @addtogroup COMP_Exported_Functions_Group3 Peripheral Control functions
bogdanm 92:4fc01daae5a5 432 * @brief management functions
bogdanm 92:4fc01daae5a5 433 * @{
bogdanm 92:4fc01daae5a5 434 */
bogdanm 85:024bf7f99721 435 /* Peripheral Control functions ***********************************************/
bogdanm 85:024bf7f99721 436 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 437 uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp);
bogdanm 85:024bf7f99721 438
bogdanm 85:024bf7f99721 439 /* Callback in Interrupt mode */
bogdanm 85:024bf7f99721 440 void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp);
bogdanm 92:4fc01daae5a5 441 /**
bogdanm 92:4fc01daae5a5 442 * @}
bogdanm 92:4fc01daae5a5 443 */
bogdanm 85:024bf7f99721 444
bogdanm 92:4fc01daae5a5 445 /** @addtogroup COMP_Exported_Functions_Group4 Peripheral State functions
bogdanm 92:4fc01daae5a5 446 * @brief Peripheral State functions
bogdanm 92:4fc01daae5a5 447 * @{
bogdanm 92:4fc01daae5a5 448 */
bogdanm 85:024bf7f99721 449 /* Peripheral State and Error functions ***************************************/
bogdanm 85:024bf7f99721 450 HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp);
bogdanm 92:4fc01daae5a5 451 /**
bogdanm 92:4fc01daae5a5 452 * @}
bogdanm 92:4fc01daae5a5 453 */
bogdanm 92:4fc01daae5a5 454
bogdanm 92:4fc01daae5a5 455 /**
bogdanm 92:4fc01daae5a5 456 * @}
bogdanm 92:4fc01daae5a5 457 */
bogdanm 85:024bf7f99721 458
bogdanm 85:024bf7f99721 459 /**
bogdanm 85:024bf7f99721 460 * @}
bogdanm 85:024bf7f99721 461 */
bogdanm 85:024bf7f99721 462
bogdanm 85:024bf7f99721 463 /**
bogdanm 85:024bf7f99721 464 * @}
bogdanm 85:024bf7f99721 465 */
bogdanm 92:4fc01daae5a5 466
bogdanm 85:024bf7f99721 467 #endif /* STM32F051x8 || STM32F058xx || */
bogdanm 92:4fc01daae5a5 468 /* STM32F071xB || STM32F072xB || STM32F078xx || */
bogdanm 92:4fc01daae5a5 469 /* STM32F091xC || STM32F098xx */
bogdanm 85:024bf7f99721 470
bogdanm 85:024bf7f99721 471 #ifdef __cplusplus
bogdanm 85:024bf7f99721 472 }
bogdanm 85:024bf7f99721 473 #endif
bogdanm 85:024bf7f99721 474
bogdanm 85:024bf7f99721 475 #endif /* __STM32F0xx_HAL_COMP_H */
bogdanm 85:024bf7f99721 476
bogdanm 85:024bf7f99721 477 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 478