Hal Drivers for L4
Dependents: BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo
Fork of STM32L4xx_HAL_Driver by
Inc/stm32l4xx_ll_comp.h@2:7aef7655b0a8, 2015-11-25 (annotated)
- Committer:
- EricLew
- Date:
- Wed Nov 25 17:30:43 2015 +0000
- Revision:
- 2:7aef7655b0a8
- Parent:
- 0:80ee8f3b695e
commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EricLew | 0:80ee8f3b695e | 1 | /** |
EricLew | 0:80ee8f3b695e | 2 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 3 | * @file stm32l4xx_ll_comp.h |
EricLew | 0:80ee8f3b695e | 4 | * @author MCD Application Team |
EricLew | 0:80ee8f3b695e | 5 | * @version V1.1.0 |
EricLew | 0:80ee8f3b695e | 6 | * @date 16-September-2015 |
EricLew | 0:80ee8f3b695e | 7 | * @brief Header file of COMP LL module. |
EricLew | 0:80ee8f3b695e | 8 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 9 | * @attention |
EricLew | 0:80ee8f3b695e | 10 | * |
EricLew | 0:80ee8f3b695e | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
EricLew | 0:80ee8f3b695e | 12 | * |
EricLew | 0:80ee8f3b695e | 13 | * Redistribution and use in source and binary forms, with or without modification, |
EricLew | 0:80ee8f3b695e | 14 | * are permitted provided that the following conditions are met: |
EricLew | 0:80ee8f3b695e | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
EricLew | 0:80ee8f3b695e | 16 | * this list of conditions and the following disclaimer. |
EricLew | 0:80ee8f3b695e | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
EricLew | 0:80ee8f3b695e | 18 | * this list of conditions and the following disclaimer in the documentation |
EricLew | 0:80ee8f3b695e | 19 | * and/or other materials provided with the distribution. |
EricLew | 0:80ee8f3b695e | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
EricLew | 0:80ee8f3b695e | 21 | * may be used to endorse or promote products derived from this software |
EricLew | 0:80ee8f3b695e | 22 | * without specific prior written permission. |
EricLew | 0:80ee8f3b695e | 23 | * |
EricLew | 0:80ee8f3b695e | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
EricLew | 0:80ee8f3b695e | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
EricLew | 0:80ee8f3b695e | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
EricLew | 0:80ee8f3b695e | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
EricLew | 0:80ee8f3b695e | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
EricLew | 0:80ee8f3b695e | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
EricLew | 0:80ee8f3b695e | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
EricLew | 0:80ee8f3b695e | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
EricLew | 0:80ee8f3b695e | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
EricLew | 0:80ee8f3b695e | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
EricLew | 0:80ee8f3b695e | 34 | * |
EricLew | 0:80ee8f3b695e | 35 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 36 | */ |
EricLew | 0:80ee8f3b695e | 37 | |
EricLew | 0:80ee8f3b695e | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 39 | #ifndef __STM32L4xx_LL_COMP_H |
EricLew | 0:80ee8f3b695e | 40 | #define __STM32L4xx_LL_COMP_H |
EricLew | 0:80ee8f3b695e | 41 | |
EricLew | 0:80ee8f3b695e | 42 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 43 | extern "C" { |
EricLew | 0:80ee8f3b695e | 44 | #endif |
EricLew | 0:80ee8f3b695e | 45 | |
EricLew | 0:80ee8f3b695e | 46 | /* Includes ------------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 47 | #include "stm32l4xx.h" |
EricLew | 0:80ee8f3b695e | 48 | |
EricLew | 0:80ee8f3b695e | 49 | /** @addtogroup STM32L4xx_LL_Driver |
EricLew | 0:80ee8f3b695e | 50 | * @{ |
EricLew | 0:80ee8f3b695e | 51 | */ |
EricLew | 0:80ee8f3b695e | 52 | |
EricLew | 0:80ee8f3b695e | 53 | #if defined (COMP1) || defined (COMP2) |
EricLew | 0:80ee8f3b695e | 54 | |
EricLew | 0:80ee8f3b695e | 55 | /** @defgroup COMP_LL COMP |
EricLew | 0:80ee8f3b695e | 56 | * @{ |
EricLew | 0:80ee8f3b695e | 57 | */ |
EricLew | 0:80ee8f3b695e | 58 | |
EricLew | 0:80ee8f3b695e | 59 | /* Private types -------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 60 | /* Private variables ---------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 61 | |
EricLew | 0:80ee8f3b695e | 62 | /* Private constants ---------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 63 | |
EricLew | 0:80ee8f3b695e | 64 | /* Private macros ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 65 | |
EricLew | 0:80ee8f3b695e | 66 | /* Exported types ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 67 | /* Exported constants --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 68 | |
EricLew | 0:80ee8f3b695e | 69 | /** @defgroup COMP_LL_Exported_Constants COMP Exported Constants |
EricLew | 0:80ee8f3b695e | 70 | * @{ |
EricLew | 0:80ee8f3b695e | 71 | */ |
EricLew | 0:80ee8f3b695e | 72 | |
EricLew | 0:80ee8f3b695e | 73 | |
EricLew | 0:80ee8f3b695e | 74 | /** @defgroup COMP_LL_EC_POWERMODE POWERMODE |
EricLew | 0:80ee8f3b695e | 75 | * @{ |
EricLew | 0:80ee8f3b695e | 76 | */ |
EricLew | 0:80ee8f3b695e | 77 | #define LL_COMP_POWERMODE_HIGHSPEED ((uint32_t)0x00000000) /*!< High speed */ |
EricLew | 0:80ee8f3b695e | 78 | #define LL_COMP_POWERMODE_MEDIUMSPEED (COMP_CSR_PWRMODE_0) /*!< Medium speed */ |
EricLew | 0:80ee8f3b695e | 79 | #define LL_COMP_POWERMODE_ULTRALOWPOWER (COMP_CSR_PWRMODE_1 | COMP_CSR_PWRMODE_0) /*!< Ultra-low power mode */ |
EricLew | 0:80ee8f3b695e | 80 | /** |
EricLew | 0:80ee8f3b695e | 81 | * @} |
EricLew | 0:80ee8f3b695e | 82 | */ |
EricLew | 0:80ee8f3b695e | 83 | |
EricLew | 0:80ee8f3b695e | 84 | /** @defgroup COMP_LL_EC_WINDOWMODE WINDOWMODE |
EricLew | 0:80ee8f3b695e | 85 | * @{ |
EricLew | 0:80ee8f3b695e | 86 | */ |
EricLew | 0:80ee8f3b695e | 87 | #define LL_COMP_WINDOWMODE_DISABLE ((uint32_t)0x00000000) /*!< Window mode disable: Comparators 1 and 2 are independent (no input connection) */ |
EricLew | 0:80ee8f3b695e | 88 | #define LL_COMP_WINDOWMODE_ENABLE (COMP_CSR_WINMODE) /*!< Window mode enable: Comparators 1 and 2 have their input non-inverting connected together. The common input to be used is the one of COMP2, COMP1 non-inverting input is no more accessible. */ |
EricLew | 0:80ee8f3b695e | 89 | /** |
EricLew | 0:80ee8f3b695e | 90 | * @} |
EricLew | 0:80ee8f3b695e | 91 | */ |
EricLew | 0:80ee8f3b695e | 92 | |
EricLew | 0:80ee8f3b695e | 93 | /** @defgroup COMP_LL_EC_INVERTINGINPUT INVERTINGINPUT |
EricLew | 0:80ee8f3b695e | 94 | * @{ |
EricLew | 0:80ee8f3b695e | 95 | */ |
EricLew | 0:80ee8f3b695e | 96 | #define LL_COMP_INVERTINGINPUT_1_4VREFINT ( COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< 1/4 VREFINT connected to comparator inverting input */ |
EricLew | 0:80ee8f3b695e | 97 | #define LL_COMP_INVERTINGINPUT_1_2VREFINT ( COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< 1/2 VREFINT connected to comparator inverting input */ |
EricLew | 0:80ee8f3b695e | 98 | #define LL_COMP_INVERTINGINPUT_3_4VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_SCALEN | COMP_CSR_BRGEN) /*!< 3/4 VREFINT connected to comparator inverting input */ |
EricLew | 0:80ee8f3b695e | 99 | #define LL_COMP_INVERTINGINPUT_VREFINT ( COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0 | COMP_CSR_SCALEN ) /*!< VREFINT connected to comparator1 inverting input */ |
EricLew | 0:80ee8f3b695e | 100 | #define LL_COMP_INVERTINGINPUT_DAC1 (COMP_CSR_INMSEL_2 ) /*!< DAC_OUT1 connected to comparator inverting input */ |
EricLew | 0:80ee8f3b695e | 101 | #define LL_COMP_INVERTINGINPUT_DAC2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0) /*!< DAC_OUT2 connected to comparator inverting input */ |
EricLew | 0:80ee8f3b695e | 102 | #define LL_COMP_INVERTINGINPUT_IO1 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 ) /*!< IO1 connected to comparator inverting input. On STM32L4: pin PB1 for COMP1, pin PB3 for COMP2. */ |
EricLew | 0:80ee8f3b695e | 103 | #define LL_COMP_INVERTINGINPUT_IO2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< IO2 connected to comparator inverting input. On STM32L4: pin PC4 for COMP1, pin PB7 for COMP2. */ |
EricLew | 0:80ee8f3b695e | 104 | /** |
EricLew | 0:80ee8f3b695e | 105 | * @} |
EricLew | 0:80ee8f3b695e | 106 | */ |
EricLew | 0:80ee8f3b695e | 107 | |
EricLew | 0:80ee8f3b695e | 108 | /** @defgroup COMP_LL_EC_NONINVERTINGINPUT NONINVERTINGINPUT |
EricLew | 0:80ee8f3b695e | 109 | * @{ |
EricLew | 0:80ee8f3b695e | 110 | */ |
EricLew | 0:80ee8f3b695e | 111 | #define LL_COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< IO1 connected to comparator non inverting input. On STM32L4: pin PC5 for COMP1, pin PB4 for COMP2. */ |
EricLew | 0:80ee8f3b695e | 112 | #define LL_COMP_NONINVERTINGINPUT_IO2 (COMP_CSR_INPSEL) /*!< IO2 connected to comparator non inverting input. On STM32L4: pin PB2 for COMP1, pin PB6 for COMP2. */ |
EricLew | 0:80ee8f3b695e | 113 | /** |
EricLew | 0:80ee8f3b695e | 114 | * @} |
EricLew | 0:80ee8f3b695e | 115 | */ |
EricLew | 0:80ee8f3b695e | 116 | |
EricLew | 0:80ee8f3b695e | 117 | /** @defgroup COMP_LL_EC_HYSTERESIS HYSTERESIS |
EricLew | 0:80ee8f3b695e | 118 | * @{ |
EricLew | 0:80ee8f3b695e | 119 | */ |
EricLew | 0:80ee8f3b695e | 120 | #define LL_COMP_HYSTERESIS_NONE ((uint32_t)0x00000000) /*!< No hysteresis */ |
EricLew | 0:80ee8f3b695e | 121 | #define LL_COMP_HYSTERESIS_LOW ( COMP_CSR_HYST_0) /*!< Hysteresis level low */ |
EricLew | 0:80ee8f3b695e | 122 | #define LL_COMP_HYSTERESIS_MEDIUM (COMP_CSR_HYST_1 ) /*!< Hysteresis level medium */ |
EricLew | 0:80ee8f3b695e | 123 | #define LL_COMP_HYSTERESIS_HIGH (COMP_CSR_HYST_1 | COMP_CSR_HYST_0) /*!< Hysteresis level high */ |
EricLew | 0:80ee8f3b695e | 124 | /** |
EricLew | 0:80ee8f3b695e | 125 | * @} |
EricLew | 0:80ee8f3b695e | 126 | */ |
EricLew | 0:80ee8f3b695e | 127 | |
EricLew | 0:80ee8f3b695e | 128 | /** @defgroup COMP_LL_EC_OUTPUTPOL OUTPUTPOL |
EricLew | 0:80ee8f3b695e | 129 | * @{ |
EricLew | 0:80ee8f3b695e | 130 | */ |
EricLew | 0:80ee8f3b695e | 131 | #define LL_COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000) /*!< COMP output polarity is not inverted: comparator output is high when the non-inverting input is at a higher voltage than the inverting input */ |
EricLew | 0:80ee8f3b695e | 132 | #define LL_COMP_OUTPUTPOL_INVERTED (COMP_CSR_POLARITY) /*!< COMP output polarity is inverted: comparator output is low when the non-inverting input is at a lower voltage than the inverting input */ |
EricLew | 0:80ee8f3b695e | 133 | /** |
EricLew | 0:80ee8f3b695e | 134 | * @} |
EricLew | 0:80ee8f3b695e | 135 | */ |
EricLew | 0:80ee8f3b695e | 136 | |
EricLew | 0:80ee8f3b695e | 137 | /** @defgroup COMP_LL_EC_BLANKINGSRC BLANKINGSRC |
EricLew | 0:80ee8f3b695e | 138 | * @{ |
EricLew | 0:80ee8f3b695e | 139 | */ |
EricLew | 0:80ee8f3b695e | 140 | #define LL_COMP_BLANKINGSRC_NONE ((uint32_t)0x00000000) /*!< No blanking source */ |
EricLew | 0:80ee8f3b695e | 141 | #define LL_COMP_BLANKINGSRC_TIM1_OC5 (COMP_CSR_BLANKING_0) /*!< Blanking source for COMP1: TIM1 OC5 selected as blanking source for comparator */ |
EricLew | 0:80ee8f3b695e | 142 | #define LL_COMP_BLANKINGSRC_TIM2_OC3 (COMP_CSR_BLANKING_1) /*!< Blanking source for COMP1: TIM2 OC3 selected as blanking source for comparator */ |
EricLew | 0:80ee8f3b695e | 143 | #define LL_COMP_BLANKINGSRC_TIM3_OC3 (COMP_CSR_BLANKING_2) /*!< Blanking source for COMP1: TIM3 OC3 selected as blanking source for compartor */ |
EricLew | 0:80ee8f3b695e | 144 | #define LL_COMP_BLANKINGSRC_TIM3_OC4 (COMP_CSR_BLANKING_0) /*!< Blanking source for COMP2: TIM3 OC4 selected as blanking source for comparator */ |
EricLew | 0:80ee8f3b695e | 145 | #define LL_COMP_BLANKINGSRC_TIM8_OC5 (COMP_CSR_BLANKING_1) /*!< Blanking source for COMP2: TIM8 OC5 selected as blanking source for comparator */ |
EricLew | 0:80ee8f3b695e | 146 | #define LL_COMP_BLANKINGSRC_TIM15_OC1 (COMP_CSR_BLANKING_2) /*!< Blanking source for COMP2: TIM15 OC1 selected as blanking source for comparator */ |
EricLew | 0:80ee8f3b695e | 147 | /** |
EricLew | 0:80ee8f3b695e | 148 | * @} |
EricLew | 0:80ee8f3b695e | 149 | */ |
EricLew | 0:80ee8f3b695e | 150 | |
EricLew | 0:80ee8f3b695e | 151 | /** @defgroup COMP_LL_EC_OUTPUT_LEVEL OUTPUT LEVEL |
EricLew | 0:80ee8f3b695e | 152 | * @{ |
EricLew | 0:80ee8f3b695e | 153 | */ |
EricLew | 0:80ee8f3b695e | 154 | #define LL_COMP_OUTPUT_LEVEL_LOW (0x00000000) /*!< Comparator output level low (if the polarity is not inverted, otherwise to be complemented) */ |
EricLew | 0:80ee8f3b695e | 155 | #define LL_COMP_OUTPUT_LEVEL_HIGH (COMP_CSR_VALUE) /*!< Comparator output level high (if the polarity is not inverted, otherwise to be complemented) */ |
EricLew | 0:80ee8f3b695e | 156 | /** |
EricLew | 0:80ee8f3b695e | 157 | * @} |
EricLew | 0:80ee8f3b695e | 158 | */ |
EricLew | 0:80ee8f3b695e | 159 | |
EricLew | 0:80ee8f3b695e | 160 | /** |
EricLew | 0:80ee8f3b695e | 161 | * @} |
EricLew | 0:80ee8f3b695e | 162 | */ |
EricLew | 0:80ee8f3b695e | 163 | |
EricLew | 0:80ee8f3b695e | 164 | /* Exported macro ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 165 | /** @defgroup COMP_LL_Exported_Macros COMP Exported Macros |
EricLew | 0:80ee8f3b695e | 166 | * @{ |
EricLew | 0:80ee8f3b695e | 167 | */ |
EricLew | 0:80ee8f3b695e | 168 | /** @defgroup COMP_LL_EM_WRITE_READ Common Write and read registers macro |
EricLew | 0:80ee8f3b695e | 169 | * @{ |
EricLew | 0:80ee8f3b695e | 170 | */ |
EricLew | 0:80ee8f3b695e | 171 | /** |
EricLew | 0:80ee8f3b695e | 172 | * @brief Write a value in COMP register |
EricLew | 0:80ee8f3b695e | 173 | * @param __INSTANCE__ comparator instance |
EricLew | 0:80ee8f3b695e | 174 | * @param __REG__ Register to be written |
EricLew | 0:80ee8f3b695e | 175 | * @param __VALUE__ Value to be written in the register |
EricLew | 0:80ee8f3b695e | 176 | * @retval None |
EricLew | 0:80ee8f3b695e | 177 | */ |
EricLew | 0:80ee8f3b695e | 178 | #define LL_COMP_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
EricLew | 0:80ee8f3b695e | 179 | |
EricLew | 0:80ee8f3b695e | 180 | /** |
EricLew | 0:80ee8f3b695e | 181 | * @brief Read a value in COMP register |
EricLew | 0:80ee8f3b695e | 182 | * @param __INSTANCE__ comparator instance |
EricLew | 0:80ee8f3b695e | 183 | * @param __REG__ Register to be read |
EricLew | 0:80ee8f3b695e | 184 | * @retval Register value |
EricLew | 0:80ee8f3b695e | 185 | */ |
EricLew | 0:80ee8f3b695e | 186 | #define LL_COMP_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
EricLew | 0:80ee8f3b695e | 187 | /** |
EricLew | 0:80ee8f3b695e | 188 | * @} |
EricLew | 0:80ee8f3b695e | 189 | */ |
EricLew | 0:80ee8f3b695e | 190 | |
EricLew | 0:80ee8f3b695e | 191 | |
EricLew | 0:80ee8f3b695e | 192 | /** |
EricLew | 0:80ee8f3b695e | 193 | * @} |
EricLew | 0:80ee8f3b695e | 194 | */ |
EricLew | 0:80ee8f3b695e | 195 | |
EricLew | 0:80ee8f3b695e | 196 | /* Exported functions --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 197 | /** @defgroup COMP_LL_Exported_Functions COMP Exported Functions |
EricLew | 0:80ee8f3b695e | 198 | * @{ |
EricLew | 0:80ee8f3b695e | 199 | */ |
EricLew | 0:80ee8f3b695e | 200 | /** @defgroup COMP_LL_EF_Configuration_comparator_modes Configuration of comparator modes |
EricLew | 0:80ee8f3b695e | 201 | * @{ |
EricLew | 0:80ee8f3b695e | 202 | */ |
EricLew | 0:80ee8f3b695e | 203 | /** |
EricLew | 0:80ee8f3b695e | 204 | * @brief Set comparator instance operating mode to adjust power and speed. |
EricLew | 0:80ee8f3b695e | 205 | * @rmtoll CSR PWRMODE LL_COMP_SetPowerMode |
EricLew | 0:80ee8f3b695e | 206 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 207 | * @param PowerMode This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 208 | * @arg @ref LL_COMP_POWERMODE_HIGHSPEED |
EricLew | 0:80ee8f3b695e | 209 | * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED |
EricLew | 0:80ee8f3b695e | 210 | * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER |
EricLew | 0:80ee8f3b695e | 211 | * @retval None |
EricLew | 0:80ee8f3b695e | 212 | */ |
EricLew | 0:80ee8f3b695e | 213 | __STATIC_INLINE void LL_COMP_SetPowerMode(COMP_TypeDef *COMPx, uint32_t PowerMode) |
EricLew | 0:80ee8f3b695e | 214 | { |
EricLew | 0:80ee8f3b695e | 215 | MODIFY_REG(COMPx->CSR, COMP_CSR_PWRMODE, PowerMode); |
EricLew | 0:80ee8f3b695e | 216 | } |
EricLew | 0:80ee8f3b695e | 217 | |
EricLew | 0:80ee8f3b695e | 218 | /** |
EricLew | 0:80ee8f3b695e | 219 | * @brief Get comparator instance operating mode to adjust power and speed. |
EricLew | 0:80ee8f3b695e | 220 | * @rmtoll CSR PWRMODE LL_COMP_GetPowerMode |
EricLew | 0:80ee8f3b695e | 221 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 222 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 223 | * @arg @ref LL_COMP_POWERMODE_HIGHSPEED |
EricLew | 0:80ee8f3b695e | 224 | * @arg @ref LL_COMP_POWERMODE_MEDIUMSPEED |
EricLew | 0:80ee8f3b695e | 225 | * @arg @ref LL_COMP_POWERMODE_ULTRALOWPOWER |
EricLew | 0:80ee8f3b695e | 226 | */ |
EricLew | 0:80ee8f3b695e | 227 | __STATIC_INLINE uint32_t LL_COMP_GetPowerMode(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 228 | { |
EricLew | 0:80ee8f3b695e | 229 | return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_PWRMODE)); |
EricLew | 0:80ee8f3b695e | 230 | } |
EricLew | 0:80ee8f3b695e | 231 | |
EricLew | 0:80ee8f3b695e | 232 | /** |
EricLew | 0:80ee8f3b695e | 233 | * @brief Set window mode of the comparators. |
EricLew | 0:80ee8f3b695e | 234 | * @rmtoll CSR WINMODE LL_COMP_SetWindowMode |
EricLew | 0:80ee8f3b695e | 235 | * @param COMPx Comparator instance. |
EricLew | 0:80ee8f3b695e | 236 | * On this STM32 family, window mode can be set only from COMP instance: COMP2. |
EricLew | 0:80ee8f3b695e | 237 | * @param WindowMode This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 238 | * @arg @ref LL_COMP_WINDOWMODE_DISABLE |
EricLew | 0:80ee8f3b695e | 239 | * @arg @ref LL_COMP_WINDOWMODE_ENABLE |
EricLew | 0:80ee8f3b695e | 240 | * @retval None |
EricLew | 0:80ee8f3b695e | 241 | */ |
EricLew | 0:80ee8f3b695e | 242 | __STATIC_INLINE void LL_COMP_SetWindowMode(COMP_TypeDef *COMPx, uint32_t WindowMode) |
EricLew | 0:80ee8f3b695e | 243 | { |
EricLew | 0:80ee8f3b695e | 244 | MODIFY_REG(COMPx->CSR, COMP_CSR_WINMODE, WindowMode); |
EricLew | 0:80ee8f3b695e | 245 | } |
EricLew | 0:80ee8f3b695e | 246 | |
EricLew | 0:80ee8f3b695e | 247 | /** |
EricLew | 0:80ee8f3b695e | 248 | * @brief Get window mode of the comparators. |
EricLew | 0:80ee8f3b695e | 249 | * @rmtoll CSR WINMODE LL_COMP_GetWindowMode |
EricLew | 0:80ee8f3b695e | 250 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 251 | * On this STM32 family, window mode can be set only from COMP instance: COMP2. |
EricLew | 0:80ee8f3b695e | 252 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 253 | * @arg @ref LL_COMP_WINDOWMODE_DISABLE |
EricLew | 0:80ee8f3b695e | 254 | * @arg @ref LL_COMP_WINDOWMODE_ENABLE |
EricLew | 0:80ee8f3b695e | 255 | */ |
EricLew | 0:80ee8f3b695e | 256 | __STATIC_INLINE uint32_t LL_COMP_GetWindowMode(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 257 | { |
EricLew | 0:80ee8f3b695e | 258 | return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_WINMODE)); |
EricLew | 0:80ee8f3b695e | 259 | } |
EricLew | 0:80ee8f3b695e | 260 | |
EricLew | 0:80ee8f3b695e | 261 | /** |
EricLew | 0:80ee8f3b695e | 262 | * @} |
EricLew | 0:80ee8f3b695e | 263 | */ |
EricLew | 0:80ee8f3b695e | 264 | |
EricLew | 0:80ee8f3b695e | 265 | /** @defgroup COMP_LL_EF_Configuration_comparator_inputs Configuration of comparator inputs |
EricLew | 0:80ee8f3b695e | 266 | * @{ |
EricLew | 0:80ee8f3b695e | 267 | */ |
EricLew | 0:80ee8f3b695e | 268 | /** |
EricLew | 0:80ee8f3b695e | 269 | * @brief Set COMP inputs inverting and non-inverting. |
EricLew | 0:80ee8f3b695e | 270 | * @note In case of comparator input selected to be connected to IO: |
EricLew | 0:80ee8f3b695e | 271 | * IP pins are specific to each comparator instance. |
EricLew | 0:80ee8f3b695e | 272 | * Refer to description of parameters or to reference manual. |
EricLew | 0:80ee8f3b695e | 273 | * @note On STM32L4, scaler bridge is configurable: |
EricLew | 0:80ee8f3b695e | 274 | * to optimize power consumption, this function enables the |
EricLew | 0:80ee8f3b695e | 275 | * voltage scaler bridge only when required (comparator input |
EricLew | 0:80ee8f3b695e | 276 | * based on VrefInt). |
EricLew | 0:80ee8f3b695e | 277 | * The scaler bridge is common for all comparator instances, |
EricLew | 0:80ee8f3b695e | 278 | * therefore if at least one of the comparator instance |
EricLew | 0:80ee8f3b695e | 279 | * is requiring the scaler bridge, it remains enabled. |
EricLew | 0:80ee8f3b695e | 280 | * @rmtoll CSR INMSEL LL_COMP_ConfigInputs\n |
EricLew | 0:80ee8f3b695e | 281 | * CSR INPSEL LL_COMP_ConfigInputs\n |
EricLew | 0:80ee8f3b695e | 282 | * CSR BRGEN LL_COMP_ConfigInputs\n |
EricLew | 0:80ee8f3b695e | 283 | * CSR SCALEN LL_COMP_ConfigInputs |
EricLew | 0:80ee8f3b695e | 284 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 285 | * @param InputInverting This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 286 | * @arg @ref LL_COMP_INVERTINGINPUT_1_4VREFINT |
EricLew | 0:80ee8f3b695e | 287 | * @arg @ref LL_COMP_INVERTINGINPUT_1_2VREFINT |
EricLew | 0:80ee8f3b695e | 288 | * @arg @ref LL_COMP_INVERTINGINPUT_3_4VREFINT |
EricLew | 0:80ee8f3b695e | 289 | * @arg @ref LL_COMP_INVERTINGINPUT_VREFINT |
EricLew | 0:80ee8f3b695e | 290 | * @arg @ref LL_COMP_INVERTINGINPUT_DAC1 |
EricLew | 0:80ee8f3b695e | 291 | * @arg @ref LL_COMP_INVERTINGINPUT_DAC2 |
EricLew | 0:80ee8f3b695e | 292 | * @arg @ref LL_COMP_INVERTINGINPUT_IO1 |
EricLew | 0:80ee8f3b695e | 293 | * @arg @ref LL_COMP_INVERTINGINPUT_IO2 |
EricLew | 0:80ee8f3b695e | 294 | * @param InputNonInverting This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 295 | * @arg @ref LL_COMP_NONINVERTINGINPUT_IO1 |
EricLew | 0:80ee8f3b695e | 296 | * @arg @ref LL_COMP_NONINVERTINGINPUT_IO2 |
EricLew | 0:80ee8f3b695e | 297 | * @retval None |
EricLew | 0:80ee8f3b695e | 298 | */ |
EricLew | 0:80ee8f3b695e | 299 | __STATIC_INLINE void LL_COMP_ConfigInputs(COMP_TypeDef *COMPx, uint32_t InputInverting, uint32_t InputNonInverting) |
EricLew | 0:80ee8f3b695e | 300 | { |
EricLew | 0:80ee8f3b695e | 301 | MODIFY_REG(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_INPSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN, InputInverting | InputNonInverting); |
EricLew | 0:80ee8f3b695e | 302 | } |
EricLew | 0:80ee8f3b695e | 303 | |
EricLew | 0:80ee8f3b695e | 304 | /** |
EricLew | 0:80ee8f3b695e | 305 | * @brief Set COMP inputs non-inverting. |
EricLew | 0:80ee8f3b695e | 306 | * @note In case of comparator input selected to be connected to IO: |
EricLew | 0:80ee8f3b695e | 307 | * IP pins are specific to each comparator instance. |
EricLew | 0:80ee8f3b695e | 308 | * Refer to description of parameters or to reference manual. |
EricLew | 0:80ee8f3b695e | 309 | * @rmtoll CSR INMSEL LL_COMP_SetInputInverting |
EricLew | 0:80ee8f3b695e | 310 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 311 | * @param InputNonInverting This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 312 | * @arg @ref LL_COMP_NONINVERTINGINPUT_IO1 |
EricLew | 0:80ee8f3b695e | 313 | * @arg @ref LL_COMP_NONINVERTINGINPUT_IO2 |
EricLew | 0:80ee8f3b695e | 314 | * @retval None |
EricLew | 0:80ee8f3b695e | 315 | */ |
EricLew | 0:80ee8f3b695e | 316 | __STATIC_INLINE void LL_COMP_SetInputNonInverting(COMP_TypeDef *COMPx, uint32_t InputNonInverting) |
EricLew | 0:80ee8f3b695e | 317 | { |
EricLew | 0:80ee8f3b695e | 318 | MODIFY_REG(COMPx->CSR, COMP_CSR_INPSEL, InputNonInverting); |
EricLew | 0:80ee8f3b695e | 319 | } |
EricLew | 0:80ee8f3b695e | 320 | |
EricLew | 0:80ee8f3b695e | 321 | /** |
EricLew | 0:80ee8f3b695e | 322 | * @brief Get COMP input non-inverting. |
EricLew | 0:80ee8f3b695e | 323 | * @note In case of comparator input selected to be connected to IO: |
EricLew | 0:80ee8f3b695e | 324 | * IP pins are specific to each comparator instance. |
EricLew | 0:80ee8f3b695e | 325 | * Refer to description of parameters or to reference manual. |
EricLew | 0:80ee8f3b695e | 326 | * @rmtoll CSR INMSEL LL_COMP_GetInputInverting |
EricLew | 0:80ee8f3b695e | 327 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 328 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 329 | * @arg @ref LL_COMP_NONINVERTINGINPUT_IO1 |
EricLew | 0:80ee8f3b695e | 330 | * @arg @ref LL_COMP_NONINVERTINGINPUT_IO2 |
EricLew | 0:80ee8f3b695e | 331 | */ |
EricLew | 0:80ee8f3b695e | 332 | __STATIC_INLINE uint32_t LL_COMP_GetInputNonInverting(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 333 | { |
EricLew | 0:80ee8f3b695e | 334 | return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INPSEL)); |
EricLew | 0:80ee8f3b695e | 335 | } |
EricLew | 0:80ee8f3b695e | 336 | |
EricLew | 0:80ee8f3b695e | 337 | /** |
EricLew | 0:80ee8f3b695e | 338 | * @brief Set COMP input inverting. |
EricLew | 0:80ee8f3b695e | 339 | * @note In case of comparator input selected to be connected to IO: |
EricLew | 0:80ee8f3b695e | 340 | * IP pins are specific to each comparator instance. |
EricLew | 0:80ee8f3b695e | 341 | * Refer to description of parameters or to reference manual. |
EricLew | 0:80ee8f3b695e | 342 | * @note On STM32L4, scaler bridge is configurable: |
EricLew | 0:80ee8f3b695e | 343 | * to optimize power consumption, this function enables the |
EricLew | 0:80ee8f3b695e | 344 | * voltage scaler bridge only when required (comparator input |
EricLew | 0:80ee8f3b695e | 345 | * based on VrefInt). |
EricLew | 0:80ee8f3b695e | 346 | * The scaler bridge is common for all comparator instances, |
EricLew | 0:80ee8f3b695e | 347 | * therefore if at least one of the comparator instance |
EricLew | 0:80ee8f3b695e | 348 | * is requiring the scaler bridge, it remains enabled. |
EricLew | 0:80ee8f3b695e | 349 | * @rmtoll CSR INPSEL LL_COMP_SetInputNonInverting\n |
EricLew | 0:80ee8f3b695e | 350 | * CSR BRGEN LL_COMP_SetInputNonInverting\n |
EricLew | 0:80ee8f3b695e | 351 | * CSR SCALEN LL_COMP_SetInputNonInverting |
EricLew | 0:80ee8f3b695e | 352 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 353 | * @param InputInverting This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 354 | * @arg @ref LL_COMP_INVERTINGINPUT_1_4VREFINT |
EricLew | 0:80ee8f3b695e | 355 | * @arg @ref LL_COMP_INVERTINGINPUT_1_2VREFINT |
EricLew | 0:80ee8f3b695e | 356 | * @arg @ref LL_COMP_INVERTINGINPUT_3_4VREFINT |
EricLew | 0:80ee8f3b695e | 357 | * @arg @ref LL_COMP_INVERTINGINPUT_VREFINT |
EricLew | 0:80ee8f3b695e | 358 | * @arg @ref LL_COMP_INVERTINGINPUT_DAC1 |
EricLew | 0:80ee8f3b695e | 359 | * @arg @ref LL_COMP_INVERTINGINPUT_DAC2 |
EricLew | 0:80ee8f3b695e | 360 | * @arg @ref LL_COMP_INVERTINGINPUT_IO1 |
EricLew | 0:80ee8f3b695e | 361 | * @arg @ref LL_COMP_INVERTINGINPUT_IO2 |
EricLew | 0:80ee8f3b695e | 362 | * @retval None |
EricLew | 0:80ee8f3b695e | 363 | */ |
EricLew | 0:80ee8f3b695e | 364 | __STATIC_INLINE void LL_COMP_SetInputInverting(COMP_TypeDef *COMPx, uint32_t InputInverting) |
EricLew | 0:80ee8f3b695e | 365 | { |
EricLew | 0:80ee8f3b695e | 366 | MODIFY_REG(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN, InputInverting); |
EricLew | 0:80ee8f3b695e | 367 | } |
EricLew | 0:80ee8f3b695e | 368 | |
EricLew | 0:80ee8f3b695e | 369 | /** |
EricLew | 0:80ee8f3b695e | 370 | * @brief Get COMP input inverting. |
EricLew | 0:80ee8f3b695e | 371 | * @note In case of comparator input selected to be connected to IO: |
EricLew | 0:80ee8f3b695e | 372 | * IP pins are specific to each comparator instance. |
EricLew | 0:80ee8f3b695e | 373 | * Refer to description of parameters or to reference manual. |
EricLew | 0:80ee8f3b695e | 374 | * @rmtoll CSR INPSEL LL_COMP_GetInputNonInverting\n |
EricLew | 0:80ee8f3b695e | 375 | * CSR BRGEN LL_COMP_GetInputNonInverting\n |
EricLew | 0:80ee8f3b695e | 376 | * CSR SCALEN LL_COMP_GetInputNonInverting |
EricLew | 0:80ee8f3b695e | 377 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 378 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 379 | * @arg @ref LL_COMP_INVERTINGINPUT_1_4VREFINT |
EricLew | 0:80ee8f3b695e | 380 | * @arg @ref LL_COMP_INVERTINGINPUT_1_2VREFINT |
EricLew | 0:80ee8f3b695e | 381 | * @arg @ref LL_COMP_INVERTINGINPUT_3_4VREFINT |
EricLew | 0:80ee8f3b695e | 382 | * @arg @ref LL_COMP_INVERTINGINPUT_VREFINT |
EricLew | 0:80ee8f3b695e | 383 | * @arg @ref LL_COMP_INVERTINGINPUT_DAC1 |
EricLew | 0:80ee8f3b695e | 384 | * @arg @ref LL_COMP_INVERTINGINPUT_DAC2 |
EricLew | 0:80ee8f3b695e | 385 | * @arg @ref LL_COMP_INVERTINGINPUT_IO1 |
EricLew | 0:80ee8f3b695e | 386 | * @arg @ref LL_COMP_INVERTINGINPUT_IO2 |
EricLew | 0:80ee8f3b695e | 387 | */ |
EricLew | 0:80ee8f3b695e | 388 | __STATIC_INLINE uint32_t LL_COMP_GetInputInverting(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 389 | { |
EricLew | 0:80ee8f3b695e | 390 | return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_INMSEL | COMP_CSR_SCALEN | COMP_CSR_BRGEN)); |
EricLew | 0:80ee8f3b695e | 391 | } |
EricLew | 0:80ee8f3b695e | 392 | |
EricLew | 0:80ee8f3b695e | 393 | /** |
EricLew | 0:80ee8f3b695e | 394 | * @brief Set comparator instance hysteresis mode of the inverting input. |
EricLew | 0:80ee8f3b695e | 395 | * @rmtoll CSR HYST LL_COMP_SetInputHysteresis |
EricLew | 0:80ee8f3b695e | 396 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 397 | * @param Hysteresis This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 398 | * @arg @ref LL_COMP_HYSTERESIS_NONE |
EricLew | 0:80ee8f3b695e | 399 | * @arg @ref LL_COMP_HYSTERESIS_LOW |
EricLew | 0:80ee8f3b695e | 400 | * @arg @ref LL_COMP_HYSTERESIS_MEDIUM |
EricLew | 0:80ee8f3b695e | 401 | * @arg @ref LL_COMP_HYSTERESIS_HIGH |
EricLew | 0:80ee8f3b695e | 402 | * @retval None |
EricLew | 0:80ee8f3b695e | 403 | */ |
EricLew | 0:80ee8f3b695e | 404 | __STATIC_INLINE void LL_COMP_SetInputHysteresis(COMP_TypeDef *COMPx, uint32_t Hysteresis) |
EricLew | 0:80ee8f3b695e | 405 | { |
EricLew | 0:80ee8f3b695e | 406 | MODIFY_REG(COMPx->CSR, COMP_CSR_HYST, Hysteresis); |
EricLew | 0:80ee8f3b695e | 407 | } |
EricLew | 0:80ee8f3b695e | 408 | |
EricLew | 0:80ee8f3b695e | 409 | /** |
EricLew | 0:80ee8f3b695e | 410 | * @brief Get comparator instance hysteresis mode of the inverting input. |
EricLew | 0:80ee8f3b695e | 411 | * @rmtoll CSR HYST LL_COMP_GetInputHysteresis |
EricLew | 0:80ee8f3b695e | 412 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 413 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 414 | * @arg @ref LL_COMP_HYSTERESIS_NONE |
EricLew | 0:80ee8f3b695e | 415 | * @arg @ref LL_COMP_HYSTERESIS_LOW |
EricLew | 0:80ee8f3b695e | 416 | * @arg @ref LL_COMP_HYSTERESIS_MEDIUM |
EricLew | 0:80ee8f3b695e | 417 | * @arg @ref LL_COMP_HYSTERESIS_HIGH |
EricLew | 0:80ee8f3b695e | 418 | */ |
EricLew | 0:80ee8f3b695e | 419 | __STATIC_INLINE uint32_t LL_COMP_GetInputHysteresis(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 420 | { |
EricLew | 0:80ee8f3b695e | 421 | return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_HYST)); |
EricLew | 0:80ee8f3b695e | 422 | } |
EricLew | 0:80ee8f3b695e | 423 | |
EricLew | 0:80ee8f3b695e | 424 | /** |
EricLew | 0:80ee8f3b695e | 425 | * @} |
EricLew | 0:80ee8f3b695e | 426 | */ |
EricLew | 0:80ee8f3b695e | 427 | |
EricLew | 0:80ee8f3b695e | 428 | /** @defgroup COMP_LL_EF_Configuration_comparator_output Configuration of comparator output |
EricLew | 0:80ee8f3b695e | 429 | * @{ |
EricLew | 0:80ee8f3b695e | 430 | */ |
EricLew | 0:80ee8f3b695e | 431 | /** |
EricLew | 0:80ee8f3b695e | 432 | * @brief Set comparator instance output polarity. |
EricLew | 0:80ee8f3b695e | 433 | * @rmtoll CSR POLARITY LL_COMP_SetOutputPolarity |
EricLew | 0:80ee8f3b695e | 434 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 435 | * @param Polarity This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 436 | * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED |
EricLew | 0:80ee8f3b695e | 437 | * @arg @ref LL_COMP_OUTPUTPOL_INVERTED |
EricLew | 0:80ee8f3b695e | 438 | * @retval None |
EricLew | 0:80ee8f3b695e | 439 | */ |
EricLew | 0:80ee8f3b695e | 440 | __STATIC_INLINE void LL_COMP_SetOutputPolarity(COMP_TypeDef *COMPx, uint32_t Polarity) |
EricLew | 0:80ee8f3b695e | 441 | { |
EricLew | 0:80ee8f3b695e | 442 | MODIFY_REG(COMPx->CSR, COMP_CSR_POLARITY, Polarity); |
EricLew | 0:80ee8f3b695e | 443 | } |
EricLew | 0:80ee8f3b695e | 444 | |
EricLew | 0:80ee8f3b695e | 445 | /** |
EricLew | 0:80ee8f3b695e | 446 | * @brief Get comparator instance output polarity. |
EricLew | 0:80ee8f3b695e | 447 | * @rmtoll CSR POLARITY LL_COMP_GetOutputPolarity |
EricLew | 0:80ee8f3b695e | 448 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 449 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 450 | * @arg @ref LL_COMP_OUTPUTPOL_NONINVERTED |
EricLew | 0:80ee8f3b695e | 451 | * @arg @ref LL_COMP_OUTPUTPOL_INVERTED |
EricLew | 0:80ee8f3b695e | 452 | */ |
EricLew | 0:80ee8f3b695e | 453 | __STATIC_INLINE uint32_t LL_COMP_GetOutputPolarity(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 454 | { |
EricLew | 0:80ee8f3b695e | 455 | return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_POLARITY)); |
EricLew | 0:80ee8f3b695e | 456 | } |
EricLew | 0:80ee8f3b695e | 457 | |
EricLew | 0:80ee8f3b695e | 458 | /** |
EricLew | 0:80ee8f3b695e | 459 | * @brief Set comparator instance blanking source. |
EricLew | 0:80ee8f3b695e | 460 | * @note Blanking source may be specific to each comparator instance. |
EricLew | 0:80ee8f3b695e | 461 | * Refer to description of parameters or to reference manual. |
EricLew | 0:80ee8f3b695e | 462 | * @rmtoll CSR BLANKING LL_COMP_SetOutputBlankingSource |
EricLew | 0:80ee8f3b695e | 463 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 464 | * @param BlankingSource This parameter can be one of the following values: |
EricLew | 0:80ee8f3b695e | 465 | * @arg @ref LL_COMP_BLANKINGSRC_NONE |
EricLew | 0:80ee8f3b695e | 466 | * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5 (1) |
EricLew | 0:80ee8f3b695e | 467 | * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3 (1) |
EricLew | 0:80ee8f3b695e | 468 | * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3 (1) |
EricLew | 0:80ee8f3b695e | 469 | * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4 (2) |
EricLew | 0:80ee8f3b695e | 470 | * @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5 (2) |
EricLew | 0:80ee8f3b695e | 471 | * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1 (2) |
EricLew | 0:80ee8f3b695e | 472 | * (1) On STM32L4, parameter available only on comparator instance: COMP1. |
EricLew | 0:80ee8f3b695e | 473 | * (2) On STM32L4, parameter available only on comparator instance: COMP2. |
EricLew | 0:80ee8f3b695e | 474 | * @retval None |
EricLew | 0:80ee8f3b695e | 475 | */ |
EricLew | 0:80ee8f3b695e | 476 | __STATIC_INLINE void LL_COMP_SetOutputBlankingSource(COMP_TypeDef *COMPx, uint32_t BlankingSource) |
EricLew | 0:80ee8f3b695e | 477 | { |
EricLew | 0:80ee8f3b695e | 478 | MODIFY_REG(COMPx->CSR, COMP_CSR_BLANKING, BlankingSource); |
EricLew | 0:80ee8f3b695e | 479 | } |
EricLew | 0:80ee8f3b695e | 480 | |
EricLew | 0:80ee8f3b695e | 481 | /** |
EricLew | 0:80ee8f3b695e | 482 | * @brief Get comparator instance blanking source. |
EricLew | 0:80ee8f3b695e | 483 | * @note Blanking source may be specific to each comparator instance. |
EricLew | 0:80ee8f3b695e | 484 | * Refer to description of parameters or to reference manual. |
EricLew | 0:80ee8f3b695e | 485 | * @rmtoll CSR BLANKING LL_COMP_GetOutputBlankingSource |
EricLew | 0:80ee8f3b695e | 486 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 487 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 488 | * @arg @ref LL_COMP_BLANKINGSRC_NONE |
EricLew | 0:80ee8f3b695e | 489 | * @arg @ref LL_COMP_BLANKINGSRC_TIM1_OC5 (1) |
EricLew | 0:80ee8f3b695e | 490 | * @arg @ref LL_COMP_BLANKINGSRC_TIM2_OC3 (1) |
EricLew | 0:80ee8f3b695e | 491 | * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC3 (1) |
EricLew | 0:80ee8f3b695e | 492 | * @arg @ref LL_COMP_BLANKINGSRC_TIM3_OC4 (2) |
EricLew | 0:80ee8f3b695e | 493 | * @arg @ref LL_COMP_BLANKINGSRC_TIM8_OC5 (2) |
EricLew | 0:80ee8f3b695e | 494 | * @arg @ref LL_COMP_BLANKINGSRC_TIM15_OC1 (2) |
EricLew | 0:80ee8f3b695e | 495 | * (1) On STM32L4, parameter available only on comparator instance: COMP1. |
EricLew | 0:80ee8f3b695e | 496 | * (2) On STM32L4, parameter available only on comparator instance: COMP2. |
EricLew | 0:80ee8f3b695e | 497 | */ |
EricLew | 0:80ee8f3b695e | 498 | __STATIC_INLINE uint32_t LL_COMP_GetOutputBlankingSource(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 499 | { |
EricLew | 0:80ee8f3b695e | 500 | return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_BLANKING)); |
EricLew | 0:80ee8f3b695e | 501 | } |
EricLew | 0:80ee8f3b695e | 502 | |
EricLew | 0:80ee8f3b695e | 503 | /** |
EricLew | 0:80ee8f3b695e | 504 | * @} |
EricLew | 0:80ee8f3b695e | 505 | */ |
EricLew | 0:80ee8f3b695e | 506 | |
EricLew | 0:80ee8f3b695e | 507 | /** @defgroup COMP_LL_EF_Operation Operation |
EricLew | 0:80ee8f3b695e | 508 | * @{ |
EricLew | 0:80ee8f3b695e | 509 | */ |
EricLew | 0:80ee8f3b695e | 510 | /** |
EricLew | 0:80ee8f3b695e | 511 | * @brief Enable comparator instance. |
EricLew | 0:80ee8f3b695e | 512 | * @rmtoll CSR EN LL_COMP_Enable |
EricLew | 0:80ee8f3b695e | 513 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 514 | * @retval None |
EricLew | 0:80ee8f3b695e | 515 | */ |
EricLew | 0:80ee8f3b695e | 516 | __STATIC_INLINE void LL_COMP_Enable(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 517 | { |
EricLew | 0:80ee8f3b695e | 518 | SET_BIT(COMPx->CSR, COMP_CSR_EN); |
EricLew | 0:80ee8f3b695e | 519 | } |
EricLew | 0:80ee8f3b695e | 520 | |
EricLew | 0:80ee8f3b695e | 521 | /** |
EricLew | 0:80ee8f3b695e | 522 | * @brief Disable comparator instance. |
EricLew | 0:80ee8f3b695e | 523 | * @rmtoll CSR EN LL_COMP_Disable |
EricLew | 0:80ee8f3b695e | 524 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 525 | * @retval None |
EricLew | 0:80ee8f3b695e | 526 | */ |
EricLew | 0:80ee8f3b695e | 527 | __STATIC_INLINE void LL_COMP_Disable(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 528 | { |
EricLew | 0:80ee8f3b695e | 529 | CLEAR_BIT(COMPx->CSR, COMP_CSR_EN); |
EricLew | 0:80ee8f3b695e | 530 | } |
EricLew | 0:80ee8f3b695e | 531 | |
EricLew | 0:80ee8f3b695e | 532 | /** |
EricLew | 0:80ee8f3b695e | 533 | * @brief Get COMP enable state |
EricLew | 0:80ee8f3b695e | 534 | * (0: COMP is disabled, 1: COMP is enabled) |
EricLew | 0:80ee8f3b695e | 535 | * @rmtoll CSR EN LL_COMP_IsEnabled |
EricLew | 0:80ee8f3b695e | 536 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 537 | * @retval State of bit (1 or 0). |
EricLew | 0:80ee8f3b695e | 538 | */ |
EricLew | 0:80ee8f3b695e | 539 | __STATIC_INLINE uint32_t LL_COMP_IsEnabled(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 540 | { |
EricLew | 0:80ee8f3b695e | 541 | return (READ_BIT(COMPx->CSR, COMP_CSR_EN) == (COMP_CSR_EN)); |
EricLew | 0:80ee8f3b695e | 542 | } |
EricLew | 0:80ee8f3b695e | 543 | |
EricLew | 0:80ee8f3b695e | 544 | /** |
EricLew | 0:80ee8f3b695e | 545 | * @brief Lock comparator instance. |
EricLew | 0:80ee8f3b695e | 546 | * Once locked, comparator configuration can be accessed in read-only. |
EricLew | 0:80ee8f3b695e | 547 | * The only way to unlock the comparator is a device hardware reset. |
EricLew | 0:80ee8f3b695e | 548 | * @rmtoll CSR LOCK LL_COMP_Lock |
EricLew | 0:80ee8f3b695e | 549 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 550 | * @retval None |
EricLew | 0:80ee8f3b695e | 551 | */ |
EricLew | 0:80ee8f3b695e | 552 | __STATIC_INLINE void LL_COMP_Lock(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 553 | { |
EricLew | 0:80ee8f3b695e | 554 | SET_BIT(COMPx->CSR, COMP_CSR_LOCK); |
EricLew | 0:80ee8f3b695e | 555 | } |
EricLew | 0:80ee8f3b695e | 556 | |
EricLew | 0:80ee8f3b695e | 557 | /** |
EricLew | 0:80ee8f3b695e | 558 | * @brief Get COMP lock state. |
EricLew | 0:80ee8f3b695e | 559 | * (0: COMP is unlocked, 1: COMP is locked) |
EricLew | 0:80ee8f3b695e | 560 | * @rmtoll CSR LOCK LL_COMP_IsLocked |
EricLew | 0:80ee8f3b695e | 561 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 562 | * @retval State of bit (1 or 0). |
EricLew | 0:80ee8f3b695e | 563 | */ |
EricLew | 0:80ee8f3b695e | 564 | __STATIC_INLINE uint32_t LL_COMP_IsLocked(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 565 | { |
EricLew | 0:80ee8f3b695e | 566 | return (READ_BIT(COMPx->CSR, COMP_CSR_LOCK) == (COMP_CSR_LOCK)); |
EricLew | 0:80ee8f3b695e | 567 | } |
EricLew | 0:80ee8f3b695e | 568 | |
EricLew | 0:80ee8f3b695e | 569 | /** |
EricLew | 0:80ee8f3b695e | 570 | * @brief Read comparator instance output level. |
EricLew | 0:80ee8f3b695e | 571 | * The output level depends on the selected polarity. |
EricLew | 0:80ee8f3b695e | 572 | * If the polarity is not inverted: |
EricLew | 0:80ee8f3b695e | 573 | * - Comparator output is low when the non-inverting input is at a lower |
EricLew | 0:80ee8f3b695e | 574 | * voltage than the inverting input |
EricLew | 0:80ee8f3b695e | 575 | * - Comparator output is high when the non-inverting input is at a higher |
EricLew | 0:80ee8f3b695e | 576 | * voltage than the inverting input |
EricLew | 0:80ee8f3b695e | 577 | * If the polarity is inverted: |
EricLew | 0:80ee8f3b695e | 578 | * - Comparator output is high when the non-inverting input is at a lower |
EricLew | 0:80ee8f3b695e | 579 | * voltage than the inverting input |
EricLew | 0:80ee8f3b695e | 580 | * - Comparator output is low when the non-inverting input is at a higher |
EricLew | 0:80ee8f3b695e | 581 | * voltage than the inverting input |
EricLew | 0:80ee8f3b695e | 582 | * @rmtoll CSR VALUE LL_COMP_ReadOutputLevel |
EricLew | 0:80ee8f3b695e | 583 | * @param COMPx Comparator instance |
EricLew | 0:80ee8f3b695e | 584 | * @retval Returned value can be one of the following values: |
EricLew | 0:80ee8f3b695e | 585 | * @arg @ref LL_COMP_OUTPUT_LEVEL_LOW |
EricLew | 0:80ee8f3b695e | 586 | * @arg @ref LL_COMP_OUTPUT_LEVEL_HIGH |
EricLew | 0:80ee8f3b695e | 587 | */ |
EricLew | 0:80ee8f3b695e | 588 | __STATIC_INLINE uint32_t LL_COMP_ReadOutputLevel(COMP_TypeDef *COMPx) |
EricLew | 0:80ee8f3b695e | 589 | { |
EricLew | 0:80ee8f3b695e | 590 | return (uint32_t)(READ_BIT(COMPx->CSR, COMP_CSR_VALUE)); |
EricLew | 0:80ee8f3b695e | 591 | } |
EricLew | 0:80ee8f3b695e | 592 | |
EricLew | 0:80ee8f3b695e | 593 | /** |
EricLew | 0:80ee8f3b695e | 594 | * @} |
EricLew | 0:80ee8f3b695e | 595 | */ |
EricLew | 0:80ee8f3b695e | 596 | |
EricLew | 0:80ee8f3b695e | 597 | |
EricLew | 0:80ee8f3b695e | 598 | /** |
EricLew | 0:80ee8f3b695e | 599 | * @} |
EricLew | 0:80ee8f3b695e | 600 | */ |
EricLew | 0:80ee8f3b695e | 601 | |
EricLew | 0:80ee8f3b695e | 602 | /** |
EricLew | 0:80ee8f3b695e | 603 | * @} |
EricLew | 0:80ee8f3b695e | 604 | */ |
EricLew | 0:80ee8f3b695e | 605 | |
EricLew | 0:80ee8f3b695e | 606 | #endif /* COMP1 || COMP2 */ |
EricLew | 0:80ee8f3b695e | 607 | |
EricLew | 0:80ee8f3b695e | 608 | /** |
EricLew | 0:80ee8f3b695e | 609 | * @} |
EricLew | 0:80ee8f3b695e | 610 | */ |
EricLew | 0:80ee8f3b695e | 611 | |
EricLew | 0:80ee8f3b695e | 612 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 613 | } |
EricLew | 0:80ee8f3b695e | 614 | #endif |
EricLew | 0:80ee8f3b695e | 615 | |
EricLew | 0:80ee8f3b695e | 616 | #endif /* __STM32L4xx_LL_COMP_H */ |
EricLew | 0:80ee8f3b695e | 617 | |
EricLew | 0:80ee8f3b695e | 618 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
EricLew | 0:80ee8f3b695e | 619 |