The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_NUCLEO_F030R8/TARGET_STM/TARGET_STM32F0/device/stm32f0xx_ll_comp.h@143:86740a56073b, 2017-05-26 (annotated)
- Committer:
- AnnaBridge
- Date:
- Fri May 26 12:30:20 2017 +0100
- Revision:
- 143:86740a56073b
- Parent:
- 134:ad3be0349dc5
- Child:
- 160:5571c4ff569f
Release 143 of the mbed library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 134:ad3be0349dc5 | 1 | /** |
<> | 134:ad3be0349dc5 | 2 | ****************************************************************************** |
<> | 134:ad3be0349dc5 | 3 | * @file stm32f0xx_ll_comp.h |
<> | 134:ad3be0349dc5 | 4 | * @author MCD Application Team |
<> | 134:ad3be0349dc5 | 5 | * @version V1.4.0 |
<> | 134:ad3be0349dc5 | 6 | * @date 27-May-2016 |
<> | 134:ad3be0349dc5 | 7 | * @brief Header file of COMP LL module. |
<> | 134:ad3be0349dc5 | 8 | ****************************************************************************** |
<> | 134:ad3be0349dc5 | 9 | * @attention |
<> | 134:ad3be0349dc5 | 10 | * |
<> | 134:ad3be0349dc5 | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
<> | 134:ad3be0349dc5 | 12 | * |
<> | 134:ad3be0349dc5 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
<> | 134:ad3be0349dc5 | 14 | * are permitted provided that the following conditions are met: |
<> | 134:ad3be0349dc5 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
<> | 134:ad3be0349dc5 | 16 | * this list of conditions and the following disclaimer. |
<> | 134:ad3be0349dc5 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
<> | 134:ad3be0349dc5 | 18 | * this list of conditions and the following disclaimer in the documentation |
<> | 134:ad3be0349dc5 | 19 | * and/or other materials provided with the distribution. |
<> | 134:ad3be0349dc5 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
<> | 134:ad3be0349dc5 | 21 | * may be used to endorse or promote products derived from this software |
<> | 134:ad3be0349dc5 | 22 | * without specific prior written permission. |
<> | 134:ad3be0349dc5 | 23 | * |
<> | 134:ad3be0349dc5 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
<> | 134:ad3be0349dc5 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
<> | 134:ad3be0349dc5 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 134:ad3be0349dc5 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
<> | 134:ad3be0349dc5 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
<> | 134:ad3be0349dc5 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
<> | 134:ad3be0349dc5 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
<> | 134:ad3be0349dc5 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
<> | 134:ad3be0349dc5 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
<> | 134:ad3be0349dc5 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 134:ad3be0349dc5 | 34 | * |
<> | 134:ad3be0349dc5 | 35 | ****************************************************************************** |
<> | 134:ad3be0349dc5 | 36 | */ |
<> | 134:ad3be0349dc5 | 37 | |
<> | 134:ad3be0349dc5 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
<> | 134:ad3be0349dc5 | 39 | #ifndef __STM32F0xx_LL_COMP_H |
<> | 134:ad3be0349dc5 | 40 | #define __STM32F0xx_LL_COMP_H |
<> | 134:ad3be0349dc5 | 41 | |
<> | 134:ad3be0349dc5 | 42 | #ifdef __cplusplus |
<> | 134:ad3be0349dc5 | 43 | extern "C" { |
<> | 134:ad3be0349dc5 | 44 | #endif |
<> | 134:ad3be0349dc5 | 45 | |
<> | 134:ad3be0349dc5 | 46 | /* Includes ------------------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 47 | #include "stm32f0xx.h" |
<> | 134:ad3be0349dc5 | 48 | |
<> | 134:ad3be0349dc5 | 49 | /** @addtogroup STM32F0xx_LL_Driver |
<> | 134:ad3be0349dc5 | 50 | * @{ |
<> | 134:ad3be0349dc5 | 51 | */ |
<> | 134:ad3be0349dc5 | 52 | |
<> | 134:ad3be0349dc5 | 53 | #if defined (COMP1) || defined (COMP2) |
<> | 134:ad3be0349dc5 | 54 | |
<> | 134:ad3be0349dc5 | 55 | /** @defgroup COMP_LL COMP |
<> | 134:ad3be0349dc5 | 56 | * @{ |
<> | 134:ad3be0349dc5 | 57 | */ |
<> | 134:ad3be0349dc5 | 58 | |
<> | 134:ad3be0349dc5 | 59 | /* Private types -------------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 60 | /* Private variables ---------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 61 | /* Private constants ---------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 62 | /** @defgroup COMP_LL_Private_Constants COMP Private Constants |
<> | 134:ad3be0349dc5 | 63 | * @{ |
<> | 134:ad3be0349dc5 | 64 | */ |
<> | 134:ad3be0349dc5 | 65 | |
<> | 134:ad3be0349dc5 | 66 | /* Differentiation between COMP instances */ |
<> | 134:ad3be0349dc5 | 67 | /* Note: Value not corresponding to a register offset since both */ |
<> | 134:ad3be0349dc5 | 68 | /* COMP instances are sharing the same register) . */ |
<> | 134:ad3be0349dc5 | 69 | #define COMPX_BASE COMP_BASE |
<> | 134:ad3be0349dc5 | 70 | #define COMPX (COMP1 - COMP2) |
<> | 134:ad3be0349dc5 | 71 | |
<> | 134:ad3be0349dc5 | 72 | /* COMP registers bits positions */ |
<> | 134:ad3be0349dc5 | 73 | #define LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS ((uint32_t)14U) /* Value equivalent to POSITION_VAL(COMP_CSR_COMP1OUT) */ |
<> | 134:ad3be0349dc5 | 74 | |
<> | 134:ad3be0349dc5 | 75 | /** |
<> | 134:ad3be0349dc5 | 76 | * @} |
<> | 134:ad3be0349dc5 | 77 | */ |
<> | 134:ad3be0349dc5 | 78 | |
<> | 134:ad3be0349dc5 | 79 | /* Private macros ------------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 80 | /** @defgroup COMP_LL_Private_Macros COMP Private Macros |
<> | 134:ad3be0349dc5 | 81 | * @{ |
<> | 134:ad3be0349dc5 | 82 | */ |
<> | 134:ad3be0349dc5 | 83 | |
<> | 134:ad3be0349dc5 | 84 | /** |
<> | 134:ad3be0349dc5 | 85 | * @brief Driver macro reserved for internal use: if COMP instance selected |
<> | 134:ad3be0349dc5 | 86 | * is odd (COMP1, COMP3, ...), return value '1', else return '0'. |
<> | 134:ad3be0349dc5 | 87 | * @param __COMP_INSTANCE__ COMP instance |
<> | 134:ad3be0349dc5 | 88 | * @retval If COMP instance is odd, value '1'. Else, value '0'. |
<> | 134:ad3be0349dc5 | 89 | */ |
<> | 134:ad3be0349dc5 | 90 | #define __COMP_IS_INSTANCE_ODD(__COMP_INSTANCE__) \ |
<> | 134:ad3be0349dc5 | 91 | ((~(((uint32_t)(__COMP_INSTANCE__) - COMP_BASE) >> 1U)) & 0x00000001) |
<> | 134:ad3be0349dc5 | 92 | |
<> | 134:ad3be0349dc5 | 93 | /** |
<> | 134:ad3be0349dc5 | 94 | * @brief Driver macro reserved for internal use: if COMP instance selected |
<> | 134:ad3be0349dc5 | 95 | * is even (COMP2, COMP4, ...), return value '1', else return '0'. |
<> | 134:ad3be0349dc5 | 96 | * @param __COMP_INSTANCE__ COMP instance |
<> | 134:ad3be0349dc5 | 97 | * @retval If COMP instance is even, value '1'. Else, value '0'. |
<> | 134:ad3be0349dc5 | 98 | */ |
<> | 134:ad3be0349dc5 | 99 | #define __COMP_IS_INSTANCE_EVEN(__COMP_INSTANCE__) \ |
<> | 134:ad3be0349dc5 | 100 | (((uint32_t)(__COMP_INSTANCE__) - COMP_BASE) >> 1U) |
<> | 134:ad3be0349dc5 | 101 | |
<> | 134:ad3be0349dc5 | 102 | /** |
<> | 134:ad3be0349dc5 | 103 | * @brief Driver macro reserved for internal use: from COMP instance |
<> | 134:ad3be0349dc5 | 104 | * selected, set offset of bits into COMP register. |
<> | 134:ad3be0349dc5 | 105 | * @note Since both COMP instances are sharing the same register |
<> | 134:ad3be0349dc5 | 106 | * with 2 area of bits with an offset of 16 bits, this function |
<> | 134:ad3be0349dc5 | 107 | * returns value "0" if COMP1 is selected and "16" if COMP2 is |
<> | 134:ad3be0349dc5 | 108 | * selected. |
<> | 134:ad3be0349dc5 | 109 | * @param __COMP_INSTANCE__ COMP instance |
<> | 134:ad3be0349dc5 | 110 | * @retval Bits offset in register 32 bits |
<> | 134:ad3be0349dc5 | 111 | */ |
<> | 134:ad3be0349dc5 | 112 | #define __COMP_BITOFFSET_INSTANCE(__COMP_INSTANCE__) \ |
<> | 134:ad3be0349dc5 | 113 | (((uint32_t)(__COMP_INSTANCE__) - COMP_BASE) << 3U) |
<> | 134:ad3be0349dc5 | 114 | |
<> | 134:ad3be0349dc5 | 115 | /** |
<> | 134:ad3be0349dc5 | 116 | * @} |
<> | 134:ad3be0349dc5 | 117 | */ |
<> | 134:ad3be0349dc5 | 118 | |
<> | 134:ad3be0349dc5 | 119 | /* Exported types ------------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 120 | #if defined(USE_FULL_LL_DRIVER) |
<> | 134:ad3be0349dc5 | 121 | /** @defgroup COMP_LL_ES_INIT COMP Exported Init structure |
<> | 134:ad3be0349dc5 | 122 | * @{ |
<> | 134:ad3be0349dc5 | 123 | */ |
<> | 134:ad3be0349dc5 | 124 | |
<> | 134:ad3be0349dc5 | 125 | /** |
<> | 134:ad3be0349dc5 | 126 | * @brief Structure definition of some features of COMP instance. |
<> | 134:ad3be0349dc5 | 127 | */ |
<> | 134:ad3be0349dc5 | 128 | typedef struct |
<> | 134:ad3be0349dc5 | 129 | { |
<> | 134:ad3be0349dc5 | 130 | uint32_t PowerMode; /*!< Set comparator operating mode to adjust power and speed. |
<> | 134:ad3be0349dc5 | 131 | This parameter can be a value of @ref COMP_LL_EC_POWERMODE |
<> | 134:ad3be0349dc5 | 132 | |
<> | 134:ad3be0349dc5 | 133 | This feature can be modified afterwards using unitary function @ref LL_COMP_SetPowerMode(). */ |
<> | 134:ad3be0349dc5 | 134 | |
<> | 134:ad3be0349dc5 | 135 | uint32_t InputPlus; /*!< Set comparator input plus (non-inverting input). |
<> | 134:ad3be0349dc5 | 136 | This parameter can be a value of @ref COMP_LL_EC_INPUT_PLUS |
<> | 134:ad3be0349dc5 | 137 | |
<> | 134:ad3be0349dc5 | 138 | This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputPlus(). */ |
<> | 134:ad3be0349dc5 | 139 | |
<> | 134:ad3be0349dc5 | 140 | uint32_t InputMinus; /*!< Set comparator input minus (inverting input). |
<> | 134:ad3be0349dc5 | 141 | This parameter can be a value of @ref COMP_LL_EC_INPUT_MINUS |
<> | 134:ad3be0349dc5 | 142 | |
<> | 134:ad3be0349dc5 | 143 | This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputMinus(). */ |
<> | 134:ad3be0349dc5 | 144 | |
<> | 134:ad3be0349dc5 | 145 | uint32_t InputHysteresis; /*!< Set comparator hysteresis mode of the input minus. |
<> | 134:ad3be0349dc5 | 146 | This parameter can be a value of @ref COMP_LL_EC_INPUT_HYSTERESIS |
<> | 134:ad3be0349dc5 | 147 | |
<> | 134:ad3be0349dc5 | 148 | This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputHysteresis(). */ |
<> | 134:ad3be0349dc5 | 149 | |
<> | 134:ad3be0349dc5 | 150 | uint32_t OutputSelection; /*!< Set comparator output selection. |
<> | 134:ad3be0349dc5 | 151 | This parameter can be a value of @ref COMP_LL_EC_OUTPUT_SELECTION |
<> | 134:ad3be0349dc5 | 152 | |
<> | 134:ad3be0349dc5 | 153 | This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputSelection(). */ |
<> | 134:ad3be0349dc5 | 154 | |
<> | 134:ad3be0349dc5 | 155 | uint32_t OutputPolarity; /*!< Set comparator output polarity. |
<> | 134:ad3be0349dc5 | 156 | This parameter can be a value of @ref COMP_LL_EC_OUTPUT_POLARITY |
<> | 134:ad3be0349dc5 | 157 | |
<> | 134:ad3be0349dc5 | 158 | This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputPolarity(). */ |
<> | 134:ad3be0349dc5 | 159 | |
<> | 134:ad3be0349dc5 | 160 | } LL_COMP_InitTypeDef; |
<> | 134:ad3be0349dc5 | 161 | |
<> | 134:ad3be0349dc5 | 162 | /** |
<> | 134:ad3be0349dc5 | 163 | * @} |
<> | 134:ad3be0349dc5 | 164 | */ |
<> | 134:ad3be0349dc5 | 165 | #endif /* USE_FULL_LL_DRIVER */ |
<> | 134:ad3be0349dc5 | 166 | |
<> | 134:ad3be0349dc5 | 167 | /* Exported constants --------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 168 | /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants |
<> | 134:ad3be0349dc5 | 169 | * @{ |
<> | 134:ad3be0349dc5 | 170 | */ |
<> | 134:ad3be0349dc5 | 171 | |
<> | 134:ad3be0349dc5 | 172 | /** @defgroup COMP_LL_EC_COMMON_WINDOWMODE Comparator common modes - Window mode |
<> | 134:ad3be0349dc5 | 173 | * @{ |
<> | 134:ad3be0349dc5 | 174 | */ |
<> | 134:ad3be0349dc5 | 175 | #define LL_COMP_WINDOWMODE_DISABLE ((uint32_t)0x00000000U) /*!< Window mode disable: Comparators 1 and 2 are independent */ |
<> | 134:ad3be0349dc5 | 176 | #define LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CSR_WNDWEN) /*!< Window mode enable: Comparators instances pair COMP1 and COMP2 have their input plus connected together. The common input is COMP1 input plus (COMP2 input plus is no more accessible). */ |
<> | 134:ad3be0349dc5 | 177 | /** |
<> | 134:ad3be0349dc5 | 178 | * @} |
<> | 134:ad3be0349dc5 | 179 | */ |
<> | 134:ad3be0349dc5 | 180 | |
<> | 134:ad3be0349dc5 | 181 | /** @defgroup COMP_LL_EC_POWERMODE Comparator modes - Power mode |
<> | 134:ad3be0349dc5 | 182 | * @{ |
<> | 134:ad3be0349dc5 | 183 | */ |
<> | 134:ad3be0349dc5 | 184 | #define LL_COMP_POWERMODE_HIGHSPEED ((uint32_t)0x00000000U) /*!< COMP power mode to high speed */ |
<> | 134:ad3be0349dc5 | 185 | #define LL_COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_COMP1MODE_0) /*!< COMP power mode to medium speed */ |
<> | 134:ad3be0349dc5 | 186 | #define LL_COMP_POWERMODE_LOWPOWER (COMP_CSR_COMP1MODE_1) /*!< COMP power mode to low power */ |
<> | 134:ad3be0349dc5 | 187 | #define LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_COMP1MODE_1 | COMP_CSR_COMP1MODE_0) /*!< COMP power mode to ultra-low power */ |
<> | 134:ad3be0349dc5 | 188 | /** |
<> | 134:ad3be0349dc5 | 189 | * @} |
<> | 134:ad3be0349dc5 | 190 | */ |
<> | 134:ad3be0349dc5 | 191 | |
<> | 134:ad3be0349dc5 | 192 | /** @defgroup COMP_LL_EC_INPUT_PLUS Comparator inputs - Input plus (input non-inverting) selection |
<> | 134:ad3be0349dc5 | 193 | * @{ |
<> | 134:ad3be0349dc5 | 194 | */ |
<> | 134:ad3be0349dc5 | 195 | #define LL_COMP_INPUT_PLUS_IO1 ((uint32_t)0x00000000U) /*!< Comparator input plus connected to IO1 (pin PA1 for COMP1, pin PA3 for COMP2) */ |
<> | 134:ad3be0349dc5 | 196 | #define LL_COMP_INPUT_PLUS_DAC1_CH1 (COMP_CSR_COMP1SW1) /*!< Comparator input plus connected to DAC1 channel 1 (DAC_OUT1), through dedicated switch (Note: this switch is solely intended to redirect signals onto high impedance input, such as COMP1 input plus (highly resistive switch)) (specific to COMP instance: COMP1) */ |
<> | 134:ad3be0349dc5 | 197 | /** |
<> | 134:ad3be0349dc5 | 198 | * @} |
<> | 134:ad3be0349dc5 | 199 | */ |
<> | 134:ad3be0349dc5 | 200 | |
<> | 134:ad3be0349dc5 | 201 | /** @defgroup COMP_LL_EC_INPUT_MINUS Comparator inputs - Input minus (input inverting) selection |
<> | 134:ad3be0349dc5 | 202 | * @{ |
<> | 134:ad3be0349dc5 | 203 | */ |
<> | 134:ad3be0349dc5 | 204 | #define LL_COMP_INPUT_MINUS_1_4VREFINT ((uint32_t)0x00000000U) /*!< Comparator input minus connected to 1/4 VrefInt */ |
<> | 134:ad3be0349dc5 | 205 | #define LL_COMP_INPUT_MINUS_1_2VREFINT ( COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to 1/2 VrefInt */ |
<> | 134:ad3be0349dc5 | 206 | #define LL_COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_COMP1INSEL_1 ) /*!< Comparator input minus connected to 3/4 VrefInt */ |
<> | 134:ad3be0349dc5 | 207 | #define LL_COMP_INPUT_MINUS_VREFINT ( COMP_CSR_COMP1INSEL_1 | COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to VrefInt */ |
<> | 134:ad3be0349dc5 | 208 | #define LL_COMP_INPUT_MINUS_DAC1_CH1 (COMP_CSR_COMP1INSEL_2 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) */ |
<> | 134:ad3be0349dc5 | 209 | #define LL_COMP_INPUT_MINUS_DAC1_CH2 (COMP_CSR_COMP1INSEL_2 | COMP_CSR_COMP1INSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) */ |
<> | 134:ad3be0349dc5 | 210 | #define LL_COMP_INPUT_MINUS_IO1 (COMP_CSR_COMP1INSEL_2 | COMP_CSR_COMP1INSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PA0 for COMP1, pin PA2 for COMP2) */ |
<> | 134:ad3be0349dc5 | 211 | /** |
<> | 134:ad3be0349dc5 | 212 | * @} |
<> | 134:ad3be0349dc5 | 213 | */ |
<> | 134:ad3be0349dc5 | 214 | |
<> | 134:ad3be0349dc5 | 215 | /** @defgroup COMP_LL_EC_INPUT_HYSTERESIS Comparator input - Hysteresis |
<> | 134:ad3be0349dc5 | 216 | * @{ |
<> | 134:ad3be0349dc5 | 217 | */ |
<> | 134:ad3be0349dc5 | 218 | #define LL_COMP_HYSTERESIS_NONE ((uint32_t)0x00000000U) /*!< No hysteresis */ |
<> | 134:ad3be0349dc5 | 219 | #define LL_COMP_HYSTERESIS_LOW ( COMP_CSR_COMP1HYST_0) /*!< Hysteresis level low */ |
<> | 134:ad3be0349dc5 | 220 | #define LL_COMP_HYSTERESIS_MEDIUM (COMP_CSR_COMP1HYST_1 ) /*!< Hysteresis level medium */ |
<> | 134:ad3be0349dc5 | 221 | #define LL_COMP_HYSTERESIS_HIGH (COMP_CSR_COMP1HYST_1 | COMP_CSR_COMP1HYST_0) /*!< Hysteresis level high */ |
<> | 134:ad3be0349dc5 | 222 | /** |
<> | 134:ad3be0349dc5 | 223 | * @} |
<> | 134:ad3be0349dc5 | 224 | */ |
<> | 134:ad3be0349dc5 | 225 | |
<> | 134:ad3be0349dc5 | 226 | /** @defgroup COMP_LL_EC_OUTPUT_SELECTION Comparator output - Output selection |
<> | 134:ad3be0349dc5 | 227 | * @{ |
<> | 134:ad3be0349dc5 | 228 | */ |
<> | 134:ad3be0349dc5 | 229 | /* Note: Output redirection is common for COMP1 and COMP2 */ |
<> | 134:ad3be0349dc5 | 230 | #define LL_COMP_OUTPUT_NONE ((uint32_t)0x00000000U) /*!< COMP output is not connected to other peripherals (except GPIO and EXTI that are always connected to COMP output) */ |
<> | 134:ad3be0349dc5 | 231 | #define LL_COMP_OUTPUT_TIM1_BKIN (COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM1 break input (BKIN) */ |
<> | 134:ad3be0349dc5 | 232 | #define LL_COMP_OUTPUT_TIM1_IC1 (COMP_CSR_COMP1OUTSEL_1) /*!< COMP output connected to TIM1 input capture 1 */ |
<> | 134:ad3be0349dc5 | 233 | #define LL_COMP_OUTPUT_TIM1_OCCLR (COMP_CSR_COMP1OUTSEL_1 | COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM1 OCREF clear */ |
<> | 134:ad3be0349dc5 | 234 | #define LL_COMP_OUTPUT_TIM2_IC4 (COMP_CSR_COMP1OUTSEL_2) /*!< COMP output connected to TIM2 input capture 4 */ |
<> | 134:ad3be0349dc5 | 235 | #define LL_COMP_OUTPUT_TIM2_OCCLR (COMP_CSR_COMP1OUTSEL_2 | COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM2 OCREF clear */ |
<> | 134:ad3be0349dc5 | 236 | #define LL_COMP_OUTPUT_TIM3_IC1 (COMP_CSR_COMP1OUTSEL_2 | COMP_CSR_COMP1OUTSEL_1) /*!< COMP output connected to TIM3 input capture 1 */ |
<> | 134:ad3be0349dc5 | 237 | #define LL_COMP_OUTPUT_TIM3_OCCLR (COMP_CSR_COMP1OUTSEL_2 | COMP_CSR_COMP1OUTSEL_1 | COMP_CSR_COMP1OUTSEL_0) /*!< COMP output connected to TIM3 OCREF clear */ |
<> | 134:ad3be0349dc5 | 238 | /** |
<> | 134:ad3be0349dc5 | 239 | * @} |
<> | 134:ad3be0349dc5 | 240 | */ |
<> | 134:ad3be0349dc5 | 241 | |
<> | 134:ad3be0349dc5 | 242 | /** @defgroup COMP_LL_EC_OUTPUT_POLARITY Comparator output - Output polarity |
<> | 134:ad3be0349dc5 | 243 | * @{ |
<> | 134:ad3be0349dc5 | 244 | */ |
<> | 134:ad3be0349dc5 | 245 | #define LL_COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000U) /*!< COMP output polarity is not inverted: comparator output is high when the plus (non-inverting) input is at a higher voltage than the minus (inverting) input */ |
<> | 134:ad3be0349dc5 | 246 | #define LL_COMP_OUTPUTPOL_INVERTED (COMP_CSR_COMP1POL) /*!< COMP output polarity is inverted: comparator output is low when the plus (non-inverting) input is at a lower voltage than the minus (inverting) input */ |
<> | 134:ad3be0349dc5 | 247 | /** |
<> | 134:ad3be0349dc5 | 248 | * @} |
<> | 134:ad3be0349dc5 | 249 | */ |
<> | 134:ad3be0349dc5 | 250 | |
<> | 134:ad3be0349dc5 | 251 | /** @defgroup COMP_LL_EC_OUTPUT_LEVEL Comparator output - Output level |
<> | 134:ad3be0349dc5 | 252 | * @{ |
<> | 134:ad3be0349dc5 | 253 | */ |
<> | 134:ad3be0349dc5 | 254 | #define LL_COMP_OUTPUT_LEVEL_LOW ((uint32_t)0x00000000U) /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */ |
<> | 134:ad3be0349dc5 | 255 | #define LL_COMP_OUTPUT_LEVEL_HIGH ((uint32_t)0x00000001U) /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */ |
<> | 134:ad3be0349dc5 | 256 | /** |
<> | 134:ad3be0349dc5 | 257 | * @} |
<> | 134:ad3be0349dc5 | 258 | */ |
<> | 134:ad3be0349dc5 | 259 | |
<> | 134:ad3be0349dc5 | 260 | /** @defgroup COMP_LL_EC_HW_DELAYS Definitions of COMP hardware constraints delays |
<> | 134:ad3be0349dc5 | 261 | * @note Only COMP IP HW delays are defined in COMP LL driver driver, |
<> | 134:ad3be0349dc5 | 262 | * not timeout values. |
<> | 134:ad3be0349dc5 | 263 | * For details on delays values, refer to descriptions in source code |
<> | 134:ad3be0349dc5 | 264 | * above each literal definition. |
<> | 134:ad3be0349dc5 | 265 | * @{ |
<> | 134:ad3be0349dc5 | 266 | */ |
<> | 134:ad3be0349dc5 | 267 | |
<> | 134:ad3be0349dc5 | 268 | /* Delay for comparator startup time. */ |
<> | 134:ad3be0349dc5 | 269 | /* Note: Delay required to reach propagation delay specification. */ |
<> | 134:ad3be0349dc5 | 270 | /* Literal set to maximum value (refer to device datasheet, */ |
<> | 134:ad3be0349dc5 | 271 | /* parameter "tSTART"). */ |
<> | 134:ad3be0349dc5 | 272 | /* Unit: us */ |
<> | 134:ad3be0349dc5 | 273 | #define LL_COMP_DELAY_STARTUP_US ((uint32_t) 60U) /*!< Delay for COMP startup time */ |
<> | 134:ad3be0349dc5 | 274 | |
<> | 134:ad3be0349dc5 | 275 | /* Delay for comparator voltage scaler stabilization time */ |
<> | 134:ad3be0349dc5 | 276 | /* (voltage from VrefInt, delay based on VrefInt startup time). */ |
<> | 134:ad3be0349dc5 | 277 | /* Literal set to maximum value (refer to device datasheet, */ |
<> | 134:ad3be0349dc5 | 278 | /* parameter "tS_SC"). */ |
<> | 134:ad3be0349dc5 | 279 | /* Unit: us */ |
<> | 134:ad3be0349dc5 | 280 | #define LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US ((uint32_t) 200U) /*!< Delay for COMP voltage scaler stabilization time */ |
<> | 134:ad3be0349dc5 | 281 | |
<> | 134:ad3be0349dc5 | 282 | |
<> | 134:ad3be0349dc5 | 283 | /** |
<> | 134:ad3be0349dc5 | 284 | * @} |
<> | 134:ad3be0349dc5 | 285 | */ |
<> | 134:ad3be0349dc5 | 286 | |
<> | 134:ad3be0349dc5 | 287 | /** |
<> | 134:ad3be0349dc5 | 288 | * @} |
<> | 134:ad3be0349dc5 | 289 | */ |
<> | 134:ad3be0349dc5 | 290 | |
<> | 134:ad3be0349dc5 | 291 | /* Exported macro ------------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 292 | /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros |
<> | 134:ad3be0349dc5 | 293 | * @{ |
<> | 134:ad3be0349dc5 | 294 | */ |
<> | 134:ad3be0349dc5 | 295 | /** @defgroup COMP_LL_EM_WRITE_READ Common write and read registers macro |
<> | 134:ad3be0349dc5 | 296 | * @{ |
<> | 134:ad3be0349dc5 | 297 | */ |
<> | 134:ad3be0349dc5 | 298 | |
<> | 134:ad3be0349dc5 | 299 | /** |
<> | 134:ad3be0349dc5 | 300 | * @brief Write a value in COMP register |
<> | 134:ad3be0349dc5 | 301 | * @param __INSTANCE__ comparator instance |
<> | 134:ad3be0349dc5 | 302 | * @param __REG__ Register to be written |
<> | 134:ad3be0349dc5 | 303 | * @param __VALUE__ Value to be written in the register |
<> | 134:ad3be0349dc5 | 304 | * @retval None |
<> | 134:ad3be0349dc5 | 305 | */ |
<> | 134:ad3be0349dc5 | 306 | #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
<> | 134:ad3be0349dc5 | 307 | |
<> | 134:ad3be0349dc5 | 308 | /** |
<> | 134:ad3be0349dc5 | 309 | * @brief Read a value in COMP register |
<> | 134:ad3be0349dc5 | 310 | * @param __INSTANCE__ comparator instance |
<> | 134:ad3be0349dc5 | 311 | * @param __REG__ Register to be read |
<> | 134:ad3be0349dc5 | 312 | * @retval Register value |
<> | 134:ad3be0349dc5 | 313 | */ |
<> | 134:ad3be0349dc5 | 314 | #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
<> | 134:ad3be0349dc5 | 315 | /** |
<> | 134:ad3be0349dc5 | 316 | * @} |
<> | 134:ad3be0349dc5 | 317 | */ |
<> | 134:ad3be0349dc5 | 318 | |
<> | 134:ad3be0349dc5 | 319 | /** @defgroup COMP_LL_EM_HELPER_MACRO COMP helper macro |
<> | 134:ad3be0349dc5 | 320 | * @{ |
<> | 134:ad3be0349dc5 | 321 | */ |
<> | 134:ad3be0349dc5 | 322 | |
<> | 134:ad3be0349dc5 | 323 | /** |
<> | 134:ad3be0349dc5 | 324 | * @brief Helper macro to select the COMP common instance |
<> | 134:ad3be0349dc5 | 325 | * to which is belonging the selected COMP instance. |
<> | 134:ad3be0349dc5 | 326 | * @note COMP common register instance can be used to |
<> | 134:ad3be0349dc5 | 327 | * set parameters common to several COMP instances. |
<> | 134:ad3be0349dc5 | 328 | * Refer to functions having argument "COMPxy_COMMON" as parameter. |
<> | 134:ad3be0349dc5 | 329 | * @param __COMPx__ COMP instance |
<> | 134:ad3be0349dc5 | 330 | * @retval COMP common instance or value "0" if there is no COMP common instance. |
<> | 134:ad3be0349dc5 | 331 | */ |
<> | 134:ad3be0349dc5 | 332 | #define __LL_COMP_COMMON_INSTANCE(__COMPx__) \ |
<> | 134:ad3be0349dc5 | 333 | (COMP12_COMMON) |
<> | 134:ad3be0349dc5 | 334 | |
<> | 134:ad3be0349dc5 | 335 | /** |
<> | 134:ad3be0349dc5 | 336 | * @} |
<> | 134:ad3be0349dc5 | 337 | */ |
<> | 134:ad3be0349dc5 | 338 | |
<> | 134:ad3be0349dc5 | 339 | /** |
<> | 134:ad3be0349dc5 | 340 | * @} |
<> | 134:ad3be0349dc5 | 341 | */ |
<> | 134:ad3be0349dc5 | 342 | |
<> | 134:ad3be0349dc5 | 343 | /* Exported functions --------------------------------------------------------*/ |
<> | 134:ad3be0349dc5 | 344 | /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions |
<> | 134:ad3be0349dc5 | 345 | * @{ |
<> | 134:ad3be0349dc5 | 346 | */ |
<> | 134:ad3be0349dc5 | 347 | |
<> | 134:ad3be0349dc5 | 348 | /** @defgroup COMP_LL_EF_Configuration_comparator_common Configuration of COMP hierarchical scope: common to several COMP instances |
<> | 134:ad3be0349dc5 | 349 | * @{ |
<> | 134:ad3be0349dc5 | 350 | */ |
<> | 134:ad3be0349dc5 | 351 | |
<> | 134:ad3be0349dc5 | 352 | /** |
<> | 134:ad3be0349dc5 | 353 | * @brief Set window mode of a pair of comparators instances |
<> | 134:ad3be0349dc5 | 354 | * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>). |
<> | 134:ad3be0349dc5 | 355 | * @rmtoll CSR WNDWEN LL_COMP_SetCommonWindowMode |
<> | 134:ad3be0349dc5 | 356 | * @param COMPxy_COMMON Comparator common instance |
<> | 134:ad3be0349dc5 | 357 | * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() ) |
<> | 134:ad3be0349dc5 | 358 | * @param WindowMode This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 359 | * @arg @ref LL_COMP_WINDOWMODE_DISABLE |
<> | 134:ad3be0349dc5 | 360 | * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON |
<> | 134:ad3be0349dc5 | 361 | * @retval None |
<> | 134:ad3be0349dc5 | 362 | */ |
<> | 134:ad3be0349dc5 | 363 | __STATIC_INLINE void LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON, uint32_t WindowMode) |
<> | 134:ad3be0349dc5 | 364 | { |
<> | 134:ad3be0349dc5 | 365 | MODIFY_REG(COMPxy_COMMON->CSR, COMP_CSR_WNDWEN, WindowMode); |
<> | 134:ad3be0349dc5 | 366 | } |
<> | 134:ad3be0349dc5 | 367 | |
<> | 134:ad3be0349dc5 | 368 | /** |
<> | 134:ad3be0349dc5 | 369 | * @brief Get window mode of a pair of comparators instances |
<> | 134:ad3be0349dc5 | 370 | * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>). |
<> | 134:ad3be0349dc5 | 371 | * @rmtoll CSR WNDWEN LL_COMP_GetCommonWindowMode |
<> | 134:ad3be0349dc5 | 372 | * @param COMPxy_COMMON Comparator common instance |
<> | 134:ad3be0349dc5 | 373 | * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() ) |
<> | 134:ad3be0349dc5 | 374 | * @retval Returned value can be one of the following values: |
<> | 134:ad3be0349dc5 | 375 | * @arg @ref LL_COMP_WINDOWMODE_DISABLE |
<> | 134:ad3be0349dc5 | 376 | * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON |
<> | 134:ad3be0349dc5 | 377 | */ |
<> | 134:ad3be0349dc5 | 378 | __STATIC_INLINE uint32_t LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON) |
<> | 134:ad3be0349dc5 | 379 | { |
<> | 134:ad3be0349dc5 | 380 | return (uint32_t)(READ_BIT(COMPxy_COMMON->CSR, COMP_CSR_WNDWEN)); |
<> | 134:ad3be0349dc5 | 381 | } |
<> | 134:ad3be0349dc5 | 382 | |
<> | 134:ad3be0349dc5 | 383 | /** |
<> | 134:ad3be0349dc5 | 384 | * @} |
<> | 134:ad3be0349dc5 | 385 | */ |
<> | 134:ad3be0349dc5 | 386 | |
<> | 134:ad3be0349dc5 | 387 | /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes |
<> | 134:ad3be0349dc5 | 388 | * @{ |
<> | 134:ad3be0349dc5 | 389 | */ |
<> | 134:ad3be0349dc5 | 390 | |
<> | 134:ad3be0349dc5 | 391 | /** |
<> | 134:ad3be0349dc5 | 392 | * @brief Set comparator instance operating mode to adjust power and speed. |
<> | 134:ad3be0349dc5 | 393 | * @rmtoll CSR COMP1MODE LL_COMP_SetPowerMode\n |
<> | 134:ad3be0349dc5 | 394 | * COMP2MODE LL_COMP_SetPowerMode |
<> | 134:ad3be0349dc5 | 395 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 396 | * @param PowerMode This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 397 | * @arg @ref LL_COMP_POWERMODE_HIGHSPEED |
<> | 134:ad3be0349dc5 | 398 | * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED |
<> | 134:ad3be0349dc5 | 399 | * @arg @ref LL_COMP_POWERMODE_LOWPOWER |
<> | 134:ad3be0349dc5 | 400 | * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER |
<> | 134:ad3be0349dc5 | 401 | * @retval None |
<> | 134:ad3be0349dc5 | 402 | */ |
<> | 134:ad3be0349dc5 | 403 | __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode) |
<> | 134:ad3be0349dc5 | 404 | { |
<> | 134:ad3be0349dc5 | 405 | MODIFY_REG(COMP->CSR, |
<> | 134:ad3be0349dc5 | 406 | COMP_CSR_COMP1MODE << __COMP_BITOFFSET_INSTANCE(COMPx), |
<> | 134:ad3be0349dc5 | 407 | PowerMode << __COMP_BITOFFSET_INSTANCE(COMPx) ); |
<> | 134:ad3be0349dc5 | 408 | } |
<> | 134:ad3be0349dc5 | 409 | |
<> | 134:ad3be0349dc5 | 410 | /** |
<> | 134:ad3be0349dc5 | 411 | * @brief Get comparator instance operating mode to adjust power and speed. |
<> | 134:ad3be0349dc5 | 412 | * @rmtoll CSR COMP1MODE LL_COMP_GetPowerMode\n |
<> | 134:ad3be0349dc5 | 413 | * COMP2MODE LL_COMP_GetPowerMode |
<> | 134:ad3be0349dc5 | 414 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 415 | * @retval Returned value can be one of the following values: |
<> | 134:ad3be0349dc5 | 416 | * @arg @ref LL_COMP_POWERMODE_HIGHSPEED |
<> | 134:ad3be0349dc5 | 417 | * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED |
<> | 134:ad3be0349dc5 | 418 | * @arg @ref LL_COMP_POWERMODE_LOWPOWER |
<> | 134:ad3be0349dc5 | 419 | * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER |
<> | 134:ad3be0349dc5 | 420 | */ |
<> | 134:ad3be0349dc5 | 421 | __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 422 | { |
<> | 134:ad3be0349dc5 | 423 | return (uint32_t)(READ_BIT(COMP->CSR, |
<> | 134:ad3be0349dc5 | 424 | COMP_CSR_COMP1MODE << __COMP_BITOFFSET_INSTANCE(COMPx)) |
<> | 134:ad3be0349dc5 | 425 | >> __COMP_BITOFFSET_INSTANCE(COMPx) |
<> | 134:ad3be0349dc5 | 426 | ); |
<> | 134:ad3be0349dc5 | 427 | } |
<> | 134:ad3be0349dc5 | 428 | |
<> | 134:ad3be0349dc5 | 429 | /** |
<> | 134:ad3be0349dc5 | 430 | * @} |
<> | 134:ad3be0349dc5 | 431 | */ |
<> | 134:ad3be0349dc5 | 432 | |
<> | 134:ad3be0349dc5 | 433 | /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs |
<> | 134:ad3be0349dc5 | 434 | * @{ |
<> | 134:ad3be0349dc5 | 435 | */ |
<> | 134:ad3be0349dc5 | 436 | |
<> | 134:ad3be0349dc5 | 437 | /** |
<> | 134:ad3be0349dc5 | 438 | * @brief Set comparator inputs minus (inverting) and plus (non-inverting). |
<> | 134:ad3be0349dc5 | 439 | * @note In case of comparator input selected to be connected to IO: |
<> | 134:ad3be0349dc5 | 440 | * GPIO pins are specific to each comparator instance. |
<> | 134:ad3be0349dc5 | 441 | * Refer to description of parameters or to reference manual. |
<> | 134:ad3be0349dc5 | 442 | * @rmtoll CSR COMP1INSEL LL_COMP_ConfigInputs\n |
<> | 134:ad3be0349dc5 | 443 | * CSR COMP2INSEL LL_COMP_ConfigInputs\n |
<> | 134:ad3be0349dc5 | 444 | * CSR COMP1SW1 LL_COMP_ConfigInputs |
<> | 134:ad3be0349dc5 | 445 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 446 | * @param InputMinus This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 447 | * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT |
<> | 134:ad3be0349dc5 | 448 | * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT |
<> | 134:ad3be0349dc5 | 449 | * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT |
<> | 134:ad3be0349dc5 | 450 | * @arg @ref LL_COMP_INPUT_MINUS_VREFINT |
<> | 134:ad3be0349dc5 | 451 | * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1 |
<> | 134:ad3be0349dc5 | 452 | * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 |
<> | 134:ad3be0349dc5 | 453 | * @arg @ref LL_COMP_INPUT_MINUS_IO1 |
<> | 134:ad3be0349dc5 | 454 | * @param InputPlus This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 455 | * @arg @ref LL_COMP_INPUT_PLUS_IO1 |
<> | 134:ad3be0349dc5 | 456 | * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1 (1) |
<> | 134:ad3be0349dc5 | 457 | * |
<> | 134:ad3be0349dc5 | 458 | * (1) Parameter available only on COMP instance: COMP1. |
<> | 134:ad3be0349dc5 | 459 | * @retval None |
<> | 134:ad3be0349dc5 | 460 | */ |
<> | 134:ad3be0349dc5 | 461 | __STATIC_INLINE void LL_COMP_ConfigInputs(COMP_TypeDef *COMPx, uint32_t InputMinus, uint32_t InputPlus) |
<> | 134:ad3be0349dc5 | 462 | { |
<> | 134:ad3be0349dc5 | 463 | /* Note: Connection switch is applicable only to COMP instance COMP1, */ |
<> | 134:ad3be0349dc5 | 464 | /* therefore if COMP2 is selected the equivalent bit is */ |
<> | 134:ad3be0349dc5 | 465 | /* kept unmodified. */ |
<> | 134:ad3be0349dc5 | 466 | MODIFY_REG(COMP->CSR, |
<> | 134:ad3be0349dc5 | 467 | (COMP_CSR_COMP1INSEL | (COMP_CSR_COMP1SW1 * __COMP_IS_INSTANCE_ODD(COMPx))) << __COMP_BITOFFSET_INSTANCE(COMPx), |
<> | 134:ad3be0349dc5 | 468 | (InputMinus | InputPlus) << __COMP_BITOFFSET_INSTANCE(COMPx) ); |
<> | 134:ad3be0349dc5 | 469 | } |
<> | 134:ad3be0349dc5 | 470 | |
<> | 134:ad3be0349dc5 | 471 | /** |
<> | 134:ad3be0349dc5 | 472 | * @brief Set comparator input plus (non-inverting). |
<> | 134:ad3be0349dc5 | 473 | * @note In case of comparator input selected to be connected to IO: |
<> | 134:ad3be0349dc5 | 474 | * GPIO pins are specific to each comparator instance. |
<> | 134:ad3be0349dc5 | 475 | * Refer to description of parameters or to reference manual. |
<> | 134:ad3be0349dc5 | 476 | * @rmtoll CSR COMP1INSEL LL_COMP_SetInputPlus\n |
<> | 134:ad3be0349dc5 | 477 | * CSR COMP2INSEL LL_COMP_SetInputPlus |
<> | 134:ad3be0349dc5 | 478 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 479 | * @param InputPlus This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 480 | * @arg @ref LL_COMP_INPUT_PLUS_IO1 |
<> | 134:ad3be0349dc5 | 481 | * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1 (1) |
<> | 134:ad3be0349dc5 | 482 | * |
<> | 134:ad3be0349dc5 | 483 | * (1) Parameter available only on COMP instance: COMP1. |
<> | 134:ad3be0349dc5 | 484 | * @retval None |
<> | 134:ad3be0349dc5 | 485 | */ |
<> | 134:ad3be0349dc5 | 486 | __STATIC_INLINE void LL_COMP_SetInputPlus(COMP_TypeDef *COMPx, uint32_t InputPlus) |
<> | 134:ad3be0349dc5 | 487 | { |
<> | 134:ad3be0349dc5 | 488 | /* Note: Connection switch is applicable only to COMP instance COMP1, */ |
<> | 134:ad3be0349dc5 | 489 | /* therefore if COMP2 is selected the equivalent bit is */ |
<> | 134:ad3be0349dc5 | 490 | /* kept unmodified. */ |
<> | 134:ad3be0349dc5 | 491 | MODIFY_REG(COMP->CSR, |
<> | 134:ad3be0349dc5 | 492 | (COMP_CSR_COMP1SW1 * __COMP_IS_INSTANCE_ODD(COMPx)) << __COMP_BITOFFSET_INSTANCE(COMPx), |
<> | 134:ad3be0349dc5 | 493 | InputPlus << __COMP_BITOFFSET_INSTANCE(COMPx) ); |
<> | 134:ad3be0349dc5 | 494 | } |
<> | 134:ad3be0349dc5 | 495 | |
<> | 134:ad3be0349dc5 | 496 | /** |
<> | 134:ad3be0349dc5 | 497 | * @brief Get comparator input plus (non-inverting). |
<> | 134:ad3be0349dc5 | 498 | * @note In case of comparator input selected to be connected to IO: |
<> | 134:ad3be0349dc5 | 499 | * GPIO pins are specific to each comparator instance. |
<> | 134:ad3be0349dc5 | 500 | * Refer to description of parameters or to reference manual. |
<> | 134:ad3be0349dc5 | 501 | * @rmtoll CSR COMP1INSEL LL_COMP_GetInputPlus\n |
<> | 134:ad3be0349dc5 | 502 | * CSR COMP2INSEL LL_COMP_GetInputPlus |
<> | 134:ad3be0349dc5 | 503 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 504 | * @retval Returned value can be one of the following values: |
<> | 134:ad3be0349dc5 | 505 | * @arg @ref LL_COMP_INPUT_PLUS_IO1 |
<> | 134:ad3be0349dc5 | 506 | * @arg @ref LL_COMP_INPUT_PLUS_DAC1_CH1 (1) |
<> | 134:ad3be0349dc5 | 507 | * |
<> | 134:ad3be0349dc5 | 508 | * (1) Parameter available only on COMP instance: COMP1. |
<> | 134:ad3be0349dc5 | 509 | */ |
<> | 134:ad3be0349dc5 | 510 | __STATIC_INLINE uint32_t LL_COMP_GetInputPlus(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 511 | { |
<> | 134:ad3be0349dc5 | 512 | /* Note: Connection switch is applicable only to COMP instance COMP1, */ |
<> | 134:ad3be0349dc5 | 513 | /* therefore is COMP2 is selected the returned value will be null. */ |
<> | 134:ad3be0349dc5 | 514 | return (uint32_t)(READ_BIT(COMP->CSR, |
<> | 134:ad3be0349dc5 | 515 | COMP_CSR_COMP1SW1 << __COMP_BITOFFSET_INSTANCE(COMPx)) |
<> | 134:ad3be0349dc5 | 516 | >> __COMP_BITOFFSET_INSTANCE(COMPx) |
<> | 134:ad3be0349dc5 | 517 | ); |
<> | 134:ad3be0349dc5 | 518 | } |
<> | 134:ad3be0349dc5 | 519 | |
<> | 134:ad3be0349dc5 | 520 | /** |
<> | 134:ad3be0349dc5 | 521 | * @brief Set comparator input minus (inverting). |
<> | 134:ad3be0349dc5 | 522 | * @note In case of comparator input selected to be connected to IO: |
<> | 134:ad3be0349dc5 | 523 | * GPIO pins are specific to each comparator instance. |
<> | 134:ad3be0349dc5 | 524 | * Refer to description of parameters or to reference manual. |
<> | 134:ad3be0349dc5 | 525 | * @rmtoll CSR COMP1SW1 LL_COMP_SetInputMinus |
<> | 134:ad3be0349dc5 | 526 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 527 | * @param InputMinus This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 528 | * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT |
<> | 134:ad3be0349dc5 | 529 | * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT |
<> | 134:ad3be0349dc5 | 530 | * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT |
<> | 134:ad3be0349dc5 | 531 | * @arg @ref LL_COMP_INPUT_MINUS_VREFINT |
<> | 134:ad3be0349dc5 | 532 | * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1 |
<> | 134:ad3be0349dc5 | 533 | * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 |
<> | 134:ad3be0349dc5 | 534 | * @arg @ref LL_COMP_INPUT_MINUS_IO1 |
<> | 134:ad3be0349dc5 | 535 | * @retval None |
<> | 134:ad3be0349dc5 | 536 | */ |
<> | 134:ad3be0349dc5 | 537 | __STATIC_INLINE void LL_COMP_SetInputMinus(COMP_TypeDef *COMPx, uint32_t InputMinus) |
<> | 134:ad3be0349dc5 | 538 | { |
<> | 134:ad3be0349dc5 | 539 | MODIFY_REG(COMP->CSR, |
<> | 134:ad3be0349dc5 | 540 | COMP_CSR_COMP1INSEL << __COMP_BITOFFSET_INSTANCE(COMPx), |
<> | 134:ad3be0349dc5 | 541 | InputMinus << __COMP_BITOFFSET_INSTANCE(COMPx) ); |
<> | 134:ad3be0349dc5 | 542 | } |
<> | 134:ad3be0349dc5 | 543 | |
<> | 134:ad3be0349dc5 | 544 | /** |
<> | 134:ad3be0349dc5 | 545 | * @brief Get comparator input minus (inverting). |
<> | 134:ad3be0349dc5 | 546 | * @note In case of comparator input selected to be connected to IO: |
<> | 134:ad3be0349dc5 | 547 | * GPIO pins are specific to each comparator instance. |
<> | 134:ad3be0349dc5 | 548 | * Refer to description of parameters or to reference manual. |
<> | 134:ad3be0349dc5 | 549 | * @rmtoll CSR COMP1SW1 LL_COMP_GetInputMinus |
<> | 134:ad3be0349dc5 | 550 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 551 | * @retval Returned value can be one of the following values: |
<> | 134:ad3be0349dc5 | 552 | * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT |
<> | 134:ad3be0349dc5 | 553 | * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT |
<> | 134:ad3be0349dc5 | 554 | * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT |
<> | 134:ad3be0349dc5 | 555 | * @arg @ref LL_COMP_INPUT_MINUS_VREFINT |
<> | 134:ad3be0349dc5 | 556 | * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1 |
<> | 134:ad3be0349dc5 | 557 | * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 |
<> | 134:ad3be0349dc5 | 558 | * @arg @ref LL_COMP_INPUT_MINUS_IO1 |
<> | 134:ad3be0349dc5 | 559 | */ |
<> | 134:ad3be0349dc5 | 560 | __STATIC_INLINE uint32_t LL_COMP_GetInputMinus(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 561 | { |
<> | 134:ad3be0349dc5 | 562 | return (uint32_t)(READ_BIT(COMP->CSR, |
<> | 134:ad3be0349dc5 | 563 | COMP_CSR_COMP1INSEL << __COMP_BITOFFSET_INSTANCE(COMPx)) |
<> | 134:ad3be0349dc5 | 564 | >> __COMP_BITOFFSET_INSTANCE(COMPx) |
<> | 134:ad3be0349dc5 | 565 | ); |
<> | 134:ad3be0349dc5 | 566 | } |
<> | 134:ad3be0349dc5 | 567 | |
<> | 134:ad3be0349dc5 | 568 | /** |
<> | 134:ad3be0349dc5 | 569 | * @brief Set comparator instance hysteresis mode of the input minus (inverting input). |
<> | 134:ad3be0349dc5 | 570 | * @rmtoll CSR COMP1HYST LL_COMP_SetInputHysteresis\n |
<> | 134:ad3be0349dc5 | 571 | * COMP2HYST LL_COMP_SetInputHysteresis |
<> | 134:ad3be0349dc5 | 572 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 573 | * @param InputHysteresis This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 574 | * @arg @ref LL_COMP_HYSTERESIS_NONE |
<> | 134:ad3be0349dc5 | 575 | * @arg @ref LL_COMP_HYSTERESIS_LOW |
<> | 134:ad3be0349dc5 | 576 | * @arg @ref LL_COMP_HYSTERESIS_MEDIUM |
<> | 134:ad3be0349dc5 | 577 | * @arg @ref LL_COMP_HYSTERESIS_HIGH |
<> | 134:ad3be0349dc5 | 578 | * @retval None |
<> | 134:ad3be0349dc5 | 579 | */ |
<> | 134:ad3be0349dc5 | 580 | __STATIC_INLINE void LL_COMP_SetInputHysteresis(COMP_TypeDef *COMPx, uint32_t InputHysteresis) |
<> | 134:ad3be0349dc5 | 581 | { |
<> | 134:ad3be0349dc5 | 582 | MODIFY_REG(COMP->CSR, |
<> | 134:ad3be0349dc5 | 583 | COMP_CSR_COMP1HYST << __COMP_BITOFFSET_INSTANCE(COMPx), |
<> | 134:ad3be0349dc5 | 584 | InputHysteresis << __COMP_BITOFFSET_INSTANCE(COMPx) ); |
<> | 134:ad3be0349dc5 | 585 | } |
<> | 134:ad3be0349dc5 | 586 | |
<> | 134:ad3be0349dc5 | 587 | /** |
<> | 134:ad3be0349dc5 | 588 | * @brief Get comparator instance hysteresis mode of the minus (inverting) input. |
<> | 134:ad3be0349dc5 | 589 | * @rmtoll CSR COMP1HYST LL_COMP_GetInputHysteresis\n |
<> | 134:ad3be0349dc5 | 590 | * COMP2HYST LL_COMP_GetInputHysteresis |
<> | 134:ad3be0349dc5 | 591 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 592 | * @retval Returned value can be one of the following values: |
<> | 134:ad3be0349dc5 | 593 | * @arg @ref LL_COMP_HYSTERESIS_NONE |
<> | 134:ad3be0349dc5 | 594 | * @arg @ref LL_COMP_HYSTERESIS_LOW |
<> | 134:ad3be0349dc5 | 595 | * @arg @ref LL_COMP_HYSTERESIS_MEDIUM |
<> | 134:ad3be0349dc5 | 596 | * @arg @ref LL_COMP_HYSTERESIS_HIGH |
<> | 134:ad3be0349dc5 | 597 | */ |
<> | 134:ad3be0349dc5 | 598 | __STATIC_INLINE uint32_t LL_COMP_GetInputHysteresis(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 599 | { |
<> | 134:ad3be0349dc5 | 600 | return (uint32_t)(READ_BIT(COMP->CSR, |
<> | 134:ad3be0349dc5 | 601 | COMP_CSR_COMP1HYST << __COMP_BITOFFSET_INSTANCE(COMPx)) |
<> | 134:ad3be0349dc5 | 602 | >> __COMP_BITOFFSET_INSTANCE(COMPx) |
<> | 134:ad3be0349dc5 | 603 | ); |
<> | 134:ad3be0349dc5 | 604 | |
<> | 134:ad3be0349dc5 | 605 | } |
<> | 134:ad3be0349dc5 | 606 | |
<> | 134:ad3be0349dc5 | 607 | /** |
<> | 134:ad3be0349dc5 | 608 | * @} |
<> | 134:ad3be0349dc5 | 609 | */ |
<> | 134:ad3be0349dc5 | 610 | |
<> | 134:ad3be0349dc5 | 611 | /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output |
<> | 134:ad3be0349dc5 | 612 | * @{ |
<> | 134:ad3be0349dc5 | 613 | */ |
<> | 134:ad3be0349dc5 | 614 | |
<> | 134:ad3be0349dc5 | 615 | /** |
<> | 134:ad3be0349dc5 | 616 | * @brief Set comparator output selection. |
<> | 134:ad3be0349dc5 | 617 | * @note Availability of parameters of output selection to timer |
<> | 134:ad3be0349dc5 | 618 | * depends on timers availability on the selected device. |
<> | 134:ad3be0349dc5 | 619 | * @rmtoll CSR COMP1OUTSEL LL_COMP_SetOutputSelection\n |
<> | 134:ad3be0349dc5 | 620 | * COMP2OUTSEL LL_COMP_SetOutputSelection |
<> | 134:ad3be0349dc5 | 621 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 622 | * @param OutputSelection This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 623 | * @arg @ref LL_COMP_OUTPUT_NONE |
<> | 134:ad3be0349dc5 | 624 | * @arg @ref LL_COMP_OUTPUT_TIM1_BKIN (1) |
<> | 134:ad3be0349dc5 | 625 | * @arg @ref LL_COMP_OUTPUT_TIM1_IC1 (1) |
<> | 134:ad3be0349dc5 | 626 | * @arg @ref LL_COMP_OUTPUT_TIM1_OCCLR (1) |
<> | 134:ad3be0349dc5 | 627 | * @arg @ref LL_COMP_OUTPUT_TIM2_IC4 (1) |
<> | 134:ad3be0349dc5 | 628 | * @arg @ref LL_COMP_OUTPUT_TIM2_OCCLR (1) |
<> | 134:ad3be0349dc5 | 629 | * @arg @ref LL_COMP_OUTPUT_TIM3_IC1 (1) |
<> | 134:ad3be0349dc5 | 630 | * @arg @ref LL_COMP_OUTPUT_TIM3_OCCLR (1) |
<> | 134:ad3be0349dc5 | 631 | * |
<> | 134:ad3be0349dc5 | 632 | * (1) Parameter availability depending on timer availability |
<> | 134:ad3be0349dc5 | 633 | * on the selected device. |
<> | 134:ad3be0349dc5 | 634 | * @retval None |
<> | 134:ad3be0349dc5 | 635 | */ |
<> | 134:ad3be0349dc5 | 636 | __STATIC_INLINE void LL_COMP_SetOutputSelection(COMP_TypeDef *COMPx, uint32_t OutputSelection) |
<> | 134:ad3be0349dc5 | 637 | { |
<> | 134:ad3be0349dc5 | 638 | MODIFY_REG(COMP->CSR, |
<> | 134:ad3be0349dc5 | 639 | COMP_CSR_COMP1OUTSEL << __COMP_BITOFFSET_INSTANCE(COMPx), |
<> | 134:ad3be0349dc5 | 640 | OutputSelection << __COMP_BITOFFSET_INSTANCE(COMPx) ); |
<> | 134:ad3be0349dc5 | 641 | } |
<> | 134:ad3be0349dc5 | 642 | |
<> | 134:ad3be0349dc5 | 643 | /** |
<> | 134:ad3be0349dc5 | 644 | * @brief Get comparator output selection. |
<> | 134:ad3be0349dc5 | 645 | * @note Availability of parameters of output selection to timer |
<> | 134:ad3be0349dc5 | 646 | * depends on timers availability on the selected device. |
<> | 134:ad3be0349dc5 | 647 | * @rmtoll CSR COMP1OUTSEL LL_COMP_GetOutputSelection\n |
<> | 134:ad3be0349dc5 | 648 | * COMP2OUTSEL LL_COMP_GetOutputSelection |
<> | 134:ad3be0349dc5 | 649 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 650 | * @retval Returned value can be one of the following values: |
<> | 134:ad3be0349dc5 | 651 | * @arg @ref LL_COMP_OUTPUT_NONE |
<> | 134:ad3be0349dc5 | 652 | * @arg @ref LL_COMP_OUTPUT_TIM1_BKIN (1) |
<> | 134:ad3be0349dc5 | 653 | * @arg @ref LL_COMP_OUTPUT_TIM1_IC1 (1) |
<> | 134:ad3be0349dc5 | 654 | * @arg @ref LL_COMP_OUTPUT_TIM1_OCCLR (1) |
<> | 134:ad3be0349dc5 | 655 | * @arg @ref LL_COMP_OUTPUT_TIM2_IC4 (1) |
<> | 134:ad3be0349dc5 | 656 | * @arg @ref LL_COMP_OUTPUT_TIM2_OCCLR (1) |
<> | 134:ad3be0349dc5 | 657 | * @arg @ref LL_COMP_OUTPUT_TIM3_IC1 (1) |
<> | 134:ad3be0349dc5 | 658 | * @arg @ref LL_COMP_OUTPUT_TIM3_OCCLR (1) |
<> | 134:ad3be0349dc5 | 659 | * |
<> | 134:ad3be0349dc5 | 660 | * (1) Parameter availability depending on timer availability |
<> | 134:ad3be0349dc5 | 661 | * on the selected device. |
<> | 134:ad3be0349dc5 | 662 | */ |
<> | 134:ad3be0349dc5 | 663 | __STATIC_INLINE uint32_t LL_COMP_GetOutputSelection(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 664 | { |
<> | 134:ad3be0349dc5 | 665 | return (uint32_t)(READ_BIT(COMP->CSR, |
<> | 134:ad3be0349dc5 | 666 | COMP_CSR_COMP1OUTSEL << __COMP_BITOFFSET_INSTANCE(COMPx)) |
<> | 134:ad3be0349dc5 | 667 | >> __COMP_BITOFFSET_INSTANCE(COMPx) |
<> | 134:ad3be0349dc5 | 668 | ); |
<> | 134:ad3be0349dc5 | 669 | } |
<> | 134:ad3be0349dc5 | 670 | |
<> | 134:ad3be0349dc5 | 671 | /** |
<> | 134:ad3be0349dc5 | 672 | * @brief Set comparator instance output polarity. |
<> | 134:ad3be0349dc5 | 673 | * @rmtoll CSR COMP1POL LL_COMP_SetOutputPolarity\n |
<> | 134:ad3be0349dc5 | 674 | * COMP2POL LL_COMP_SetOutputPolarity |
<> | 134:ad3be0349dc5 | 675 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 676 | * @param OutputPolarity This parameter can be one of the following values: |
<> | 134:ad3be0349dc5 | 677 | * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED |
<> | 134:ad3be0349dc5 | 678 | * @arg @ref LL_COMP_OUTPUTPOL_INVERTED |
<> | 134:ad3be0349dc5 | 679 | * @retval None |
<> | 134:ad3be0349dc5 | 680 | */ |
<> | 134:ad3be0349dc5 | 681 | __STATIC_INLINE void LL_COMP_SetOutputPolarity(COMP_TypeDef *COMPx, uint32_t OutputPolarity) |
<> | 134:ad3be0349dc5 | 682 | { |
<> | 134:ad3be0349dc5 | 683 | MODIFY_REG(COMP->CSR, |
<> | 134:ad3be0349dc5 | 684 | COMP_CSR_COMP1POL << __COMP_BITOFFSET_INSTANCE(COMPx), |
<> | 134:ad3be0349dc5 | 685 | OutputPolarity << __COMP_BITOFFSET_INSTANCE(COMPx) ); |
<> | 134:ad3be0349dc5 | 686 | } |
<> | 134:ad3be0349dc5 | 687 | |
<> | 134:ad3be0349dc5 | 688 | /** |
<> | 134:ad3be0349dc5 | 689 | * @brief Get comparator instance output polarity. |
<> | 134:ad3be0349dc5 | 690 | * @rmtoll CSR COMP1POL LL_COMP_GetOutputPolarity\n |
<> | 134:ad3be0349dc5 | 691 | * COMP2POL LL_COMP_GetOutputPolarity |
<> | 134:ad3be0349dc5 | 692 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 693 | * @retval Returned value can be one of the following values: |
<> | 134:ad3be0349dc5 | 694 | * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED |
<> | 134:ad3be0349dc5 | 695 | * @arg @ref LL_COMP_OUTPUTPOL_INVERTED |
<> | 134:ad3be0349dc5 | 696 | */ |
<> | 134:ad3be0349dc5 | 697 | __STATIC_INLINE uint32_t LL_COMP_GetOutputPolarity(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 698 | { |
<> | 134:ad3be0349dc5 | 699 | return (uint32_t)(READ_BIT(COMP->CSR, |
<> | 134:ad3be0349dc5 | 700 | COMP_CSR_COMP1POL << __COMP_BITOFFSET_INSTANCE(COMPx)) |
<> | 134:ad3be0349dc5 | 701 | >> __COMP_BITOFFSET_INSTANCE(COMPx) |
<> | 134:ad3be0349dc5 | 702 | ); |
<> | 134:ad3be0349dc5 | 703 | } |
<> | 134:ad3be0349dc5 | 704 | |
<> | 134:ad3be0349dc5 | 705 | /** |
<> | 134:ad3be0349dc5 | 706 | * @} |
<> | 134:ad3be0349dc5 | 707 | */ |
<> | 134:ad3be0349dc5 | 708 | |
<> | 134:ad3be0349dc5 | 709 | /** @defgroup COMP_LL_EF_Operation Operation on comparator instance |
<> | 134:ad3be0349dc5 | 710 | * @{ |
<> | 134:ad3be0349dc5 | 711 | */ |
<> | 134:ad3be0349dc5 | 712 | |
<> | 134:ad3be0349dc5 | 713 | /** |
<> | 134:ad3be0349dc5 | 714 | * @brief Enable comparator instance. |
<> | 134:ad3be0349dc5 | 715 | * @note After enable from off state, comparator requires a delay |
<> | 134:ad3be0349dc5 | 716 | * to reach reach propagation delay specification. |
<> | 134:ad3be0349dc5 | 717 | * Refer to device datasheet, parameter "tSTART". |
<> | 134:ad3be0349dc5 | 718 | * @rmtoll CSR COMP1EN LL_COMP_Enable\n |
<> | 134:ad3be0349dc5 | 719 | * COMP2EN LL_COMP_Enable |
<> | 134:ad3be0349dc5 | 720 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 721 | * @retval None |
<> | 134:ad3be0349dc5 | 722 | */ |
<> | 134:ad3be0349dc5 | 723 | __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 724 | { |
<> | 134:ad3be0349dc5 | 725 | SET_BIT(COMP->CSR, COMP_CSR_COMP1EN << __COMP_BITOFFSET_INSTANCE(COMPx)); |
<> | 134:ad3be0349dc5 | 726 | } |
<> | 134:ad3be0349dc5 | 727 | |
<> | 134:ad3be0349dc5 | 728 | /** |
<> | 134:ad3be0349dc5 | 729 | * @brief Disable comparator instance. |
<> | 134:ad3be0349dc5 | 730 | * @rmtoll CSR COMP1EN LL_COMP_Disable\n |
<> | 134:ad3be0349dc5 | 731 | * COMP2EN LL_COMP_Disable |
<> | 134:ad3be0349dc5 | 732 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 733 | * @retval None |
<> | 134:ad3be0349dc5 | 734 | */ |
<> | 134:ad3be0349dc5 | 735 | __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 736 | { |
<> | 134:ad3be0349dc5 | 737 | CLEAR_BIT(COMP->CSR, COMP_CSR_COMP1EN << __COMP_BITOFFSET_INSTANCE(COMPx)); |
<> | 134:ad3be0349dc5 | 738 | } |
<> | 134:ad3be0349dc5 | 739 | |
<> | 134:ad3be0349dc5 | 740 | /** |
<> | 134:ad3be0349dc5 | 741 | * @brief Get comparator enable state |
<> | 134:ad3be0349dc5 | 742 | * (0: COMP is disabled, 1: COMP is enabled) |
<> | 134:ad3be0349dc5 | 743 | * @rmtoll CSR COMP1EN LL_COMP_IsEnabled\n |
<> | 134:ad3be0349dc5 | 744 | * COMP2EN LL_COMP_IsEnabled |
<> | 134:ad3be0349dc5 | 745 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 746 | * @retval State of bit (1 or 0). |
<> | 134:ad3be0349dc5 | 747 | */ |
<> | 134:ad3be0349dc5 | 748 | __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 749 | { |
<> | 134:ad3be0349dc5 | 750 | return (READ_BIT(COMP->CSR, COMP_CSR_COMP1EN << __COMP_BITOFFSET_INSTANCE(COMPx)) == COMP_CSR_COMP1EN << __COMP_BITOFFSET_INSTANCE(COMPx)); |
<> | 134:ad3be0349dc5 | 751 | } |
<> | 134:ad3be0349dc5 | 752 | |
<> | 134:ad3be0349dc5 | 753 | /** |
<> | 134:ad3be0349dc5 | 754 | * @brief Lock comparator instance. |
<> | 134:ad3be0349dc5 | 755 | * @note Once locked, comparator configuration can be accessed in read-only. |
<> | 134:ad3be0349dc5 | 756 | * @note The only way to unlock the comparator is a device hardware reset. |
<> | 134:ad3be0349dc5 | 757 | * @rmtoll CSR COMP1LOCK LL_COMP_Lock\n |
<> | 134:ad3be0349dc5 | 758 | * COMP2LOCK LL_COMP_Lock |
<> | 134:ad3be0349dc5 | 759 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 760 | * @retval None |
<> | 134:ad3be0349dc5 | 761 | */ |
<> | 134:ad3be0349dc5 | 762 | __STATIC_INLINE void LL_COMP_Lock(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 763 | { |
<> | 134:ad3be0349dc5 | 764 | SET_BIT(COMP->CSR, COMP_CSR_COMP1LOCK << __COMP_BITOFFSET_INSTANCE(COMPx)); |
<> | 134:ad3be0349dc5 | 765 | } |
<> | 134:ad3be0349dc5 | 766 | |
<> | 134:ad3be0349dc5 | 767 | /** |
<> | 134:ad3be0349dc5 | 768 | * @brief Get comparator lock state |
<> | 134:ad3be0349dc5 | 769 | * (0: COMP is unlocked, 1: COMP is locked). |
<> | 134:ad3be0349dc5 | 770 | * @note Once locked, comparator configuration can be accessed in read-only. |
<> | 134:ad3be0349dc5 | 771 | * @note The only way to unlock the comparator is a device hardware reset. |
<> | 134:ad3be0349dc5 | 772 | * @rmtoll CSR COMP1LOCK LL_COMP_IsLocked\n |
<> | 134:ad3be0349dc5 | 773 | * COMP2LOCK LL_COMP_IsLocked |
<> | 134:ad3be0349dc5 | 774 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 775 | * @retval State of bit (1 or 0). |
<> | 134:ad3be0349dc5 | 776 | */ |
<> | 134:ad3be0349dc5 | 777 | __STATIC_INLINE uint32_t LL_COMP_IsLocked(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 778 | { |
<> | 134:ad3be0349dc5 | 779 | return (READ_BIT(COMP->CSR, COMP_CSR_COMP1LOCK << __COMP_BITOFFSET_INSTANCE(COMPx)) == COMP_CSR_COMP1LOCK << __COMP_BITOFFSET_INSTANCE(COMPx)); |
<> | 134:ad3be0349dc5 | 780 | } |
<> | 134:ad3be0349dc5 | 781 | |
<> | 134:ad3be0349dc5 | 782 | /** |
<> | 134:ad3be0349dc5 | 783 | * @brief Read comparator instance output level. |
<> | 134:ad3be0349dc5 | 784 | * @note The comparator output level depends on the selected polarity |
<> | 134:ad3be0349dc5 | 785 | * (Refer to function @ref LL_COMP_SetOutputPolarity()). |
<> | 134:ad3be0349dc5 | 786 | * If the comparator polarity is not inverted: |
<> | 134:ad3be0349dc5 | 787 | * - Comparator output is low when the input plus |
<> | 134:ad3be0349dc5 | 788 | * is at a lower voltage than the input minus |
<> | 134:ad3be0349dc5 | 789 | * - Comparator output is high when the input plus |
<> | 134:ad3be0349dc5 | 790 | * is at a higher voltage than the input minus |
<> | 134:ad3be0349dc5 | 791 | * If the comparator polarity is inverted: |
<> | 134:ad3be0349dc5 | 792 | * - Comparator output is high when the input plus |
<> | 134:ad3be0349dc5 | 793 | * is at a lower voltage than the input minus |
<> | 134:ad3be0349dc5 | 794 | * - Comparator output is low when the input plus |
<> | 134:ad3be0349dc5 | 795 | * is at a higher voltage than the input minus |
<> | 134:ad3be0349dc5 | 796 | * @rmtoll CSR COMP1OUT LL_COMP_ReadOutputLevel\n |
<> | 134:ad3be0349dc5 | 797 | * COMP2OUT LL_COMP_ReadOutputLevel |
<> | 134:ad3be0349dc5 | 798 | * @param COMPx Comparator instance |
<> | 134:ad3be0349dc5 | 799 | * @retval Returned value can be one of the following values: |
<> | 134:ad3be0349dc5 | 800 | * @arg @ref LL_COMP_OUTPUT_LEVEL_LOW |
<> | 134:ad3be0349dc5 | 801 | * @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH |
<> | 134:ad3be0349dc5 | 802 | */ |
<> | 134:ad3be0349dc5 | 803 | __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx) |
<> | 134:ad3be0349dc5 | 804 | { |
<> | 134:ad3be0349dc5 | 805 | return (uint32_t)(READ_BIT(COMP->CSR, |
<> | 134:ad3be0349dc5 | 806 | COMP_CSR_COMP1OUT << __COMP_BITOFFSET_INSTANCE(COMPx)) |
<> | 134:ad3be0349dc5 | 807 | >> (__COMP_BITOFFSET_INSTANCE(COMPx) + LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS) |
<> | 134:ad3be0349dc5 | 808 | ); |
<> | 134:ad3be0349dc5 | 809 | } |
<> | 134:ad3be0349dc5 | 810 | |
<> | 134:ad3be0349dc5 | 811 | /** |
<> | 134:ad3be0349dc5 | 812 | * @} |
<> | 134:ad3be0349dc5 | 813 | */ |
<> | 134:ad3be0349dc5 | 814 | |
<> | 134:ad3be0349dc5 | 815 | #if defined(USE_FULL_LL_DRIVER) |
<> | 134:ad3be0349dc5 | 816 | /** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions |
<> | 134:ad3be0349dc5 | 817 | * @{ |
<> | 134:ad3be0349dc5 | 818 | */ |
<> | 134:ad3be0349dc5 | 819 | |
<> | 134:ad3be0349dc5 | 820 | ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx); |
<> | 134:ad3be0349dc5 | 821 | ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct); |
<> | 134:ad3be0349dc5 | 822 | void LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct); |
<> | 134:ad3be0349dc5 | 823 | |
<> | 134:ad3be0349dc5 | 824 | /** |
<> | 134:ad3be0349dc5 | 825 | * @} |
<> | 134:ad3be0349dc5 | 826 | */ |
<> | 134:ad3be0349dc5 | 827 | #endif /* USE_FULL_LL_DRIVER */ |
<> | 134:ad3be0349dc5 | 828 | |
<> | 134:ad3be0349dc5 | 829 | /** |
<> | 134:ad3be0349dc5 | 830 | * @} |
<> | 134:ad3be0349dc5 | 831 | */ |
<> | 134:ad3be0349dc5 | 832 | |
<> | 134:ad3be0349dc5 | 833 | /** |
<> | 134:ad3be0349dc5 | 834 | * @} |
<> | 134:ad3be0349dc5 | 835 | */ |
<> | 134:ad3be0349dc5 | 836 | |
<> | 134:ad3be0349dc5 | 837 | #endif /* COMP1 || COMP2 */ |
<> | 134:ad3be0349dc5 | 838 | |
<> | 134:ad3be0349dc5 | 839 | /** |
<> | 134:ad3be0349dc5 | 840 | * @} |
<> | 134:ad3be0349dc5 | 841 | */ |
<> | 134:ad3be0349dc5 | 842 | |
<> | 134:ad3be0349dc5 | 843 | #ifdef __cplusplus |
<> | 134:ad3be0349dc5 | 844 | } |
<> | 134:ad3be0349dc5 | 845 | #endif |
<> | 134:ad3be0349dc5 | 846 | |
<> | 134:ad3be0349dc5 | 847 | #endif /* __STM32F0xx_LL_COMP_H */ |
<> | 134:ad3be0349dc5 | 848 | |
<> | 134:ad3be0349dc5 | 849 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |