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.

Committer:
Kojto
Date:
Tue Feb 14 11:24:20 2017 +0000
Revision:
136:ef9c61f8c49f
Parent:
128:9bcdf88f62b0
Child:
165:d1b4690b3f8b
Release 136 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3432: Target STM USBHOST support https://github.com/ARMmbed/mbed-os/pull/3432
3181: NUCLEO_F207ZG extending PeripheralPins.c: all available alternate functions can be used now https://github.com/ARMmbed/mbed-os/pull/3181
3626: NUCLEO_F412ZG : Add USB Device +Host https://github.com/ARMmbed/mbed-os/pull/3626
3628: Fix warnings https://github.com/ARMmbed/mbed-os/pull/3628
3629: STM32: L0 LL layer https://github.com/ARMmbed/mbed-os/pull/3629
3632: IDE Export support for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3632
3642: Missing IRQ pin fix for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3642
3664: Fix ncs36510 sleep definitions https://github.com/ARMmbed/mbed-os/pull/3664
3655: [STM32F4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3655
3657: [STM32L4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3657
3658: [STM32F3] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3658
3685: STM32: I2C: reset state machine https://github.com/ARMmbed/mbed-os/pull/3685
3692: uVisor: Standardize available legacy heap and stack https://github.com/ARMmbed/mbed-os/pull/3692
3621: Fix for #2884, LPC824: export to LPCXpresso, target running with wron https://github.com/ARMmbed/mbed-os/pull/3621
3649: [STM32F7] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3649
3695: Enforce device_name is valid in targets.json https://github.com/ARMmbed/mbed-os/pull/3695
3723: NCS36510: spi_format function bug fix https://github.com/ARMmbed/mbed-os/pull/3723

Who changed what in which revision?

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