mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
184:08ed48f1de7f
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file stm32l1xx_ll_comp.h
<> 149:156823d33999 4 * @author MCD Application Team
<> 149:156823d33999 5 * @brief Header file of COMP LL module.
<> 149:156823d33999 6 ******************************************************************************
<> 149:156823d33999 7 * @attention
<> 149:156823d33999 8 *
AnnaBridge 184:08ed48f1de7f 9 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
<> 149:156823d33999 10 *
<> 149:156823d33999 11 * Redistribution and use in source and binary forms, with or without modification,
<> 149:156823d33999 12 * are permitted provided that the following conditions are met:
<> 149:156823d33999 13 * 1. Redistributions of source code must retain the above copyright notice,
<> 149:156823d33999 14 * this list of conditions and the following disclaimer.
<> 149:156823d33999 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 149:156823d33999 16 * this list of conditions and the following disclaimer in the documentation
<> 149:156823d33999 17 * and/or other materials provided with the distribution.
<> 149:156823d33999 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 149:156823d33999 19 * may be used to endorse or promote products derived from this software
<> 149:156823d33999 20 * without specific prior written permission.
<> 149:156823d33999 21 *
<> 149:156823d33999 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 149:156823d33999 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 149:156823d33999 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 149:156823d33999 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 149:156823d33999 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 149:156823d33999 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 149:156823d33999 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 149:156823d33999 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 149:156823d33999 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 149:156823d33999 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 149:156823d33999 32 *
<> 149:156823d33999 33 ******************************************************************************
<> 149:156823d33999 34 */
<> 149:156823d33999 35
<> 149:156823d33999 36 /* Define to prevent recursive inclusion -------------------------------------*/
<> 149:156823d33999 37 #ifndef __STM32L1xx_LL_COMP_H
<> 149:156823d33999 38 #define __STM32L1xx_LL_COMP_H
<> 149:156823d33999 39
<> 149:156823d33999 40 #ifdef __cplusplus
<> 149:156823d33999 41 extern "C" {
<> 149:156823d33999 42 #endif
<> 149:156823d33999 43
<> 149:156823d33999 44 /* Includes ------------------------------------------------------------------*/
<> 149:156823d33999 45 #include "stm32l1xx.h"
<> 149:156823d33999 46
<> 149:156823d33999 47 /** @addtogroup STM32L1xx_LL_Driver
<> 149:156823d33999 48 * @{
<> 149:156823d33999 49 */
<> 149:156823d33999 50
<> 149:156823d33999 51 #if defined (COMP1) || defined (COMP2)
<> 149:156823d33999 52
<> 149:156823d33999 53 /** @defgroup COMP_LL COMP
<> 149:156823d33999 54 * @{
<> 149:156823d33999 55 */
<> 149:156823d33999 56
<> 149:156823d33999 57 /* Private types -------------------------------------------------------------*/
<> 149:156823d33999 58 /* Private variables ---------------------------------------------------------*/
<> 149:156823d33999 59 /* Private constants ---------------------------------------------------------*/
<> 149:156823d33999 60 /** @defgroup COMP_LL_Private_Constants COMP Private Constants
<> 149:156823d33999 61 * @{
<> 149:156823d33999 62 */
<> 149:156823d33999 63
<> 149:156823d33999 64 /* COMP registers bits positions */
AnnaBridge 184:08ed48f1de7f 65 #define LL_COMP_OUTPUT_LEVEL_COMP1_BITOFFSET_POS ( 7U) /* Value equivalent to POSITION_VAL(COMP_CSR_CMP1OUT) */
AnnaBridge 184:08ed48f1de7f 66 #define LL_COMP_OUTPUT_LEVEL_COMP2_BITOFFSET_POS (13U) /* Value equivalent to POSITION_VAL(COMP_CSR_CMP2OUT) */
AnnaBridge 184:08ed48f1de7f 67 #define LL_COMP_ENABLE_COMP1_BITOFFSET_POS ( 4U) /* Value equivalent to POSITION_VAL(COMP_CSR_CMP1EN) */
<> 149:156823d33999 68
<> 149:156823d33999 69 /**
<> 149:156823d33999 70 * @}
<> 149:156823d33999 71 */
<> 149:156823d33999 72
<> 149:156823d33999 73 /* Private macros ------------------------------------------------------------*/
<> 149:156823d33999 74 /** @defgroup COMP_LL_Private_Macros COMP Private Macros
<> 149:156823d33999 75 * @{
<> 149:156823d33999 76 */
<> 149:156823d33999 77
<> 149:156823d33999 78 /**
<> 149:156823d33999 79 * @brief Driver macro reserved for internal use: if COMP instance selected
<> 149:156823d33999 80 * is odd (COMP1, COMP3, ...), return value '1', else return '0'.
<> 149:156823d33999 81 * @param __COMP_INSTANCE__ COMP instance
<> 149:156823d33999 82 * @retval If COMP instance is odd, value '1'. Else, value '0'.
<> 149:156823d33999 83 */
<> 149:156823d33999 84 #define __COMP_IS_INSTANCE_ODD(__COMP_INSTANCE__) \
<> 149:156823d33999 85 ((~((uint32_t)(__COMP_INSTANCE__) - COMP_BASE)) & 0x00000001)
<> 149:156823d33999 86
<> 149:156823d33999 87 /**
<> 149:156823d33999 88 * @brief Driver macro reserved for internal use: if COMP instance selected
<> 149:156823d33999 89 * is even (COMP2, COMP4, ...), return value '1', else return '0'.
<> 149:156823d33999 90 * @param __COMP_INSTANCE__ COMP instance
<> 149:156823d33999 91 * @retval If COMP instance is even, value '1'. Else, value '0'.
<> 149:156823d33999 92 */
<> 149:156823d33999 93 #define __COMP_IS_INSTANCE_EVEN(__COMP_INSTANCE__) \
<> 149:156823d33999 94 ((uint32_t)(__COMP_INSTANCE__) - COMP_BASE)
<> 149:156823d33999 95
<> 149:156823d33999 96 /**
<> 149:156823d33999 97 * @}
<> 149:156823d33999 98 */
<> 149:156823d33999 99
<> 149:156823d33999 100 /* Exported types ------------------------------------------------------------*/
<> 149:156823d33999 101 #if defined(USE_FULL_LL_DRIVER)
<> 149:156823d33999 102 /** @defgroup COMP_LL_ES_INIT COMP Exported Init structure
<> 149:156823d33999 103 * @{
<> 149:156823d33999 104 */
<> 149:156823d33999 105
<> 149:156823d33999 106 /**
<> 149:156823d33999 107 * @brief Structure definition of some features of COMP instance.
<> 149:156823d33999 108 */
<> 149:156823d33999 109 typedef struct
<> 149:156823d33999 110 {
<> 149:156823d33999 111 uint32_t PowerMode; /*!< Set comparator operating mode to adjust power and speed.
<> 149:156823d33999 112 This parameter can be a value of @ref COMP_LL_EC_POWERMODE
<> 149:156823d33999 113
<> 149:156823d33999 114 This feature can be modified afterwards using unitary function @ref LL_COMP_SetPowerMode(). */
<> 149:156823d33999 115
<> 149:156823d33999 116 uint32_t InputPlus; /*!< Set comparator input plus (non-inverting input).
<> 149:156823d33999 117 This parameter can be a value of @ref COMP_LL_EC_INPUT_PLUS
<> 149:156823d33999 118
<> 149:156823d33999 119 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputPlus(). */
<> 149:156823d33999 120
<> 149:156823d33999 121 uint32_t InputMinus; /*!< Set comparator input minus (inverting input).
<> 149:156823d33999 122 This parameter can be a value of @ref COMP_LL_EC_INPUT_MINUS
<> 149:156823d33999 123
<> 149:156823d33999 124 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputMinus(). */
<> 149:156823d33999 125
<> 149:156823d33999 126 uint32_t OutputSelection; /*!< Set comparator output selection.
<> 149:156823d33999 127 This parameter can be a value of @ref COMP_LL_EC_OUTPUT_SELECTION
<> 149:156823d33999 128
<> 149:156823d33999 129 This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputSelection(). */
<> 149:156823d33999 130
<> 149:156823d33999 131 } LL_COMP_InitTypeDef;
<> 149:156823d33999 132
<> 149:156823d33999 133 /**
<> 149:156823d33999 134 * @}
<> 149:156823d33999 135 */
<> 149:156823d33999 136 #endif /* USE_FULL_LL_DRIVER */
<> 149:156823d33999 137
<> 149:156823d33999 138 /* Exported constants --------------------------------------------------------*/
<> 149:156823d33999 139 /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants
<> 149:156823d33999 140 * @{
<> 149:156823d33999 141 */
<> 149:156823d33999 142
<> 149:156823d33999 143 /** @defgroup COMP_LL_EC_COMMON_WINDOWMODE Comparator common modes - Window mode
<> 149:156823d33999 144 * @{
<> 149:156823d33999 145 */
AnnaBridge 184:08ed48f1de7f 146 #define LL_COMP_WINDOWMODE_DISABLE (0x00000000U) /*!< Window mode disable: Comparators 1 and 2 are independent */
<> 149:156823d33999 147 #define LL_COMP_WINDOWMODE_COMP2_INPUT_PLUS_COMMON (COMP_CSR_WNDWE) /*!< Window mode enable: Comparators instances pair COMP1 and COMP2 have their input plus connected together. The common input is COMP2 input plus (COMP1 input plus is no more accessible, either from GPIO and from ADC channel VCOMP). */
<> 149:156823d33999 148 /**
<> 149:156823d33999 149 * @}
<> 149:156823d33999 150 */
<> 149:156823d33999 151
<> 149:156823d33999 152 /** @defgroup COMP_LL_EC_POWERMODE Comparator modes - Power mode
<> 149:156823d33999 153 * @{
<> 149:156823d33999 154 */
AnnaBridge 184:08ed48f1de7f 155 #define LL_COMP_POWERMODE_ULTRALOWPOWER (0x00000000U) /*!< COMP power mode to low speed (specific to COMP instance: COMP2) */
<> 149:156823d33999 156 #define LL_COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_SPEED) /*!< COMP power mode to fast speed (specific to COMP instance: COMP2) */
<> 149:156823d33999 157 /**
<> 149:156823d33999 158 * @}
<> 149:156823d33999 159 */
<> 149:156823d33999 160
<> 149:156823d33999 161 /** @defgroup COMP_LL_EC_INPUT_PLUS Comparator inputs - Input plus (input non-inverting) selection
<> 149:156823d33999 162 * @{
<> 149:156823d33999 163 */
AnnaBridge 184:08ed48f1de7f 164 #define LL_COMP_INPUT_PLUS_NONE (0x00000000U) /*!< Comparator input plus connected not connected */
<> 149:156823d33999 165 #define LL_COMP_INPUT_PLUS_IO1 (RI_ASCR2_GR6_1) /*!< Comparator input plus connected to IO1 (pin PB4 for COMP2) (specific to COMP instance: COMP2) */
<> 149:156823d33999 166 #define LL_COMP_INPUT_PLUS_IO2 (RI_ASCR2_GR6_2) /*!< Comparator input plus connected to IO1 (pin PB5 for COMP2) (specific to COMP instance: COMP2) */
<> 149:156823d33999 167 #if defined(RI_ASCR1_CH_31)
<> 149:156823d33999 168 #define LL_COMP_INPUT_PLUS_IO3 (RI_ASCR2_GR6_3) /*!< Comparator input plus connected to IO1 (pin PB6 for COMP2) (specific to COMP instance: COMP2) */
<> 149:156823d33999 169 #define LL_COMP_INPUT_PLUS_IO4 (RI_ASCR2_GR6_4) /*!< Comparator input plus connected to IO1 (pin PB7 for COMP2) (specific to COMP instance: COMP2) */
<> 149:156823d33999 170 #endif
<> 149:156823d33999 171 #define LL_COMP_INPUT_PLUS_IO5 (RI_ASCR1_CH_0) /*!< Comparator input plus connected to IO5 (pin PA0 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 172 #define LL_COMP_INPUT_PLUS_IO6 (RI_ASCR1_CH_1) /*!< Comparator input plus connected to IO6 (pin PA1 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 173 #define LL_COMP_INPUT_PLUS_IO7 (RI_ASCR1_CH_2) /*!< Comparator input plus connected to IO7 (pin PA2 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 174 #define LL_COMP_INPUT_PLUS_IO8 (RI_ASCR1_CH_3) /*!< Comparator input plus connected to IO8 (pin PA3 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 175 #define LL_COMP_INPUT_PLUS_IO9 (RI_ASCR1_CH_4) /*!< Comparator input plus connected to IO9 (pin PA4 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 176 #define LL_COMP_INPUT_PLUS_IO10 (RI_ASCR1_CH_5) /*!< Comparator input plus connected to IO10 (pin PA5 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 177 #define LL_COMP_INPUT_PLUS_IO11 (RI_ASCR1_CH_5) /*!< Comparator input plus connected to IO11 (pin PA5 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 178 #define LL_COMP_INPUT_PLUS_IO12 (RI_ASCR1_CH_7) /*!< Comparator input plus connected to IO12 (pin PA7 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 179 #define LL_COMP_INPUT_PLUS_IO13 (RI_ASCR1_CH_8) /*!< Comparator input plus connected to IO13 (pin PB0 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 180 #define LL_COMP_INPUT_PLUS_IO14 (RI_ASCR1_CH_9) /*!< Comparator input plus connected to IO14 (pin PB1 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 181 #define LL_COMP_INPUT_PLUS_IO15 (RI_ASCR1_CH_10) /*!< Comparator input plus connected to IO15 (pin PC0 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 182 #define LL_COMP_INPUT_PLUS_IO16 (RI_ASCR1_CH_11) /*!< Comparator input plus connected to IO16 (pin PC1 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 183 #define LL_COMP_INPUT_PLUS_IO17 (RI_ASCR1_CH_12) /*!< Comparator input plus connected to IO17 (pin PC2 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 184 #define LL_COMP_INPUT_PLUS_IO18 (RI_ASCR1_CH_13) /*!< Comparator input plus connected to IO18 (pin PC3 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 185 #define LL_COMP_INPUT_PLUS_IO19 (RI_ASCR1_CH_14) /*!< Comparator input plus connected to IO19 (pin PC4 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 186 #define LL_COMP_INPUT_PLUS_IO20 (RI_ASCR1_CH_15) /*!< Comparator input plus connected to IO20 (pin PC5 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 187 #define LL_COMP_INPUT_PLUS_IO21 (RI_ASCR1_CH_18) /*!< Comparator input plus connected to IO21 (pin PB12 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 188 #define LL_COMP_INPUT_PLUS_IO22 (RI_ASCR1_CH_19) /*!< Comparator input plus connected to IO22 (pin PB13 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 189 #define LL_COMP_INPUT_PLUS_IO23 (RI_ASCR1_CH_20) /*!< Comparator input plus connected to IO23 (pin PB14 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 190 #define LL_COMP_INPUT_PLUS_IO24 (RI_ASCR1_CH_21) /*!< Comparator input plus connected to IO24 (pin PB15 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 191 #define LL_COMP_INPUT_PLUS_IO25 (RI_ASCR1_CH_22) /*!< Comparator input plus connected to IO25 (pin PE7 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 192 #define LL_COMP_INPUT_PLUS_IO26 (RI_ASCR1_CH_23) /*!< Comparator input plus connected to IO26 (pin PE8 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 193 #define LL_COMP_INPUT_PLUS_IO27 (RI_ASCR1_CH_24) /*!< Comparator input plus connected to IO27 (pin PE9 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 194 #define LL_COMP_INPUT_PLUS_IO28 (RI_ASCR1_CH_25) /*!< Comparator input plus connected to IO28 (pin PE10 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 195 #if defined(RI_ASCR1_CH_31)
<> 149:156823d33999 196 #define LL_COMP_INPUT_PLUS_IO29 (RI_ASCR1_CH_27) /*!< Comparator input plus connected to IO29 (pin PF6 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 197 #define LL_COMP_INPUT_PLUS_IO30 (RI_ASCR1_CH_28) /*!< Comparator input plus connected to IO30 (pin PF7 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 198 #define LL_COMP_INPUT_PLUS_IO31 (RI_ASCR1_CH_29) /*!< Comparator input plus connected to IO31 (pin PF8 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 199 #define LL_COMP_INPUT_PLUS_IO32 (RI_ASCR1_CH_30) /*!< Comparator input plus connected to IO32 (pin PF9 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 200 #define LL_COMP_INPUT_PLUS_IO33 (RI_ASCR1_CH_31) /*!< Comparator input plus connected to IO33 (pin PF10 for COMP1) (specific to COMP instance: COMP1) */
<> 149:156823d33999 201 #endif
<> 149:156823d33999 202 #if defined(OPAMP1)
<> 149:156823d33999 203 #define LL_COMP_INPUT_PLUS_OPAMP1 (RI_ASCR1_CH_3) /*!< Comparator input plus connected to OPAMP1 output (specific to COMP instance: COMP1) */
<> 149:156823d33999 204 #define LL_COMP_INPUT_PLUS_OPAMP2 (RI_ASCR1_CH_8) /*!< Comparator input plus connected to OPAMP2 output (specific to COMP instance: COMP1) */
<> 149:156823d33999 205 #endif
<> 149:156823d33999 206 #if defined(OPAMP3)
<> 149:156823d33999 207 #define LL_COMP_INPUT_PLUS_OPAMP3 (RI_ASCR1_CH_13) /*!< Comparator input plus connected to OPAMP3 output (specific to COMP instance: COMP1) */
<> 149:156823d33999 208 #endif
<> 149:156823d33999 209 /**
<> 149:156823d33999 210 * @}
<> 149:156823d33999 211 */
<> 149:156823d33999 212
<> 149:156823d33999 213 /** @defgroup COMP_LL_EC_INPUT_MINUS Comparator inputs - Input minus (input inverting) selection
<> 149:156823d33999 214 * @{
<> 149:156823d33999 215 */
<> 149:156823d33999 216 #define LL_COMP_INPUT_MINUS_1_4VREFINT (COMP_CSR_INSEL_2 | COMP_CSR_INSEL_0) /*!< Comparator input minus connected to 1/4 VrefInt (specific to COMP instance: COMP2) */
<> 149:156823d33999 217 #define LL_COMP_INPUT_MINUS_1_2VREFINT (COMP_CSR_INSEL_2 ) /*!< Comparator input minus connected to 1/2 VrefInt (specific to COMP instance: COMP2) */
<> 149:156823d33999 218 #define LL_COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_INSEL_1 | COMP_CSR_INSEL_0) /*!< Comparator input minus connected to 3/4 VrefInt (specific to COMP instance: COMP2) */
<> 149:156823d33999 219 #define LL_COMP_INPUT_MINUS_VREFINT ( COMP_CSR_INSEL_1 ) /*!< Comparator input minus connected to VrefInt */
<> 149:156823d33999 220 #define LL_COMP_INPUT_MINUS_DAC1_CH1 (COMP_CSR_INSEL_2 | COMP_CSR_INSEL_1 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) (specific to COMP instance: COMP2) */
<> 149:156823d33999 221 #define LL_COMP_INPUT_MINUS_DAC1_CH2 (COMP_CSR_INSEL_2 | COMP_CSR_INSEL_1 | COMP_CSR_INSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) (specific to COMP instance: COMP2) */
<> 149:156823d33999 222 #define LL_COMP_INPUT_MINUS_IO1 ( COMP_CSR_INSEL_0) /*!< Comparator input minus connected to IO1 (pin PB3 for COMP2) (specific to COMP instance: COMP2) */
<> 149:156823d33999 223 /**
<> 149:156823d33999 224 * @}
<> 149:156823d33999 225 */
<> 149:156823d33999 226
<> 149:156823d33999 227 /** @defgroup COMP_LL_EC_INPUT_PULLING_RESISTOR Comparator input - Pulling resistor
<> 149:156823d33999 228 * @{
<> 149:156823d33999 229 */
AnnaBridge 184:08ed48f1de7f 230 #define LL_COMP_INPUT_MINUS_PULL_NO (0x00000000U) /*!< Comparator input minus not connected to any pulling resistor */
<> 149:156823d33999 231 #define LL_COMP_INPUT_MINUS_PULL_UP_10K (COMP_CSR_10KPU) /*!< Comparator input minus connected to pull-up resistor of 10kOhm (specific to COMP instance: COMP1) */
<> 149:156823d33999 232 #define LL_COMP_INPUT_MINUS_PULL_UP_400K (COMP_CSR_400KPU) /*!< Comparator input minus connected to pull-up resistor of 400kOhm (specific to COMP instance: COMP1) */
<> 149:156823d33999 233 #define LL_COMP_INPUT_MINUS_PULL_DOWN_10K (COMP_CSR_10KPD) /*!< Comparator input minus connected to pull-down resistor of 10kOhm (specific to COMP instance: COMP1) */
<> 149:156823d33999 234 #define LL_COMP_INPUT_MINUS_PULL_DOWN_400K (COMP_CSR_400KPD) /*!< Comparator input minus connected to pull-down resistor of 400kOhm (specific to COMP instance: COMP1) */
<> 149:156823d33999 235
<> 149:156823d33999 236 /**
<> 149:156823d33999 237 * @}
<> 149:156823d33999 238 */
<> 149:156823d33999 239
<> 149:156823d33999 240 /** @defgroup COMP_LL_EC_OUTPUT_SELECTION Comparator output - Output selection
<> 149:156823d33999 241 * @{
<> 149:156823d33999 242 */
<> 149:156823d33999 243 #define LL_COMP_OUTPUT_NONE (COMP_CSR_OUTSEL_2 | COMP_CSR_OUTSEL_1 | COMP_CSR_OUTSEL_0) /*!< COMP output is not connected to other peripherals (except GPIO and EXTI that are always connected to COMP output) (specific to COMP instance: COMP2) */
AnnaBridge 184:08ed48f1de7f 244 #define LL_COMP_OUTPUT_TIM2_IC4 (0x00000000) /*!< COMP output connected to TIM2 input capture 4 (specific to COMP instance: COMP2) */
<> 149:156823d33999 245 #define LL_COMP_OUTPUT_TIM2_OCREFCLR ( COMP_CSR_OUTSEL_0) /*!< COMP output connected to TIM2 OCREF clear (specific to COMP instance: COMP2) */
<> 149:156823d33999 246 #define LL_COMP_OUTPUT_TIM3_IC4 ( COMP_CSR_OUTSEL_1 ) /*!< COMP output connected to TIM3 input capture 4 (specific to COMP instance: COMP2) */
<> 149:156823d33999 247 #define LL_COMP_OUTPUT_TIM3_OCREFCLR ( COMP_CSR_OUTSEL_1 | COMP_CSR_OUTSEL_0) /*!< COMP output connected to TIM3 OCREF clear (specific to COMP instance: COMP2) */
<> 149:156823d33999 248 #define LL_COMP_OUTPUT_TIM4_IC4 (COMP_CSR_OUTSEL_2 ) /*!< COMP output connected to TIM4 input capture 4 (specific to COMP instance: COMP2) */
<> 149:156823d33999 249 #define LL_COMP_OUTPUT_TIM4_OCREFCLR (COMP_CSR_OUTSEL_2 | COMP_CSR_OUTSEL_0) /*!< COMP output connected to TIM4 OCREF clear (specific to COMP instance: COMP2) */
<> 149:156823d33999 250 #define LL_COMP_OUTPUT_TIM10_IC1 (COMP_CSR_OUTSEL_2 | COMP_CSR_OUTSEL_1 ) /*!< COMP output connected to TIM10 input capture 1 (specific to COMP instance: COMP2) */
<> 149:156823d33999 251 /**
<> 149:156823d33999 252 * @}
<> 149:156823d33999 253 */
<> 149:156823d33999 254
<> 149:156823d33999 255 /** @defgroup COMP_LL_EC_OUTPUT_LEVEL Comparator output - Output level
<> 149:156823d33999 256 * @{
<> 149:156823d33999 257 */
AnnaBridge 184:08ed48f1de7f 258 #define LL_COMP_OUTPUT_LEVEL_LOW (0x00000000U) /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */
AnnaBridge 184:08ed48f1de7f 259 #define LL_COMP_OUTPUT_LEVEL_HIGH (0x00000001U) /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */
<> 149:156823d33999 260 /**
<> 149:156823d33999 261 * @}
<> 149:156823d33999 262 */
<> 149:156823d33999 263
<> 149:156823d33999 264 /** @defgroup COMP_LL_EC_HW_DELAYS Definitions of COMP hardware constraints delays
<> 149:156823d33999 265 * @note Only COMP IP HW delays are defined in COMP LL driver driver,
<> 149:156823d33999 266 * not timeout values.
<> 149:156823d33999 267 * For details on delays values, refer to descriptions in source code
<> 149:156823d33999 268 * above each literal definition.
<> 149:156823d33999 269 * @{
<> 149:156823d33999 270 */
<> 149:156823d33999 271
<> 149:156823d33999 272 /* Delay for comparator startup time. */
<> 149:156823d33999 273 /* Note: Delay required to reach propagation delay specification. */
<> 149:156823d33999 274 /* Literal set to maximum value (refer to device datasheet, */
<> 149:156823d33999 275 /* parameter "tSTART"). */
<> 149:156823d33999 276 /* Unit: us */
AnnaBridge 184:08ed48f1de7f 277 #define LL_COMP_DELAY_STARTUP_US (25U) /*!< Delay for COMP startup time */
<> 149:156823d33999 278
<> 149:156823d33999 279
<> 149:156823d33999 280 /**
<> 149:156823d33999 281 * @}
<> 149:156823d33999 282 */
<> 149:156823d33999 283
<> 149:156823d33999 284 /**
<> 149:156823d33999 285 * @}
<> 149:156823d33999 286 */
<> 149:156823d33999 287
<> 149:156823d33999 288 /* Exported macro ------------------------------------------------------------*/
<> 149:156823d33999 289 /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros
<> 149:156823d33999 290 * @{
<> 149:156823d33999 291 */
<> 149:156823d33999 292 /** @defgroup COMP_LL_EM_WRITE_READ Common write and read registers macro
<> 149:156823d33999 293 * @{
<> 149:156823d33999 294 */
<> 149:156823d33999 295
<> 149:156823d33999 296 /**
<> 149:156823d33999 297 * @brief Write a value in COMP register
<> 149:156823d33999 298 * @param __INSTANCE__ comparator instance
<> 149:156823d33999 299 * @param __REG__ Register to be written
<> 149:156823d33999 300 * @param __VALUE__ Value to be written in the register
<> 149:156823d33999 301 * @retval None
<> 149:156823d33999 302 */
<> 149:156823d33999 303 #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
<> 149:156823d33999 304
<> 149:156823d33999 305 /**
<> 149:156823d33999 306 * @brief Read a value in COMP register
<> 149:156823d33999 307 * @param __INSTANCE__ comparator instance
<> 149:156823d33999 308 * @param __REG__ Register to be read
<> 149:156823d33999 309 * @retval Register value
<> 149:156823d33999 310 */
<> 149:156823d33999 311 #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
<> 149:156823d33999 312 /**
<> 149:156823d33999 313 * @}
<> 149:156823d33999 314 */
<> 149:156823d33999 315
<> 149:156823d33999 316 /** @defgroup COMP_LL_EM_HELPER_MACRO COMP helper macro
<> 149:156823d33999 317 * @{
<> 149:156823d33999 318 */
<> 149:156823d33999 319
<> 149:156823d33999 320 /**
<> 149:156823d33999 321 * @brief Helper macro to select the COMP common instance
<> 149:156823d33999 322 * to which is belonging the selected COMP instance.
<> 149:156823d33999 323 * @note COMP common register instance can be used to
<> 149:156823d33999 324 * set parameters common to several COMP instances.
<> 149:156823d33999 325 * Refer to functions having argument "COMPxy_COMMON" as parameter.
<> 149:156823d33999 326 * @param __COMPx__ COMP instance
<> 149:156823d33999 327 * @retval COMP common instance or value "0" if there is no COMP common instance.
<> 149:156823d33999 328 */
<> 149:156823d33999 329 #define __LL_COMP_COMMON_INSTANCE(__COMPx__) \
<> 149:156823d33999 330 (COMP12_COMMON)
<> 149:156823d33999 331
<> 149:156823d33999 332 /**
<> 149:156823d33999 333 * @}
<> 149:156823d33999 334 */
<> 149:156823d33999 335
<> 149:156823d33999 336 /**
<> 149:156823d33999 337 * @}
<> 149:156823d33999 338 */
<> 149:156823d33999 339
<> 149:156823d33999 340 /* Exported functions --------------------------------------------------------*/
<> 149:156823d33999 341 /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions
<> 149:156823d33999 342 * @{
<> 149:156823d33999 343 */
<> 149:156823d33999 344
<> 149:156823d33999 345 /** @defgroup COMP_LL_EF_Configuration_comparator_common Configuration of COMP hierarchical scope: common to several COMP instances
<> 149:156823d33999 346 * @{
<> 149:156823d33999 347 */
<> 149:156823d33999 348
<> 149:156823d33999 349 /**
<> 149:156823d33999 350 * @brief Set window mode of a pair of comparators instances
<> 149:156823d33999 351 * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
<> 149:156823d33999 352 * @rmtoll CSR WNDWE LL_COMP_SetCommonWindowMode
<> 149:156823d33999 353 * @param COMPxy_COMMON Comparator common instance
<> 149:156823d33999 354 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
<> 149:156823d33999 355 * @param WindowMode This parameter can be one of the following values:
<> 149:156823d33999 356 * @arg @ref LL_COMP_WINDOWMODE_DISABLE
<> 149:156823d33999 357 * @arg @ref LL_COMP_WINDOWMODE_COMP2_INPUT_PLUS_COMMON
<> 149:156823d33999 358 * @retval None
<> 149:156823d33999 359 */
<> 149:156823d33999 360 __STATIC_INLINE void LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON, uint32_t WindowMode)
<> 149:156823d33999 361 {
<> 149:156823d33999 362 MODIFY_REG(COMPxy_COMMON->CSR, COMP_CSR_WNDWE, WindowMode);
<> 149:156823d33999 363 }
<> 149:156823d33999 364
<> 149:156823d33999 365 /**
<> 149:156823d33999 366 * @brief Get window mode of a pair of comparators instances
<> 149:156823d33999 367 * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
<> 149:156823d33999 368 * @rmtoll CSR WNDWE LL_COMP_GetCommonWindowMode
<> 149:156823d33999 369 * @param COMPxy_COMMON Comparator common instance
<> 149:156823d33999 370 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
<> 149:156823d33999 371 * @retval Returned value can be one of the following values:
<> 149:156823d33999 372 * @arg @ref LL_COMP_WINDOWMODE_DISABLE
<> 149:156823d33999 373 * @arg @ref LL_COMP_WINDOWMODE_COMP2_INPUT_PLUS_COMMON
<> 149:156823d33999 374 */
<> 149:156823d33999 375 __STATIC_INLINE uint32_t LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON)
<> 149:156823d33999 376 {
<> 149:156823d33999 377 return (uint32_t)(READ_BIT(COMPxy_COMMON->CSR, COMP_CSR_WNDWE));
<> 149:156823d33999 378 }
<> 149:156823d33999 379
<> 149:156823d33999 380 /**
<> 149:156823d33999 381 * @}
<> 149:156823d33999 382 */
<> 149:156823d33999 383
<> 149:156823d33999 384 /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes
<> 149:156823d33999 385 * @{
<> 149:156823d33999 386 */
<> 149:156823d33999 387
<> 149:156823d33999 388 /**
<> 149:156823d33999 389 * @brief Set comparator instance operating mode to adjust power and speed.
<> 149:156823d33999 390 * @rmtoll COMP2_CSR SPEED LL_COMP_SetPowerMode
<> 149:156823d33999 391 * @param COMPx Comparator instance
<> 149:156823d33999 392 * @param PowerMode This parameter can be one of the following values:
<> 149:156823d33999 393 * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED (1)
<> 149:156823d33999 394 * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER (1)
<> 149:156823d33999 395 *
<> 149:156823d33999 396 * (1) Available only on COMP instance: COMP2.
<> 149:156823d33999 397 * @retval None
<> 149:156823d33999 398 */
<> 149:156823d33999 399 __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode)
<> 149:156823d33999 400 {
<> 149:156823d33999 401 MODIFY_REG(COMP->CSR, COMP_CSR_SPEED, PowerMode);
<> 149:156823d33999 402 }
<> 149:156823d33999 403
<> 149:156823d33999 404 /**
<> 149:156823d33999 405 * @brief Get comparator instance operating mode to adjust power and speed.
<> 149:156823d33999 406 * @rmtoll COMP2_CSR SPEED LL_COMP_GetPowerMode
<> 149:156823d33999 407 * @param COMPx Comparator instance
<> 149:156823d33999 408 * @retval Returned value can be one of the following values:
<> 149:156823d33999 409 * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED (1)
<> 149:156823d33999 410 * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER (1)
<> 149:156823d33999 411 *
<> 149:156823d33999 412 * (1) Available only on COMP instance: COMP2.
<> 149:156823d33999 413 */
<> 149:156823d33999 414 __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx)
<> 149:156823d33999 415 {
<> 149:156823d33999 416 return (uint32_t)(READ_BIT(COMP->CSR, COMP_CSR_SPEED));
<> 149:156823d33999 417 }
<> 149:156823d33999 418
<> 149:156823d33999 419 /**
<> 149:156823d33999 420 * @}
<> 149:156823d33999 421 */
<> 149:156823d33999 422
<> 149:156823d33999 423 /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs
<> 149:156823d33999 424 * @{
<> 149:156823d33999 425 */
<> 149:156823d33999 426
<> 149:156823d33999 427 /**
<> 149:156823d33999 428 * @brief Set comparator input plus (non-inverting).
<> 149:156823d33999 429 * @note In case of comparator input selected to be connected to IO:
<> 149:156823d33999 430 * GPIO pins are specific to each comparator instance.
<> 149:156823d33999 431 * Refer to description of parameters or to reference manual.
<> 149:156823d33999 432 * @rmtoll RI RI_ASCR1_CH LL_COMP_SetInputPlus\n
<> 149:156823d33999 433 * RI RI_ASCR2_GR6 LL_COMP_SetInputPlus
<> 149:156823d33999 434 * @param COMPx Comparator instance
<> 149:156823d33999 435 * @param InputPlus This parameter can be one of the following values:
<> 149:156823d33999 436 * @arg @ref LL_COMP_INPUT_PLUS_NONE
<> 149:156823d33999 437 * @arg @ref LL_COMP_INPUT_PLUS_IO1 (2)
<> 149:156823d33999 438 * @arg @ref LL_COMP_INPUT_PLUS_IO2 (2)
<> 149:156823d33999 439 * @arg @ref LL_COMP_INPUT_PLUS_IO3 (2)(5)
<> 149:156823d33999 440 * @arg @ref LL_COMP_INPUT_PLUS_IO4 (2)(5)
<> 149:156823d33999 441 * @arg @ref LL_COMP_INPUT_PLUS_IO5 (1)
<> 149:156823d33999 442 * @arg @ref LL_COMP_INPUT_PLUS_IO6 (1)
<> 149:156823d33999 443 * @arg @ref LL_COMP_INPUT_PLUS_IO7 (1)
<> 149:156823d33999 444 * @arg @ref LL_COMP_INPUT_PLUS_IO8 (1)
<> 149:156823d33999 445 * @arg @ref LL_COMP_INPUT_PLUS_IO9 (1)
<> 149:156823d33999 446 * @arg @ref LL_COMP_INPUT_PLUS_IO10 (1)
<> 149:156823d33999 447 * @arg @ref LL_COMP_INPUT_PLUS_IO11 (1)
<> 149:156823d33999 448 * @arg @ref LL_COMP_INPUT_PLUS_IO12 (1)
<> 149:156823d33999 449 * @arg @ref LL_COMP_INPUT_PLUS_IO13 (1)
<> 149:156823d33999 450 * @arg @ref LL_COMP_INPUT_PLUS_IO14 (1)
<> 149:156823d33999 451 * @arg @ref LL_COMP_INPUT_PLUS_IO15 (1)
<> 149:156823d33999 452 * @arg @ref LL_COMP_INPUT_PLUS_IO16 (1)
<> 149:156823d33999 453 * @arg @ref LL_COMP_INPUT_PLUS_IO17 (1)
<> 149:156823d33999 454 * @arg @ref LL_COMP_INPUT_PLUS_IO18 (1)
<> 149:156823d33999 455 * @arg @ref LL_COMP_INPUT_PLUS_IO19 (1)
<> 149:156823d33999 456 * @arg @ref LL_COMP_INPUT_PLUS_IO20 (1)
<> 149:156823d33999 457 * @arg @ref LL_COMP_INPUT_PLUS_IO21 (1)
<> 149:156823d33999 458 * @arg @ref LL_COMP_INPUT_PLUS_IO22 (1)
<> 149:156823d33999 459 * @arg @ref LL_COMP_INPUT_PLUS_IO23 (1)
<> 149:156823d33999 460 * @arg @ref LL_COMP_INPUT_PLUS_IO24 (1)
<> 149:156823d33999 461 * @arg @ref LL_COMP_INPUT_PLUS_IO25 (1)
<> 149:156823d33999 462 * @arg @ref LL_COMP_INPUT_PLUS_IO26 (1)
<> 149:156823d33999 463 * @arg @ref LL_COMP_INPUT_PLUS_IO27 (1)
<> 149:156823d33999 464 * @arg @ref LL_COMP_INPUT_PLUS_IO28 (1)
<> 149:156823d33999 465 * @arg @ref LL_COMP_INPUT_PLUS_IO29 (1)(4)
<> 149:156823d33999 466 * @arg @ref LL_COMP_INPUT_PLUS_IO30 (1)(4)
<> 149:156823d33999 467 * @arg @ref LL_COMP_INPUT_PLUS_IO31 (1)(4)
<> 149:156823d33999 468 * @arg @ref LL_COMP_INPUT_PLUS_IO32 (1)(4)
<> 149:156823d33999 469 * @arg @ref LL_COMP_INPUT_PLUS_IO33 (1)(4)
<> 149:156823d33999 470 * @arg @ref LL_COMP_INPUT_PLUS_OPAMP1 (1)(3)
<> 149:156823d33999 471 * @arg @ref LL_COMP_INPUT_PLUS_OPAMP2 (1)(3)
<> 149:156823d33999 472 * @arg @ref LL_COMP_INPUT_PLUS_OPAMP3 (1)(4)
<> 149:156823d33999 473 *
<> 149:156823d33999 474 * (1) Available only on COMP instance: COMP1. \n
<> 149:156823d33999 475 * (2) Available only on COMP instance: COMP2. \n
<> 149:156823d33999 476 * (3) Available on devices: STM32L100xB, STM32L151xB, STM32L152xB, STM32L100xBA, STM32L151xBA, STM32L152xBA, STM32L151xCA, STM32L151xD, STM32L152xCA, STM32L152xD, STM32L162xCA, STM32L162xD \n
<> 149:156823d33999 477 * (4) Available on devices: STM32L151xCA, STM32L151xD, STM32L152xCA, STM32L152xD, STM32L162xCA, STM32L162xD \n
<> 149:156823d33999 478 * (5) Available on devices: STM32L100xC, STM32L151xC, STM32L152xC, STM32L162xC, STM32L151xCA, STM32L151xD, STM32L152xCA, STM32L152xD, STM32L162xCA, STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX, STM32L152xE, STM32L152xDX, STM32L162xE, STM32L162xDX
<> 149:156823d33999 479 * @retval None
<> 149:156823d33999 480 */
<> 149:156823d33999 481 __STATIC_INLINE void LL_COMP_SetInputPlus(COMP_TypeDef *COMPx, uint32_t InputPlus)
<> 149:156823d33999 482 {
<> 149:156823d33999 483 /* Set switch in routing interface (RI) register ASCR1 or ASCR2 */
<> 149:156823d33999 484 /* Note: If COMP instance COMP1 is selected, this function performs */
<> 149:156823d33999 485 /* necessary actions on routing interface: */
<> 149:156823d33999 486 /* - close switch netween comparator 1 and switch matrix */
<> 149:156823d33999 487 /* (RI_ASCR1_VCOMP) */
<> 149:156823d33999 488 /* - enable IO switch control mode (RI_ASCR1_SCM) */
<> 149:156823d33999 489 /* If ADC needs to be used afterwards, disable IO switch control */
<> 149:156823d33999 490 /* mode using function @ref LL_RI_DisableSwitchControlMode(). */
<> 149:156823d33999 491 register uint32_t *preg = ((uint32_t *)((uint32_t) ((uint32_t)(&(RI->ASCR1)) + ((__COMP_IS_INSTANCE_EVEN(COMPx)) << 2U))));
<> 149:156823d33999 492
<> 149:156823d33999 493 MODIFY_REG(*preg,
<> 149:156823d33999 494 (RI_ASCR1_CH * __COMP_IS_INSTANCE_ODD(COMPx)) | (RI_ASCR2_GR6 * __COMP_IS_INSTANCE_EVEN(COMPx)),
<> 149:156823d33999 495 InputPlus | ((RI_ASCR1_VCOMP | RI_ASCR1_SCM) * __COMP_IS_INSTANCE_ODD(COMPx)));
<> 149:156823d33999 496 }
<> 149:156823d33999 497
<> 149:156823d33999 498 /**
<> 149:156823d33999 499 * @brief Get comparator input plus (non-inverting).
<> 149:156823d33999 500 * @note In case of comparator input selected to be connected to IO:
<> 149:156823d33999 501 * GPIO pins are specific to each comparator instance.
<> 149:156823d33999 502 * Refer to description of parameters or to reference manual.
<> 149:156823d33999 503 * @rmtoll RI RI_ASCR1_CH LL_COMP_GetInputPlus\n
<> 149:156823d33999 504 * RI RI_ASCR2_GR6 LL_COMP_GetInputPlus
<> 149:156823d33999 505 * @param COMPx Comparator instance
<> 149:156823d33999 506 * @retval Returned value can be one of the following values:
<> 149:156823d33999 507 * @arg @ref LL_COMP_INPUT_PLUS_NONE
<> 149:156823d33999 508 * @arg @ref LL_COMP_INPUT_PLUS_IO1 (2)
<> 149:156823d33999 509 * @arg @ref LL_COMP_INPUT_PLUS_IO2 (2)
<> 149:156823d33999 510 * @arg @ref LL_COMP_INPUT_PLUS_IO3 (2)(5)
<> 149:156823d33999 511 * @arg @ref LL_COMP_INPUT_PLUS_IO4 (2)(5)
<> 149:156823d33999 512 * @arg @ref LL_COMP_INPUT_PLUS_IO5 (1)
<> 149:156823d33999 513 * @arg @ref LL_COMP_INPUT_PLUS_IO6 (1)
<> 149:156823d33999 514 * @arg @ref LL_COMP_INPUT_PLUS_IO7 (1)
<> 149:156823d33999 515 * @arg @ref LL_COMP_INPUT_PLUS_IO8 (1)
<> 149:156823d33999 516 * @arg @ref LL_COMP_INPUT_PLUS_IO9 (1)
<> 149:156823d33999 517 * @arg @ref LL_COMP_INPUT_PLUS_IO10 (1)
<> 149:156823d33999 518 * @arg @ref LL_COMP_INPUT_PLUS_IO11 (1)
<> 149:156823d33999 519 * @arg @ref LL_COMP_INPUT_PLUS_IO12 (1)
<> 149:156823d33999 520 * @arg @ref LL_COMP_INPUT_PLUS_IO13 (1)
<> 149:156823d33999 521 * @arg @ref LL_COMP_INPUT_PLUS_IO14 (1)
<> 149:156823d33999 522 * @arg @ref LL_COMP_INPUT_PLUS_IO15 (1)
<> 149:156823d33999 523 * @arg @ref LL_COMP_INPUT_PLUS_IO16 (1)
<> 149:156823d33999 524 * @arg @ref LL_COMP_INPUT_PLUS_IO17 (1)
<> 149:156823d33999 525 * @arg @ref LL_COMP_INPUT_PLUS_IO18 (1)
<> 149:156823d33999 526 * @arg @ref LL_COMP_INPUT_PLUS_IO19 (1)
<> 149:156823d33999 527 * @arg @ref LL_COMP_INPUT_PLUS_IO20 (1)
<> 149:156823d33999 528 * @arg @ref LL_COMP_INPUT_PLUS_IO21 (1)
<> 149:156823d33999 529 * @arg @ref LL_COMP_INPUT_PLUS_IO22 (1)
<> 149:156823d33999 530 * @arg @ref LL_COMP_INPUT_PLUS_IO23 (1)
<> 149:156823d33999 531 * @arg @ref LL_COMP_INPUT_PLUS_IO24 (1)
<> 149:156823d33999 532 * @arg @ref LL_COMP_INPUT_PLUS_IO25 (1)
<> 149:156823d33999 533 * @arg @ref LL_COMP_INPUT_PLUS_IO26 (1)
<> 149:156823d33999 534 * @arg @ref LL_COMP_INPUT_PLUS_IO27 (1)
<> 149:156823d33999 535 * @arg @ref LL_COMP_INPUT_PLUS_IO28 (1)
<> 149:156823d33999 536 * @arg @ref LL_COMP_INPUT_PLUS_IO29 (1)(4)
<> 149:156823d33999 537 * @arg @ref LL_COMP_INPUT_PLUS_IO30 (1)(4)
<> 149:156823d33999 538 * @arg @ref LL_COMP_INPUT_PLUS_IO31 (1)(4)
<> 149:156823d33999 539 * @arg @ref LL_COMP_INPUT_PLUS_IO32 (1)(4)
<> 149:156823d33999 540 * @arg @ref LL_COMP_INPUT_PLUS_IO33 (1)(4)
<> 149:156823d33999 541 * @arg @ref LL_COMP_INPUT_PLUS_OPAMP1 (1)(3)
<> 149:156823d33999 542 * @arg @ref LL_COMP_INPUT_PLUS_OPAMP2 (1)(3)
<> 149:156823d33999 543 * @arg @ref LL_COMP_INPUT_PLUS_OPAMP3 (1)(4)
<> 149:156823d33999 544 *
<> 149:156823d33999 545 * (1) Available only on COMP instance: COMP1. \n
<> 149:156823d33999 546 * (2) Available only on COMP instance: COMP2. \n
<> 149:156823d33999 547 * (3) Available on devices: STM32L100xB, STM32L151xB, STM32L152xB, STM32L100xBA, STM32L151xBA, STM32L152xBA, STM32L151xCA, STM32L151xD, STM32L152xCA, STM32L152xD, STM32L162xCA, STM32L162xD \n
<> 149:156823d33999 548 * (4) Available on devices: STM32L151xCA, STM32L151xD, STM32L152xCA, STM32L152xD, STM32L162xCA, STM32L162xD \n
<> 149:156823d33999 549 * (5) Available on devices: STM32L100xC, STM32L151xC, STM32L152xC, STM32L162xC, STM32L151xCA, STM32L151xD, STM32L152xCA, STM32L152xD, STM32L162xCA, STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX, STM32L152xE, STM32L152xDX, STM32L162xE, STM32L162xDX
<> 149:156823d33999 550 */
<> 149:156823d33999 551 __STATIC_INLINE uint32_t LL_COMP_GetInputPlus(COMP_TypeDef *COMPx)
<> 149:156823d33999 552 {
<> 149:156823d33999 553 /* Get switch state in routing interface (RI) register ASCR1 or ASCR2 */
<> 149:156823d33999 554 register uint32_t *preg = ((uint32_t *)((uint32_t) ((uint32_t)(&(RI->ASCR1)) + ((__COMP_IS_INSTANCE_EVEN(COMPx)) << 2U))));
<> 149:156823d33999 555
<> 149:156823d33999 556 return (uint32_t)(READ_BIT(*preg,
<> 149:156823d33999 557 (RI_ASCR1_CH * __COMP_IS_INSTANCE_ODD(COMPx)) | (RI_ASCR2_GR6 * __COMP_IS_INSTANCE_EVEN(COMPx))));
<> 149:156823d33999 558 }
<> 149:156823d33999 559
<> 149:156823d33999 560 /**
<> 149:156823d33999 561 * @brief Set comparator input minus (inverting).
<> 149:156823d33999 562 * @note In case of comparator input selected to be connected to IO:
<> 149:156823d33999 563 * GPIO pins are specific to each comparator instance.
<> 149:156823d33999 564 * Refer to description of parameters or to reference manual.
<> 149:156823d33999 565 * @rmtoll CSR COMP_CSR_INSEL LL_COMP_SetInputMinus
<> 149:156823d33999 566 * @param COMPx Comparator instance
<> 149:156823d33999 567 * @param InputMinus This parameter can be one of the following values:
<> 149:156823d33999 568 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT (1)
<> 149:156823d33999 569 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT (1)
<> 149:156823d33999 570 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT (1)
<> 149:156823d33999 571 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
<> 149:156823d33999 572 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1 (1)
<> 149:156823d33999 573 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 (1)
<> 149:156823d33999 574 * @arg @ref LL_COMP_INPUT_MINUS_IO1 (1)
<> 149:156823d33999 575 *
<> 149:156823d33999 576 * (1) Available only on COMP instance: COMP2.
<> 149:156823d33999 577 * @retval None
<> 149:156823d33999 578 */
<> 149:156823d33999 579 __STATIC_INLINE void LL_COMP_SetInputMinus(COMP_TypeDef *COMPx, uint32_t InputMinus)
<> 149:156823d33999 580 {
<> 149:156823d33999 581 /* On this STM32 serie, only COMP instance COMP1 input minus is fixed to */
<> 149:156823d33999 582 /* VrefInt. Check of comparator instance is implemented to modify register */
<> 149:156823d33999 583 /* only if COMP2 is selected. */
<> 149:156823d33999 584 MODIFY_REG(COMP->CSR,
<> 149:156823d33999 585 COMP_CSR_INSEL * __COMP_IS_INSTANCE_EVEN(COMPx),
<> 149:156823d33999 586 InputMinus * __COMP_IS_INSTANCE_EVEN(COMPx));
<> 149:156823d33999 587 }
<> 149:156823d33999 588
<> 149:156823d33999 589 /**
<> 149:156823d33999 590 * @brief Get comparator input minus (inverting).
<> 149:156823d33999 591 * @note In case of comparator input selected to be connected to IO:
<> 149:156823d33999 592 * GPIO pins are specific to each comparator instance.
<> 149:156823d33999 593 * Refer to description of parameters or to reference manual.
<> 149:156823d33999 594 * @rmtoll CSR COMP_CSR_INSEL LL_COMP_SetInputMinus
<> 149:156823d33999 595 * @param COMPx Comparator instance
<> 149:156823d33999 596 * @retval Returned value can be one of the following values:
<> 149:156823d33999 597 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT (1)
<> 149:156823d33999 598 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT (1)
<> 149:156823d33999 599 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT (1)
<> 149:156823d33999 600 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
<> 149:156823d33999 601 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1 (1)
<> 149:156823d33999 602 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2 (1)
<> 149:156823d33999 603 * @arg @ref LL_COMP_INPUT_MINUS_IO1 (1)
<> 149:156823d33999 604 *
<> 149:156823d33999 605 * (1) Available only on COMP instance: COMP2.
<> 149:156823d33999 606 */
<> 149:156823d33999 607 __STATIC_INLINE uint32_t LL_COMP_GetInputMinus(COMP_TypeDef *COMPx)
<> 149:156823d33999 608 {
<> 149:156823d33999 609 /* On this STM32 serie, only COMP instance COMP1 input minus is fixed to */
<> 149:156823d33999 610 /* VrefInt. Check of comparator instance is implemented to return */
<> 149:156823d33999 611 /* the comparator input plus depending on COMP instance selected. */
<> 149:156823d33999 612 return (uint32_t)((READ_BIT(COMP->CSR, COMP_CSR_INSEL) * __COMP_IS_INSTANCE_EVEN(COMPx))
<> 149:156823d33999 613 | (LL_COMP_INPUT_MINUS_VREFINT * __COMP_IS_INSTANCE_ODD(COMPx)));
<> 149:156823d33999 614 }
<> 149:156823d33999 615
<> 149:156823d33999 616 /**
<> 149:156823d33999 617 * @brief Set comparator input pulling resistor.
<> 149:156823d33999 618 * @rmtoll CSR 10KPU LL_COMP_SetInputPullingResistor\n
<> 149:156823d33999 619 * CSR 400KPU LL_COMP_SetInputPullingResistor\n
<> 149:156823d33999 620 * CSR 10KPD LL_COMP_SetInputPullingResistor\n
<> 149:156823d33999 621 * CSR 400KPD LL_COMP_SetInputPullingResistor
<> 149:156823d33999 622 * @param COMPx Comparator instance
<> 149:156823d33999 623 * @param InputPullingResistor This parameter can be one of the following values:
<> 149:156823d33999 624 * @arg @ref LL_COMP_INPUT_MINUS_PULL_NO
<> 149:156823d33999 625 * @arg @ref LL_COMP_INPUT_MINUS_PULL_UP_10K (1)
<> 149:156823d33999 626 * @arg @ref LL_COMP_INPUT_MINUS_PULL_UP_400K (1)
<> 149:156823d33999 627 * @arg @ref LL_COMP_INPUT_MINUS_PULL_DOWN_10K (1)
<> 149:156823d33999 628 * @arg @ref LL_COMP_INPUT_MINUS_PULL_DOWN_400K (1)
<> 149:156823d33999 629 *
<> 149:156823d33999 630 * (1) Available only on COMP instance: COMP1.
<> 149:156823d33999 631 * @retval None
<> 149:156823d33999 632 */
<> 149:156823d33999 633 __STATIC_INLINE void LL_COMP_SetInputPullingResistor(COMP_TypeDef *COMPx, uint32_t InputPullingResistor)
<> 149:156823d33999 634 {
<> 149:156823d33999 635 /* On this STM32 serie, only COMP instance COMP1 has input pulling */
<> 149:156823d33999 636 /* resistor. Check of comparator instance is implemented to modify register */
<> 149:156823d33999 637 /* only if COMP1 is selected. */
<> 149:156823d33999 638 MODIFY_REG(COMP->CSR,
<> 149:156823d33999 639 (COMP_CSR_10KPU | COMP_CSR_400KPU | COMP_CSR_10KPD | COMP_CSR_400KPD) * __COMP_IS_INSTANCE_ODD(COMPx),
<> 149:156823d33999 640 InputPullingResistor * __COMP_IS_INSTANCE_ODD(COMPx));
<> 149:156823d33999 641 }
<> 149:156823d33999 642
<> 149:156823d33999 643 /**
<> 149:156823d33999 644 * @brief Get comparator input pulling resistor.
<> 149:156823d33999 645 * @rmtoll CSR 10KPU LL_COMP_SetInputPullingResistor\n
<> 149:156823d33999 646 * CSR 400KPU LL_COMP_SetInputPullingResistor\n
<> 149:156823d33999 647 * CSR 10KPD LL_COMP_SetInputPullingResistor\n
<> 149:156823d33999 648 * CSR 400KPD LL_COMP_SetInputPullingResistor
<> 149:156823d33999 649 * @param COMPx Comparator instance
<> 149:156823d33999 650 * @retval Returned value can be one of the following values:
<> 149:156823d33999 651 * @arg @ref LL_COMP_INPUT_MINUS_PULL_NO
<> 149:156823d33999 652 * @arg @ref LL_COMP_INPUT_MINUS_PULL_UP_10K (1)
<> 149:156823d33999 653 * @arg @ref LL_COMP_INPUT_MINUS_PULL_UP_400K (1)
<> 149:156823d33999 654 * @arg @ref LL_COMP_INPUT_MINUS_PULL_DOWN_10K (1)
<> 149:156823d33999 655 * @arg @ref LL_COMP_INPUT_MINUS_PULL_DOWN_400K (1)
<> 149:156823d33999 656 *
<> 149:156823d33999 657 * (1) Available only on COMP instance: COMP1.
<> 149:156823d33999 658 */
<> 149:156823d33999 659 __STATIC_INLINE uint32_t LL_COMP_GetInputPullingResistor(COMP_TypeDef *COMPx)
<> 149:156823d33999 660 {
<> 149:156823d33999 661 /* On this STM32 serie, only COMP instance COMP1 has input pulling */
<> 149:156823d33999 662 /* resistor. Check of comparator instance is implemented to return */
<> 149:156823d33999 663 /* the comparator input pulling resistor depending on COMP instance */
<> 149:156823d33999 664 /* selected. */
<> 149:156823d33999 665 /* On this STM32 serie, only COMP instance COMP1 input minus is fixed to */
<> 149:156823d33999 666 /* VrefInt. Check of comparator instance is implemented to return */
<> 149:156823d33999 667 /* the comparator input plus depending on COMP instance selected. */
<> 149:156823d33999 668 return (uint32_t)((READ_BIT(COMP->CSR, (COMP_CSR_10KPU | COMP_CSR_400KPU | COMP_CSR_10KPD | COMP_CSR_400KPD)) * __COMP_IS_INSTANCE_ODD(COMPx))
<> 149:156823d33999 669 | (LL_COMP_INPUT_MINUS_PULL_NO * __COMP_IS_INSTANCE_EVEN(COMPx)));
<> 149:156823d33999 670 }
<> 149:156823d33999 671
<> 149:156823d33999 672 /**
<> 149:156823d33999 673 * @}
<> 149:156823d33999 674 */
<> 149:156823d33999 675
<> 149:156823d33999 676 /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output
<> 149:156823d33999 677 * @{
<> 149:156823d33999 678 */
<> 149:156823d33999 679
<> 149:156823d33999 680 /**
<> 149:156823d33999 681 * @brief Set comparator output selection.
<> 149:156823d33999 682 * @note Availability of parameters of output selection to timer
<> 149:156823d33999 683 * depends on timers availability on the selected device.
<> 149:156823d33999 684 * @rmtoll CSR OUTSEL LL_COMP_SetOutputSelection
<> 149:156823d33999 685 * @param COMPx Comparator instance
<> 149:156823d33999 686 * @param OutputSelection This parameter can be one of the following values:
<> 149:156823d33999 687 * @arg @ref LL_COMP_OUTPUT_NONE
<> 149:156823d33999 688 * @arg @ref LL_COMP_OUTPUT_TIM2_IC4 (1)(2)
<> 149:156823d33999 689 * @arg @ref LL_COMP_OUTPUT_TIM2_OCREFCLR (1)(2)
<> 149:156823d33999 690 * @arg @ref LL_COMP_OUTPUT_TIM3_IC4 (1)(2)
<> 149:156823d33999 691 * @arg @ref LL_COMP_OUTPUT_TIM3_OCREFCLR (1)(2)
<> 149:156823d33999 692 * @arg @ref LL_COMP_OUTPUT_TIM4_IC4 (1)(2)
<> 149:156823d33999 693 * @arg @ref LL_COMP_OUTPUT_TIM4_OCREFCLR (1)(2)
<> 149:156823d33999 694 * @arg @ref LL_COMP_OUTPUT_TIM10_IC1 (1)(2)
<> 149:156823d33999 695 *
<> 149:156823d33999 696 * (1) Parameter availability depending on timer availability
<> 149:156823d33999 697 * on the selected device.
<> 149:156823d33999 698 * (2) Available only on COMP instance: COMP2.
<> 149:156823d33999 699 * @retval None
<> 149:156823d33999 700 */
<> 149:156823d33999 701 __STATIC_INLINE void LL_COMP_SetOutputSelection(COMP_TypeDef *COMPx, uint32_t OutputSelection)
<> 149:156823d33999 702 {
<> 149:156823d33999 703 /* On this STM32 serie, only COMP instance COMP2 has feature output */
<> 149:156823d33999 704 /* selection. Check of comparator instance is implemented to modify register*/
<> 149:156823d33999 705 /* only if COMP2 is selected. */
<> 149:156823d33999 706 MODIFY_REG(COMP->CSR,
<> 149:156823d33999 707 COMP_CSR_OUTSEL * __COMP_IS_INSTANCE_EVEN(COMPx),
<> 149:156823d33999 708 OutputSelection * __COMP_IS_INSTANCE_EVEN(COMPx));
<> 149:156823d33999 709 }
<> 149:156823d33999 710
<> 149:156823d33999 711 /**
<> 149:156823d33999 712 * @brief Get comparator output selection.
<> 149:156823d33999 713 * @note Availability of parameters of output selection to timer
<> 149:156823d33999 714 * depends on timers availability on the selected device.
<> 149:156823d33999 715 * @rmtoll CSR OUTSEL LL_COMP_GetOutputSelection
<> 149:156823d33999 716 * @param COMPx Comparator instance
<> 149:156823d33999 717 * @retval Returned value can be one of the following values:
<> 149:156823d33999 718 * @arg @ref LL_COMP_OUTPUT_NONE
<> 149:156823d33999 719 * @arg @ref LL_COMP_OUTPUT_TIM2_IC4 (1)(2)
<> 149:156823d33999 720 * @arg @ref LL_COMP_OUTPUT_TIM2_OCREFCLR (1)(2)
<> 149:156823d33999 721 * @arg @ref LL_COMP_OUTPUT_TIM3_IC4 (1)(2)
<> 149:156823d33999 722 * @arg @ref LL_COMP_OUTPUT_TIM3_OCREFCLR (1)(2)
<> 149:156823d33999 723 * @arg @ref LL_COMP_OUTPUT_TIM4_IC4 (1)(2)
<> 149:156823d33999 724 * @arg @ref LL_COMP_OUTPUT_TIM4_OCREFCLR (1)(2)
<> 149:156823d33999 725 * @arg @ref LL_COMP_OUTPUT_TIM10_IC1 (1)(2)
<> 149:156823d33999 726 *
<> 149:156823d33999 727 * (1) Parameter availability depending on timer availability
<> 149:156823d33999 728 * on the selected device.
<> 149:156823d33999 729 * (2) Available only on COMP instance: COMP2.
<> 149:156823d33999 730 */
<> 149:156823d33999 731 __STATIC_INLINE uint32_t LL_COMP_GetOutputSelection(COMP_TypeDef *COMPx)
<> 149:156823d33999 732 {
<> 149:156823d33999 733 /* On this STM32 serie, only COMP instance COMP2 has feature output */
<> 149:156823d33999 734 /* selection. Check of comparator instance is implemented to return */
<> 149:156823d33999 735 /* the comparator output depending on COMP instance selected. */
<> 149:156823d33999 736 return (uint32_t)((READ_BIT(COMP->CSR, COMP_CSR_OUTSEL) * __COMP_IS_INSTANCE_EVEN(COMPx))
<> 149:156823d33999 737 | (LL_COMP_OUTPUT_NONE * __COMP_IS_INSTANCE_ODD(COMPx)));
<> 149:156823d33999 738 }
<> 149:156823d33999 739
<> 149:156823d33999 740 /**
<> 149:156823d33999 741 * @}
<> 149:156823d33999 742 */
<> 149:156823d33999 743
<> 149:156823d33999 744 /** @defgroup COMP_LL_EF_Operation Operation on comparator instance
<> 149:156823d33999 745 * @{
<> 149:156823d33999 746 */
<> 149:156823d33999 747
<> 149:156823d33999 748 /**
<> 149:156823d33999 749 * @brief Enable comparator instance.
<> 149:156823d33999 750 * @note After enable from off state, comparator requires a delay
<> 149:156823d33999 751 * to reach reach propagation delay specification.
<> 149:156823d33999 752 * Refer to device datasheet, parameter "tSTART".
<> 149:156823d33999 753 * @rmtoll CSR COMP1EN LL_COMP_Enable\n
<> 149:156823d33999 754 * CSR COMP_CSR_INSEL LL_COMP_Enable
<> 149:156823d33999 755 * @param COMPx Comparator instance (1)
<> 149:156823d33999 756 *
<> 149:156823d33999 757 * (1) On this STM32 serie, the only COMP instance that can be enabled
<> 149:156823d33999 758 * using this function is COMP1.
<> 149:156823d33999 759 * COMP2 is enabled by setting input minus.
<> 149:156823d33999 760 * Refer to function @ref LL_COMP_SetInputMinus().
<> 149:156823d33999 761 * @retval None
<> 149:156823d33999 762 */
<> 149:156823d33999 763 __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx)
<> 149:156823d33999 764 {
<> 149:156823d33999 765 /* On this STM32 serie, only COMP instance COMP1 has a dedicated bit */
<> 149:156823d33999 766 /* for comparator enable. Check of comparator instance is implemented */
<> 149:156823d33999 767 /* to modify register only if COMP1 is selected. */
<> 149:156823d33999 768 SET_BIT(COMP->CSR, __COMP_IS_INSTANCE_ODD(COMPx) << LL_COMP_ENABLE_COMP1_BITOFFSET_POS);
<> 149:156823d33999 769 }
<> 149:156823d33999 770
<> 149:156823d33999 771 /**
<> 149:156823d33999 772 * @brief Disable comparator instance.
<> 149:156823d33999 773 * @note On this STM32 serie, COMP2 is disabled by clearing input minus
<> 149:156823d33999 774 * selection. If COMP2 must be enabled afterwards, input minus must
<> 149:156823d33999 775 * be set. Refer to function @ref LL_COMP_SetInputMinus().
<> 149:156823d33999 776 * @rmtoll CSR COMP1EN LL_COMP_Disable\n
<> 149:156823d33999 777 * CSR COMP_CSR_INSEL LL_COMP_Disable
<> 149:156823d33999 778 * @param COMPx Comparator instance
<> 149:156823d33999 779 * @retval None
<> 149:156823d33999 780 */
<> 149:156823d33999 781 __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx)
<> 149:156823d33999 782 {
<> 149:156823d33999 783 /* Note: On this STM32 serie, COMP2 is enabled by setting input minus. */
<> 149:156823d33999 784 /* Refer to function @ref LL_COMP_SetInputMinus(). */
<> 149:156823d33999 785 /* To disable COMP2, bitfield of input minus selection is reset. */
<> 149:156823d33999 786 CLEAR_BIT(COMP->CSR, (COMP_CSR_CMP1EN * __COMP_IS_INSTANCE_ODD(COMPx)) | (COMP_CSR_INSEL * __COMP_IS_INSTANCE_EVEN(COMPx)));
<> 149:156823d33999 787 }
<> 149:156823d33999 788
<> 149:156823d33999 789 /**
<> 149:156823d33999 790 * @brief Get comparator enable state
<> 149:156823d33999 791 * (0: COMP is disabled, 1: COMP is enabled)
<> 149:156823d33999 792 * @rmtoll CSR COMP1EN LL_COMP_IsEnabled\n
<> 149:156823d33999 793 * CSR COMP_CSR_INSEL LL_COMP_IsEnabled
<> 149:156823d33999 794 * @param COMPx Comparator instance
<> 149:156823d33999 795 * @retval State of bit (1 or 0).
<> 149:156823d33999 796 */
<> 149:156823d33999 797 __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx)
<> 149:156823d33999 798 {
<> 149:156823d33999 799 return (READ_BIT(COMP->CSR, (COMP_CSR_CMP1EN * __COMP_IS_INSTANCE_ODD(COMPx)) | (COMP_CSR_INSEL * __COMP_IS_INSTANCE_EVEN(COMPx))) != (0U));
<> 149:156823d33999 800 }
<> 149:156823d33999 801
<> 149:156823d33999 802 /**
<> 149:156823d33999 803 * @brief Read comparator instance output level.
<> 149:156823d33999 804 * @note On this STM32 serie, comparator polarity is not settable
<> 149:156823d33999 805 * and not inverted:
<> 149:156823d33999 806 * - Comparator output is low when the input plus
<> 149:156823d33999 807 * is at a lower voltage than the input minus
<> 149:156823d33999 808 * - Comparator output is high when the input plus
<> 149:156823d33999 809 * is at a higher voltage than the input minus
<> 149:156823d33999 810 * @rmtoll CSR CMP1OUT LL_COMP_ReadOutputLevel\n
<> 149:156823d33999 811 * CSR CMP2OUT LL_COMP_ReadOutputLevel
<> 149:156823d33999 812 * @param COMPx Comparator instance
<> 149:156823d33999 813 * @retval Returned value can be one of the following values:
<> 149:156823d33999 814 * @arg @ref LL_COMP_OUTPUT_LEVEL_LOW
<> 149:156823d33999 815 * @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH
<> 149:156823d33999 816 */
<> 149:156823d33999 817 __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx)
<> 149:156823d33999 818 {
<> 149:156823d33999 819 return (uint32_t)(READ_BIT(COMP->CSR,
<> 149:156823d33999 820 ((__COMP_IS_INSTANCE_ODD(COMPx) << LL_COMP_OUTPUT_LEVEL_COMP1_BITOFFSET_POS) | (__COMP_IS_INSTANCE_EVEN(COMPx) << LL_COMP_OUTPUT_LEVEL_COMP2_BITOFFSET_POS)))
<> 149:156823d33999 821 >> (LL_COMP_OUTPUT_LEVEL_COMP1_BITOFFSET_POS + ((LL_COMP_OUTPUT_LEVEL_COMP2_BITOFFSET_POS - LL_COMP_OUTPUT_LEVEL_COMP1_BITOFFSET_POS) * __COMP_IS_INSTANCE_EVEN(COMPx)))
<> 149:156823d33999 822 );
<> 149:156823d33999 823 }
<> 149:156823d33999 824
<> 149:156823d33999 825 /**
<> 149:156823d33999 826 * @}
<> 149:156823d33999 827 */
<> 149:156823d33999 828
<> 149:156823d33999 829 #if defined(USE_FULL_LL_DRIVER)
<> 149:156823d33999 830 /** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions
<> 149:156823d33999 831 * @{
<> 149:156823d33999 832 */
<> 149:156823d33999 833
<> 149:156823d33999 834 ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx);
<> 149:156823d33999 835 ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct);
<> 149:156823d33999 836 void LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct);
<> 149:156823d33999 837
<> 149:156823d33999 838 /**
<> 149:156823d33999 839 * @}
<> 149:156823d33999 840 */
<> 149:156823d33999 841 #endif /* USE_FULL_LL_DRIVER */
<> 149:156823d33999 842
<> 149:156823d33999 843 /**
<> 149:156823d33999 844 * @}
<> 149:156823d33999 845 */
<> 149:156823d33999 846
<> 149:156823d33999 847 /**
<> 149:156823d33999 848 * @}
<> 149:156823d33999 849 */
<> 149:156823d33999 850
<> 149:156823d33999 851 #endif /* COMP1 || COMP2 */
<> 149:156823d33999 852
<> 149:156823d33999 853 /**
<> 149:156823d33999 854 * @}
<> 149:156823d33999 855 */
<> 149:156823d33999 856
<> 149:156823d33999 857 #ifdef __cplusplus
<> 149:156823d33999 858 }
<> 149:156823d33999 859 #endif
<> 149:156823d33999 860
<> 149:156823d33999 861 #endif /* __STM32L1xx_LL_COMP_H */
<> 149:156823d33999 862
<> 149:156823d33999 863 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/