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