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