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:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /**
Kojto 122:f9eeca106725 2 ******************************************************************************
Kojto 122:f9eeca106725 3 * @file stm32l4xx_ll_comp.h
Kojto 122:f9eeca106725 4 * @author MCD Application Team
Kojto 122:f9eeca106725 5 * @version V1.5.1
Kojto 122:f9eeca106725 6 * @date 31-May-2016
Kojto 122:f9eeca106725 7 * @brief Header file of COMP LL module.
Kojto 122:f9eeca106725 8 ******************************************************************************
Kojto 122:f9eeca106725 9 * @attention
Kojto 122:f9eeca106725 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Kojto 122:f9eeca106725 12 *
Kojto 122:f9eeca106725 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 122:f9eeca106725 14 * are permitted provided that the following conditions are met:
Kojto 122:f9eeca106725 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 122:f9eeca106725 16 * this list of conditions and the following disclaimer.
Kojto 122:f9eeca106725 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 122:f9eeca106725 18 * this list of conditions and the following disclaimer in the documentation
Kojto 122:f9eeca106725 19 * and/or other materials provided with the distribution.
Kojto 122:f9eeca106725 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 122:f9eeca106725 21 * may be used to endorse or promote products derived from this software
Kojto 122:f9eeca106725 22 * without specific prior written permission.
Kojto 122:f9eeca106725 23 *
Kojto 122:f9eeca106725 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 122:f9eeca106725 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 122:f9eeca106725 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 122:f9eeca106725 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 122:f9eeca106725 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 122:f9eeca106725 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 122:f9eeca106725 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 122:f9eeca106725 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 122:f9eeca106725 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 122:f9eeca106725 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 122:f9eeca106725 34 *
Kojto 122:f9eeca106725 35 ******************************************************************************
Kojto 122:f9eeca106725 36 */
Kojto 122:f9eeca106725 37
Kojto 122:f9eeca106725 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 122:f9eeca106725 39 #ifndef __STM32L4xx_LL_COMP_H
Kojto 122:f9eeca106725 40 #define __STM32L4xx_LL_COMP_H
Kojto 122:f9eeca106725 41
Kojto 122:f9eeca106725 42 #ifdef __cplusplus
Kojto 122:f9eeca106725 43 extern "C" {
Kojto 122:f9eeca106725 44 #endif
Kojto 122:f9eeca106725 45
Kojto 122:f9eeca106725 46 /* Includes ------------------------------------------------------------------*/
Kojto 122:f9eeca106725 47 #include "stm32l4xx.h"
Kojto 122:f9eeca106725 48
Kojto 122:f9eeca106725 49 /** @addtogroup STM32L4xx_LL_Driver
Kojto 122:f9eeca106725 50 * @{
Kojto 122:f9eeca106725 51 */
Kojto 122:f9eeca106725 52
Kojto 122:f9eeca106725 53 #if defined (COMP1) || defined (COMP2)
Kojto 122:f9eeca106725 54
Kojto 122:f9eeca106725 55 /** @defgroup COMP_LL COMP
Kojto 122:f9eeca106725 56 * @{
Kojto 122:f9eeca106725 57 */
Kojto 122:f9eeca106725 58
Kojto 122:f9eeca106725 59 /* Private types -------------------------------------------------------------*/
Kojto 122:f9eeca106725 60 /* Private variables ---------------------------------------------------------*/
Kojto 122:f9eeca106725 61 /* Private constants ---------------------------------------------------------*/
Kojto 122:f9eeca106725 62 /** @defgroup COMP_LL_Private_Constants COMP Private Constants
Kojto 122:f9eeca106725 63 * @{
Kojto 122:f9eeca106725 64 */
Kojto 122:f9eeca106725 65
Kojto 122:f9eeca106725 66 /* COMP registers bits positions */
Kojto 122:f9eeca106725 67 #define LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS ((uint32_t)30U) /* Value equivalent to POSITION_VAL(COMP_CSR_VALUE) */
Kojto 122:f9eeca106725 68
Kojto 122:f9eeca106725 69 /**
Kojto 122:f9eeca106725 70 * @}
Kojto 122:f9eeca106725 71 */
Kojto 122:f9eeca106725 72
Kojto 122:f9eeca106725 73 /* Private macros ------------------------------------------------------------*/
Kojto 122:f9eeca106725 74 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 75 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 76 /** @defgroup COMP_LL_ES_INIT COMP Exported Init structure
Kojto 122:f9eeca106725 77 * @{
Kojto 122:f9eeca106725 78 */
Kojto 122:f9eeca106725 79
Kojto 122:f9eeca106725 80 /**
Kojto 122:f9eeca106725 81 * @brief Structure definition of some features of COMP instance.
Kojto 122:f9eeca106725 82 */
Kojto 122:f9eeca106725 83 typedef struct
Kojto 122:f9eeca106725 84 {
Kojto 122:f9eeca106725 85 uint32_t PowerMode; /*!< Set comparator operating mode to adjust power and speed.
Kojto 122:f9eeca106725 86 This parameter can be a value of @ref COMP_LL_EC_POWERMODE
Kojto 122:f9eeca106725 87
Kojto 122:f9eeca106725 88 This feature can be modified afterwards using unitary function @ref LL_COMP_SetPowerMode(). */
Kojto 122:f9eeca106725 89
Kojto 122:f9eeca106725 90 uint32_t InputPlus; /*!< Set comparator input plus (non-inverting input).
Kojto 122:f9eeca106725 91 This parameter can be a value of @ref COMP_LL_EC_INPUT_PLUS
Kojto 122:f9eeca106725 92
Kojto 122:f9eeca106725 93 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputPlus(). */
Kojto 122:f9eeca106725 94
Kojto 122:f9eeca106725 95 uint32_t InputMinus; /*!< Set comparator input minus (inverting input).
Kojto 122:f9eeca106725 96 This parameter can be a value of @ref COMP_LL_EC_INPUT_MINUS
Kojto 122:f9eeca106725 97
Kojto 122:f9eeca106725 98 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputMinus(). */
Kojto 122:f9eeca106725 99
Kojto 122:f9eeca106725 100 uint32_t InputHysteresis; /*!< Set comparator hysteresis mode of the input minus.
Kojto 122:f9eeca106725 101 This parameter can be a value of @ref COMP_LL_EC_INPUT_HYSTERESIS
Kojto 122:f9eeca106725 102
Kojto 122:f9eeca106725 103 This feature can be modified afterwards using unitary function @ref LL_COMP_SetInputHysteresis(). */
Kojto 122:f9eeca106725 104
Kojto 122:f9eeca106725 105 uint32_t OutputPolarity; /*!< Set comparator output polarity.
Kojto 122:f9eeca106725 106 This parameter can be a value of @ref COMP_LL_EC_OUTPUT_POLARITY
Kojto 122:f9eeca106725 107
Kojto 122:f9eeca106725 108 This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputPolarity(). */
Kojto 122:f9eeca106725 109
Kojto 122:f9eeca106725 110 uint32_t OutputBlankingSource; /*!< Set comparator blanking source.
Kojto 122:f9eeca106725 111 This parameter can be a value of @ref COMP_LL_EC_OUTPUT_BLANKING_SOURCE
Kojto 122:f9eeca106725 112
Kojto 122:f9eeca106725 113 This feature can be modified afterwards using unitary function @ref LL_COMP_SetOutputBlankingSource(). */
Kojto 122:f9eeca106725 114
Kojto 122:f9eeca106725 115 } LL_COMP_InitTypeDef;
Kojto 122:f9eeca106725 116
Kojto 122:f9eeca106725 117 /**
Kojto 122:f9eeca106725 118 * @}
Kojto 122:f9eeca106725 119 */
Kojto 122:f9eeca106725 120 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 121
Kojto 122:f9eeca106725 122 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 123 /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants
Kojto 122:f9eeca106725 124 * @{
Kojto 122:f9eeca106725 125 */
Kojto 122:f9eeca106725 126
Kojto 122:f9eeca106725 127 /** @defgroup COMP_LL_EC_COMMON_WINDOWMODE Comparator common modes - Window mode
Kojto 122:f9eeca106725 128 * @{
Kojto 122:f9eeca106725 129 */
Kojto 122:f9eeca106725 130 #define LL_COMP_WINDOWMODE_DISABLE ((uint32_t)0x00000000U) /*!< Window mode disable: Comparators 1 and 2 are independent */
Kojto 122:f9eeca106725 131 #define LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON (COMP_CSR_WINMODE) /*!< Window mode enable: Comparators instances pair COMP1 and COMP2 have their input plus connected together. The common input is COMP1 input plus (COMP2 input plus is no more accessible). */
Kojto 122:f9eeca106725 132 /**
Kojto 122:f9eeca106725 133 * @}
Kojto 122:f9eeca106725 134 */
Kojto 122:f9eeca106725 135
Kojto 122:f9eeca106725 136 /** @defgroup COMP_LL_EC_POWERMODE Comparator modes - Power mode
Kojto 122:f9eeca106725 137 * @{
Kojto 122:f9eeca106725 138 */
Kojto 122:f9eeca106725 139 #define LL_COMP_POWERMODE_HIGHSPEED ((uint32_t)0x00000000U) /*!< COMP power mode to high speed */
Kojto 122:f9eeca106725 140 #define LL_COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_PWRMODE_0) /*!< COMP power mode to medium speed */
Kojto 122:f9eeca106725 141 #define LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_PWRMODE_1 | COMP_CSR_PWRMODE_0) /*!< COMP power mode to ultra-low power */
Kojto 122:f9eeca106725 142 /**
Kojto 122:f9eeca106725 143 * @}
Kojto 122:f9eeca106725 144 */
Kojto 122:f9eeca106725 145
Kojto 122:f9eeca106725 146 /** @defgroup COMP_LL_EC_INPUT_PLUS Comparator inputs - Input plus (input non-inverting) selection
Kojto 122:f9eeca106725 147 * @{
Kojto 122:f9eeca106725 148 */
Kojto 122:f9eeca106725 149 #define LL_COMP_INPUT_PLUS_IO1 ((uint32_t)0x00000000U) /*!< Comparator input plus connected to IO1 (pin PC5 for COMP1, pin PB4 for COMP2) */
Kojto 122:f9eeca106725 150 #define LL_COMP_INPUT_PLUS_IO2 (COMP_CSR_INPSEL_0) /*!< Comparator input plus connected to IO2 (pin PB2 for COMP1, pin PB6 for COMP2) */
Kojto 122:f9eeca106725 151 #if defined(COMP_CSR_INPSEL_1)
Kojto 122:f9eeca106725 152 #define LL_COMP_INPUT_PLUS_IO3 (COMP_CSR_INPSEL_1 | COMP_CSR_INPSEL_0) /*!< Comparator input plus connected to IO3 (pin PA1 for COMP1, pin PA3 for COMP2) */
Kojto 122:f9eeca106725 153 #endif
Kojto 122:f9eeca106725 154 /**
Kojto 122:f9eeca106725 155 * @}
Kojto 122:f9eeca106725 156 */
Kojto 122:f9eeca106725 157
Kojto 122:f9eeca106725 158 /** @defgroup COMP_LL_EC_INPUT_MINUS Comparator inputs - Input minus (input inverting) selection
Kojto 122:f9eeca106725 159 * @{
Kojto 122:f9eeca106725 160 */
Kojto 122:f9eeca106725 161 #define LL_COMP_INPUT_MINUS_1_4VREFINT ( COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 1/4 VrefInt */
Kojto 122:f9eeca106725 162 #define LL_COMP_INPUT_MINUS_1_2VREFINT ( COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 1/2 VrefInt */
Kojto 122:f9eeca106725 163 #define LL_COMP_INPUT_MINUS_3_4VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< Comparator input minus connected to 3/4 VrefInt */
Kojto 122:f9eeca106725 164 #define LL_COMP_INPUT_MINUS_VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN ) /*!< Comparator input minus connected to VrefInt */
Kojto 122:f9eeca106725 165 #define LL_COMP_INPUT_MINUS_DAC1_CH1 (COMP_CSR_INMSEL_2 ) /*!< Comparator input minus connected to DAC1 channel 1 (DAC_OUT1) */
Kojto 122:f9eeca106725 166 #define LL_COMP_INPUT_MINUS_DAC1_CH2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to DAC1 channel 2 (DAC_OUT2) */
Kojto 122:f9eeca106725 167 #define LL_COMP_INPUT_MINUS_IO1 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 ) /*!< Comparator input minus connected to IO1 (pin PB1 for COMP1, pin PB3 for COMP2) */
Kojto 122:f9eeca106725 168 #define LL_COMP_INPUT_MINUS_IO2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO2 (pin PC4 for COMP1, pin PB7 for COMP2) */
Kojto 122:f9eeca106725 169 #if defined(COMP_CSR_INMESEL_1)
Kojto 122:f9eeca106725 170 #define LL_COMP_INPUT_MINUS_IO3 ( COMP_CSR_INMESEL_0 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO3 (pin PA0 for COMP1, pin PA2 for COMP2) */
Kojto 122:f9eeca106725 171 #define LL_COMP_INPUT_MINUS_IO4 (COMP_CSR_INMESEL_1 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO4 (pin PA4 for COMP1, pin PA4 for COMP2) */
Kojto 122:f9eeca106725 172 #define LL_COMP_INPUT_MINUS_IO5 (COMP_CSR_INMESEL_1 | COMP_CSR_INMESEL_0 | COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< Comparator input minus connected to IO5 (pin PA5 for COMP1, pin PA5 for COMP2) */
Kojto 122:f9eeca106725 173 #endif
Kojto 122:f9eeca106725 174 /**
Kojto 122:f9eeca106725 175 * @}
Kojto 122:f9eeca106725 176 */
Kojto 122:f9eeca106725 177
Kojto 122:f9eeca106725 178 /** @defgroup COMP_LL_EC_INPUT_LEGACY Comparator inputs legacy literals name
Kojto 122:f9eeca106725 179 * @{
Kojto 122:f9eeca106725 180 */
Kojto 122:f9eeca106725 181 #define LL_COMP_WINDOWMODE_ENABLE LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
Kojto 122:f9eeca106725 182
Kojto 122:f9eeca106725 183 #define LL_COMP_INVERTINGINPUT_1_4VREFINT LL_COMP_INPUT_MINUS_1_4VREFINT
Kojto 122:f9eeca106725 184 #define LL_COMP_INVERTINGINPUT_1_2VREFINT LL_COMP_INPUT_MINUS_1_2VREFINT
Kojto 122:f9eeca106725 185 #define LL_COMP_INVERTINGINPUT_3_4VREFINT LL_COMP_INPUT_MINUS_3_4VREFINT
Kojto 122:f9eeca106725 186 #define LL_COMP_INVERTINGINPUT_VREFINT LL_COMP_INPUT_MINUS_VREFINT
Kojto 122:f9eeca106725 187 #define LL_COMP_INVERTINGINPUT_DAC1 LL_COMP_INPUT_MINUS_DAC1_CH1
Kojto 122:f9eeca106725 188 #define LL_COMP_INVERTINGINPUT_DAC2 LL_COMP_INPUT_MINUS_DAC1_CH2
Kojto 122:f9eeca106725 189 #define LL_COMP_INVERTINGINPUT_IO1 LL_COMP_INPUT_MINUS_IO1
Kojto 122:f9eeca106725 190 #define LL_COMP_INVERTINGINPUT_IO2 LL_COMP_INPUT_MINUS_IO2
Kojto 122:f9eeca106725 191 #if defined(COMP_CSR_INMESEL_1)
Kojto 122:f9eeca106725 192 #define LL_COMP_INVERTINGINPUT_IO3 LL_COMP_INPUT_MINUS_IO3
Kojto 122:f9eeca106725 193 #define LL_COMP_INVERTINGINPUT_IO4 LL_COMP_INPUT_MINUS_IO4
Kojto 122:f9eeca106725 194 #define LL_COMP_INVERTINGINPUT_IO5 LL_COMP_INPUT_MINUS_IO5
Kojto 122:f9eeca106725 195 #endif
Kojto 122:f9eeca106725 196
Kojto 122:f9eeca106725 197 #define LL_COMP_NONINVERTINGINPUT_IO1 LL_COMP_INPUT_PLUS_IO1
Kojto 122:f9eeca106725 198 #define LL_COMP_NONINVERTINGINPUT_IO2 LL_COMP_INPUT_PLUS_IO2
Kojto 122:f9eeca106725 199 #if defined(COMP_CSR_INPSEL_1)
Kojto 122:f9eeca106725 200 #define LL_COMP_NONINVERTINGINPUT_IO3 LL_COMP_INPUT_PLUS_IO3
Kojto 122:f9eeca106725 201 #endif
Kojto 122:f9eeca106725 202 /**
Kojto 122:f9eeca106725 203 * @}
Kojto 122:f9eeca106725 204 */
Kojto 122:f9eeca106725 205
Kojto 122:f9eeca106725 206 /** @defgroup COMP_LL_EC_INPUT_HYSTERESIS Comparator input - Hysteresis
Kojto 122:f9eeca106725 207 * @{
Kojto 122:f9eeca106725 208 */
Kojto 122:f9eeca106725 209 #define LL_COMP_HYSTERESIS_NONE ((uint32_t)0x00000000U) /*!< No hysteresis */
Kojto 122:f9eeca106725 210 #define LL_COMP_HYSTERESIS_LOW ( COMP_CSR_HYST_0) /*!< Hysteresis level low */
Kojto 122:f9eeca106725 211 #define LL_COMP_HYSTERESIS_MEDIUM (COMP_CSR_HYST_1 ) /*!< Hysteresis level medium */
Kojto 122:f9eeca106725 212 #define LL_COMP_HYSTERESIS_HIGH (COMP_CSR_HYST_1 | COMP_CSR_HYST_0) /*!< Hysteresis level high */
Kojto 122:f9eeca106725 213 /**
Kojto 122:f9eeca106725 214 * @}
Kojto 122:f9eeca106725 215 */
Kojto 122:f9eeca106725 216
Kojto 122:f9eeca106725 217 /** @defgroup COMP_LL_EC_OUTPUT_POLARITY Comparator output - Output polarity
Kojto 122:f9eeca106725 218 * @{
Kojto 122:f9eeca106725 219 */
Kojto 122:f9eeca106725 220 #define LL_COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000U) /*!< COMP output polarity is not inverted: comparator output is high when the plus (non-inverting) input is at a higher voltage than the minus (inverting) input */
Kojto 122:f9eeca106725 221 #define LL_COMP_OUTPUTPOL_INVERTED (COMP_CSR_POLARITY) /*!< COMP output polarity is inverted: comparator output is low when the plus (non-inverting) input is at a lower voltage than the minus (inverting) input */
Kojto 122:f9eeca106725 222 /**
Kojto 122:f9eeca106725 223 * @}
Kojto 122:f9eeca106725 224 */
Kojto 122:f9eeca106725 225
Kojto 122:f9eeca106725 226 /** @defgroup COMP_LL_EC_OUTPUT_BLANKING_SOURCE Comparator output - Blanking source
Kojto 122:f9eeca106725 227 * @{
Kojto 122:f9eeca106725 228 */
Kojto 122:f9eeca106725 229 #define LL_COMP_BLANKINGSRC_NONE ((uint32_t)0x00000000U) /*!<Comparator output without blanking */
Kojto 122:f9eeca106725 230 #define LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1 (COMP_CSR_BLANKING_0) /*!< Comparator output blanking source TIM1 OC5 (specific to COMP instance: COMP1) */
Kojto 122:f9eeca106725 231 #define LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1 (COMP_CSR_BLANKING_1) /*!< Comparator output blanking source TIM2 OC3 (specific to COMP instance: COMP1) */
Kojto 122:f9eeca106725 232 #define LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1 (COMP_CSR_BLANKING_2) /*!< Comparator output blanking source TIM3 OC3 (specific to COMP instance: COMP1) */
Kojto 122:f9eeca106725 233 #define LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2 (COMP_CSR_BLANKING_0) /*!< Comparator output blanking source TIM3 OC4 (specific to COMP instance: COMP2) */
Kojto 122:f9eeca106725 234 #define LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2 (COMP_CSR_BLANKING_1) /*!< Comparator output blanking source TIM8 OC5 (specific to COMP instance: COMP2) */
Kojto 122:f9eeca106725 235 #define LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (COMP_CSR_BLANKING_2) /*!< Comparator output blanking source TIM15 OC1 (specific to COMP instance: COMP2) */
Kojto 122:f9eeca106725 236 /**
Kojto 122:f9eeca106725 237 * @}
Kojto 122:f9eeca106725 238 */
Kojto 122:f9eeca106725 239
Kojto 122:f9eeca106725 240 /** @defgroup COMP_LL_EC_OUTPUT_BLANKING_SOURCE_LEGACY Comparator output blanking source legacy literals name
Kojto 122:f9eeca106725 241 * @{
Kojto 122:f9eeca106725 242 */
Kojto 122:f9eeca106725 243 #define LL_COMP_BLANKINGSRC_TIM1_OC5 (LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1)
Kojto 122:f9eeca106725 244 #define LL_COMP_BLANKINGSRC_TIM2_OC3 (LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1)
Kojto 122:f9eeca106725 245 #define LL_COMP_BLANKINGSRC_TIM3_OC3 (LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1)
Kojto 122:f9eeca106725 246
Kojto 122:f9eeca106725 247 #define LL_COMP_BLANKINGSRC_TIM3_OC4 (LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2)
Kojto 122:f9eeca106725 248 #define LL_COMP_BLANKINGSRC_TIM8_OC5 (LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2)
Kojto 122:f9eeca106725 249 #define LL_COMP_BLANKINGSRC_TIM15_OC1 (LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2)
Kojto 122:f9eeca106725 250 /**
Kojto 122:f9eeca106725 251 * @}
Kojto 122:f9eeca106725 252 */
Kojto 122:f9eeca106725 253
Kojto 122:f9eeca106725 254 /** @defgroup COMP_LL_EC_OUTPUT_LEVEL Comparator output - Output level
Kojto 122:f9eeca106725 255 * @{
Kojto 122:f9eeca106725 256 */
Kojto 122:f9eeca106725 257 #define LL_COMP_OUTPUT_LEVEL_LOW ((uint32_t)0x00000000U) /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */
Kojto 122:f9eeca106725 258 #define LL_COMP_OUTPUT_LEVEL_HIGH ((uint32_t)0x00000001U) /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */
Kojto 122:f9eeca106725 259 /**
Kojto 122:f9eeca106725 260 * @}
Kojto 122:f9eeca106725 261 */
Kojto 122:f9eeca106725 262
Kojto 122:f9eeca106725 263 /** @defgroup COMP_LL_EC_HW_DELAYS Definitions of COMP hardware constraints delays
Kojto 122:f9eeca106725 264 * @note Only COMP IP HW delays are defined in COMP LL driver driver,
Kojto 122:f9eeca106725 265 * not timeout values.
Kojto 122:f9eeca106725 266 * For details on delays values, refer to descriptions in source code
Kojto 122:f9eeca106725 267 * above each literal definition.
Kojto 122:f9eeca106725 268 * @{
Kojto 122:f9eeca106725 269 */
Kojto 122:f9eeca106725 270
Kojto 122:f9eeca106725 271 /* Delay for comparator startup time. */
Kojto 122:f9eeca106725 272 /* Note: Delay required to reach propagation delay specification. */
Kojto 122:f9eeca106725 273 /* Literal set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 274 /* parameter "tSTART"). */
Kojto 122:f9eeca106725 275 /* Unit: us */
Kojto 122:f9eeca106725 276 #define LL_COMP_DELAY_STARTUP_US ((uint32_t) 80U) /*!< Delay for COMP startup time */
Kojto 122:f9eeca106725 277
Kojto 122:f9eeca106725 278 /* Delay for comparator voltage scaler stabilization time. */
Kojto 122:f9eeca106725 279 /* Note: Voltage scaler is used when selecting comparator input */
Kojto 122:f9eeca106725 280 /* based on VrefInt: VrefInt or subdivision of VrefInt. */
Kojto 122:f9eeca106725 281 /* Literal set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 282 /* parameter "tSTART_SCALER"). */
Kojto 122:f9eeca106725 283 /* Unit: us */
Kojto 122:f9eeca106725 284 #define LL_COMP_DELAY_VOLTAGE_SCALER_STAB_US ((uint32_t) 200U) /*!< Delay for COMP voltage scaler stabilization time */
Kojto 122:f9eeca106725 285
Kojto 122:f9eeca106725 286 /**
Kojto 122:f9eeca106725 287 * @}
Kojto 122:f9eeca106725 288 */
Kojto 122:f9eeca106725 289
Kojto 122:f9eeca106725 290 /**
Kojto 122:f9eeca106725 291 * @}
Kojto 122:f9eeca106725 292 */
Kojto 122:f9eeca106725 293
Kojto 122:f9eeca106725 294 /* Exported macro ------------------------------------------------------------*/
Kojto 122:f9eeca106725 295 /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros
Kojto 122:f9eeca106725 296 * @{
Kojto 122:f9eeca106725 297 */
Kojto 122:f9eeca106725 298 /** @defgroup COMP_LL_EM_WRITE_READ Common write and read registers macro
Kojto 122:f9eeca106725 299 * @{
Kojto 122:f9eeca106725 300 */
Kojto 122:f9eeca106725 301
Kojto 122:f9eeca106725 302 /**
Kojto 122:f9eeca106725 303 * @brief Write a value in COMP register
Kojto 122:f9eeca106725 304 * @param __INSTANCE__ comparator instance
Kojto 122:f9eeca106725 305 * @param __REG__ Register to be written
Kojto 122:f9eeca106725 306 * @param __VALUE__ Value to be written in the register
Kojto 122:f9eeca106725 307 * @retval None
Kojto 122:f9eeca106725 308 */
Kojto 122:f9eeca106725 309 #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 122:f9eeca106725 310
Kojto 122:f9eeca106725 311 /**
Kojto 122:f9eeca106725 312 * @brief Read a value in COMP register
Kojto 122:f9eeca106725 313 * @param __INSTANCE__ comparator instance
Kojto 122:f9eeca106725 314 * @param __REG__ Register to be read
Kojto 122:f9eeca106725 315 * @retval Register value
Kojto 122:f9eeca106725 316 */
Kojto 122:f9eeca106725 317 #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 122:f9eeca106725 318 /**
Kojto 122:f9eeca106725 319 * @}
Kojto 122:f9eeca106725 320 */
Kojto 122:f9eeca106725 321
Kojto 122:f9eeca106725 322 /** @defgroup COMP_LL_EM_HELPER_MACRO COMP helper macro
Kojto 122:f9eeca106725 323 * @{
Kojto 122:f9eeca106725 324 */
Kojto 122:f9eeca106725 325
Kojto 122:f9eeca106725 326 /**
Kojto 122:f9eeca106725 327 * @brief Helper macro to select the COMP common instance
Kojto 122:f9eeca106725 328 * to which is belonging the selected COMP instance.
Kojto 122:f9eeca106725 329 * @note COMP common register instance can be used to
Kojto 122:f9eeca106725 330 * set parameters common to several COMP instances.
Kojto 122:f9eeca106725 331 * Refer to functions having argument "COMPxy_COMMON" as parameter.
Kojto 122:f9eeca106725 332 * @param __COMPx__ COMP instance
Kojto 122:f9eeca106725 333 * @retval COMP common instance or value "0" if there is no COMP common instance.
Kojto 122:f9eeca106725 334 */
Kojto 122:f9eeca106725 335 #define __LL_COMP_COMMON_INSTANCE(__COMPx__) \
Kojto 122:f9eeca106725 336 (COMP12_COMMON)
Kojto 122:f9eeca106725 337
Kojto 122:f9eeca106725 338 /**
Kojto 122:f9eeca106725 339 * @}
Kojto 122:f9eeca106725 340 */
Kojto 122:f9eeca106725 341
Kojto 122:f9eeca106725 342 /**
Kojto 122:f9eeca106725 343 * @}
Kojto 122:f9eeca106725 344 */
Kojto 122:f9eeca106725 345
Kojto 122:f9eeca106725 346 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 347 /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions
Kojto 122:f9eeca106725 348 * @{
Kojto 122:f9eeca106725 349 */
Kojto 122:f9eeca106725 350
Kojto 122:f9eeca106725 351 /** @defgroup COMP_LL_EF_Configuration_comparator_common Configuration of COMP hierarchical scope: common to several COMP instances
Kojto 122:f9eeca106725 352 * @{
Kojto 122:f9eeca106725 353 */
Kojto 122:f9eeca106725 354
Kojto 122:f9eeca106725 355 /**
Kojto 122:f9eeca106725 356 * @brief Set window mode of a pair of comparators instances
Kojto 122:f9eeca106725 357 * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
Kojto 122:f9eeca106725 358 * @rmtoll CSR WINMODE LL_COMP_SetCommonWindowMode
Kojto 122:f9eeca106725 359 * @param COMPxy_COMMON Comparator common instance
Kojto 122:f9eeca106725 360 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 361 * @param WindowMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 362 * @arg @ref LL_COMP_WINDOWMODE_DISABLE
Kojto 122:f9eeca106725 363 * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
Kojto 122:f9eeca106725 364 * @retval None
Kojto 122:f9eeca106725 365 */
Kojto 122:f9eeca106725 366 __STATIC_INLINE void LL_COMP_SetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON, uint32_t WindowMode)
Kojto 122:f9eeca106725 367 {
Kojto 122:f9eeca106725 368 /* Note: On this STM32 serie, window mode can be set only */
Kojto 122:f9eeca106725 369 /* from COMP instance: COMP2. */
Kojto 122:f9eeca106725 370 MODIFY_REG(COMPxy_COMMON->CSR, COMP_CSR_WINMODE, WindowMode);
Kojto 122:f9eeca106725 371 }
Kojto 122:f9eeca106725 372
Kojto 122:f9eeca106725 373 /**
Kojto 122:f9eeca106725 374 * @brief Get window mode of a pair of comparators instances
Kojto 122:f9eeca106725 375 * (2 consecutive COMP instances odd and even COMP<x> and COMP<x+1>).
Kojto 122:f9eeca106725 376 * @rmtoll CSR WINMODE LL_COMP_GetCommonWindowMode
Kojto 122:f9eeca106725 377 * @param COMPxy_COMMON Comparator common instance
Kojto 122:f9eeca106725 378 * (can be set directly from CMSIS definition or by using helper macro @ref __LL_COMP_COMMON_INSTANCE() )
Kojto 122:f9eeca106725 379 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 380 * @arg @ref LL_COMP_WINDOWMODE_DISABLE
Kojto 122:f9eeca106725 381 * @arg @ref LL_COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON
Kojto 122:f9eeca106725 382 */
Kojto 122:f9eeca106725 383 __STATIC_INLINE uint32_t LL_COMP_GetCommonWindowMode(COMP_Common_TypeDef *COMPxy_COMMON)
Kojto 122:f9eeca106725 384 {
Kojto 122:f9eeca106725 385 return (uint32_t)(READ_BIT(COMPxy_COMMON->CSR, COMP_CSR_WINMODE));
Kojto 122:f9eeca106725 386 }
Kojto 122:f9eeca106725 387
Kojto 122:f9eeca106725 388 /**
Kojto 122:f9eeca106725 389 * @}
Kojto 122:f9eeca106725 390 */
Kojto 122:f9eeca106725 391
Kojto 122:f9eeca106725 392 /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes
Kojto 122:f9eeca106725 393 * @{
Kojto 122:f9eeca106725 394 */
Kojto 122:f9eeca106725 395
Kojto 122:f9eeca106725 396 /**
Kojto 122:f9eeca106725 397 * @brief Set comparator instance operating mode to adjust power and speed.
Kojto 122:f9eeca106725 398 * @rmtoll CSR PWRMODE LL_COMP_SetPowerMode
Kojto 122:f9eeca106725 399 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 400 * @param PowerMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 401 * @arg @ref LL_COMP_POWERMODE_HIGHSPEED
Kojto 122:f9eeca106725 402 * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED
Kojto 122:f9eeca106725 403 * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER
Kojto 122:f9eeca106725 404 * @retval None
Kojto 122:f9eeca106725 405 */
Kojto 122:f9eeca106725 406 __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode)
Kojto 122:f9eeca106725 407 {
Kojto 122:f9eeca106725 408 MODIFY_REG(COMPx->CSR, COMP_CSR_PWRMODE, PowerMode);
Kojto 122:f9eeca106725 409 }
Kojto 122:f9eeca106725 410
Kojto 122:f9eeca106725 411 /**
Kojto 122:f9eeca106725 412 * @brief Get comparator instance operating mode to adjust power and speed.
Kojto 122:f9eeca106725 413 * @rmtoll CSR PWRMODE LL_COMP_GetPowerMode
Kojto 122:f9eeca106725 414 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 415 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 416 * @arg @ref LL_COMP_POWERMODE_HIGHSPEED
Kojto 122:f9eeca106725 417 * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED
Kojto 122:f9eeca106725 418 * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER
Kojto 122:f9eeca106725 419 */
Kojto 122:f9eeca106725 420 __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 421 {
Kojto 122:f9eeca106725 422 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_PWRMODE));
Kojto 122:f9eeca106725 423 }
Kojto 122:f9eeca106725 424
Kojto 122:f9eeca106725 425 /**
Kojto 122:f9eeca106725 426 * @}
Kojto 122:f9eeca106725 427 */
Kojto 122:f9eeca106725 428
Kojto 122:f9eeca106725 429 /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs
Kojto 122:f9eeca106725 430 * @{
Kojto 122:f9eeca106725 431 */
Kojto 122:f9eeca106725 432
Kojto 122:f9eeca106725 433 /**
Kojto 122:f9eeca106725 434 * @brief Set comparator inputs minus (inverting) and plus (non-inverting).
Kojto 122:f9eeca106725 435 * @note In case of comparator input selected to be connected to IO:
Kojto 122:f9eeca106725 436 * GPIO pins are specific to each comparator instance.
Kojto 122:f9eeca106725 437 * Refer to description of parameters or to reference manual.
Kojto 122:f9eeca106725 438 * @note On this STM32 serie, scaler bridge is configurable:
Kojto 122:f9eeca106725 439 * to optimize power consumption, this function enables the
Kojto 122:f9eeca106725 440 * voltage scaler bridge only when required
Kojto 122:f9eeca106725 441 * (when selecting comparator input based on VrefInt: VrefInt or
Kojto 122:f9eeca106725 442 * subdivision of VrefInt).
Kojto 122:f9eeca106725 443 * - For scaler bridge power consumption values,
Kojto 122:f9eeca106725 444 * refer to device datasheet, parameter "IDDA(SCALER)".
Kojto 122:f9eeca106725 445 * - Voltage scaler requires a delay for voltage stabilization.
Kojto 122:f9eeca106725 446 * Refer to device datasheet, parameter "tSTART_SCALER".
Kojto 122:f9eeca106725 447 * - Scaler bridge is common for all comparator instances,
Kojto 122:f9eeca106725 448 * therefore if at least one of the comparator instance
Kojto 122:f9eeca106725 449 * is requiring the scaler bridge, it remains enabled.
Kojto 122:f9eeca106725 450 * @rmtoll CSR INMSEL LL_COMP_ConfigInputs\n
Kojto 122:f9eeca106725 451 * CSR INPSEL LL_COMP_ConfigInputs\n
Kojto 122:f9eeca106725 452 * CSR BRGEN LL_COMP_ConfigInputs\n
Kojto 122:f9eeca106725 453 * CSR SCALEN LL_COMP_ConfigInputs
Kojto 122:f9eeca106725 454 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 455 * @param InputMinus This parameter can be one of the following values:
Kojto 122:f9eeca106725 456 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
Kojto 122:f9eeca106725 457 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
Kojto 122:f9eeca106725 458 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
Kojto 122:f9eeca106725 459 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
Kojto 122:f9eeca106725 460 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
Kojto 122:f9eeca106725 461 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
Kojto 122:f9eeca106725 462 * @arg @ref LL_COMP_INPUT_MINUS_IO1
Kojto 122:f9eeca106725 463 * @arg @ref LL_COMP_INPUT_MINUS_IO2
Kojto 122:f9eeca106725 464 * @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
Kojto 122:f9eeca106725 465 * @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
Kojto 122:f9eeca106725 466 * @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
Kojto 122:f9eeca106725 467 *
Kojto 122:f9eeca106725 468 * (*) Parameter not available on all devices.
Kojto 122:f9eeca106725 469 * @param InputPlus This parameter can be one of the following values:
Kojto 122:f9eeca106725 470 * @arg @ref LL_COMP_INPUT_PLUS_IO1
Kojto 122:f9eeca106725 471 * @arg @ref LL_COMP_INPUT_PLUS_IO2
Kojto 122:f9eeca106725 472 * @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
Kojto 122:f9eeca106725 473 *
Kojto 122:f9eeca106725 474 * (*) Parameter not available on all devices.
Kojto 122:f9eeca106725 475 * @retval None
Kojto 122:f9eeca106725 476 */
Kojto 122:f9eeca106725 477 __STATIC_INLINE void LL_COMP_ConfigInputs(COMP_TypeDef *COMPx, uint32_t InputMinus, uint32_t InputPlus)
Kojto 122:f9eeca106725 478 {
Kojto 122:f9eeca106725 479 #if defined(COMP_CSR_INMESEL_1)
Kojto 122:f9eeca106725 480 MODIFY_REG(COMPx->CSR,
Kojto 122:f9eeca106725 481 COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_INPSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN,
Kojto 122:f9eeca106725 482 InputMinus | InputPlus);
Kojto 122:f9eeca106725 483 #else
Kojto 122:f9eeca106725 484 MODIFY_REG(COMPx->CSR,
Kojto 122:f9eeca106725 485 COMP_CSR_INMSEL | COMP_CSR_INPSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN,
Kojto 122:f9eeca106725 486 InputMinus | InputPlus);
Kojto 122:f9eeca106725 487 #endif
Kojto 122:f9eeca106725 488 }
Kojto 122:f9eeca106725 489
Kojto 122:f9eeca106725 490 /**
Kojto 122:f9eeca106725 491 * @brief Set comparator input plus (non-inverting).
Kojto 122:f9eeca106725 492 * @note In case of comparator input selected to be connected to IO:
Kojto 122:f9eeca106725 493 * GPIO pins are specific to each comparator instance.
Kojto 122:f9eeca106725 494 * Refer to description of parameters or to reference manual.
Kojto 122:f9eeca106725 495 * @rmtoll CSR INPSEL LL_COMP_SetInputPlus
Kojto 122:f9eeca106725 496 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 497 * @param InputPlus This parameter can be one of the following values:
Kojto 122:f9eeca106725 498 * @arg @ref LL_COMP_INPUT_PLUS_IO1
Kojto 122:f9eeca106725 499 * @arg @ref LL_COMP_INPUT_PLUS_IO2
Kojto 122:f9eeca106725 500 * @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
Kojto 122:f9eeca106725 501 *
Kojto 122:f9eeca106725 502 * (*) Parameter not available on all devices.
Kojto 122:f9eeca106725 503 * @retval None
Kojto 122:f9eeca106725 504 */
Kojto 122:f9eeca106725 505 __STATIC_INLINE void LL_COMP_SetInputPlus(COMP_TypeDef *COMPx, uint32_t InputPlus)
Kojto 122:f9eeca106725 506 {
Kojto 122:f9eeca106725 507 MODIFY_REG(COMPx->CSR, COMP_CSR_INPSEL, InputPlus);
Kojto 122:f9eeca106725 508 }
Kojto 122:f9eeca106725 509
Kojto 122:f9eeca106725 510 /**
Kojto 122:f9eeca106725 511 * @brief Get comparator input plus (non-inverting).
Kojto 122:f9eeca106725 512 * @note In case of comparator input selected to be connected to IO:
Kojto 122:f9eeca106725 513 * GPIO pins are specific to each comparator instance.
Kojto 122:f9eeca106725 514 * Refer to description of parameters or to reference manual.
Kojto 122:f9eeca106725 515 * @rmtoll CSR INPSEL LL_COMP_GetInputPlus
Kojto 122:f9eeca106725 516 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 517 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 518 * @arg @ref LL_COMP_INPUT_PLUS_IO1
Kojto 122:f9eeca106725 519 * @arg @ref LL_COMP_INPUT_PLUS_IO2
Kojto 122:f9eeca106725 520 * @arg @ref LL_COMP_INPUT_PLUS_IO3 (*)
Kojto 122:f9eeca106725 521 *
Kojto 122:f9eeca106725 522 * (*) Parameter not available on all devices.
Kojto 122:f9eeca106725 523 */
Kojto 122:f9eeca106725 524 __STATIC_INLINE uint32_t LL_COMP_GetInputPlus(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 525 {
Kojto 122:f9eeca106725 526 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INPSEL));
Kojto 122:f9eeca106725 527 }
Kojto 122:f9eeca106725 528
Kojto 122:f9eeca106725 529 /**
Kojto 122:f9eeca106725 530 * @brief Set comparator input minus (inverting).
Kojto 122:f9eeca106725 531 * @note In case of comparator input selected to be connected to IO:
Kojto 122:f9eeca106725 532 * GPIO pins are specific to each comparator instance.
Kojto 122:f9eeca106725 533 * Refer to description of parameters or to reference manual.
Kojto 122:f9eeca106725 534 * @note On this STM32 serie, scaler bridge is configurable:
Kojto 122:f9eeca106725 535 * to optimize power consumption, this function enables the
Kojto 122:f9eeca106725 536 * voltage scaler bridge only when required
Kojto 122:f9eeca106725 537 * (when selecting comparator input based on VrefInt: VrefInt or
Kojto 122:f9eeca106725 538 * subdivision of VrefInt).
Kojto 122:f9eeca106725 539 * - For scaler bridge power consumption values,
Kojto 122:f9eeca106725 540 * refer to device datasheet, parameter "IDDA(SCALER)".
Kojto 122:f9eeca106725 541 * - Voltage scaler requires a delay for voltage stabilization.
Kojto 122:f9eeca106725 542 * Refer to device datasheet, parameter "tSTART_SCALER".
Kojto 122:f9eeca106725 543 * - Scaler bridge is common for all comparator instances,
Kojto 122:f9eeca106725 544 * therefore if at least one of the comparator instance
Kojto 122:f9eeca106725 545 * is requiring the scaler bridge, it remains enabled.
Kojto 122:f9eeca106725 546 * @rmtoll CSR INMSEL LL_COMP_SetInputMinus\n
Kojto 122:f9eeca106725 547 * CSR BRGEN LL_COMP_SetInputMinus\n
Kojto 122:f9eeca106725 548 * CSR SCALEN LL_COMP_SetInputMinus
Kojto 122:f9eeca106725 549 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 550 * @param InputMinus This parameter can be one of the following values:
Kojto 122:f9eeca106725 551 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
Kojto 122:f9eeca106725 552 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
Kojto 122:f9eeca106725 553 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
Kojto 122:f9eeca106725 554 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
Kojto 122:f9eeca106725 555 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
Kojto 122:f9eeca106725 556 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
Kojto 122:f9eeca106725 557 * @arg @ref LL_COMP_INPUT_MINUS_IO1
Kojto 122:f9eeca106725 558 * @arg @ref LL_COMP_INPUT_MINUS_IO2
Kojto 122:f9eeca106725 559 * @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
Kojto 122:f9eeca106725 560 * @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
Kojto 122:f9eeca106725 561 * @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
Kojto 122:f9eeca106725 562 *
Kojto 122:f9eeca106725 563 * (*) Parameter not available on all devices.
Kojto 122:f9eeca106725 564 * @retval None
Kojto 122:f9eeca106725 565 */
Kojto 122:f9eeca106725 566 __STATIC_INLINE void LL_COMP_SetInputMinus(COMP_TypeDef *COMPx, uint32_t InputMinus)
Kojto 122:f9eeca106725 567 {
Kojto 122:f9eeca106725 568 #if defined(COMP_CSR_INMESEL_1)
Kojto 122:f9eeca106725 569 MODIFY_REG(COMPx->CSR, COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN, InputMinus);
Kojto 122:f9eeca106725 570 #else
Kojto 122:f9eeca106725 571 MODIFY_REG(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN, InputMinus);
Kojto 122:f9eeca106725 572 #endif
Kojto 122:f9eeca106725 573 }
Kojto 122:f9eeca106725 574
Kojto 122:f9eeca106725 575 /**
Kojto 122:f9eeca106725 576 * @brief Get comparator input minus (inverting).
Kojto 122:f9eeca106725 577 * @note In case of comparator input selected to be connected to IO:
Kojto 122:f9eeca106725 578 * GPIO pins are specific to each comparator instance.
Kojto 122:f9eeca106725 579 * Refer to description of parameters or to reference manual.
Kojto 122:f9eeca106725 580 * @rmtoll CSR INMSEL LL_COMP_GetInputMinus\n
Kojto 122:f9eeca106725 581 * CSR BRGEN LL_COMP_GetInputMinus\n
Kojto 122:f9eeca106725 582 * CSR SCALEN LL_COMP_GetInputMinus
Kojto 122:f9eeca106725 583 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 584 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 585 * @arg @ref LL_COMP_INPUT_MINUS_1_4VREFINT
Kojto 122:f9eeca106725 586 * @arg @ref LL_COMP_INPUT_MINUS_1_2VREFINT
Kojto 122:f9eeca106725 587 * @arg @ref LL_COMP_INPUT_MINUS_3_4VREFINT
Kojto 122:f9eeca106725 588 * @arg @ref LL_COMP_INPUT_MINUS_VREFINT
Kojto 122:f9eeca106725 589 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH1
Kojto 122:f9eeca106725 590 * @arg @ref LL_COMP_INPUT_MINUS_DAC1_CH2
Kojto 122:f9eeca106725 591 * @arg @ref LL_COMP_INPUT_MINUS_IO1
Kojto 122:f9eeca106725 592 * @arg @ref LL_COMP_INPUT_MINUS_IO2
Kojto 122:f9eeca106725 593 * @arg @ref LL_COMP_INPUT_MINUS_IO3 (*)
Kojto 122:f9eeca106725 594 * @arg @ref LL_COMP_INPUT_MINUS_IO4 (*)
Kojto 122:f9eeca106725 595 * @arg @ref LL_COMP_INPUT_MINUS_IO5 (*)
Kojto 122:f9eeca106725 596 *
Kojto 122:f9eeca106725 597 * (*) Parameter not available on all devices.
Kojto 122:f9eeca106725 598 */
Kojto 122:f9eeca106725 599 __STATIC_INLINE uint32_t LL_COMP_GetInputMinus(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 600 {
Kojto 122:f9eeca106725 601 #if defined(COMP_CSR_INMESEL_1)
Kojto 122:f9eeca106725 602 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INMESEL | COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN));
Kojto 122:f9eeca106725 603 #else
Kojto 122:f9eeca106725 604 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN));
Kojto 122:f9eeca106725 605 #endif
Kojto 122:f9eeca106725 606 }
Kojto 122:f9eeca106725 607
Kojto 122:f9eeca106725 608 /**
Kojto 122:f9eeca106725 609 * @brief Set comparator instance hysteresis mode of the input minus (inverting input).
Kojto 122:f9eeca106725 610 * @rmtoll CSR HYST LL_COMP_SetInputHysteresis
Kojto 122:f9eeca106725 611 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 612 * @param InputHysteresis This parameter can be one of the following values:
Kojto 122:f9eeca106725 613 * @arg @ref LL_COMP_HYSTERESIS_NONE
Kojto 122:f9eeca106725 614 * @arg @ref LL_COMP_HYSTERESIS_LOW
Kojto 122:f9eeca106725 615 * @arg @ref LL_COMP_HYSTERESIS_MEDIUM
Kojto 122:f9eeca106725 616 * @arg @ref LL_COMP_HYSTERESIS_HIGH
Kojto 122:f9eeca106725 617 * @retval None
Kojto 122:f9eeca106725 618 */
Kojto 122:f9eeca106725 619 __STATIC_INLINE void LL_COMP_SetInputHysteresis(COMP_TypeDef *COMPx, uint32_t InputHysteresis)
Kojto 122:f9eeca106725 620 {
Kojto 122:f9eeca106725 621 MODIFY_REG(COMPx->CSR, COMP_CSR_HYST, InputHysteresis);
Kojto 122:f9eeca106725 622 }
Kojto 122:f9eeca106725 623
Kojto 122:f9eeca106725 624 /**
Kojto 122:f9eeca106725 625 * @brief Get comparator instance hysteresis mode of the minus (inverting) input.
Kojto 122:f9eeca106725 626 * @rmtoll CSR HYST LL_COMP_GetInputHysteresis
Kojto 122:f9eeca106725 627 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 628 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 629 * @arg @ref LL_COMP_HYSTERESIS_NONE
Kojto 122:f9eeca106725 630 * @arg @ref LL_COMP_HYSTERESIS_LOW
Kojto 122:f9eeca106725 631 * @arg @ref LL_COMP_HYSTERESIS_MEDIUM
Kojto 122:f9eeca106725 632 * @arg @ref LL_COMP_HYSTERESIS_HIGH
Kojto 122:f9eeca106725 633 */
Kojto 122:f9eeca106725 634 __STATIC_INLINE uint32_t LL_COMP_GetInputHysteresis(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 635 {
Kojto 122:f9eeca106725 636 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_HYST));
Kojto 122:f9eeca106725 637 }
Kojto 122:f9eeca106725 638
Kojto 122:f9eeca106725 639 /**
Kojto 122:f9eeca106725 640 * @}
Kojto 122:f9eeca106725 641 */
Kojto 122:f9eeca106725 642
Kojto 122:f9eeca106725 643 /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output
Kojto 122:f9eeca106725 644 * @{
Kojto 122:f9eeca106725 645 */
Kojto 122:f9eeca106725 646
Kojto 122:f9eeca106725 647 /**
Kojto 122:f9eeca106725 648 * @brief Set comparator instance output polarity.
Kojto 122:f9eeca106725 649 * @rmtoll CSR POLARITY LL_COMP_SetOutputPolarity
Kojto 122:f9eeca106725 650 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 651 * @param OutputPolarity This parameter can be one of the following values:
Kojto 122:f9eeca106725 652 * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
Kojto 122:f9eeca106725 653 * @arg @ref LL_COMP_OUTPUTPOL_INVERTED
Kojto 122:f9eeca106725 654 * @retval None
Kojto 122:f9eeca106725 655 */
Kojto 122:f9eeca106725 656 __STATIC_INLINE void LL_COMP_SetOutputPolarity(COMP_TypeDef *COMPx, uint32_t OutputPolarity)
Kojto 122:f9eeca106725 657 {
Kojto 122:f9eeca106725 658 MODIFY_REG(COMPx->CSR, COMP_CSR_POLARITY, OutputPolarity);
Kojto 122:f9eeca106725 659 }
Kojto 122:f9eeca106725 660
Kojto 122:f9eeca106725 661 /**
Kojto 122:f9eeca106725 662 * @brief Get comparator instance output polarity.
Kojto 122:f9eeca106725 663 * @rmtoll CSR POLARITY LL_COMP_GetOutputPolarity
Kojto 122:f9eeca106725 664 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 665 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 666 * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED
Kojto 122:f9eeca106725 667 * @arg @ref LL_COMP_OUTPUTPOL_INVERTED
Kojto 122:f9eeca106725 668 */
Kojto 122:f9eeca106725 669 __STATIC_INLINE uint32_t LL_COMP_GetOutputPolarity(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 670 {
Kojto 122:f9eeca106725 671 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_POLARITY));
Kojto 122:f9eeca106725 672 }
Kojto 122:f9eeca106725 673
Kojto 122:f9eeca106725 674 /**
Kojto 122:f9eeca106725 675 * @brief Set comparator instance blanking source.
Kojto 122:f9eeca106725 676 * @note Blanking source may be specific to each comparator instance.
Kojto 122:f9eeca106725 677 * Refer to description of parameters or to reference manual.
Kojto 122:f9eeca106725 678 * @note Availability of parameters of blanking source from timer
Kojto 122:f9eeca106725 679 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 680 * @rmtoll CSR BLANKING LL_COMP_SetOutputBlankingSource
Kojto 122:f9eeca106725 681 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 682 * @param BlankingSource This parameter can be one of the following values:
Kojto 122:f9eeca106725 683 * @arg @ref LL_COMP_BLANKINGSRC_NONE
Kojto 122:f9eeca106725 684 * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1 (1)(2)
Kojto 122:f9eeca106725 685 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1 (1)(2)
Kojto 122:f9eeca106725 686 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1 (1)(2)
Kojto 122:f9eeca106725 687 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2 (1)(3)
Kojto 122:f9eeca106725 688 * @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2 (1)(3)
Kojto 122:f9eeca106725 689 * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (1)(3)
Kojto 122:f9eeca106725 690 *
Kojto 122:f9eeca106725 691 * (1) Parameter availability depending on timer availability
Kojto 122:f9eeca106725 692 * on the selected device.
Kojto 122:f9eeca106725 693 * (2) On STM32L4, parameter available only on comparator instance: COMP1.
Kojto 122:f9eeca106725 694 * (3) On STM32L4, parameter available only on comparator instance: COMP2.
Kojto 122:f9eeca106725 695 * @retval None
Kojto 122:f9eeca106725 696 */
Kojto 122:f9eeca106725 697 __STATIC_INLINE void LL_COMP_SetOutputBlankingSource(COMP_TypeDef *COMPx, uint32_t BlankingSource)
Kojto 122:f9eeca106725 698 {
Kojto 122:f9eeca106725 699 MODIFY_REG(COMPx->CSR, COMP_CSR_BLANKING, BlankingSource);
Kojto 122:f9eeca106725 700 }
Kojto 122:f9eeca106725 701
Kojto 122:f9eeca106725 702 /**
Kojto 122:f9eeca106725 703 * @brief Get comparator instance blanking source.
Kojto 122:f9eeca106725 704 * @note Availability of parameters of blanking source from timer
Kojto 122:f9eeca106725 705 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 706 * @note Blanking source may be specific to each comparator instance.
Kojto 122:f9eeca106725 707 * Refer to description of parameters or to reference manual.
Kojto 122:f9eeca106725 708 * @rmtoll CSR BLANKING LL_COMP_GetOutputBlankingSource
Kojto 122:f9eeca106725 709 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 710 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 711 * @arg @ref LL_COMP_BLANKINGSRC_NONE
Kojto 122:f9eeca106725 712 * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5_COMP1 (1)(2)
Kojto 122:f9eeca106725 713 * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3_COMP1 (1)(2)
Kojto 122:f9eeca106725 714 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3_COMP1 (1)(2)
Kojto 122:f9eeca106725 715 * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4_COMP2 (1)(3)
Kojto 122:f9eeca106725 716 * @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5_COMP2 (1)(3)
Kojto 122:f9eeca106725 717 * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1_COMP2 (1)(3)
Kojto 122:f9eeca106725 718 *
Kojto 122:f9eeca106725 719 * (1) Parameter availability depending on timer availability
Kojto 122:f9eeca106725 720 * on the selected device.
Kojto 122:f9eeca106725 721 * (2) On STM32L4, parameter available only on comparator instance: COMP1.
Kojto 122:f9eeca106725 722 * (3) On STM32L4, parameter available only on comparator instance: COMP2.
Kojto 122:f9eeca106725 723 */
Kojto 122:f9eeca106725 724 __STATIC_INLINE uint32_t LL_COMP_GetOutputBlankingSource(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 725 {
Kojto 122:f9eeca106725 726 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_BLANKING));
Kojto 122:f9eeca106725 727 }
Kojto 122:f9eeca106725 728
Kojto 122:f9eeca106725 729 /**
Kojto 122:f9eeca106725 730 * @}
Kojto 122:f9eeca106725 731 */
Kojto 122:f9eeca106725 732
Kojto 122:f9eeca106725 733 /** @defgroup COMP_LL_EF_Configuration_Legacy_Functions Configuration of COMP, legacy functions name
Kojto 122:f9eeca106725 734 * @{
Kojto 122:f9eeca106725 735 */
Kojto 122:f9eeca106725 736 /* Old functions name kept for legacy purpose, to be replaced by the */
Kojto 122:f9eeca106725 737 /* current functions name. */
Kojto 122:f9eeca106725 738 __STATIC_INLINE void LL_COMP_SetInputNonInverting(COMP_TypeDef *COMPx, uint32_t InputNonInverting)
Kojto 122:f9eeca106725 739 {
Kojto 122:f9eeca106725 740 LL_COMP_SetInputPlus(COMPx, InputNonInverting);
Kojto 122:f9eeca106725 741 }
Kojto 122:f9eeca106725 742 __STATIC_INLINE uint32_t LL_COMP_GetInputNonInverting(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 743 {
Kojto 122:f9eeca106725 744 return LL_COMP_GetInputPlus(COMPx);
Kojto 122:f9eeca106725 745 }
Kojto 122:f9eeca106725 746
Kojto 122:f9eeca106725 747 __STATIC_INLINE void LL_COMP_SetInputInverting(COMP_TypeDef *COMPx, uint32_t InputInverting)
Kojto 122:f9eeca106725 748 {
Kojto 122:f9eeca106725 749 LL_COMP_SetInputMinus(COMPx, InputInverting);
Kojto 122:f9eeca106725 750 }
Kojto 122:f9eeca106725 751 __STATIC_INLINE uint32_t LL_COMP_GetInputInverting(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 752 {
Kojto 122:f9eeca106725 753 return LL_COMP_GetInputMinus(COMPx);
Kojto 122:f9eeca106725 754 }
Kojto 122:f9eeca106725 755
Kojto 122:f9eeca106725 756 /**
Kojto 122:f9eeca106725 757 * @}
Kojto 122:f9eeca106725 758 */
Kojto 122:f9eeca106725 759
Kojto 122:f9eeca106725 760 /** @defgroup COMP_LL_EF_Operation Operation on comparator instance
Kojto 122:f9eeca106725 761 * @{
Kojto 122:f9eeca106725 762 */
Kojto 122:f9eeca106725 763
Kojto 122:f9eeca106725 764 /**
Kojto 122:f9eeca106725 765 * @brief Enable comparator instance.
Kojto 122:f9eeca106725 766 * @note After enable from off state, comparator requires a delay
Kojto 122:f9eeca106725 767 * to reach reach propagation delay specification.
Kojto 122:f9eeca106725 768 * Refer to device datasheet, parameter "tSTART".
Kojto 122:f9eeca106725 769 * @rmtoll CSR EN LL_COMP_Enable
Kojto 122:f9eeca106725 770 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 771 * @retval None
Kojto 122:f9eeca106725 772 */
Kojto 122:f9eeca106725 773 __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 774 {
Kojto 122:f9eeca106725 775 SET_BIT(COMPx->CSR, COMP_CSR_EN);
Kojto 122:f9eeca106725 776 }
Kojto 122:f9eeca106725 777
Kojto 122:f9eeca106725 778 /**
Kojto 122:f9eeca106725 779 * @brief Disable comparator instance.
Kojto 122:f9eeca106725 780 * @rmtoll CSR EN LL_COMP_Disable
Kojto 122:f9eeca106725 781 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 782 * @retval None
Kojto 122:f9eeca106725 783 */
Kojto 122:f9eeca106725 784 __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 785 {
Kojto 122:f9eeca106725 786 CLEAR_BIT(COMPx->CSR, COMP_CSR_EN);
Kojto 122:f9eeca106725 787 }
Kojto 122:f9eeca106725 788
Kojto 122:f9eeca106725 789 /**
Kojto 122:f9eeca106725 790 * @brief Get comparator enable state
Kojto 122:f9eeca106725 791 * (0: COMP is disabled, 1: COMP is enabled)
Kojto 122:f9eeca106725 792 * @rmtoll CSR EN LL_COMP_IsEnabled
Kojto 122:f9eeca106725 793 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 794 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 795 */
Kojto 122:f9eeca106725 796 __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 797 {
Kojto 122:f9eeca106725 798 return (READ_BIT(COMPx->CSR, COMP_CSR_EN) == (COMP_CSR_EN));
Kojto 122:f9eeca106725 799 }
Kojto 122:f9eeca106725 800
Kojto 122:f9eeca106725 801 /**
Kojto 122:f9eeca106725 802 * @brief Lock comparator instance.
Kojto 122:f9eeca106725 803 * @note Once locked, comparator configuration can be accessed in read-only.
Kojto 122:f9eeca106725 804 * @note The only way to unlock the comparator is a device hardware reset.
Kojto 122:f9eeca106725 805 * @rmtoll CSR LOCK LL_COMP_Lock
Kojto 122:f9eeca106725 806 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 807 * @retval None
Kojto 122:f9eeca106725 808 */
Kojto 122:f9eeca106725 809 __STATIC_INLINE void LL_COMP_Lock(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 810 {
Kojto 122:f9eeca106725 811 SET_BIT(COMPx->CSR, COMP_CSR_LOCK);
Kojto 122:f9eeca106725 812 }
Kojto 122:f9eeca106725 813
Kojto 122:f9eeca106725 814 /**
Kojto 122:f9eeca106725 815 * @brief Get comparator lock state
Kojto 122:f9eeca106725 816 * (0: COMP is unlocked, 1: COMP is locked).
Kojto 122:f9eeca106725 817 * @note Once locked, comparator configuration can be accessed in read-only.
Kojto 122:f9eeca106725 818 * @note The only way to unlock the comparator is a device hardware reset.
Kojto 122:f9eeca106725 819 * @rmtoll CSR LOCK LL_COMP_IsLocked
Kojto 122:f9eeca106725 820 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 821 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 822 */
Kojto 122:f9eeca106725 823 __STATIC_INLINE uint32_t LL_COMP_IsLocked(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 824 {
Kojto 122:f9eeca106725 825 return (READ_BIT(COMPx->CSR, COMP_CSR_LOCK) == (COMP_CSR_LOCK));
Kojto 122:f9eeca106725 826 }
Kojto 122:f9eeca106725 827
Kojto 122:f9eeca106725 828 /**
Kojto 122:f9eeca106725 829 * @brief Read comparator instance output level.
Kojto 122:f9eeca106725 830 * @note The comparator output level depends on the selected polarity
Kojto 122:f9eeca106725 831 * (Refer to function @ref LL_COMP_SetOutputPolarity()).
Kojto 122:f9eeca106725 832 * If the comparator polarity is not inverted:
Kojto 122:f9eeca106725 833 * - Comparator output is low when the input plus
Kojto 122:f9eeca106725 834 * is at a lower voltage than the input minus
Kojto 122:f9eeca106725 835 * - Comparator output is high when the input plus
Kojto 122:f9eeca106725 836 * is at a higher voltage than the input minus
Kojto 122:f9eeca106725 837 * If the comparator polarity is inverted:
Kojto 122:f9eeca106725 838 * - Comparator output is high when the input plus
Kojto 122:f9eeca106725 839 * is at a lower voltage than the input minus
Kojto 122:f9eeca106725 840 * - Comparator output is low when the input plus
Kojto 122:f9eeca106725 841 * is at a higher voltage than the input minus
Kojto 122:f9eeca106725 842 * @rmtoll CSR VALUE LL_COMP_ReadOutputLevel
Kojto 122:f9eeca106725 843 * @param COMPx Comparator instance
Kojto 122:f9eeca106725 844 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 845 * @arg @ref LL_COMP_OUTPUT_LEVEL_LOW
Kojto 122:f9eeca106725 846 * @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH
Kojto 122:f9eeca106725 847 */
Kojto 122:f9eeca106725 848 __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx)
Kojto 122:f9eeca106725 849 {
Kojto 122:f9eeca106725 850 return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_VALUE)
Kojto 122:f9eeca106725 851 >> LL_COMP_OUTPUT_LEVEL_BITOFFSET_POS);
Kojto 122:f9eeca106725 852 }
Kojto 122:f9eeca106725 853
Kojto 122:f9eeca106725 854 /**
Kojto 122:f9eeca106725 855 * @}
Kojto 122:f9eeca106725 856 */
Kojto 122:f9eeca106725 857
Kojto 122:f9eeca106725 858 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 859 /** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions
Kojto 122:f9eeca106725 860 * @{
Kojto 122:f9eeca106725 861 */
Kojto 122:f9eeca106725 862
Kojto 122:f9eeca106725 863 ErrorStatus LL_COMP_DeInit(COMP_TypeDef *COMPx);
Kojto 122:f9eeca106725 864 ErrorStatus LL_COMP_Init(COMP_TypeDef *COMPx, LL_COMP_InitTypeDef *COMP_InitStruct);
Kojto 122:f9eeca106725 865 void LL_COMP_StructInit(LL_COMP_InitTypeDef *COMP_InitStruct);
Kojto 122:f9eeca106725 866
Kojto 122:f9eeca106725 867 /**
Kojto 122:f9eeca106725 868 * @}
Kojto 122:f9eeca106725 869 */
Kojto 122:f9eeca106725 870 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 871
Kojto 122:f9eeca106725 872 /**
Kojto 122:f9eeca106725 873 * @}
Kojto 122:f9eeca106725 874 */
Kojto 122:f9eeca106725 875
Kojto 122:f9eeca106725 876 /**
Kojto 122:f9eeca106725 877 * @}
Kojto 122:f9eeca106725 878 */
Kojto 122:f9eeca106725 879
Kojto 122:f9eeca106725 880 #endif /* COMP1 || COMP2 */
Kojto 122:f9eeca106725 881
Kojto 122:f9eeca106725 882 /**
Kojto 122:f9eeca106725 883 * @}
Kojto 122:f9eeca106725 884 */
Kojto 122:f9eeca106725 885
Kojto 122:f9eeca106725 886 #ifdef __cplusplus
Kojto 122:f9eeca106725 887 }
Kojto 122:f9eeca106725 888 #endif
Kojto 122:f9eeca106725 889
Kojto 122:f9eeca106725 890 #endif /* __STM32L4xx_LL_COMP_H */
Kojto 122:f9eeca106725 891
Kojto 122:f9eeca106725 892 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/