fix LPC812 PWM
Fork of mbed-dev by
targets/cmsis/TARGET_STM/TARGET_STM32L1/stm32l1xx_hal_comp.h@129:2e517c56bcfb, 2016-05-16 (annotated)
- Committer:
- nameless129
- Date:
- Mon May 16 16:50:30 2016 +0000
- Revision:
- 129:2e517c56bcfb
- Parent:
- 0:9b334a45a8ff
PWM Fix:Duty 0%??H???????????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:9b334a45a8ff | 1 | /** |
bogdanm | 0:9b334a45a8ff | 2 | ****************************************************************************** |
bogdanm | 0:9b334a45a8ff | 3 | * @file stm32l1xx_hal_comp.h |
bogdanm | 0:9b334a45a8ff | 4 | * @author MCD Application Team |
bogdanm | 0:9b334a45a8ff | 5 | * @version V1.0.0 |
bogdanm | 0:9b334a45a8ff | 6 | * @date 5-September-2014 |
bogdanm | 0:9b334a45a8ff | 7 | * @brief Header file of COMP HAL module. |
bogdanm | 0:9b334a45a8ff | 8 | ****************************************************************************** |
bogdanm | 0:9b334a45a8ff | 9 | * @attention |
bogdanm | 0:9b334a45a8ff | 10 | * |
bogdanm | 0:9b334a45a8ff | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
bogdanm | 0:9b334a45a8ff | 12 | * |
bogdanm | 0:9b334a45a8ff | 13 | * Redistribution and use in source and binary forms, with or without modification, |
bogdanm | 0:9b334a45a8ff | 14 | * are permitted provided that the following conditions are met: |
bogdanm | 0:9b334a45a8ff | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
bogdanm | 0:9b334a45a8ff | 16 | * this list of conditions and the following disclaimer. |
bogdanm | 0:9b334a45a8ff | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bogdanm | 0:9b334a45a8ff | 18 | * this list of conditions and the following disclaimer in the documentation |
bogdanm | 0:9b334a45a8ff | 19 | * and/or other materials provided with the distribution. |
bogdanm | 0:9b334a45a8ff | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bogdanm | 0:9b334a45a8ff | 21 | * may be used to endorse or promote products derived from this software |
bogdanm | 0:9b334a45a8ff | 22 | * without specific prior written permission. |
bogdanm | 0:9b334a45a8ff | 23 | * |
bogdanm | 0:9b334a45a8ff | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bogdanm | 0:9b334a45a8ff | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bogdanm | 0:9b334a45a8ff | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bogdanm | 0:9b334a45a8ff | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bogdanm | 0:9b334a45a8ff | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bogdanm | 0:9b334a45a8ff | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bogdanm | 0:9b334a45a8ff | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bogdanm | 0:9b334a45a8ff | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bogdanm | 0:9b334a45a8ff | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bogdanm | 0:9b334a45a8ff | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bogdanm | 0:9b334a45a8ff | 34 | * |
bogdanm | 0:9b334a45a8ff | 35 | ****************************************************************************** |
bogdanm | 0:9b334a45a8ff | 36 | */ |
bogdanm | 0:9b334a45a8ff | 37 | |
bogdanm | 0:9b334a45a8ff | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 39 | #ifndef __STM32L1xx_HAL_COMP_H |
bogdanm | 0:9b334a45a8ff | 40 | #define __STM32L1xx_HAL_COMP_H |
bogdanm | 0:9b334a45a8ff | 41 | |
bogdanm | 0:9b334a45a8ff | 42 | #ifdef __cplusplus |
bogdanm | 0:9b334a45a8ff | 43 | extern "C" { |
bogdanm | 0:9b334a45a8ff | 44 | #endif |
bogdanm | 0:9b334a45a8ff | 45 | |
bogdanm | 0:9b334a45a8ff | 46 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 47 | #include "stm32l1xx_hal_def.h" |
bogdanm | 0:9b334a45a8ff | 48 | |
bogdanm | 0:9b334a45a8ff | 49 | /** @addtogroup STM32L1xx_HAL_Driver |
bogdanm | 0:9b334a45a8ff | 50 | * @{ |
bogdanm | 0:9b334a45a8ff | 51 | */ |
bogdanm | 0:9b334a45a8ff | 52 | |
bogdanm | 0:9b334a45a8ff | 53 | /** @addtogroup COMP |
bogdanm | 0:9b334a45a8ff | 54 | * @{ |
bogdanm | 0:9b334a45a8ff | 55 | */ |
bogdanm | 0:9b334a45a8ff | 56 | |
bogdanm | 0:9b334a45a8ff | 57 | /* Exported types ------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 58 | /** @defgroup COMP_Exported_Types COMP Exported Types |
bogdanm | 0:9b334a45a8ff | 59 | * @{ |
bogdanm | 0:9b334a45a8ff | 60 | */ |
bogdanm | 0:9b334a45a8ff | 61 | |
bogdanm | 0:9b334a45a8ff | 62 | /** |
bogdanm | 0:9b334a45a8ff | 63 | * @brief COMP Init structure definition |
bogdanm | 0:9b334a45a8ff | 64 | */ |
bogdanm | 0:9b334a45a8ff | 65 | typedef struct |
bogdanm | 0:9b334a45a8ff | 66 | { |
bogdanm | 0:9b334a45a8ff | 67 | |
bogdanm | 0:9b334a45a8ff | 68 | uint32_t InvertingInput; /*!< Selects the inverting input of the comparator. |
bogdanm | 0:9b334a45a8ff | 69 | This parameter can be a value of @ref COMP_InvertingInput |
bogdanm | 0:9b334a45a8ff | 70 | Note: Inverting input can be changed on the fly, while comparator is running. |
bogdanm | 0:9b334a45a8ff | 71 | Note: This feature is available on COMP2 only. If COMP1 is selected, this parameter is discarded (On COMP1, inverting input is fixed to Vrefint). */ |
bogdanm | 0:9b334a45a8ff | 72 | |
bogdanm | 0:9b334a45a8ff | 73 | uint32_t NonInvertingInput; /*!< Selects the non inverting input of the comparator. |
bogdanm | 0:9b334a45a8ff | 74 | This parameter can be a value of @ref COMPEx_NonInvertingInput */ |
bogdanm | 0:9b334a45a8ff | 75 | |
bogdanm | 0:9b334a45a8ff | 76 | uint32_t Output; /*!< Selects the output redirection of the comparator. |
bogdanm | 0:9b334a45a8ff | 77 | This parameter can be a value of @ref COMP_Output |
bogdanm | 0:9b334a45a8ff | 78 | Note: This feature is available on COMP2 only. If COMP1 is selected, this parameter is discarded. */ |
bogdanm | 0:9b334a45a8ff | 79 | |
bogdanm | 0:9b334a45a8ff | 80 | uint32_t Mode; /*!< Selects the operating consumption mode of the comparator |
bogdanm | 0:9b334a45a8ff | 81 | to adjust the speed/consumption. |
bogdanm | 0:9b334a45a8ff | 82 | This parameter can be a value of @ref COMP_Mode |
bogdanm | 0:9b334a45a8ff | 83 | Note: This feature is available on COMP2 only. If COMP1 is selected, this parameter is discarded. */ |
bogdanm | 0:9b334a45a8ff | 84 | |
bogdanm | 0:9b334a45a8ff | 85 | uint32_t WindowMode; /*!< Selects the window mode of the 2 comparators. |
bogdanm | 0:9b334a45a8ff | 86 | If enabled, non-inverting inputs of the 2 comparators are connected together and are using inputs of COMP2 only (COMP1 non-inverting input is no more accessible, even from ADC channel VCOMP). |
bogdanm | 0:9b334a45a8ff | 87 | This parameter can be a value of @ref COMP_WindowMode |
bogdanm | 0:9b334a45a8ff | 88 | Note: This feature must be enabled from COMP2 instance. If COMP1 is selected, this parameter is discarded. */ |
bogdanm | 0:9b334a45a8ff | 89 | |
bogdanm | 0:9b334a45a8ff | 90 | uint32_t TriggerMode; /*!< Selects the trigger mode of the comparator when using interruption on EXTI line (interrupt mode). |
bogdanm | 0:9b334a45a8ff | 91 | This parameter can be a value of @ref COMP_TriggerMode |
bogdanm | 0:9b334a45a8ff | 92 | Note: This feature is used with function "HAL_COMP_Start_IT()". In all other functions, this parameter is discarded. */ |
bogdanm | 0:9b334a45a8ff | 93 | |
bogdanm | 0:9b334a45a8ff | 94 | uint32_t NonInvertingInputPull; /*!< Selects the internal pulling resistor connected on non inverting input. |
bogdanm | 0:9b334a45a8ff | 95 | This parameter can be a value of @ref COMP_NonInvertingInputPull |
bogdanm | 0:9b334a45a8ff | 96 | Note: To avoid extra power consumption, only one resistor should be enabled at a time. |
bogdanm | 0:9b334a45a8ff | 97 | Note: This feature is available on COMP1 only. If COMP2 is selected, this parameter is discarded. */ |
bogdanm | 0:9b334a45a8ff | 98 | |
bogdanm | 0:9b334a45a8ff | 99 | }COMP_InitTypeDef; |
bogdanm | 0:9b334a45a8ff | 100 | |
bogdanm | 0:9b334a45a8ff | 101 | /** |
bogdanm | 0:9b334a45a8ff | 102 | * @brief HAL State structures definition |
bogdanm | 0:9b334a45a8ff | 103 | */ |
bogdanm | 0:9b334a45a8ff | 104 | typedef enum |
bogdanm | 0:9b334a45a8ff | 105 | { |
bogdanm | 0:9b334a45a8ff | 106 | HAL_COMP_STATE_RESET = 0x00, /*!< COMP not yet initialized or disabled */ |
bogdanm | 0:9b334a45a8ff | 107 | HAL_COMP_STATE_READY = 0x01, /*!< COMP initialized and ready for use */ |
bogdanm | 0:9b334a45a8ff | 108 | HAL_COMP_STATE_READY_LOCKED = 0x11, /*!< COMP initialized but the configuration is locked */ |
bogdanm | 0:9b334a45a8ff | 109 | HAL_COMP_STATE_BUSY = 0x02, /*!< COMP is running */ |
bogdanm | 0:9b334a45a8ff | 110 | HAL_COMP_STATE_BUSY_LOCKED = 0x12 /*!< COMP is running and the configuration is locked */ |
bogdanm | 0:9b334a45a8ff | 111 | }HAL_COMP_StateTypeDef; |
bogdanm | 0:9b334a45a8ff | 112 | |
bogdanm | 0:9b334a45a8ff | 113 | /** |
bogdanm | 0:9b334a45a8ff | 114 | * @brief COMP Handle Structure definition |
bogdanm | 0:9b334a45a8ff | 115 | */ |
bogdanm | 0:9b334a45a8ff | 116 | typedef struct |
bogdanm | 0:9b334a45a8ff | 117 | { |
bogdanm | 0:9b334a45a8ff | 118 | COMP_TypeDef *Instance; /*!< Register base address */ |
bogdanm | 0:9b334a45a8ff | 119 | COMP_InitTypeDef Init; /*!< COMP required parameters */ |
bogdanm | 0:9b334a45a8ff | 120 | HAL_LockTypeDef Lock; /*!< Locking object */ |
bogdanm | 0:9b334a45a8ff | 121 | __IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */ |
bogdanm | 0:9b334a45a8ff | 122 | } COMP_HandleTypeDef; |
bogdanm | 0:9b334a45a8ff | 123 | |
bogdanm | 0:9b334a45a8ff | 124 | /** |
bogdanm | 0:9b334a45a8ff | 125 | * @} |
bogdanm | 0:9b334a45a8ff | 126 | */ |
bogdanm | 0:9b334a45a8ff | 127 | |
bogdanm | 0:9b334a45a8ff | 128 | /* Exported constants --------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 129 | /** @defgroup COMP_Exported_Constants COMP Exported Constants |
bogdanm | 0:9b334a45a8ff | 130 | * @{ |
bogdanm | 0:9b334a45a8ff | 131 | */ |
bogdanm | 0:9b334a45a8ff | 132 | |
bogdanm | 0:9b334a45a8ff | 133 | /** @defgroup COMP_Output COMP Output |
bogdanm | 0:9b334a45a8ff | 134 | * @{ |
bogdanm | 0:9b334a45a8ff | 135 | */ |
bogdanm | 0:9b334a45a8ff | 136 | #define COMP_OUTPUT_TIM2IC4 ((uint32_t)0x00000000) /*!< COMP2 output connected to TIM2 Input Capture 4 */ |
bogdanm | 0:9b334a45a8ff | 137 | #define COMP_OUTPUT_TIM2OCREFCLR ( COMP_CSR_OUTSEL_0) /*!< COMP2 output connected to TIM2 OCREF Clear */ |
bogdanm | 0:9b334a45a8ff | 138 | #define COMP_OUTPUT_TIM3IC4 ( COMP_CSR_OUTSEL_1 ) /*!< COMP2 output connected to TIM3 Input Capture 4 */ |
bogdanm | 0:9b334a45a8ff | 139 | #define COMP_OUTPUT_TIM3OCREFCLR ( COMP_CSR_OUTSEL_1 | COMP_CSR_OUTSEL_0) /*!< COMP2 output connected to TIM3 OCREF Clear */ |
bogdanm | 0:9b334a45a8ff | 140 | #define COMP_OUTPUT_TIM4IC4 (COMP_CSR_OUTSEL_2 ) /*!< COMP2 output connected to TIM4 Input Capture 4 */ |
bogdanm | 0:9b334a45a8ff | 141 | #define COMP_OUTPUT_TIM4OCREFCLR (COMP_CSR_OUTSEL_2 | COMP_CSR_OUTSEL_0) /*!< COMP2 output connected to TIM4 OCREF Clear */ |
bogdanm | 0:9b334a45a8ff | 142 | #define COMP_OUTPUT_TIM10IC1 (COMP_CSR_OUTSEL_2 | COMP_CSR_OUTSEL_1 ) /*!< COMP2 output connected to TIM10 Input Capture 1 */ |
bogdanm | 0:9b334a45a8ff | 143 | #define COMP_OUTPUT_NONE (COMP_CSR_OUTSEL_2 | COMP_CSR_OUTSEL_1 | COMP_CSR_OUTSEL_0) /*!< COMP2 output is not connected to other peripherals */ |
bogdanm | 0:9b334a45a8ff | 144 | |
bogdanm | 0:9b334a45a8ff | 145 | #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OUTPUT_TIM2IC4) || \ |
bogdanm | 0:9b334a45a8ff | 146 | ((OUTPUT) == COMP_OUTPUT_TIM2OCREFCLR) || \ |
bogdanm | 0:9b334a45a8ff | 147 | ((OUTPUT) == COMP_OUTPUT_TIM3IC4) || \ |
bogdanm | 0:9b334a45a8ff | 148 | ((OUTPUT) == COMP_OUTPUT_TIM3OCREFCLR) || \ |
bogdanm | 0:9b334a45a8ff | 149 | ((OUTPUT) == COMP_OUTPUT_TIM4IC4) || \ |
bogdanm | 0:9b334a45a8ff | 150 | ((OUTPUT) == COMP_OUTPUT_TIM4OCREFCLR) || \ |
bogdanm | 0:9b334a45a8ff | 151 | ((OUTPUT) == COMP_OUTPUT_TIM10IC1) || \ |
bogdanm | 0:9b334a45a8ff | 152 | ((OUTPUT) == COMP_OUTPUT_NONE) ) |
bogdanm | 0:9b334a45a8ff | 153 | /** |
bogdanm | 0:9b334a45a8ff | 154 | * @} |
bogdanm | 0:9b334a45a8ff | 155 | */ |
bogdanm | 0:9b334a45a8ff | 156 | |
bogdanm | 0:9b334a45a8ff | 157 | /** @defgroup COMP_InvertingInput COMP InvertingInput |
bogdanm | 0:9b334a45a8ff | 158 | * @{ |
bogdanm | 0:9b334a45a8ff | 159 | */ |
bogdanm | 0:9b334a45a8ff | 160 | /* Inverting Input specific to COMP2 */ |
bogdanm | 0:9b334a45a8ff | 161 | #define COMP_INVERTINGINPUT_IO ( COMP_CSR_INSEL_0) /*!< External I/O (COMP2_INM connected to pin PB3) connected to comparator 2 inverting input */ |
bogdanm | 0:9b334a45a8ff | 162 | #define COMP_INVERTINGINPUT_VREFINT ( COMP_CSR_INSEL_1 ) /*!< VREFINT connected to comparator 2 inverting input */ |
bogdanm | 0:9b334a45a8ff | 163 | #define COMP_INVERTINGINPUT_3_4VREFINT ( COMP_CSR_INSEL_1 | COMP_CSR_INSEL_0) /*!< 3/4 VREFINT connected to comparator 2 inverting input */ |
bogdanm | 0:9b334a45a8ff | 164 | #define COMP_INVERTINGINPUT_1_2VREFINT (COMP_CSR_INSEL_2 ) /*!< 1/2 VREFINT connected to comparator 2 inverting input */ |
bogdanm | 0:9b334a45a8ff | 165 | #define COMP_INVERTINGINPUT_1_4VREFINT (COMP_CSR_INSEL_2 | COMP_CSR_INSEL_0) /*!< 1/4 VREFINT connected to comparator 2 inverting input */ |
bogdanm | 0:9b334a45a8ff | 166 | #define COMP_INVERTINGINPUT_DAC1 (COMP_CSR_INSEL_2 | COMP_CSR_INSEL_1 ) /*!< DAC_OUT1 (PA4) connected to comparator 2 inverting input */ |
bogdanm | 0:9b334a45a8ff | 167 | #define COMP_INVERTINGINPUT_DAC2 (COMP_CSR_INSEL_2 | COMP_CSR_INSEL_1 | COMP_CSR_INSEL_0) /*!< DAC2_OUT (PA5) connected to comparator 2 inverting input */ |
bogdanm | 0:9b334a45a8ff | 168 | |
bogdanm | 0:9b334a45a8ff | 169 | #define IS_COMP_INVERTINGINPUT(INPUT) (((INPUT) == COMP_INVERTINGINPUT_IO) || \ |
bogdanm | 0:9b334a45a8ff | 170 | ((INPUT) == COMP_INVERTINGINPUT_VREFINT) || \ |
bogdanm | 0:9b334a45a8ff | 171 | ((INPUT) == COMP_INVERTINGINPUT_3_4VREFINT) || \ |
bogdanm | 0:9b334a45a8ff | 172 | ((INPUT) == COMP_INVERTINGINPUT_1_2VREFINT) || \ |
bogdanm | 0:9b334a45a8ff | 173 | ((INPUT) == COMP_INVERTINGINPUT_1_4VREFINT) || \ |
bogdanm | 0:9b334a45a8ff | 174 | ((INPUT) == COMP_INVERTINGINPUT_DAC1) || \ |
bogdanm | 0:9b334a45a8ff | 175 | ((INPUT) == COMP_INVERTINGINPUT_DAC2) ) |
bogdanm | 0:9b334a45a8ff | 176 | /** |
bogdanm | 0:9b334a45a8ff | 177 | * @} |
bogdanm | 0:9b334a45a8ff | 178 | */ |
bogdanm | 0:9b334a45a8ff | 179 | |
bogdanm | 0:9b334a45a8ff | 180 | /** @defgroup COMP_Mode COMP Mode |
bogdanm | 0:9b334a45a8ff | 181 | * @{ |
bogdanm | 0:9b334a45a8ff | 182 | */ |
bogdanm | 0:9b334a45a8ff | 183 | /* Please refer to the electrical characteristics in the device datasheet for |
bogdanm | 0:9b334a45a8ff | 184 | the power consumption values */ |
bogdanm | 0:9b334a45a8ff | 185 | #define COMP_MODE_LOWSPEED ((uint32_t)0x00000000) /*!< Low Speed */ |
bogdanm | 0:9b334a45a8ff | 186 | #define COMP_MODE_HIGHSPEED COMP_CSR_SPEED /*!< High Speed */ |
bogdanm | 0:9b334a45a8ff | 187 | |
bogdanm | 0:9b334a45a8ff | 188 | #define IS_COMP_MODE(SPEED) (((SPEED) == COMP_MODE_LOWSPEED) || \ |
bogdanm | 0:9b334a45a8ff | 189 | ((SPEED) == COMP_MODE_HIGHSPEED)) |
bogdanm | 0:9b334a45a8ff | 190 | /** |
bogdanm | 0:9b334a45a8ff | 191 | * @} |
bogdanm | 0:9b334a45a8ff | 192 | */ |
bogdanm | 0:9b334a45a8ff | 193 | |
bogdanm | 0:9b334a45a8ff | 194 | /** @defgroup COMP_WindowMode COMP WindowMode |
bogdanm | 0:9b334a45a8ff | 195 | * @{ |
bogdanm | 0:9b334a45a8ff | 196 | */ |
bogdanm | 0:9b334a45a8ff | 197 | #define COMP_WINDOWMODE_DISABLED ((uint32_t)0x00000000) /*!< Window mode disabled: COMP1 non-inverting input is independant */ |
bogdanm | 0:9b334a45a8ff | 198 | #define COMP_WINDOWMODE_ENABLED COMP_CSR_WNDWE /*!< Window mode enabled: COMP1 non-inverting input is no more accessible, even from ADC channel VCOMP) (connected to COMP2 non-inverting input) */ |
bogdanm | 0:9b334a45a8ff | 199 | |
bogdanm | 0:9b334a45a8ff | 200 | #define IS_COMP_WINDOWMODE(WINDOWMODE) (((WINDOWMODE) == COMP_WINDOWMODE_DISABLED) || \ |
bogdanm | 0:9b334a45a8ff | 201 | ((WINDOWMODE) == COMP_WINDOWMODE_ENABLED)) |
bogdanm | 0:9b334a45a8ff | 202 | /** |
bogdanm | 0:9b334a45a8ff | 203 | * @} |
bogdanm | 0:9b334a45a8ff | 204 | */ |
bogdanm | 0:9b334a45a8ff | 205 | |
bogdanm | 0:9b334a45a8ff | 206 | /** @defgroup COMP_OutputLevel COMP OutputLevel |
bogdanm | 0:9b334a45a8ff | 207 | * @{ |
bogdanm | 0:9b334a45a8ff | 208 | */ |
bogdanm | 0:9b334a45a8ff | 209 | /* Comparator output is low when the non-inverting input is at a lower */ |
bogdanm | 0:9b334a45a8ff | 210 | /* voltage than the inverting input. */ |
bogdanm | 0:9b334a45a8ff | 211 | #define COMP_OUTPUTLEVEL_LOW ((uint32_t)0x00000000) |
bogdanm | 0:9b334a45a8ff | 212 | |
bogdanm | 0:9b334a45a8ff | 213 | /* Comparator output is high when the non-inverting input is at a higher */ |
bogdanm | 0:9b334a45a8ff | 214 | /* voltage than the inverting input. */ |
bogdanm | 0:9b334a45a8ff | 215 | #define COMP_OUTPUTLEVEL_HIGH ((uint32_t)0x00000001) |
bogdanm | 0:9b334a45a8ff | 216 | /** |
bogdanm | 0:9b334a45a8ff | 217 | * @} |
bogdanm | 0:9b334a45a8ff | 218 | */ |
bogdanm | 0:9b334a45a8ff | 219 | |
bogdanm | 0:9b334a45a8ff | 220 | /** @defgroup COMP_TriggerMode COMP TriggerMode |
bogdanm | 0:9b334a45a8ff | 221 | * @{ |
bogdanm | 0:9b334a45a8ff | 222 | */ |
bogdanm | 0:9b334a45a8ff | 223 | #define COMP_TRIGGERMODE_NONE ((uint32_t)0x00000000) /*!< No External Interrupt trigger detection */ |
bogdanm | 0:9b334a45a8ff | 224 | #define COMP_TRIGGERMODE_IT_RISING ((uint32_t)0x00000001) /*!< External Interrupt Mode with Rising edge trigger detection */ |
bogdanm | 0:9b334a45a8ff | 225 | #define COMP_TRIGGERMODE_IT_FALLING ((uint32_t)0x00000002) /*!< External Interrupt Mode with Falling edge trigger detection */ |
bogdanm | 0:9b334a45a8ff | 226 | #define COMP_TRIGGERMODE_IT_RISING_FALLING ((uint32_t)0x00000003) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ |
bogdanm | 0:9b334a45a8ff | 227 | |
bogdanm | 0:9b334a45a8ff | 228 | #define IS_COMP_TRIGGERMODE(MODE) (((MODE) == COMP_TRIGGERMODE_NONE) || \ |
bogdanm | 0:9b334a45a8ff | 229 | ((MODE) == COMP_TRIGGERMODE_IT_RISING) || \ |
bogdanm | 0:9b334a45a8ff | 230 | ((MODE) == COMP_TRIGGERMODE_IT_FALLING) || \ |
bogdanm | 0:9b334a45a8ff | 231 | ((MODE) == COMP_TRIGGERMODE_IT_RISING_FALLING) ) |
bogdanm | 0:9b334a45a8ff | 232 | /** |
bogdanm | 0:9b334a45a8ff | 233 | * @} |
bogdanm | 0:9b334a45a8ff | 234 | */ |
bogdanm | 0:9b334a45a8ff | 235 | |
bogdanm | 0:9b334a45a8ff | 236 | /** @defgroup COMP_ExtiLineEvent COMP ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 237 | * @{ |
bogdanm | 0:9b334a45a8ff | 238 | */ |
bogdanm | 0:9b334a45a8ff | 239 | #define COMP_EXTI_LINE_COMP1_EVENT EXTI_RTSR_TR21 /*!< External interrupt line 21 Connected to COMP1 */ |
bogdanm | 0:9b334a45a8ff | 240 | #define COMP_EXTI_LINE_COMP2_EVENT EXTI_RTSR_TR22 /*!< External interrupt line 22 Connected to COMP2 */ |
bogdanm | 0:9b334a45a8ff | 241 | |
bogdanm | 0:9b334a45a8ff | 242 | /** |
bogdanm | 0:9b334a45a8ff | 243 | * @} |
bogdanm | 0:9b334a45a8ff | 244 | */ |
bogdanm | 0:9b334a45a8ff | 245 | |
bogdanm | 0:9b334a45a8ff | 246 | /** @defgroup COMP_NonInvertingInputPull COMP NonInvertingInputPull |
bogdanm | 0:9b334a45a8ff | 247 | * @{ |
bogdanm | 0:9b334a45a8ff | 248 | */ |
bogdanm | 0:9b334a45a8ff | 249 | #define COMP_NONINVERTINGINPUT_NOPULL ((uint32_t)0x00000000) /*!< No internal pull-up or pull-down resistor connected to comparator non inverting input */ |
bogdanm | 0:9b334a45a8ff | 250 | #define COMP_NONINVERTINGINPUT_10KPU COMP_CSR_10KPU /*!< Internal 10kOhm pull-up resistor connected to comparator non inverting input */ |
bogdanm | 0:9b334a45a8ff | 251 | #define COMP_NONINVERTINGINPUT_10KPD COMP_CSR_10KPD /*!< Internal 10kOhm pull-down resistor connected to comparator non inverting input */ |
bogdanm | 0:9b334a45a8ff | 252 | #define COMP_NONINVERTINGINPUT_400KPU COMP_CSR_400KPU /*!< Internal 400kOhm pull-up resistor connected to comparator non inverting input */ |
bogdanm | 0:9b334a45a8ff | 253 | #define COMP_NONINVERTINGINPUT_400KPD COMP_CSR_400KPD /*!< Internal 400kOhm pull-down resistor connected to comparator non inverting input */ |
bogdanm | 0:9b334a45a8ff | 254 | |
bogdanm | 0:9b334a45a8ff | 255 | #define IS_COMP_NONINVERTINGINPUTPULL(INPUT) (((INPUT) == COMP_NONINVERTINGINPUT_NOPULL) || \ |
bogdanm | 0:9b334a45a8ff | 256 | ((INPUT) == COMP_NONINVERTINGINPUT_10KPU) || \ |
bogdanm | 0:9b334a45a8ff | 257 | ((INPUT) == COMP_NONINVERTINGINPUT_10KPD) || \ |
bogdanm | 0:9b334a45a8ff | 258 | ((INPUT) == COMP_NONINVERTINGINPUT_400KPU) || \ |
bogdanm | 0:9b334a45a8ff | 259 | ((INPUT) == COMP_NONINVERTINGINPUT_400KPD) ) |
bogdanm | 0:9b334a45a8ff | 260 | /** |
bogdanm | 0:9b334a45a8ff | 261 | * @} |
bogdanm | 0:9b334a45a8ff | 262 | */ |
bogdanm | 0:9b334a45a8ff | 263 | |
bogdanm | 0:9b334a45a8ff | 264 | /** |
bogdanm | 0:9b334a45a8ff | 265 | * @} |
bogdanm | 0:9b334a45a8ff | 266 | */ |
bogdanm | 0:9b334a45a8ff | 267 | |
bogdanm | 0:9b334a45a8ff | 268 | |
bogdanm | 0:9b334a45a8ff | 269 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 270 | |
bogdanm | 0:9b334a45a8ff | 271 | /** @defgroup COMP_Exported_Macro COMP Exported Macro |
bogdanm | 0:9b334a45a8ff | 272 | * @{ |
bogdanm | 0:9b334a45a8ff | 273 | */ |
bogdanm | 0:9b334a45a8ff | 274 | |
bogdanm | 0:9b334a45a8ff | 275 | /** @brief Reset COMP handle state |
bogdanm | 0:9b334a45a8ff | 276 | * @param __HANDLE__: COMP handle. |
bogdanm | 0:9b334a45a8ff | 277 | * @retval None |
bogdanm | 0:9b334a45a8ff | 278 | */ |
bogdanm | 0:9b334a45a8ff | 279 | #define __HAL_COMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_COMP_STATE_RESET) |
bogdanm | 0:9b334a45a8ff | 280 | |
bogdanm | 0:9b334a45a8ff | 281 | /** |
bogdanm | 0:9b334a45a8ff | 282 | * @brief Enables the specified comparator |
bogdanm | 0:9b334a45a8ff | 283 | * @param __HANDLE__: COMP handle. |
bogdanm | 0:9b334a45a8ff | 284 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 285 | */ |
bogdanm | 0:9b334a45a8ff | 286 | #define __HAL_COMP_ENABLE(__HANDLE__) \ |
bogdanm | 0:9b334a45a8ff | 287 | ( ( ((__HANDLE__)->Instance == COMP1) \ |
bogdanm | 0:9b334a45a8ff | 288 | )? \ |
bogdanm | 0:9b334a45a8ff | 289 | SET_BIT(COMP->CSR, COMP_CSR_CMP1EN) \ |
bogdanm | 0:9b334a45a8ff | 290 | : \ |
bogdanm | 0:9b334a45a8ff | 291 | MODIFY_REG(COMP->CSR, COMP_CSR_INSEL, (__HANDLE__)->Init.InvertingInput ) \ |
bogdanm | 0:9b334a45a8ff | 292 | ) |
bogdanm | 0:9b334a45a8ff | 293 | |
bogdanm | 0:9b334a45a8ff | 294 | /** |
bogdanm | 0:9b334a45a8ff | 295 | * @brief Disables the specified comparator |
bogdanm | 0:9b334a45a8ff | 296 | * @param __HANDLE__: COMP handle. |
bogdanm | 0:9b334a45a8ff | 297 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 298 | */ |
bogdanm | 0:9b334a45a8ff | 299 | #define __HAL_COMP_DISABLE(__HANDLE__) \ |
bogdanm | 0:9b334a45a8ff | 300 | ( ( ((__HANDLE__)->Instance == COMP1) \ |
bogdanm | 0:9b334a45a8ff | 301 | )? \ |
bogdanm | 0:9b334a45a8ff | 302 | CLEAR_BIT(COMP->CSR, COMP_CSR_CMP1EN) \ |
bogdanm | 0:9b334a45a8ff | 303 | : \ |
bogdanm | 0:9b334a45a8ff | 304 | CLEAR_BIT(COMP->CSR, COMP_CSR_INSEL) \ |
bogdanm | 0:9b334a45a8ff | 305 | ) |
bogdanm | 0:9b334a45a8ff | 306 | |
bogdanm | 0:9b334a45a8ff | 307 | |
bogdanm | 0:9b334a45a8ff | 308 | /** @brief Checks whether the specified COMP flag is set or not. |
bogdanm | 0:9b334a45a8ff | 309 | * @param __HANDLE__: specifies the COMP Handle. |
bogdanm | 0:9b334a45a8ff | 310 | * @param __FLAG__: specifies the flag to check. |
bogdanm | 0:9b334a45a8ff | 311 | * This parameter can be one of the following values: |
bogdanm | 0:9b334a45a8ff | 312 | * @arg COMP_FLAG_LOCK: lock flag |
bogdanm | 0:9b334a45a8ff | 313 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
bogdanm | 0:9b334a45a8ff | 314 | */ |
bogdanm | 0:9b334a45a8ff | 315 | #define __HAL_COMP_GET_FLAG(__HANDLE__, __FLAG__) (READ_BIT((__HANDLE__)->Instance->CSR, (__FLAG__)) == (__FLAG__)) |
bogdanm | 0:9b334a45a8ff | 316 | |
bogdanm | 0:9b334a45a8ff | 317 | |
bogdanm | 0:9b334a45a8ff | 318 | /** |
bogdanm | 0:9b334a45a8ff | 319 | * @brief Enable the Exti Line rising edge trigger. |
bogdanm | 0:9b334a45a8ff | 320 | * @param __EXTILINE__: specifies the COMP Exti sources to be enabled. |
bogdanm | 0:9b334a45a8ff | 321 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 322 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 323 | */ |
bogdanm | 0:9b334a45a8ff | 324 | #define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (SET_BIT(EXTI->RTSR, (__EXTILINE__))) |
bogdanm | 0:9b334a45a8ff | 325 | |
bogdanm | 0:9b334a45a8ff | 326 | /** |
bogdanm | 0:9b334a45a8ff | 327 | * @brief Disable the Exti Line rising edge trigger. |
bogdanm | 0:9b334a45a8ff | 328 | * @param __EXTILINE__: specifies the COMP Exti sources to be disabled. |
bogdanm | 0:9b334a45a8ff | 329 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 330 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 331 | */ |
bogdanm | 0:9b334a45a8ff | 332 | #define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (CLEAR_BIT(EXTI->RTSR, (__EXTILINE__))) |
bogdanm | 0:9b334a45a8ff | 333 | |
bogdanm | 0:9b334a45a8ff | 334 | /** |
bogdanm | 0:9b334a45a8ff | 335 | * @brief Enable the Exti Line falling edge trigger. |
bogdanm | 0:9b334a45a8ff | 336 | * @param __EXTILINE__: specifies the COMP Exti sources to be enabled. |
bogdanm | 0:9b334a45a8ff | 337 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 338 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 339 | */ |
bogdanm | 0:9b334a45a8ff | 340 | #define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (SET_BIT(EXTI->FTSR, (__EXTILINE__))) |
bogdanm | 0:9b334a45a8ff | 341 | |
bogdanm | 0:9b334a45a8ff | 342 | /** |
bogdanm | 0:9b334a45a8ff | 343 | * @brief Disable the Exti Line falling edge trigger. |
bogdanm | 0:9b334a45a8ff | 344 | * @param __EXTILINE__: specifies the COMP Exti sources to be disabled. |
bogdanm | 0:9b334a45a8ff | 345 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 346 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 347 | */ |
bogdanm | 0:9b334a45a8ff | 348 | #define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (CLEAR_BIT(EXTI->FTSR, (__EXTILINE__))) |
bogdanm | 0:9b334a45a8ff | 349 | |
bogdanm | 0:9b334a45a8ff | 350 | /** |
bogdanm | 0:9b334a45a8ff | 351 | * @brief Get the specified EXTI line for a comparator instance |
bogdanm | 0:9b334a45a8ff | 352 | * @param __INSTANCE__: specifies the COMP instance. |
bogdanm | 0:9b334a45a8ff | 353 | * @retval value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 354 | */ |
bogdanm | 0:9b334a45a8ff | 355 | #define __HAL_COMP_GET_EXTI_LINE(__INSTANCE__) \ |
bogdanm | 0:9b334a45a8ff | 356 | ( ( ((__INSTANCE__) == COMP1) \ |
bogdanm | 0:9b334a45a8ff | 357 | )? \ |
bogdanm | 0:9b334a45a8ff | 358 | (COMP_EXTI_LINE_COMP1_EVENT) \ |
bogdanm | 0:9b334a45a8ff | 359 | : \ |
bogdanm | 0:9b334a45a8ff | 360 | (COMP_EXTI_LINE_COMP2_EVENT) \ |
bogdanm | 0:9b334a45a8ff | 361 | ) |
bogdanm | 0:9b334a45a8ff | 362 | |
bogdanm | 0:9b334a45a8ff | 363 | /** |
bogdanm | 0:9b334a45a8ff | 364 | * @brief Enable the COMP Exti Line. |
bogdanm | 0:9b334a45a8ff | 365 | * @param __EXTILINE__: specifies the COMP Exti sources to be enabled. |
bogdanm | 0:9b334a45a8ff | 366 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 367 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 368 | */ |
bogdanm | 0:9b334a45a8ff | 369 | #define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (SET_BIT(EXTI->IMR, (__EXTILINE__))) |
bogdanm | 0:9b334a45a8ff | 370 | |
bogdanm | 0:9b334a45a8ff | 371 | /** |
bogdanm | 0:9b334a45a8ff | 372 | * @brief Disable the COMP Exti Line. |
bogdanm | 0:9b334a45a8ff | 373 | * @param __EXTILINE__: specifies the COMP Exti sources to be disabled. |
bogdanm | 0:9b334a45a8ff | 374 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 375 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 376 | */ |
bogdanm | 0:9b334a45a8ff | 377 | #define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (CLEAR_BIT(EXTI->IMR, (__EXTILINE__))) |
bogdanm | 0:9b334a45a8ff | 378 | |
bogdanm | 0:9b334a45a8ff | 379 | /** |
bogdanm | 0:9b334a45a8ff | 380 | * @brief Checks whether the specified EXTI line flag is set or not. |
bogdanm | 0:9b334a45a8ff | 381 | * @param __FLAG__: specifies the COMP Exti sources to be checked. |
bogdanm | 0:9b334a45a8ff | 382 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 383 | * @retval The state of __FLAG__ (SET or RESET). |
bogdanm | 0:9b334a45a8ff | 384 | */ |
bogdanm | 0:9b334a45a8ff | 385 | #define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (READ_BIT(EXTI->PR, (__FLAG__))) |
bogdanm | 0:9b334a45a8ff | 386 | |
bogdanm | 0:9b334a45a8ff | 387 | /** |
bogdanm | 0:9b334a45a8ff | 388 | * @brief Clear the COMP Exti flags. |
bogdanm | 0:9b334a45a8ff | 389 | * @param __FLAG__: specifies the COMP Exti sources to be cleared. |
bogdanm | 0:9b334a45a8ff | 390 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 391 | * @retval None. |
bogdanm | 0:9b334a45a8ff | 392 | */ |
bogdanm | 0:9b334a45a8ff | 393 | #define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (EXTI->PR = (__FLAG__)) |
bogdanm | 0:9b334a45a8ff | 394 | |
bogdanm | 0:9b334a45a8ff | 395 | /** |
bogdanm | 0:9b334a45a8ff | 396 | * @brief Generates a Software interrupt on selected EXTI line. |
bogdanm | 0:9b334a45a8ff | 397 | * @param __EXTILINE__: specifies the COMP Exti sources to trig. |
bogdanm | 0:9b334a45a8ff | 398 | * This parameter can be a value of @ref COMP_ExtiLineEvent |
bogdanm | 0:9b334a45a8ff | 399 | * @retval None |
bogdanm | 0:9b334a45a8ff | 400 | */ |
bogdanm | 0:9b334a45a8ff | 401 | #define __HAL_COMP_EXTI_GENERATE_SWIT(__EXTILINE__) (SET_BIT(EXTI->SWIER, (__EXTILINE__))) |
bogdanm | 0:9b334a45a8ff | 402 | |
bogdanm | 0:9b334a45a8ff | 403 | /** |
bogdanm | 0:9b334a45a8ff | 404 | * @} |
bogdanm | 0:9b334a45a8ff | 405 | */ |
bogdanm | 0:9b334a45a8ff | 406 | |
bogdanm | 0:9b334a45a8ff | 407 | /* Private macro -------------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 408 | |
bogdanm | 0:9b334a45a8ff | 409 | /** @defgroup COMP_Private_Macro COMP Private Macro |
bogdanm | 0:9b334a45a8ff | 410 | * @{ |
bogdanm | 0:9b334a45a8ff | 411 | */ |
bogdanm | 0:9b334a45a8ff | 412 | |
bogdanm | 0:9b334a45a8ff | 413 | /** |
bogdanm | 0:9b334a45a8ff | 414 | * @brief Select the COMP register CSR bit CMPxOUT corresponding to the |
bogdanm | 0:9b334a45a8ff | 415 | * selected COMP instance. |
bogdanm | 0:9b334a45a8ff | 416 | * @param __HANDLE__: COMP handle |
bogdanm | 0:9b334a45a8ff | 417 | * @retval Comparator register CSR bit COMP_CSR_CMP1OUT or COMP_CSR_CMP2OUT |
bogdanm | 0:9b334a45a8ff | 418 | */ |
bogdanm | 0:9b334a45a8ff | 419 | #define __COMP_CSR_CMPXOUT(__HANDLE__) \ |
bogdanm | 0:9b334a45a8ff | 420 | ( ( ((__HANDLE__)->Instance == COMP1) \ |
bogdanm | 0:9b334a45a8ff | 421 | )? \ |
bogdanm | 0:9b334a45a8ff | 422 | (COMP_CSR_CMP1OUT) \ |
bogdanm | 0:9b334a45a8ff | 423 | : \ |
bogdanm | 0:9b334a45a8ff | 424 | (COMP_CSR_CMP2OUT) \ |
bogdanm | 0:9b334a45a8ff | 425 | ) |
bogdanm | 0:9b334a45a8ff | 426 | |
bogdanm | 0:9b334a45a8ff | 427 | /** |
bogdanm | 0:9b334a45a8ff | 428 | * @brief Verification of COMP state: enabled or disabled |
bogdanm | 0:9b334a45a8ff | 429 | * @param __HANDLE__: COMP handle |
bogdanm | 0:9b334a45a8ff | 430 | * @retval SET (COMP enabled) or RESET (COMP disabled) |
bogdanm | 0:9b334a45a8ff | 431 | */ |
bogdanm | 0:9b334a45a8ff | 432 | #define __COMP_IS_ENABLED(__HANDLE__) \ |
bogdanm | 0:9b334a45a8ff | 433 | ( ( ((__HANDLE__)->Instance == COMP1) \ |
bogdanm | 0:9b334a45a8ff | 434 | )? \ |
bogdanm | 0:9b334a45a8ff | 435 | (((READ_BIT(COMP->CSR , COMP_CSR_CMP1EN) == COMP_CSR_CMP1EN) \ |
bogdanm | 0:9b334a45a8ff | 436 | ) ? SET : RESET) \ |
bogdanm | 0:9b334a45a8ff | 437 | : \ |
bogdanm | 0:9b334a45a8ff | 438 | (((READ_BIT(COMP->CSR , COMP_CSR_INSEL) != RESET) \ |
bogdanm | 0:9b334a45a8ff | 439 | ) ? SET : RESET) \ |
bogdanm | 0:9b334a45a8ff | 440 | ) |
bogdanm | 0:9b334a45a8ff | 441 | |
bogdanm | 0:9b334a45a8ff | 442 | /** |
bogdanm | 0:9b334a45a8ff | 443 | * @} |
bogdanm | 0:9b334a45a8ff | 444 | */ |
bogdanm | 0:9b334a45a8ff | 445 | |
bogdanm | 0:9b334a45a8ff | 446 | |
bogdanm | 0:9b334a45a8ff | 447 | /* Include COMP HAL Extension module */ |
bogdanm | 0:9b334a45a8ff | 448 | #include "stm32l1xx_hal_comp_ex.h" |
bogdanm | 0:9b334a45a8ff | 449 | |
bogdanm | 0:9b334a45a8ff | 450 | /* Exported functions --------------------------------------------------------*/ |
bogdanm | 0:9b334a45a8ff | 451 | /** @addtogroup COMP_Exported_Functions |
bogdanm | 0:9b334a45a8ff | 452 | * @{ |
bogdanm | 0:9b334a45a8ff | 453 | */ |
bogdanm | 0:9b334a45a8ff | 454 | |
bogdanm | 0:9b334a45a8ff | 455 | /* Initialization and de-initialization functions ******************************/ |
bogdanm | 0:9b334a45a8ff | 456 | /** @addtogroup COMP_Exported_Functions_Group1 |
bogdanm | 0:9b334a45a8ff | 457 | * @{ |
bogdanm | 0:9b334a45a8ff | 458 | */ |
bogdanm | 0:9b334a45a8ff | 459 | HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 460 | HAL_StatusTypeDef HAL_COMP_DeInit (COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 461 | void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 462 | void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 463 | /** |
bogdanm | 0:9b334a45a8ff | 464 | * @} |
bogdanm | 0:9b334a45a8ff | 465 | */ |
bogdanm | 0:9b334a45a8ff | 466 | |
bogdanm | 0:9b334a45a8ff | 467 | /* I/O operation functions *****************************************************/ |
bogdanm | 0:9b334a45a8ff | 468 | /** @addtogroup COMP_Exported_Functions_Group2 |
bogdanm | 0:9b334a45a8ff | 469 | * @{ |
bogdanm | 0:9b334a45a8ff | 470 | */ |
bogdanm | 0:9b334a45a8ff | 471 | HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 472 | HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 473 | HAL_StatusTypeDef HAL_COMP_Start_IT(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 474 | HAL_StatusTypeDef HAL_COMP_Stop_IT(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 475 | void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 476 | /** |
bogdanm | 0:9b334a45a8ff | 477 | * @} |
bogdanm | 0:9b334a45a8ff | 478 | */ |
bogdanm | 0:9b334a45a8ff | 479 | |
bogdanm | 0:9b334a45a8ff | 480 | /* Peripheral Control functions ************************************************/ |
bogdanm | 0:9b334a45a8ff | 481 | /** @addtogroup COMP_Exported_Functions_Group3 |
bogdanm | 0:9b334a45a8ff | 482 | * @{ |
bogdanm | 0:9b334a45a8ff | 483 | */ |
bogdanm | 0:9b334a45a8ff | 484 | HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 485 | uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 486 | |
bogdanm | 0:9b334a45a8ff | 487 | /* Callback in Interrupt mode */ |
bogdanm | 0:9b334a45a8ff | 488 | void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 489 | /** |
bogdanm | 0:9b334a45a8ff | 490 | * @} |
bogdanm | 0:9b334a45a8ff | 491 | */ |
bogdanm | 0:9b334a45a8ff | 492 | |
bogdanm | 0:9b334a45a8ff | 493 | /* Peripheral State functions **************************************************/ |
bogdanm | 0:9b334a45a8ff | 494 | /** @addtogroup COMP_Exported_Functions_Group4 |
bogdanm | 0:9b334a45a8ff | 495 | * @{ |
bogdanm | 0:9b334a45a8ff | 496 | */ |
bogdanm | 0:9b334a45a8ff | 497 | HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp); |
bogdanm | 0:9b334a45a8ff | 498 | /** |
bogdanm | 0:9b334a45a8ff | 499 | * @} |
bogdanm | 0:9b334a45a8ff | 500 | */ |
bogdanm | 0:9b334a45a8ff | 501 | |
bogdanm | 0:9b334a45a8ff | 502 | /** |
bogdanm | 0:9b334a45a8ff | 503 | * @} |
bogdanm | 0:9b334a45a8ff | 504 | */ |
bogdanm | 0:9b334a45a8ff | 505 | |
bogdanm | 0:9b334a45a8ff | 506 | /** |
bogdanm | 0:9b334a45a8ff | 507 | * @} |
bogdanm | 0:9b334a45a8ff | 508 | */ |
bogdanm | 0:9b334a45a8ff | 509 | |
bogdanm | 0:9b334a45a8ff | 510 | /** |
bogdanm | 0:9b334a45a8ff | 511 | * @} |
bogdanm | 0:9b334a45a8ff | 512 | */ |
bogdanm | 0:9b334a45a8ff | 513 | |
bogdanm | 0:9b334a45a8ff | 514 | #ifdef __cplusplus |
bogdanm | 0:9b334a45a8ff | 515 | } |
bogdanm | 0:9b334a45a8ff | 516 | #endif |
bogdanm | 0:9b334a45a8ff | 517 | |
bogdanm | 0:9b334a45a8ff | 518 | #endif /* __STM32L1xx_HAL_COMP_H */ |
bogdanm | 0:9b334a45a8ff | 519 | |
bogdanm | 0:9b334a45a8ff | 520 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |