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:
Kojto
Date:
Fri Oct 02 07:35:07 2015 +0200
Revision:
108:34e6b704fe68
Parent:
93:e188a91d3eaa
Release 108  of the mbed library

Changes:
- new platforms - ELMO_F411RE, WIZNET_7500P, ARM_MPS2_BEID
- EFM32 - bugfixes in rtc, serial
- Cortex A cmsis - update files
- STML4 - RAM fixes

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