Modified version of the mbed library for use with the Nucleo boards.

Dependents:   EEPROMWrite Full-Project

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Sep 28 10:45:10 2015 +0100
Revision:
630:825f75ca301e
Parent:
441:d2c15dda23c1
Synchronized with git revision 54fbe4144faf309c37205a5d39fa665daa919f10

Full URL: https://github.com/mbedmicro/mbed/commit/54fbe4144faf309c37205a5d39fa665daa919f10/

NUCLEO_F031K6 : Add new target

Who changed what in which revision?

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