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:
108:34e6b704fe68
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 93:e188a91d3eaa 1 /**
Kojto 93:e188a91d3eaa 2 ******************************************************************************
Kojto 93:e188a91d3eaa 3 * @file stm32f0xx_hal_comp.h
Kojto 93:e188a91d3eaa 4 * @author MCD Application Team
Kojto 108:34e6b704fe68 5 * @version V1.3.0
Kojto 108:34e6b704fe68 6 * @date 26-June-2015
Kojto 93:e188a91d3eaa 7 * @brief Header file of COMP HAL module.
Kojto 93:e188a91d3eaa 8 ******************************************************************************
Kojto 93:e188a91d3eaa 9 * @attention
Kojto 93:e188a91d3eaa 10 *
Kojto 108:34e6b704fe68 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 93:e188a91d3eaa 12 *
Kojto 93:e188a91d3eaa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 93:e188a91d3eaa 14 * are permitted provided that the following conditions are met:
Kojto 93:e188a91d3eaa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 93:e188a91d3eaa 16 * this list of conditions and the following disclaimer.
Kojto 93:e188a91d3eaa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 93:e188a91d3eaa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 93:e188a91d3eaa 19 * and/or other materials provided with the distribution.
Kojto 93:e188a91d3eaa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 93:e188a91d3eaa 21 * may be used to endorse or promote products derived from this software
Kojto 93:e188a91d3eaa 22 * without specific prior written permission.
Kojto 93:e188a91d3eaa 23 *
Kojto 93:e188a91d3eaa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 93:e188a91d3eaa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 93:e188a91d3eaa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 93:e188a91d3eaa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 93:e188a91d3eaa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 93:e188a91d3eaa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 93:e188a91d3eaa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 93:e188a91d3eaa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 93:e188a91d3eaa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 93:e188a91d3eaa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 93:e188a91d3eaa 34 *
Kojto 93:e188a91d3eaa 35 ******************************************************************************
Kojto 93:e188a91d3eaa 36 */
Kojto 93:e188a91d3eaa 37
Kojto 93:e188a91d3eaa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 93:e188a91d3eaa 39 #ifndef __STM32F0xx_HAL_COMP_H
Kojto 93:e188a91d3eaa 40 #define __STM32F0xx_HAL_COMP_H
Kojto 93:e188a91d3eaa 41
Kojto 93:e188a91d3eaa 42 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 43 extern "C" {
Kojto 93:e188a91d3eaa 44 #endif
Kojto 93:e188a91d3eaa 45
Kojto 93:e188a91d3eaa 46 #if defined(STM32F051x8) || defined(STM32F058xx) || \
Kojto 93:e188a91d3eaa 47 defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
Kojto 93:e188a91d3eaa 48 defined(STM32F091xC) || defined(STM32F098xx)
Kojto 93:e188a91d3eaa 49
Kojto 93:e188a91d3eaa 50 /* Includes ------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 51 #include "stm32f0xx_hal_def.h"
Kojto 93:e188a91d3eaa 52
Kojto 93:e188a91d3eaa 53 /** @addtogroup STM32F0xx_HAL_Driver
Kojto 93:e188a91d3eaa 54 * @{
Kojto 93:e188a91d3eaa 55 */
Kojto 93:e188a91d3eaa 56
Kojto 108:34e6b704fe68 57 /** @addtogroup COMP COMP
Kojto 93:e188a91d3eaa 58 * @{
Kojto 93:e188a91d3eaa 59 */
Kojto 93:e188a91d3eaa 60
Kojto 93:e188a91d3eaa 61 /* Exported types ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 62 /** @defgroup COMP_Exported_Types COMP Exported Types
Kojto 93:e188a91d3eaa 63 * @{
Kojto 93:e188a91d3eaa 64 */
Kojto 93:e188a91d3eaa 65
Kojto 93:e188a91d3eaa 66 /**
Kojto 93:e188a91d3eaa 67 * @brief COMP Init structure definition
Kojto 93:e188a91d3eaa 68 */
Kojto 93:e188a91d3eaa 69 typedef struct
Kojto 93:e188a91d3eaa 70 {
Kojto 93:e188a91d3eaa 71
Kojto 93:e188a91d3eaa 72 uint32_t InvertingInput; /*!< Selects the inverting input of the comparator.
Kojto 93:e188a91d3eaa 73 This parameter can be a value of @ref COMP_InvertingInput */
Kojto 93:e188a91d3eaa 74
Kojto 93:e188a91d3eaa 75 uint32_t NonInvertingInput; /*!< Selects the non inverting input of the comparator.
Kojto 93:e188a91d3eaa 76 This parameter can be a value of @ref COMP_NonInvertingInput */
Kojto 93:e188a91d3eaa 77
Kojto 93:e188a91d3eaa 78 uint32_t Output; /*!< Selects the output redirection of the comparator.
Kojto 93:e188a91d3eaa 79 This parameter can be a value of @ref COMP_Output */
Kojto 93:e188a91d3eaa 80
Kojto 93:e188a91d3eaa 81 uint32_t OutputPol; /*!< Selects the output polarity of the comparator.
Kojto 93:e188a91d3eaa 82 This parameter can be a value of @ref COMP_OutputPolarity */
Kojto 93:e188a91d3eaa 83
Kojto 93:e188a91d3eaa 84 uint32_t Hysteresis; /*!< Selects the hysteresis voltage of the comparator.
Kojto 93:e188a91d3eaa 85 This parameter can be a value of @ref COMP_Hysteresis */
Kojto 93:e188a91d3eaa 86
Kojto 93:e188a91d3eaa 87 uint32_t Mode; /*!< Selects the operating comsumption mode of the comparator
Kojto 93:e188a91d3eaa 88 to adjust the speed/consumption.
Kojto 93:e188a91d3eaa 89 This parameter can be a value of @ref COMP_Mode */
Kojto 93:e188a91d3eaa 90
Kojto 93:e188a91d3eaa 91 uint32_t WindowMode; /*!< Selects the window mode of the comparator 1 & 2.
Kojto 93:e188a91d3eaa 92 This parameter can be a value of @ref COMP_WindowMode */
Kojto 93:e188a91d3eaa 93
Kojto 93:e188a91d3eaa 94 uint32_t TriggerMode; /*!< Selects the trigger mode of the comparator (interrupt mode).
Kojto 93:e188a91d3eaa 95 This parameter can be a value of @ref COMP_TriggerMode */
Kojto 93:e188a91d3eaa 96
Kojto 93:e188a91d3eaa 97 }COMP_InitTypeDef;
Kojto 93:e188a91d3eaa 98
Kojto 93:e188a91d3eaa 99 /**
Kojto 93:e188a91d3eaa 100 * @brief COMP Handle Structure definition
Kojto 93:e188a91d3eaa 101 */
Kojto 93:e188a91d3eaa 102 typedef struct
Kojto 93:e188a91d3eaa 103 {
Kojto 93:e188a91d3eaa 104 COMP_TypeDef *Instance; /*!< Register base address */
Kojto 93:e188a91d3eaa 105 COMP_InitTypeDef Init; /*!< COMP required parameters */
Kojto 93:e188a91d3eaa 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 */
Kojto 93:e188a91d3eaa 109 }COMP_HandleTypeDef;
Kojto 93:e188a91d3eaa 110
Kojto 93:e188a91d3eaa 111 /**
Kojto 93:e188a91d3eaa 112 * @}
Kojto 93:e188a91d3eaa 113 */
Kojto 93:e188a91d3eaa 114
Kojto 93:e188a91d3eaa 115 /* Exported constants --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 116 /** @defgroup COMP_Exported_Constants COMP Exported Constants
Kojto 93:e188a91d3eaa 117 * @{
Kojto 93:e188a91d3eaa 118 */
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 132 /** @defgroup COMP_OutputPolarity COMP OutputPolarity
Kojto 93:e188a91d3eaa 133 * @{
Kojto 93:e188a91d3eaa 134 */
Kojto 93:e188a91d3eaa 135 #define COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */
Kojto 93:e188a91d3eaa 136 #define COMP_OUTPUTPOL_INVERTED COMP_CSR_COMP1POL /*!< COMP output on GPIO is inverted */
Kojto 93:e188a91d3eaa 137 /**
Kojto 93:e188a91d3eaa 138 * @}
Kojto 93:e188a91d3eaa 139 */
Kojto 93:e188a91d3eaa 140
Kojto 93:e188a91d3eaa 141 /** @defgroup COMP_Hysteresis COMP Hysteresis
Kojto 93:e188a91d3eaa 142 * @{
Kojto 93:e188a91d3eaa 143 */
Kojto 93:e188a91d3eaa 144 #define COMP_HYSTERESIS_NONE ((uint32_t)0x00000000) /*!< No hysteresis */
Kojto 93:e188a91d3eaa 145 #define COMP_HYSTERESIS_LOW COMP_CSR_COMP1HYST_0 /*!< Hysteresis level low */
Kojto 93:e188a91d3eaa 146 #define COMP_HYSTERESIS_MEDIUM COMP_CSR_COMP1HYST_1 /*!< Hysteresis level medium */
Kojto 93:e188a91d3eaa 147 #define COMP_HYSTERESIS_HIGH COMP_CSR_COMP1HYST /*!< Hysteresis level high */
Kojto 93:e188a91d3eaa 148 /**
Kojto 93:e188a91d3eaa 149 * @}
Kojto 93:e188a91d3eaa 150 */
Kojto 93:e188a91d3eaa 151
Kojto 93:e188a91d3eaa 152 /** @defgroup COMP_Mode COMP Mode
Kojto 93:e188a91d3eaa 153 * @{
Kojto 93:e188a91d3eaa 154 */
Kojto 93:e188a91d3eaa 155 /* Please refer to the electrical characteristics in the device datasheet for
Kojto 93:e188a91d3eaa 156 the power consumption values */
Kojto 93:e188a91d3eaa 157 #define COMP_MODE_HIGHSPEED ((uint32_t)0x00000000) /*!< High Speed */
Kojto 93:e188a91d3eaa 158 #define COMP_MODE_MEDIUMSPEED COMP_CSR_COMP1MODE_0 /*!< Medium Speed */
Kojto 93:e188a91d3eaa 159 #define COMP_MODE_LOWPOWER COMP_CSR_COMP1MODE_1 /*!< Low power mode */
Kojto 93:e188a91d3eaa 160 #define COMP_MODE_ULTRALOWPOWER COMP_CSR_COMP1MODE /*!< Ultra-low power mode */
Kojto 93:e188a91d3eaa 161 /**
Kojto 93:e188a91d3eaa 162 * @}
Kojto 93:e188a91d3eaa 163 */
Kojto 93:e188a91d3eaa 164
Kojto 93:e188a91d3eaa 165 /** @defgroup COMP_InvertingInput COMP InvertingInput
Kojto 93:e188a91d3eaa 166 * @{
Kojto 93:e188a91d3eaa 167 */
Kojto 93:e188a91d3eaa 168
Kojto 93:e188a91d3eaa 169 #define COMP_INVERTINGINPUT_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
Kojto 93:e188a91d3eaa 170 #define COMP_INVERTINGINPUT_1_2VREFINT COMP_CSR_COMP1INSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input */
Kojto 93:e188a91d3eaa 171 #define COMP_INVERTINGINPUT_3_4VREFINT COMP_CSR_COMP1INSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input */
Kojto 93:e188a91d3eaa 172 #define COMP_INVERTINGINPUT_VREFINT (COMP_CSR_COMP1INSEL_1|COMP_CSR_COMP1INSEL_0) /*!< VREFINT connected to comparator inverting input */
Kojto 93:e188a91d3eaa 173 #define COMP_INVERTINGINPUT_DAC1 COMP_CSR_COMP1INSEL_2 /*!< DAC_OUT1 (PA4) connected to comparator inverting input */
Kojto 93:e188a91d3eaa 174 #define COMP_INVERTINGINPUT_DAC1SWITCHCLOSED (COMP_CSR_COMP1INSEL_2|COMP_CSR_COMP1SW1) /*!< DAC_OUT1 (PA4) connected to comparator inverting input
Kojto 93:e188a91d3eaa 175 and close switch (PA0 for COMP1 only) */
Kojto 93:e188a91d3eaa 176 #define COMP_INVERTINGINPUT_DAC2 (COMP_CSR_COMP1INSEL_2|COMP_CSR_COMP1INSEL_0) /*!< DAC_OUT2 (PA5) connected to comparator inverting input */
Kojto 93:e188a91d3eaa 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 93:e188a91d3eaa 178 /**
Kojto 93:e188a91d3eaa 179 * @}
Kojto 93:e188a91d3eaa 180 */
Kojto 93:e188a91d3eaa 181
Kojto 93:e188a91d3eaa 182 /** @defgroup COMP_NonInvertingInput COMP NonInvertingInput
Kojto 93:e188a91d3eaa 183 * @{
Kojto 93:e188a91d3eaa 184 */
Kojto 93:e188a91d3eaa 185 #define COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< I/O1 (PA1 for COMP1, PA3 for COMP2)
Kojto 93:e188a91d3eaa 186 connected to comparator non inverting input */
Kojto 93:e188a91d3eaa 187 #define COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED COMP_CSR_COMP1SW1 /*!< DAC ouput connected to comparator COMP1 non inverting input */
Kojto 93:e188a91d3eaa 188 /**
Kojto 93:e188a91d3eaa 189 * @}
Kojto 93:e188a91d3eaa 190 */
Kojto 93:e188a91d3eaa 191
Kojto 93:e188a91d3eaa 192 /** @defgroup COMP_Output COMP Output
Kojto 93:e188a91d3eaa 193 * @{
Kojto 93:e188a91d3eaa 194 */
Kojto 93:e188a91d3eaa 195
Kojto 93:e188a91d3eaa 196 /* Output Redirection common for COMP1 and COMP2 */
Kojto 93:e188a91d3eaa 197 #define COMP_OUTPUT_NONE ((uint32_t)0x00000000) /*!< COMP output isn't connected to other peripherals */
Kojto 93:e188a91d3eaa 198 #define COMP_OUTPUT_TIM1BKIN COMP_CSR_COMP1OUTSEL_0 /*!< COMP output connected to TIM1 Break Input (BKIN) */
Kojto 93:e188a91d3eaa 199 #define COMP_OUTPUT_TIM1IC1 COMP_CSR_COMP1OUTSEL_1 /*!< COMP output connected to TIM1 Input Capture 1 */
Kojto 93:e188a91d3eaa 200 #define COMP_OUTPUT_TIM1OCREFCLR (COMP_CSR_COMP1OUTSEL_1|COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM1 OCREF Clear */
Kojto 93:e188a91d3eaa 201 #define COMP_OUTPUT_TIM2IC4 COMP_CSR_COMP1OUTSEL_2 /*!< COMP output connected to TIM2 Input Capture 4 */
Kojto 93:e188a91d3eaa 202 #define COMP_OUTPUT_TIM2OCREFCLR (COMP_CSR_COMP1OUTSEL_2|COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM2 OCREF Clear */
Kojto 93:e188a91d3eaa 203 #define COMP_OUTPUT_TIM3IC1 (COMP_CSR_COMP1OUTSEL_2|COMP_CSR_COMP1OUTSEL_1) /*!< COMP output connected to TIM3 Input Capture 1 */
Kojto 93:e188a91d3eaa 204 #define COMP_OUTPUT_TIM3OCREFCLR COMP_CSR_COMP1OUTSEL /*!< COMP output connected to TIM3 OCREF Clear */
Kojto 93:e188a91d3eaa 205 /**
Kojto 93:e188a91d3eaa 206 * @}
Kojto 93:e188a91d3eaa 207 */
Kojto 93:e188a91d3eaa 208
Kojto 93:e188a91d3eaa 209 /** @defgroup COMP_OutputLevel COMP OutputLevel
Kojto 93:e188a91d3eaa 210 * @{
Kojto 93:e188a91d3eaa 211 */
Kojto 93:e188a91d3eaa 212 /* When output polarity is not inverted, comparator output is low when
Kojto 93:e188a91d3eaa 213 the non-inverting input is at a lower voltage than the inverting input*/
Kojto 93:e188a91d3eaa 214 #define COMP_OUTPUTLEVEL_LOW ((uint32_t)0x00000000)
Kojto 93:e188a91d3eaa 215 /* When output polarity is not inverted, comparator output is high when
Kojto 93:e188a91d3eaa 216 the non-inverting input is at a higher voltage than the inverting input */
Kojto 93:e188a91d3eaa 217 #define COMP_OUTPUTLEVEL_HIGH COMP_CSR_COMP1OUT
Kojto 93:e188a91d3eaa 218 /**
Kojto 93:e188a91d3eaa 219 * @}
Kojto 93:e188a91d3eaa 220 */
Kojto 93:e188a91d3eaa 221
Kojto 93:e188a91d3eaa 222 /** @defgroup COMP_TriggerMode COMP TriggerMode
Kojto 93:e188a91d3eaa 223 * @{
Kojto 93:e188a91d3eaa 224 */
Kojto 93:e188a91d3eaa 225 #define COMP_TRIGGERMODE_NONE ((uint32_t)0x00000000) /*!< No External Interrupt trigger detection */
Kojto 93:e188a91d3eaa 226 #define COMP_TRIGGERMODE_IT_RISING ((uint32_t)0x00000001) /*!< External Interrupt Mode with Rising edge trigger detection */
Kojto 93:e188a91d3eaa 227 #define COMP_TRIGGERMODE_IT_FALLING ((uint32_t)0x00000002) /*!< External Interrupt Mode with Falling edge trigger detection */
Kojto 93:e188a91d3eaa 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 */
Kojto 93:e188a91d3eaa 232 /**
Kojto 93:e188a91d3eaa 233 * @}
Kojto 93:e188a91d3eaa 234 */
Kojto 93:e188a91d3eaa 235
Kojto 93:e188a91d3eaa 236 /** @defgroup COMP_WindowMode COMP WindowMode
Kojto 93:e188a91d3eaa 237 * @{
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 241 is connected to the non inverting input of comparator 1 (PA1) */
Kojto 93:e188a91d3eaa 242 /**
Kojto 93:e188a91d3eaa 243 * @}
Kojto 93:e188a91d3eaa 244 */
Kojto 93:e188a91d3eaa 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 */
Kojto 93:e188a91d3eaa 250
Kojto 93:e188a91d3eaa 251 /**
Kojto 93:e188a91d3eaa 252 * @}
Kojto 93:e188a91d3eaa 253 */
Kojto 93:e188a91d3eaa 254
Kojto 93:e188a91d3eaa 255 /**
Kojto 93:e188a91d3eaa 256 * @}
Kojto 93:e188a91d3eaa 257 */
Kojto 93:e188a91d3eaa 258
Kojto 93:e188a91d3eaa 259 /* Exported macros -----------------------------------------------------------*/
Kojto 93:e188a91d3eaa 260 /** @defgroup COMP_Exported_Macros COMP Exported Macros
Kojto 93:e188a91d3eaa 261 * @{
Kojto 93:e188a91d3eaa 262 */
Kojto 93:e188a91d3eaa 263
Kojto 93:e188a91d3eaa 264 /** @brief Reset COMP handle state
Kojto 93:e188a91d3eaa 265 * @param __HANDLE__: COMP handle.
Kojto 93:e188a91d3eaa 266 * @retval None
Kojto 93:e188a91d3eaa 267 */
Kojto 93:e188a91d3eaa 268 #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET)
Kojto 93:e188a91d3eaa 269
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 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)
Kojto 93:e188a91d3eaa 314
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 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)
Kojto 93:e188a91d3eaa 368
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 384 */
Kojto 108:34e6b704fe68 385 #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR, COMP_EXTI_LINE_COMP2)
Kojto 93:e188a91d3eaa 386
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 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)
Kojto 93:e188a91d3eaa 413
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 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)
Kojto 93:e188a91d3eaa 440
Kojto 93:e188a91d3eaa 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)
Kojto 93:e188a91d3eaa 452
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 474 /**
Kojto 93:e188a91d3eaa 475 * @}
Kojto 93:e188a91d3eaa 476 */
Kojto 93:e188a91d3eaa 477
Kojto 93:e188a91d3eaa 478 /* Exported functions --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 479 /** @addtogroup COMP_Exported_Functions COMP Exported Functions
Kojto 93:e188a91d3eaa 480 * @{
Kojto 93:e188a91d3eaa 481 */
Kojto 93:e188a91d3eaa 482 /** @addtogroup COMP_Exported_Functions_Group1 Initialization/de-initialization functions
Kojto 93:e188a91d3eaa 483 * @brief Initialization and Configuration functions
Kojto 93:e188a91d3eaa 484 * @{
Kojto 93:e188a91d3eaa 485 */
Kojto 93:e188a91d3eaa 486 /* Initialization and de-initialization functions ****************************/
Kojto 93:e188a91d3eaa 487 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 488 HAL_StatusTypeDef HAL_COMP_DeInit (COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 489 void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 490 void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 491 /**
Kojto 93:e188a91d3eaa 492 * @}
Kojto 93:e188a91d3eaa 493 */
Kojto 93:e188a91d3eaa 494
Kojto 93:e188a91d3eaa 495 /** @addtogroup COMP_Exported_Functions_Group2 I/O operation functions
Kojto 93:e188a91d3eaa 496 * @brief Data transfers functions
Kojto 93:e188a91d3eaa 497 * @{
Kojto 93:e188a91d3eaa 498 */
Kojto 93:e188a91d3eaa 499 /* IO operation functions *****************************************************/
Kojto 93:e188a91d3eaa 500 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 501 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 502 HAL_StatusTypeDef HAL_COMP_Start_IT(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 503 HAL_StatusTypeDef HAL_COMP_Stop_IT(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 504 void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 505 /**
Kojto 93:e188a91d3eaa 506 * @}
Kojto 93:e188a91d3eaa 507 */
Kojto 93:e188a91d3eaa 508
Kojto 93:e188a91d3eaa 509 /** @addtogroup COMP_Exported_Functions_Group3 Peripheral Control functions
Kojto 93:e188a91d3eaa 510 * @brief management functions
Kojto 93:e188a91d3eaa 511 * @{
Kojto 93:e188a91d3eaa 512 */
Kojto 93:e188a91d3eaa 513 /* Peripheral Control functions ***********************************************/
Kojto 93:e188a91d3eaa 514 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 515 uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 516
Kojto 93:e188a91d3eaa 517 /* Callback in Interrupt mode */
Kojto 93:e188a91d3eaa 518 void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 519 /**
Kojto 93:e188a91d3eaa 520 * @}
Kojto 93:e188a91d3eaa 521 */
Kojto 93:e188a91d3eaa 522
Kojto 93:e188a91d3eaa 523 /** @addtogroup COMP_Exported_Functions_Group4 Peripheral State functions
Kojto 93:e188a91d3eaa 524 * @brief Peripheral State functions
Kojto 93:e188a91d3eaa 525 * @{
Kojto 93:e188a91d3eaa 526 */
Kojto 93:e188a91d3eaa 527 /* Peripheral State and Error functions ***************************************/
Kojto 93:e188a91d3eaa 528 uint32_t HAL_COMP_GetState(COMP_HandleTypeDef *hcomp);
Kojto 93:e188a91d3eaa 529 /**
Kojto 93:e188a91d3eaa 530 * @}
Kojto 93:e188a91d3eaa 531 */
Kojto 93:e188a91d3eaa 532
Kojto 93:e188a91d3eaa 533 /**
Kojto 93:e188a91d3eaa 534 * @}
Kojto 93:e188a91d3eaa 535 */
Kojto 93:e188a91d3eaa 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
Kojto 93:e188a91d3eaa 645 /**
Kojto 93:e188a91d3eaa 646 * @}
Kojto 93:e188a91d3eaa 647 */
Kojto 93:e188a91d3eaa 648
Kojto 93:e188a91d3eaa 649 /**
Kojto 93:e188a91d3eaa 650 * @}
Kojto 93:e188a91d3eaa 651 */
Kojto 93:e188a91d3eaa 652
Kojto 93:e188a91d3eaa 653 #endif /* STM32F051x8 || STM32F058xx || */
Kojto 93:e188a91d3eaa 654 /* STM32F071xB || STM32F072xB || STM32F078xx || */
Kojto 93:e188a91d3eaa 655 /* STM32F091xC || STM32F098xx */
Kojto 93:e188a91d3eaa 656
Kojto 93:e188a91d3eaa 657 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 658 }
Kojto 93:e188a91d3eaa 659 #endif
Kojto 93:e188a91d3eaa 660
Kojto 93:e188a91d3eaa 661 #endif /* __STM32F0xx_HAL_COMP_H */
Kojto 93:e188a91d3eaa 662
Kojto 93:e188a91d3eaa 663 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 93:e188a91d3eaa 664