Eric Lewiston / STM32L4xx_HAL_Driver

Dependents:   BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo

Fork of STM32L4xx_HAL_Driver by Senior Design: Sound Monitor

Committer:
EricLew
Date:
Mon Nov 02 19:37:23 2015 +0000
Revision:
0:80ee8f3b695e
Errors are with definitions of LCD and QSPI functions. I believe all .h and .c files are  uploaded, but there may need to be certain functions called.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EricLew 0:80ee8f3b695e 1 /**
EricLew 0:80ee8f3b695e 2 ******************************************************************************
EricLew 0:80ee8f3b695e 3 * @file stm32l4xx_hal_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 HAL module.
EricLew 0:80ee8f3b695e 8 ******************************************************************************
EricLew 0:80ee8f3b695e 9 * @attention
EricLew 0:80ee8f3b695e 10 *
EricLew 0:80ee8f3b695e 11 * <h2><center>&copy; 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_HAL_COMP_H
EricLew 0:80ee8f3b695e 40 #define __STM32L4xx_HAL_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_hal_def.h"
EricLew 0:80ee8f3b695e 48
EricLew 0:80ee8f3b695e 49 /** @addtogroup STM32L4xx_HAL_Driver
EricLew 0:80ee8f3b695e 50 * @{
EricLew 0:80ee8f3b695e 51 */
EricLew 0:80ee8f3b695e 52
EricLew 0:80ee8f3b695e 53 /** @addtogroup COMP
EricLew 0:80ee8f3b695e 54 * @{
EricLew 0:80ee8f3b695e 55 */
EricLew 0:80ee8f3b695e 56
EricLew 0:80ee8f3b695e 57 /* Exported types ------------------------------------------------------------*/
EricLew 0:80ee8f3b695e 58 /** @defgroup COMP_Exported_Types COMP Exported Types
EricLew 0:80ee8f3b695e 59 * @{
EricLew 0:80ee8f3b695e 60 */
EricLew 0:80ee8f3b695e 61
EricLew 0:80ee8f3b695e 62 /**
EricLew 0:80ee8f3b695e 63 * @brief COMP Init structure definition
EricLew 0:80ee8f3b695e 64 */
EricLew 0:80ee8f3b695e 65 typedef struct
EricLew 0:80ee8f3b695e 66 {
EricLew 0:80ee8f3b695e 67
EricLew 0:80ee8f3b695e 68 uint32_t InvertingInput; /*!< Selects the inverting input of the comparator.
EricLew 0:80ee8f3b695e 69 This parameter can be a value of @ref COMP_InvertingInput */
EricLew 0:80ee8f3b695e 70
EricLew 0:80ee8f3b695e 71 uint32_t NonInvertingInput; /*!< Selects the non inverting input of the comparator.
EricLew 0:80ee8f3b695e 72 This parameter can be a value of @ref COMP_NonInvertingInput */
EricLew 0:80ee8f3b695e 73
EricLew 0:80ee8f3b695e 74 uint32_t OutputPol; /*!< Selects the output polarity of the comparator.
EricLew 0:80ee8f3b695e 75 This parameter can be a value of @ref COMP_OutputPolarity */
EricLew 0:80ee8f3b695e 76
EricLew 0:80ee8f3b695e 77 uint32_t Hysteresis; /*!< Selects the hysteresis voltage of the comparator.
EricLew 0:80ee8f3b695e 78 This parameter can be a value of @ref COMP_Hysteresis */
EricLew 0:80ee8f3b695e 79
EricLew 0:80ee8f3b695e 80 uint32_t BlankingSrce; /*!< Selects the output blanking source of the comparator.
EricLew 0:80ee8f3b695e 81 This parameter can be a value of @ref COMP_BlankingSrce */
EricLew 0:80ee8f3b695e 82
EricLew 0:80ee8f3b695e 83 uint32_t Mode; /*!< Selects the operating consumption mode of the comparator
EricLew 0:80ee8f3b695e 84 to adjust the speed/consumption.
EricLew 0:80ee8f3b695e 85 This parameter can be a value of @ref COMP_Mode */
EricLew 0:80ee8f3b695e 86
EricLew 0:80ee8f3b695e 87 uint32_t WindowMode; /*!< Selects the window mode of the comparator 2.
EricLew 0:80ee8f3b695e 88 This parameter can be a value of @ref COMP_WindowMode */
EricLew 0:80ee8f3b695e 89
EricLew 0:80ee8f3b695e 90 uint32_t TriggerMode; /*!< Selects the trigger mode of the comparator (interrupt mode).
EricLew 0:80ee8f3b695e 91 This parameter can be a value of @ref COMP_TriggerMode */
EricLew 0:80ee8f3b695e 92
EricLew 0:80ee8f3b695e 93 }COMP_InitTypeDef;
EricLew 0:80ee8f3b695e 94
EricLew 0:80ee8f3b695e 95 /**
EricLew 0:80ee8f3b695e 96 * @brief HAL State structures definition
EricLew 0:80ee8f3b695e 97 */
EricLew 0:80ee8f3b695e 98 typedef enum
EricLew 0:80ee8f3b695e 99 {
EricLew 0:80ee8f3b695e 100 HAL_COMP_STATE_RESET = 0x00, /*!< COMP not yet initialized or disabled */
EricLew 0:80ee8f3b695e 101 HAL_COMP_STATE_READY = 0x01, /*!< COMP initialized and ready for use */
EricLew 0:80ee8f3b695e 102 HAL_COMP_STATE_READY_LOCKED = 0x11, /*!< COMP initialized but the configuration is locked */
EricLew 0:80ee8f3b695e 103 HAL_COMP_STATE_BUSY = 0x02, /*!< COMP is running */
EricLew 0:80ee8f3b695e 104 HAL_COMP_STATE_BUSY_LOCKED = 0x12 /*!< COMP is running and the configuration is locked */
EricLew 0:80ee8f3b695e 105 }HAL_COMP_StateTypeDef;
EricLew 0:80ee8f3b695e 106
EricLew 0:80ee8f3b695e 107 /**
EricLew 0:80ee8f3b695e 108 * @brief COMP Handle Structure definition
EricLew 0:80ee8f3b695e 109 */
EricLew 0:80ee8f3b695e 110 typedef struct
EricLew 0:80ee8f3b695e 111 {
EricLew 0:80ee8f3b695e 112 COMP_TypeDef *Instance; /*!< Register base address */
EricLew 0:80ee8f3b695e 113 COMP_InitTypeDef Init; /*!< COMP required parameters */
EricLew 0:80ee8f3b695e 114 HAL_LockTypeDef Lock; /*!< Locking object */
EricLew 0:80ee8f3b695e 115 __IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */
EricLew 0:80ee8f3b695e 116 } COMP_HandleTypeDef;
EricLew 0:80ee8f3b695e 117
EricLew 0:80ee8f3b695e 118 /**
EricLew 0:80ee8f3b695e 119 * @}
EricLew 0:80ee8f3b695e 120 */
EricLew 0:80ee8f3b695e 121
EricLew 0:80ee8f3b695e 122 /* Exported constants --------------------------------------------------------*/
EricLew 0:80ee8f3b695e 123 /** @defgroup COMP_Exported_Constants COMP Exported Constants
EricLew 0:80ee8f3b695e 124 * @{
EricLew 0:80ee8f3b695e 125 */
EricLew 0:80ee8f3b695e 126
EricLew 0:80ee8f3b695e 127 /** @defgroup COMP_InvertingInput COMP Inverting Input
EricLew 0:80ee8f3b695e 128 * @{
EricLew 0:80ee8f3b695e 129 */
EricLew 0:80ee8f3b695e 130 #define COMP_INVERTINGINPUT_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input (minus) */
EricLew 0:80ee8f3b695e 131 #define COMP_INVERTINGINPUT_1_2VREFINT COMP_CSR_INMSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input (minus) */
EricLew 0:80ee8f3b695e 132 #define COMP_INVERTINGINPUT_3_4VREFINT COMP_CSR_INMSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input (minus) */
EricLew 0:80ee8f3b695e 133 #define COMP_INVERTINGINPUT_VREFINT (COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0) /*!< VREFINT connected to comparator1 inverting input (minus) */
EricLew 0:80ee8f3b695e 134 #define COMP_INVERTINGINPUT_DAC1 COMP_CSR_INMSEL_2 /*!< DAC_OUT1 connected to comparator inverting input (minus) */
EricLew 0:80ee8f3b695e 135 #define COMP_INVERTINGINPUT_DAC2 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_0) /*!< DAC_OUT2 connected to comparator inverting input (minus) */
EricLew 0:80ee8f3b695e 136 #define COMP_INVERTINGINPUT_IO1 (COMP_CSR_INMSEL_2 | COMP_CSR_INMSEL_1) /*!< IO1 connected to comparator inverting input (minus) */
EricLew 0:80ee8f3b695e 137 #define COMP_INVERTINGINPUT_IO2 COMP_CSR_INMSEL /*!< IO2 connected to comparator inverting input (minus) */
EricLew 0:80ee8f3b695e 138 /**
EricLew 0:80ee8f3b695e 139 * @}
EricLew 0:80ee8f3b695e 140 */
EricLew 0:80ee8f3b695e 141
EricLew 0:80ee8f3b695e 142 /** @defgroup COMP_NonInvertingInput COMP NonInverting Input
EricLew 0:80ee8f3b695e 143 * @{
EricLew 0:80ee8f3b695e 144 */
EricLew 0:80ee8f3b695e 145 #define COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< IO1 connected to comparator non inverting input (plus) */
EricLew 0:80ee8f3b695e 146 #define COMP_NONINVERTINGINPUT_IO2 COMP_CSR_INPSEL_0 /*!< IO2 connected to comparator non inverting input (plus) */
EricLew 0:80ee8f3b695e 147 /**
EricLew 0:80ee8f3b695e 148 * @}
EricLew 0:80ee8f3b695e 149 */
EricLew 0:80ee8f3b695e 150
EricLew 0:80ee8f3b695e 151 /** @defgroup COMP_OutputPolarity COMP Output Polarity
EricLew 0:80ee8f3b695e 152 * @{
EricLew 0:80ee8f3b695e 153 */
EricLew 0:80ee8f3b695e 154 #define COMP_OUTPUTPOL_NONINVERTED ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */
EricLew 0:80ee8f3b695e 155 #define COMP_OUTPUTPOL_INVERTED COMP_CSR_POLARITY /*!< COMP output on GPIO is inverted */
EricLew 0:80ee8f3b695e 156 /**
EricLew 0:80ee8f3b695e 157 * @}
EricLew 0:80ee8f3b695e 158 */
EricLew 0:80ee8f3b695e 159
EricLew 0:80ee8f3b695e 160 /** @defgroup COMP_Mode COMP Mode
EricLew 0:80ee8f3b695e 161 * @{
EricLew 0:80ee8f3b695e 162 */
EricLew 0:80ee8f3b695e 163 /* Please refer to the electrical characteristics in the device datasheet for
EricLew 0:80ee8f3b695e 164 the power consumption values */
EricLew 0:80ee8f3b695e 165 #define COMP_MODE_HIGHSPEED ((uint32_t)0x00000000) /*!< High Speed */
EricLew 0:80ee8f3b695e 166 #define COMP_MODE_MEDIUMSPEED COMP_CSR_PWRMODE_0 /*!< Medium Speed */
EricLew 0:80ee8f3b695e 167 #define COMP_MODE_ULTRALOWPOWER COMP_CSR_PWRMODE /*!< Ultra-low power mode */
EricLew 0:80ee8f3b695e 168 /**
EricLew 0:80ee8f3b695e 169 * @}
EricLew 0:80ee8f3b695e 170 */
EricLew 0:80ee8f3b695e 171
EricLew 0:80ee8f3b695e 172 /** @defgroup COMP_Hysteresis COMP Hysteresis
EricLew 0:80ee8f3b695e 173 * @{
EricLew 0:80ee8f3b695e 174 */
EricLew 0:80ee8f3b695e 175 #define COMP_HYSTERESIS_NONE ((uint32_t)0x00000000) /*!< No hysteresis */
EricLew 0:80ee8f3b695e 176 #define COMP_HYSTERESIS_LOW COMP_CSR_HYST_0 /*!< Hysteresis level low */
EricLew 0:80ee8f3b695e 177 #define COMP_HYSTERESIS_MEDIUM COMP_CSR_HYST_1 /*!< Hysteresis level medium */
EricLew 0:80ee8f3b695e 178 #define COMP_HYSTERESIS_HIGH COMP_CSR_HYST /*!< Hysteresis level high */
EricLew 0:80ee8f3b695e 179 /**
EricLew 0:80ee8f3b695e 180 * @}
EricLew 0:80ee8f3b695e 181 */
EricLew 0:80ee8f3b695e 182
EricLew 0:80ee8f3b695e 183 /** @defgroup COMP_BlankingSrce COMP Blanking Source
EricLew 0:80ee8f3b695e 184 * @{
EricLew 0:80ee8f3b695e 185 */
EricLew 0:80ee8f3b695e 186 /* No blanking source can be selected for all comparators */
EricLew 0:80ee8f3b695e 187 #define COMP_BLANKINGSRCE_NONE ((uint32_t)0x00000000) /*!< No blanking source */
EricLew 0:80ee8f3b695e 188 /* Blanking source for COMP1 */
EricLew 0:80ee8f3b695e 189 #define COMP_BLANKINGSRCE_TIM1OC5 COMP_CSR_BLANKING_0 /*!< TIM1 OC5 selected as blanking source for comparator */
EricLew 0:80ee8f3b695e 190 #define COMP_BLANKINGSRCE_TIM2OC3 COMP_CSR_BLANKING_1 /*!< TIM2 OC3 selected as blanking source for comparator */
EricLew 0:80ee8f3b695e 191 #define COMP_BLANKINGSRCE_TIM3OC3 COMP_CSR_BLANKING_2 /*!< TIM3 OC3 selected as blanking source for comparator */
EricLew 0:80ee8f3b695e 192 /* Blanking source for COMP2 */
EricLew 0:80ee8f3b695e 193 #define COMP_BLANKINGSRCE_TIM3OC4 COMP_CSR_BLANKING_0 /*!< TIM3 OC4 selected as blanking source for comparator */
EricLew 0:80ee8f3b695e 194 #define COMP_BLANKINGSRCE_TIM8OC5 COMP_CSR_BLANKING_1 /*!< TIM8 OC5 selected as blanking source for comparator */
EricLew 0:80ee8f3b695e 195 #define COMP_BLANKINGSRCE_TIM15OC1 COMP_CSR_BLANKING_2 /*!< TIM15 OC1 selected as blanking source for comparator */
EricLew 0:80ee8f3b695e 196 /**
EricLew 0:80ee8f3b695e 197 * @}
EricLew 0:80ee8f3b695e 198 */
EricLew 0:80ee8f3b695e 199
EricLew 0:80ee8f3b695e 200 /** @defgroup COMP_WindowMode COMP Window Mode
EricLew 0:80ee8f3b695e 201 * @{
EricLew 0:80ee8f3b695e 202 */
EricLew 0:80ee8f3b695e 203 #define COMP_WINDOWMODE_DISABLE ((uint32_t)0x00000000) /*!< Window mode disable: Input plus of Comparator 2 not connected to Comparator 1 */
EricLew 0:80ee8f3b695e 204 #define COMP_WINDOWMODE_ENABLE COMP_CSR_WINMODE /*!< Window mode enable: Input plus of Comparator 2 is connected to input plus of Comparator 1 */
EricLew 0:80ee8f3b695e 205 /**
EricLew 0:80ee8f3b695e 206 * @}
EricLew 0:80ee8f3b695e 207 */
EricLew 0:80ee8f3b695e 208
EricLew 0:80ee8f3b695e 209 /** @defgroup COMP_OutputLevel COMP Output Level
EricLew 0:80ee8f3b695e 210 * @{
EricLew 0:80ee8f3b695e 211 */
EricLew 0:80ee8f3b695e 212 /* When output polarity is not inverted, comparator output is low when
EricLew 0:80ee8f3b695e 213 the non-inverting input is at a lower voltage than the inverting input*/
EricLew 0:80ee8f3b695e 214 #define COMP_OUTPUTLEVEL_LOW ((uint32_t)0x00000000)
EricLew 0:80ee8f3b695e 215 /* When output polarity is not inverted, comparator output is high when
EricLew 0:80ee8f3b695e 216 the non-inverting input is at a higher voltage than the inverting input */
EricLew 0:80ee8f3b695e 217 #define COMP_OUTPUTLEVEL_HIGH COMP_CSR_VALUE
EricLew 0:80ee8f3b695e 218 /**
EricLew 0:80ee8f3b695e 219 * @}
EricLew 0:80ee8f3b695e 220 */
EricLew 0:80ee8f3b695e 221
EricLew 0:80ee8f3b695e 222 /** @defgroup COMP_TriggerMode COMP Trigger Mode
EricLew 0:80ee8f3b695e 223 * @{
EricLew 0:80ee8f3b695e 224 */
EricLew 0:80ee8f3b695e 225 #define COMP_TRIGGERMODE_NONE ((uint32_t)0x00000000) /*!< No External Interrupt trigger detection */
EricLew 0:80ee8f3b695e 226 #define COMP_TRIGGERMODE_IT_RISING ((uint32_t)0x00000001) /*!< External Interrupt Mode with Rising edge trigger detection */
EricLew 0:80ee8f3b695e 227 #define COMP_TRIGGERMODE_IT_FALLING ((uint32_t)0x00000002) /*!< External Interrupt Mode with Falling edge trigger detection */
EricLew 0:80ee8f3b695e 228 #define COMP_TRIGGERMODE_IT_RISING_FALLING ((uint32_t)0x00000003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
EricLew 0:80ee8f3b695e 229 #define COMP_TRIGGERMODE_EVENT_RISING ((uint32_t)0x00000010) /*!< Event Mode with Rising edge trigger detection */
EricLew 0:80ee8f3b695e 230 #define COMP_TRIGGERMODE_EVENT_FALLING ((uint32_t)0x00000020) /*!< Event Mode with Falling edge trigger detection */
EricLew 0:80ee8f3b695e 231 #define COMP_TRIGGERMODE_EVENT_RISING_FALLING ((uint32_t)0x00000030) /*!< Event Mode with Rising/Falling edge trigger detection */
EricLew 0:80ee8f3b695e 232 /**
EricLew 0:80ee8f3b695e 233 * @}
EricLew 0:80ee8f3b695e 234 */
EricLew 0:80ee8f3b695e 235
EricLew 0:80ee8f3b695e 236 /** @defgroup COMP_Flag COMP Flag
EricLew 0:80ee8f3b695e 237 * @{
EricLew 0:80ee8f3b695e 238 */
EricLew 0:80ee8f3b695e 239 #define COMP_FLAG_LOCK COMP_CSR_LOCK /*!< Lock flag */
EricLew 0:80ee8f3b695e 240
EricLew 0:80ee8f3b695e 241 /**
EricLew 0:80ee8f3b695e 242 * @}
EricLew 0:80ee8f3b695e 243 */
EricLew 0:80ee8f3b695e 244
EricLew 0:80ee8f3b695e 245 /**
EricLew 0:80ee8f3b695e 246 * @}
EricLew 0:80ee8f3b695e 247 */
EricLew 0:80ee8f3b695e 248
EricLew 0:80ee8f3b695e 249 /* Exported macros -----------------------------------------------------------*/
EricLew 0:80ee8f3b695e 250 /** @defgroup COMP_Exported_Macros COMP Exported Macros
EricLew 0:80ee8f3b695e 251 * @{
EricLew 0:80ee8f3b695e 252 */
EricLew 0:80ee8f3b695e 253
EricLew 0:80ee8f3b695e 254 /** @brief Reset COMP handle state.
EricLew 0:80ee8f3b695e 255 * @param __HANDLE__ COMP handle.
EricLew 0:80ee8f3b695e 256 * @retval None
EricLew 0:80ee8f3b695e 257 */
EricLew 0:80ee8f3b695e 258 #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET)
EricLew 0:80ee8f3b695e 259
EricLew 0:80ee8f3b695e 260 /**
EricLew 0:80ee8f3b695e 261 * @brief Enable the specified comparator.
EricLew 0:80ee8f3b695e 262 * @param __HANDLE__ COMP handle.
EricLew 0:80ee8f3b695e 263 * @retval None
EricLew 0:80ee8f3b695e 264 */
EricLew 0:80ee8f3b695e 265 #define __HAL_COMP_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
EricLew 0:80ee8f3b695e 266
EricLew 0:80ee8f3b695e 267 /**
EricLew 0:80ee8f3b695e 268 * @brief Disable the specified comparator.
EricLew 0:80ee8f3b695e 269 * @param __HANDLE__ COMP handle.
EricLew 0:80ee8f3b695e 270 * @retval None
EricLew 0:80ee8f3b695e 271 */
EricLew 0:80ee8f3b695e 272 #define __HAL_COMP_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_EN)
EricLew 0:80ee8f3b695e 273
EricLew 0:80ee8f3b695e 274 /**
EricLew 0:80ee8f3b695e 275 * @brief Lock the specified comparator configuration.
EricLew 0:80ee8f3b695e 276 * @param __HANDLE__ COMP handle.
EricLew 0:80ee8f3b695e 277 * @retval None
EricLew 0:80ee8f3b695e 278 */
EricLew 0:80ee8f3b695e 279 #define __HAL_COMP_LOCK(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_LOCK)
EricLew 0:80ee8f3b695e 280
EricLew 0:80ee8f3b695e 281 /**
EricLew 0:80ee8f3b695e 282 * @brief Enable the COMP1 EXTI line rising edge trigger.
EricLew 0:80ee8f3b695e 283 * @retval None
EricLew 0:80ee8f3b695e 284 */
EricLew 0:80ee8f3b695e 285 #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 286
EricLew 0:80ee8f3b695e 287 /**
EricLew 0:80ee8f3b695e 288 * @brief Disable the COMP1 EXTI line rising edge trigger.
EricLew 0:80ee8f3b695e 289 * @retval None
EricLew 0:80ee8f3b695e 290 */
EricLew 0:80ee8f3b695e 291 #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 292
EricLew 0:80ee8f3b695e 293 /**
EricLew 0:80ee8f3b695e 294 * @brief Enable the COMP1 EXTI line falling edge trigger.
EricLew 0:80ee8f3b695e 295 * @retval None
EricLew 0:80ee8f3b695e 296 */
EricLew 0:80ee8f3b695e 297 #define __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 298
EricLew 0:80ee8f3b695e 299 /**
EricLew 0:80ee8f3b695e 300 * @brief Disable the COMP1 EXTI line falling edge trigger.
EricLew 0:80ee8f3b695e 301 * @retval None
EricLew 0:80ee8f3b695e 302 */
EricLew 0:80ee8f3b695e 303 #define __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 304
EricLew 0:80ee8f3b695e 305 /**
EricLew 0:80ee8f3b695e 306 * @brief Enable the COMP1 EXTI line rising & falling edge trigger.
EricLew 0:80ee8f3b695e 307 * @retval None
EricLew 0:80ee8f3b695e 308 */
EricLew 0:80ee8f3b695e 309 #define __HAL_COMP_COMP1_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
EricLew 0:80ee8f3b695e 310 __HAL_COMP_COMP1_EXTI_ENABLE_RISING_EDGE(); \
EricLew 0:80ee8f3b695e 311 __HAL_COMP_COMP1_EXTI_ENABLE_FALLING_EDGE(); \
EricLew 0:80ee8f3b695e 312 } while(0)
EricLew 0:80ee8f3b695e 313
EricLew 0:80ee8f3b695e 314 /**
EricLew 0:80ee8f3b695e 315 * @brief Disable the COMP1 EXTI line rising & falling edge trigger.
EricLew 0:80ee8f3b695e 316 * @retval None
EricLew 0:80ee8f3b695e 317 */
EricLew 0:80ee8f3b695e 318 #define __HAL_COMP_COMP1_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
EricLew 0:80ee8f3b695e 319 __HAL_COMP_COMP1_EXTI_DISABLE_RISING_EDGE(); \
EricLew 0:80ee8f3b695e 320 __HAL_COMP_COMP1_EXTI_DISABLE_FALLING_EDGE(); \
EricLew 0:80ee8f3b695e 321 } while(0)
EricLew 0:80ee8f3b695e 322
EricLew 0:80ee8f3b695e 323 /**
EricLew 0:80ee8f3b695e 324 * @brief Enable the COMP1 EXTI line in interrupt mode.
EricLew 0:80ee8f3b695e 325 * @retval None
EricLew 0:80ee8f3b695e 326 */
EricLew 0:80ee8f3b695e 327 #define __HAL_COMP_COMP1_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 328
EricLew 0:80ee8f3b695e 329 /**
EricLew 0:80ee8f3b695e 330 * @brief Disable the COMP1 EXTI line in interrupt mode.
EricLew 0:80ee8f3b695e 331 * @retval None
EricLew 0:80ee8f3b695e 332 */
EricLew 0:80ee8f3b695e 333 #define __HAL_COMP_COMP1_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 334
EricLew 0:80ee8f3b695e 335 /**
EricLew 0:80ee8f3b695e 336 * @brief Generate a software interrupt on the COMP1 EXTI line.
EricLew 0:80ee8f3b695e 337 * @retval None
EricLew 0:80ee8f3b695e 338 */
EricLew 0:80ee8f3b695e 339 #define __HAL_COMP_COMP1_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 340
EricLew 0:80ee8f3b695e 341 /**
EricLew 0:80ee8f3b695e 342 * @brief Enable the COMP1 EXTI Line in event mode.
EricLew 0:80ee8f3b695e 343 * @retval None
EricLew 0:80ee8f3b695e 344 */
EricLew 0:80ee8f3b695e 345 #define __HAL_COMP_COMP1_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 346
EricLew 0:80ee8f3b695e 347 /**
EricLew 0:80ee8f3b695e 348 * @brief Disable the COMP1 EXTI Line in event mode.
EricLew 0:80ee8f3b695e 349 * @retval None
EricLew 0:80ee8f3b695e 350 */
EricLew 0:80ee8f3b695e 351 #define __HAL_COMP_COMP1_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 352
EricLew 0:80ee8f3b695e 353 /**
EricLew 0:80ee8f3b695e 354 * @brief Check whether the COMP1 EXTI line flag is set or not.
EricLew 0:80ee8f3b695e 355 * @retval RESET or SET
EricLew 0:80ee8f3b695e 356 */
EricLew 0:80ee8f3b695e 357 #define __HAL_COMP_COMP1_EXTI_GET_FLAG() READ_BIT(EXTI->PR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 358
EricLew 0:80ee8f3b695e 359 /**
EricLew 0:80ee8f3b695e 360 * @brief Clear the COMP1 EXTI flag.
EricLew 0:80ee8f3b695e 361 * @retval None
EricLew 0:80ee8f3b695e 362 */
EricLew 0:80ee8f3b695e 363 #define __HAL_COMP_COMP1_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, COMP_EXTI_LINE_COMP1)
EricLew 0:80ee8f3b695e 364
EricLew 0:80ee8f3b695e 365 /**
EricLew 0:80ee8f3b695e 366 * @brief Enable the COMP2 EXTI line rising edge trigger.
EricLew 0:80ee8f3b695e 367 * @retval None
EricLew 0:80ee8f3b695e 368 */
EricLew 0:80ee8f3b695e 369 #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 370
EricLew 0:80ee8f3b695e 371 /**
EricLew 0:80ee8f3b695e 372 * @brief Disable the COMP2 EXTI line rising edge trigger.
EricLew 0:80ee8f3b695e 373 * @retval None
EricLew 0:80ee8f3b695e 374 */
EricLew 0:80ee8f3b695e 375 #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 376
EricLew 0:80ee8f3b695e 377 /**
EricLew 0:80ee8f3b695e 378 * @brief Enable the COMP2 EXTI line falling edge trigger.
EricLew 0:80ee8f3b695e 379 * @retval None
EricLew 0:80ee8f3b695e 380 */
EricLew 0:80ee8f3b695e 381 #define __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 382
EricLew 0:80ee8f3b695e 383 /**
EricLew 0:80ee8f3b695e 384 * @brief Disable the COMP2 EXTI line falling edge trigger.
EricLew 0:80ee8f3b695e 385 * @retval None
EricLew 0:80ee8f3b695e 386 */
EricLew 0:80ee8f3b695e 387 #define __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 388
EricLew 0:80ee8f3b695e 389 /**
EricLew 0:80ee8f3b695e 390 * @brief Enable the COMP2 EXTI line rising & falling edge trigger.
EricLew 0:80ee8f3b695e 391 * @retval None
EricLew 0:80ee8f3b695e 392 */
EricLew 0:80ee8f3b695e 393 #define __HAL_COMP_COMP2_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
EricLew 0:80ee8f3b695e 394 __HAL_COMP_COMP2_EXTI_ENABLE_RISING_EDGE(); \
EricLew 0:80ee8f3b695e 395 __HAL_COMP_COMP2_EXTI_ENABLE_FALLING_EDGE(); \
EricLew 0:80ee8f3b695e 396 } while(0)
EricLew 0:80ee8f3b695e 397
EricLew 0:80ee8f3b695e 398 /**
EricLew 0:80ee8f3b695e 399 * @brief Disable the COMP2 EXTI line rising & falling edge trigger.
EricLew 0:80ee8f3b695e 400 * @retval None
EricLew 0:80ee8f3b695e 401 */
EricLew 0:80ee8f3b695e 402 #define __HAL_COMP_COMP2_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
EricLew 0:80ee8f3b695e 403 __HAL_COMP_COMP2_EXTI_DISABLE_RISING_EDGE(); \
EricLew 0:80ee8f3b695e 404 __HAL_COMP_COMP2_EXTI_DISABLE_FALLING_EDGE(); \
EricLew 0:80ee8f3b695e 405 } while(0)
EricLew 0:80ee8f3b695e 406
EricLew 0:80ee8f3b695e 407 /**
EricLew 0:80ee8f3b695e 408 * @brief Enable the COMP2 EXTI line in interrupt mode.
EricLew 0:80ee8f3b695e 409 * @retval None
EricLew 0:80ee8f3b695e 410 */
EricLew 0:80ee8f3b695e 411 #define __HAL_COMP_COMP2_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 412
EricLew 0:80ee8f3b695e 413 /**
EricLew 0:80ee8f3b695e 414 * @brief Disable the COMP2 EXTI line in interrupt mode.
EricLew 0:80ee8f3b695e 415 * @retval None
EricLew 0:80ee8f3b695e 416 */
EricLew 0:80ee8f3b695e 417 #define __HAL_COMP_COMP2_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 418
EricLew 0:80ee8f3b695e 419 /**
EricLew 0:80ee8f3b695e 420 * @brief Generate a software interrupt on the COMP2 EXTI line.
EricLew 0:80ee8f3b695e 421 * @retval None
EricLew 0:80ee8f3b695e 422 */
EricLew 0:80ee8f3b695e 423 #define __HAL_COMP_COMP2_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 424
EricLew 0:80ee8f3b695e 425 /**
EricLew 0:80ee8f3b695e 426 * @brief Enable the COMP2 EXTI Line in event mode.
EricLew 0:80ee8f3b695e 427 * @retval None
EricLew 0:80ee8f3b695e 428 */
EricLew 0:80ee8f3b695e 429 #define __HAL_COMP_COMP2_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 430
EricLew 0:80ee8f3b695e 431 /**
EricLew 0:80ee8f3b695e 432 * @brief Disable the COMP2 EXTI Line in event mode.
EricLew 0:80ee8f3b695e 433 * @retval None
EricLew 0:80ee8f3b695e 434 */
EricLew 0:80ee8f3b695e 435 #define __HAL_COMP_COMP2_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 436
EricLew 0:80ee8f3b695e 437 /**
EricLew 0:80ee8f3b695e 438 * @brief Check whether the COMP2 EXTI line flag is set or not.
EricLew 0:80ee8f3b695e 439 * @retval RESET or SET
EricLew 0:80ee8f3b695e 440 */
EricLew 0:80ee8f3b695e 441 #define __HAL_COMP_COMP2_EXTI_GET_FLAG() READ_BIT(EXTI->PR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 442
EricLew 0:80ee8f3b695e 443 /**
EricLew 0:80ee8f3b695e 444 * @brief Clear the COMP2 EXTI flag.
EricLew 0:80ee8f3b695e 445 * @retval None
EricLew 0:80ee8f3b695e 446 */
EricLew 0:80ee8f3b695e 447 #define __HAL_COMP_COMP2_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 448
EricLew 0:80ee8f3b695e 449 /** @brief Check whether the specified COMP flag is set or not.
EricLew 0:80ee8f3b695e 450 * @param __HANDLE__ specifies the COMP Handle.
EricLew 0:80ee8f3b695e 451 * @param __FLAG__ specifies the flag to check.
EricLew 0:80ee8f3b695e 452 * This parameter can be one of the following values:
EricLew 0:80ee8f3b695e 453 * @arg @ref COMP_FLAG_LOCK lock flag
EricLew 0:80ee8f3b695e 454 * @retval The new state of __FLAG__ (TRUE or FALSE).
EricLew 0:80ee8f3b695e 455 */
EricLew 0:80ee8f3b695e 456 #define __HAL_COMP_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->CSR & (__FLAG__)) == (__FLAG__))
EricLew 0:80ee8f3b695e 457
EricLew 0:80ee8f3b695e 458 /**
EricLew 0:80ee8f3b695e 459 * @}
EricLew 0:80ee8f3b695e 460 */
EricLew 0:80ee8f3b695e 461
EricLew 0:80ee8f3b695e 462 /* Exported functions --------------------------------------------------------*/
EricLew 0:80ee8f3b695e 463 /** @addtogroup COMP_Exported_Functions
EricLew 0:80ee8f3b695e 464 * @{
EricLew 0:80ee8f3b695e 465 */
EricLew 0:80ee8f3b695e 466
EricLew 0:80ee8f3b695e 467 /** @addtogroup COMP_Exported_Functions_Group1
EricLew 0:80ee8f3b695e 468 * @{
EricLew 0:80ee8f3b695e 469 */
EricLew 0:80ee8f3b695e 470 /* Initialization and de-initialization functions **********************************/
EricLew 0:80ee8f3b695e 471 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 472 HAL_StatusTypeDef HAL_COMP_DeInit (COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 473 void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 474 void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 475 /**
EricLew 0:80ee8f3b695e 476 * @}
EricLew 0:80ee8f3b695e 477 */
EricLew 0:80ee8f3b695e 478
EricLew 0:80ee8f3b695e 479 /* IO operation functions *****************************************************/
EricLew 0:80ee8f3b695e 480 /** @addtogroup COMP_Exported_Functions_Group2
EricLew 0:80ee8f3b695e 481 * @{
EricLew 0:80ee8f3b695e 482 */
EricLew 0:80ee8f3b695e 483 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 484 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 485 HAL_StatusTypeDef HAL_COMP_Start_IT(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 486 HAL_StatusTypeDef HAL_COMP_Stop_IT(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 487 void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 488 /* Callback in Interrupt mode */
EricLew 0:80ee8f3b695e 489 void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 490 /**
EricLew 0:80ee8f3b695e 491 * @}
EricLew 0:80ee8f3b695e 492 */
EricLew 0:80ee8f3b695e 493
EricLew 0:80ee8f3b695e 494 /* Peripheral Control functions ************************************************/
EricLew 0:80ee8f3b695e 495 /** @addtogroup COMP_Exported_Functions_Group3
EricLew 0:80ee8f3b695e 496 * @{
EricLew 0:80ee8f3b695e 497 */
EricLew 0:80ee8f3b695e 498 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 499 uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 500 /**
EricLew 0:80ee8f3b695e 501 * @}
EricLew 0:80ee8f3b695e 502 */
EricLew 0:80ee8f3b695e 503
EricLew 0:80ee8f3b695e 504 /* Peripheral State functions **************************************************/
EricLew 0:80ee8f3b695e 505 /** @addtogroup COMP_Exported_Functions_Group4
EricLew 0:80ee8f3b695e 506 * @{
EricLew 0:80ee8f3b695e 507 */
EricLew 0:80ee8f3b695e 508 HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp);
EricLew 0:80ee8f3b695e 509 /**
EricLew 0:80ee8f3b695e 510 * @}
EricLew 0:80ee8f3b695e 511 */
EricLew 0:80ee8f3b695e 512
EricLew 0:80ee8f3b695e 513 /**
EricLew 0:80ee8f3b695e 514 * @}
EricLew 0:80ee8f3b695e 515 */
EricLew 0:80ee8f3b695e 516
EricLew 0:80ee8f3b695e 517 /* Private types -------------------------------------------------------------*/
EricLew 0:80ee8f3b695e 518 /* Private constants ---------------------------------------------------------*/
EricLew 0:80ee8f3b695e 519 /** @defgroup COMP_Private_Constants COMP Private Constants
EricLew 0:80ee8f3b695e 520 * @{
EricLew 0:80ee8f3b695e 521 */
EricLew 0:80ee8f3b695e 522 /** @defgroup COMP_ExtiLine COMP EXTI Lines
EricLew 0:80ee8f3b695e 523 * @{
EricLew 0:80ee8f3b695e 524 */
EricLew 0:80ee8f3b695e 525 #define COMP_EXTI_LINE_COMP1 ((uint32_t)0x00200000) /*!< EXTI line 21 connected to COMP1 output */
EricLew 0:80ee8f3b695e 526 #define COMP_EXTI_LINE_COMP2 ((uint32_t)0x00400000) /*!< EXTI line 22 connected to COMP2 output */
EricLew 0:80ee8f3b695e 527 /**
EricLew 0:80ee8f3b695e 528 * @}
EricLew 0:80ee8f3b695e 529 */
EricLew 0:80ee8f3b695e 530
EricLew 0:80ee8f3b695e 531 /**
EricLew 0:80ee8f3b695e 532 * @}
EricLew 0:80ee8f3b695e 533 */
EricLew 0:80ee8f3b695e 534
EricLew 0:80ee8f3b695e 535 /* Private macros ------------------------------------------------------------*/
EricLew 0:80ee8f3b695e 536 /** @defgroup COMP_Private_Macros COMP Private Macros
EricLew 0:80ee8f3b695e 537 * @{
EricLew 0:80ee8f3b695e 538 */
EricLew 0:80ee8f3b695e 539 /** @defgroup COMP_GET_EXTI_LINE COMP Private macros to get EXTI line associated with Comparators
EricLew 0:80ee8f3b695e 540 * @{
EricLew 0:80ee8f3b695e 541 */
EricLew 0:80ee8f3b695e 542 /**
EricLew 0:80ee8f3b695e 543 * @brief Get the specified EXTI line for a comparator instance.
EricLew 0:80ee8f3b695e 544 * @param __INSTANCE__ specifies the COMP instance.
EricLew 0:80ee8f3b695e 545 * @retval value of @ref COMP_ExtiLine
EricLew 0:80ee8f3b695e 546 */
EricLew 0:80ee8f3b695e 547 #define COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1 : \
EricLew 0:80ee8f3b695e 548 COMP_EXTI_LINE_COMP2)
EricLew 0:80ee8f3b695e 549 /**
EricLew 0:80ee8f3b695e 550 * @}
EricLew 0:80ee8f3b695e 551 */
EricLew 0:80ee8f3b695e 552
EricLew 0:80ee8f3b695e 553 /** @defgroup COMP_IS_COMP_Definitions COMP Private macros to check input parameters
EricLew 0:80ee8f3b695e 554 * @{
EricLew 0:80ee8f3b695e 555 */
EricLew 0:80ee8f3b695e 556
EricLew 0:80ee8f3b695e 557 #define IS_COMP_INVERTINGINPUT(__INPUT__) (((__INPUT__) == COMP_INVERTINGINPUT_1_4VREFINT) || \
EricLew 0:80ee8f3b695e 558 ((__INPUT__) == COMP_INVERTINGINPUT_1_2VREFINT) || \
EricLew 0:80ee8f3b695e 559 ((__INPUT__) == COMP_INVERTINGINPUT_3_4VREFINT) || \
EricLew 0:80ee8f3b695e 560 ((__INPUT__) == COMP_INVERTINGINPUT_VREFINT) || \
EricLew 0:80ee8f3b695e 561 ((__INPUT__) == COMP_INVERTINGINPUT_DAC1) || \
EricLew 0:80ee8f3b695e 562 ((__INPUT__) == COMP_INVERTINGINPUT_DAC2) || \
EricLew 0:80ee8f3b695e 563 ((__INPUT__) == COMP_INVERTINGINPUT_IO1) || \
EricLew 0:80ee8f3b695e 564 ((__INPUT__) == COMP_INVERTINGINPUT_IO2))
EricLew 0:80ee8f3b695e 565
EricLew 0:80ee8f3b695e 566 #define IS_COMP_NONINVERTINGINPUT(__INPUT__) (((__INPUT__) == COMP_NONINVERTINGINPUT_IO1) || \
EricLew 0:80ee8f3b695e 567 ((__INPUT__) == COMP_NONINVERTINGINPUT_IO2))
EricLew 0:80ee8f3b695e 568
EricLew 0:80ee8f3b695e 569 #define IS_COMP_OUTPUTPOL(__POL__) (((__POL__) == COMP_OUTPUTPOL_NONINVERTED) || \
EricLew 0:80ee8f3b695e 570 ((__POL__) == COMP_OUTPUTPOL_INVERTED))
EricLew 0:80ee8f3b695e 571
EricLew 0:80ee8f3b695e 572 #define IS_COMP_MODE(__MODE__) (((__MODE__) == COMP_MODE_HIGHSPEED) || \
EricLew 0:80ee8f3b695e 573 ((__MODE__) == COMP_MODE_MEDIUMSPEED) || \
EricLew 0:80ee8f3b695e 574 ((__MODE__) == COMP_MODE_ULTRALOWPOWER))
EricLew 0:80ee8f3b695e 575
EricLew 0:80ee8f3b695e 576 #define IS_COMP_HYSTERESIS(__HYSTERESIS__) (((__HYSTERESIS__) == COMP_HYSTERESIS_NONE) || \
EricLew 0:80ee8f3b695e 577 ((__HYSTERESIS__) == COMP_HYSTERESIS_LOW) || \
EricLew 0:80ee8f3b695e 578 ((__HYSTERESIS__) == COMP_HYSTERESIS_MEDIUM) || \
EricLew 0:80ee8f3b695e 579 ((__HYSTERESIS__) == COMP_HYSTERESIS_HIGH))
EricLew 0:80ee8f3b695e 580
EricLew 0:80ee8f3b695e 581 #define IS_COMP_BLANKINGSRCE(__SOURCE__) (((__SOURCE__) == COMP_BLANKINGSRCE_NONE) || \
EricLew 0:80ee8f3b695e 582 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM1OC5) || \
EricLew 0:80ee8f3b695e 583 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM2OC3) || \
EricLew 0:80ee8f3b695e 584 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM3OC3) || \
EricLew 0:80ee8f3b695e 585 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM3OC4) || \
EricLew 0:80ee8f3b695e 586 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM8OC5) || \
EricLew 0:80ee8f3b695e 587 ((__SOURCE__) == COMP_BLANKINGSRCE_TIM15OC1))
EricLew 0:80ee8f3b695e 588
EricLew 0:80ee8f3b695e 589 #define IS_COMP_BLANKINGSRCE_INSTANCE(__INSTANCE__, __BLANKINGSRCE__) \
EricLew 0:80ee8f3b695e 590 ((((__INSTANCE__) == COMP1) && \
EricLew 0:80ee8f3b695e 591 (((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_NONE) || \
EricLew 0:80ee8f3b695e 592 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM1OC5) || \
EricLew 0:80ee8f3b695e 593 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM2OC3) || \
EricLew 0:80ee8f3b695e 594 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM3OC3))) \
EricLew 0:80ee8f3b695e 595 || \
EricLew 0:80ee8f3b695e 596 (((__INSTANCE__) == COMP2) && \
EricLew 0:80ee8f3b695e 597 (((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_NONE) || \
EricLew 0:80ee8f3b695e 598 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM3OC4) || \
EricLew 0:80ee8f3b695e 599 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM8OC5) || \
EricLew 0:80ee8f3b695e 600 ((__BLANKINGSRCE__) == COMP_BLANKINGSRCE_TIM15OC1))))
EricLew 0:80ee8f3b695e 601
EricLew 0:80ee8f3b695e 602 #define IS_COMP_WINDOWMODE(__WINDOWMODE__) (((__WINDOWMODE__) == COMP_WINDOWMODE_DISABLE) || \
EricLew 0:80ee8f3b695e 603 ((__WINDOWMODE__) == COMP_WINDOWMODE_ENABLE))
EricLew 0:80ee8f3b695e 604
EricLew 0:80ee8f3b695e 605 #define IS_COMP_TRIGGERMODE(__MODE__) (((__MODE__) == COMP_TRIGGERMODE_NONE) || \
EricLew 0:80ee8f3b695e 606 ((__MODE__) == COMP_TRIGGERMODE_IT_RISING) || \
EricLew 0:80ee8f3b695e 607 ((__MODE__) == COMP_TRIGGERMODE_IT_FALLING) || \
EricLew 0:80ee8f3b695e 608 ((__MODE__) == COMP_TRIGGERMODE_IT_RISING_FALLING) || \
EricLew 0:80ee8f3b695e 609 ((__MODE__) == COMP_TRIGGERMODE_EVENT_RISING) || \
EricLew 0:80ee8f3b695e 610 ((__MODE__) == COMP_TRIGGERMODE_EVENT_FALLING) || \
EricLew 0:80ee8f3b695e 611 ((__MODE__) == COMP_TRIGGERMODE_EVENT_RISING_FALLING))
EricLew 0:80ee8f3b695e 612
EricLew 0:80ee8f3b695e 613 /**
EricLew 0:80ee8f3b695e 614 * @}
EricLew 0:80ee8f3b695e 615 */
EricLew 0:80ee8f3b695e 616
EricLew 0:80ee8f3b695e 617 /**
EricLew 0:80ee8f3b695e 618 * @}
EricLew 0:80ee8f3b695e 619 */
EricLew 0:80ee8f3b695e 620
EricLew 0:80ee8f3b695e 621 /* Private functions ---------------------------------------------------------*/
EricLew 0:80ee8f3b695e 622
EricLew 0:80ee8f3b695e 623 /**
EricLew 0:80ee8f3b695e 624 * @}
EricLew 0:80ee8f3b695e 625 */
EricLew 0:80ee8f3b695e 626
EricLew 0:80ee8f3b695e 627 /**
EricLew 0:80ee8f3b695e 628 * @}
EricLew 0:80ee8f3b695e 629 */
EricLew 0:80ee8f3b695e 630
EricLew 0:80ee8f3b695e 631 #ifdef __cplusplus
EricLew 0:80ee8f3b695e 632 }
EricLew 0:80ee8f3b695e 633 #endif
EricLew 0:80ee8f3b695e 634
EricLew 0:80ee8f3b695e 635 #endif /* __STM32L4xx_HAL_COMP_H */
EricLew 0:80ee8f3b695e 636
EricLew 0:80ee8f3b695e 637 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
EricLew 0:80ee8f3b695e 638