Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
stm32f30x_comp.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f30x_comp.h 00004 * @author MCD Application Team 00005 * @version V1.2.3 00006 * @date 10-July-2015 00007 * @brief This file contains all the functions prototypes for the COMP firmware 00008 * library. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> 00013 * 00014 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00015 * You may not use this file except in compliance with the License. 00016 * You may obtain a copy of the License at: 00017 * 00018 * http://www.st.com/software_license_agreement_liberty_v2 00019 * 00020 * Unless required by applicable law or agreed to in writing, software 00021 * distributed under the License is distributed on an "AS IS" BASIS, 00022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00023 * See the License for the specific language governing permissions and 00024 * limitations under the License. 00025 * 00026 ****************************************************************************** 00027 */ 00028 00029 /* Define to prevent recursive inclusion -------------------------------------*/ 00030 #ifndef __STM32F30x_COMP_H 00031 #define __STM32F30x_COMP_H 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 /* Includes ------------------------------------------------------------------*/ 00038 #include "stm32f30x.h" 00039 00040 /** @addtogroup STM32F30x_StdPeriph_Driver 00041 * @{ 00042 */ 00043 00044 /** @addtogroup COMP 00045 * @{ 00046 */ 00047 00048 /* Exported types ------------------------------------------------------------*/ 00049 00050 /** 00051 * @brief COMP Init structure definition 00052 */ 00053 00054 typedef struct 00055 { 00056 00057 uint32_t COMP_InvertingInput; /*!< Selects the inverting input of the comparator. 00058 This parameter can be a value of @ref COMP_InvertingInput */ 00059 00060 uint32_t COMP_NonInvertingInput; /*!< Selects the non inverting input of the comparator. 00061 This parameter can be a value of @ref COMP_NonInvertingInput */ 00062 00063 uint32_t COMP_Output; /*!< Selects the output redirection of the comparator. 00064 This parameter can be a value of @ref COMP_Output */ 00065 00066 uint32_t COMP_BlankingSrce; /*!< Selects the output blanking source of the comparator. 00067 This parameter can be a value of @ref COMP_BlankingSrce */ 00068 00069 uint32_t COMP_OutputPol; /*!< Selects the output polarity of the comparator. 00070 This parameter can be a value of @ref COMP_OutputPoloarity */ 00071 00072 uint32_t COMP_Hysteresis; /*!< Selects the hysteresis voltage of the comparator. 00073 This parameter can be a value of @ref COMP_Hysteresis */ 00074 00075 uint32_t COMP_Mode; /*!< Selects the operating mode of the comparator 00076 and allows to adjust the speed/consumption. 00077 This parameter can be a value of @ref COMP_Mode */ 00078 }COMP_InitTypeDef; 00079 00080 /* Exported constants --------------------------------------------------------*/ 00081 00082 /** @defgroup COMP_Exported_Constants 00083 * @{ 00084 */ 00085 00086 /** @defgroup COMP_Selection 00087 * @{ 00088 */ 00089 00090 #define COMP_Selection_COMP1 ((uint32_t)0x00000000) /*!< COMP1 Selection */ 00091 #define COMP_Selection_COMP2 ((uint32_t)0x00000004) /*!< COMP2 Selection */ 00092 #define COMP_Selection_COMP3 ((uint32_t)0x00000008) /*!< COMP3 Selection */ 00093 #define COMP_Selection_COMP4 ((uint32_t)0x0000000C) /*!< COMP4 Selection */ 00094 #define COMP_Selection_COMP5 ((uint32_t)0x00000010) /*!< COMP5 Selection */ 00095 #define COMP_Selection_COMP6 ((uint32_t)0x00000014) /*!< COMP6 Selection */ 00096 #define COMP_Selection_COMP7 ((uint32_t)0x00000018) /*!< COMP7 Selection */ 00097 00098 #define IS_COMP_ALL_PERIPH(PERIPH) (((PERIPH) == COMP_Selection_COMP1) || \ 00099 ((PERIPH) == COMP_Selection_COMP2) || \ 00100 ((PERIPH) == COMP_Selection_COMP3) || \ 00101 ((PERIPH) == COMP_Selection_COMP4) || \ 00102 ((PERIPH) == COMP_Selection_COMP5) || \ 00103 ((PERIPH) == COMP_Selection_COMP6) || \ 00104 ((PERIPH) == COMP_Selection_COMP7)) 00105 00106 /** 00107 * @} 00108 */ 00109 00110 /** @defgroup COMP_InvertingInput 00111 * @{ 00112 */ 00113 00114 #define COMP_InvertingInput_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */ 00115 #define COMP_InvertingInput_1_2VREFINT COMP_CSR_COMPxINSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input */ 00116 #define COMP_InvertingInput_3_4VREFINT COMP_CSR_COMPxINSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input */ 00117 #define COMP_InvertingInput_VREFINT ((uint32_t)0x00000030) /*!< VREFINT connected to comparator inverting input */ 00118 #define COMP_InvertingInput_DAC1OUT1 COMP_CSR_COMPxINSEL_2 /*!< DAC1_OUT1 (PA4) connected to comparator inverting input */ 00119 #define COMP_InvertingInput_DAC1OUT2 ((uint32_t)0x00000050) /*!< DAC1_OUT2 (PA5) connected to comparator inverting input */ 00120 00121 #define COMP_InvertingInput_IO1 ((uint32_t)0x00000060) /*!< I/O1 (PA0 for COMP1, PA2 for COMP2, PD15 for COMP3, 00122 PE8 for COMP4, PD13 for COMP5, PD10 for COMP6, 00123 PC0 for COMP7) connected to comparator inverting input */ 00124 00125 #define COMP_InvertingInput_IO2 COMP_CSR_COMPxINSEL /*!< I/O2 (PB12 for COMP3, PB2 for COMP4, PB10 for COMP5, 00126 PB15 for COMP6) connected to comparator inverting input. 00127 It is valid only for STM32F303xC devices */ 00128 00129 #define COMP_InvertingInput_DAC2OUT1 COMP_CSR_COMPxINSEL_3 /*!< DAC2_OUT1 (PA6) connected to comparator inverting input */ 00130 00131 #define IS_COMP_INVERTING_INPUT(INPUT) (((INPUT) == COMP_InvertingInput_1_4VREFINT) || \ 00132 ((INPUT) == COMP_InvertingInput_1_2VREFINT) || \ 00133 ((INPUT) == COMP_InvertingInput_3_4VREFINT) || \ 00134 ((INPUT) == COMP_InvertingInput_VREFINT) || \ 00135 ((INPUT) == COMP_InvertingInput_DAC1OUT1) || \ 00136 ((INPUT) == COMP_InvertingInput_DAC1OUT2) || \ 00137 ((INPUT) == COMP_InvertingInput_IO1) || \ 00138 ((INPUT) == COMP_InvertingInput_IO2) || \ 00139 ((INPUT) == COMP_InvertingInput_DAC2OUT1)) 00140 /** 00141 * @} 00142 */ 00143 00144 /** @defgroup COMP_NonInvertingInput 00145 * @{ 00146 */ 00147 00148 #define COMP_NonInvertingInput_IO1 ((uint32_t)0x00000000) /*!< I/O1 (PA1 for COMP1, PA7 for COMP2, PB14 for COMP3, 00149 PB0 for COMP4, PD12 for COMP5, PD11 for COMP6, 00150 PA0 for COMP7) connected to comparator non inverting input */ 00151 00152 #define COMP_NonInvertingInput_IO2 COMP_CSR_COMPxNONINSEL /*!< I/O2 (PA3 for COMP2, PD14 for COMP3, PE7 for COMP4, PB13 for COMP5, 00153 PB11 for COMP6, PC1 for COMP7) connected to comparator non inverting input */ 00154 00155 #define IS_COMP_NONINVERTING_INPUT(INPUT) (((INPUT) == COMP_NonInvertingInput_IO1) || \ 00156 ((INPUT) == COMP_NonInvertingInput_IO2)) 00157 /** 00158 * @} 00159 */ 00160 00161 /** @defgroup COMP_Output 00162 * @{ 00163 */ 00164 00165 #define COMP_Output_None ((uint32_t)0x00000000) /*!< COMP output isn't connected to other peripherals */ 00166 00167 /* Output Redirection common for all comparators COMP1...COMP7 */ 00168 #define COMP_Output_TIM1BKIN COMP_CSR_COMPxOUTSEL_0 /*!< COMP output connected to TIM1 Break Input (BKIN) */ 00169 #define COMP_Output_TIM1BKIN2 ((uint32_t)0x00000800) /*!< COMP output connected to TIM1 Break Input 2 (BKIN2) */ 00170 #define COMP_Output_TIM8BKIN ((uint32_t)0x00000C00) /*!< COMP output connected to TIM8 Break Input (BKIN) */ 00171 #define COMP_Output_TIM8BKIN2 ((uint32_t)0x00001000) /*!< COMP output connected to TIM8 Break Input 2 (BKIN2) */ 00172 #define COMP_Output_TIM1BKIN2_TIM8BKIN2 ((uint32_t)0x00001400) /*!< COMP output connected to TIM1 Break Input 2 and TIM8 Break Input 2 */ 00173 #define COMP_Output_TIM20BKIN ((uint32_t)0x00003000) /*!< COMP output connected to TIM20 Break Input (BKIN) */ 00174 #define COMP_Output_TIM20BKIN2 ((uint32_t)0x00003400) /*!< COMP output connected to TIM20 Break Input 2 (BKIN2) */ 00175 #define COMP_Output_TIM1BKIN2_TIM8BKIN2_TIM20BKIN2 ((uint32_t)0x00001400) /*!< COMP output connected to TIM1 Break Input 2, TIM8 Break Input 2 and TIM20 Break Input2 */ 00176 00177 /* Output Redirection common for COMP1 and COMP2 */ 00178 #define COMP_Output_TIM1OCREFCLR ((uint32_t)0x00001800) /*!< COMP output connected to TIM1 OCREF Clear */ 00179 #define COMP_Output_TIM1IC1 ((uint32_t)0x00001C00) /*!< COMP output connected to TIM1 Input Capture 1 */ 00180 #define COMP_Output_TIM2IC4 ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 Input Capture 4 */ 00181 #define COMP_Output_TIM2OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM2 OCREF Clear */ 00182 #define COMP_Output_TIM3IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM3 Input Capture 1 */ 00183 #define COMP_Output_TIM3OCREFCLR ((uint32_t)0x00002C00) /*!< COMP output connected to TIM3 OCREF Clear */ 00184 00185 /* Output Redirection specific to COMP2 */ 00186 #define COMP_Output_HRTIM1_FLT6 ((uint32_t)0x00003000) /*!< COMP output connected to HRTIM1 FLT6 */ 00187 #define COMP_Output_HRTIM1_EE1_2 ((uint32_t)0x00003400) /*!< COMP output connected to HRTIM1 EE1_2*/ 00188 #define COMP_Output_HRTIM1_EE6_2 ((uint32_t)0x00003800) /*!< COMP output connected to HRTIM1 EE6_2 */ 00189 #define COMP_Output_TIM20OCREFCLR ((uint32_t)0x00003C00) /*!< COMP output connected to TIM20 OCREF Clear */ 00190 00191 /* Output Redirection specific to COMP3 */ 00192 #define COMP_Output_TIM4IC1 ((uint32_t)0x00001C00) /*!< COMP output connected to TIM4 Input Capture 1 */ 00193 #define COMP_Output_TIM3IC2 ((uint32_t)0x00002000) /*!< COMP output connected to TIM3 Input Capture 2 */ 00194 #define COMP_Output_TIM15IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM15 Input Capture 1 */ 00195 #define COMP_Output_TIM15BKIN ((uint32_t)0x00002C00) /*!< COMP output connected to TIM15 Break Input (BKIN) */ 00196 00197 /* Output Redirection specific to COMP4 */ 00198 #define COMP_Output_TIM3IC3 ((uint32_t)0x00001800) /*!< COMP output connected to TIM3 Input Capture 3 */ 00199 #define COMP_Output_TIM8OCREFCLR ((uint32_t)0x00001C00) /*!< COMP output connected to TIM8 OCREF Clear */ 00200 #define COMP_Output_TIM15IC2 ((uint32_t)0x00002000) /*!< COMP output connected to TIM15 Input Capture 2 */ 00201 #define COMP_Output_TIM4IC2 ((uint32_t)0x00002400) /*!< COMP output connected to TIM4 Input Capture 2 */ 00202 #define COMP_Output_TIM15OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM15 OCREF Clear */ 00203 00204 #define COMP_Output_HRTIM1_FLT7 ((uint32_t)0x00003000) /*!< COMP output connected to HRTIM1 FLT7 */ 00205 #define COMP_Output_HRTIM1_EE2_2 ((uint32_t)0x00003400) /*!< COMP output connected to HRTIM1 EE2_2*/ 00206 #define COMP_Output_HRTIM1_EE7_2 ((uint32_t)0x00003800) /*!< COMP output connected to HRTIM1 EE7_2 */ 00207 00208 /* Output Redirection specific to COMP5 */ 00209 #define COMP_Output_TIM2IC1 ((uint32_t)0x00001800) /*!< COMP output connected to TIM2 Input Capture 1 */ 00210 #define COMP_Output_TIM17IC1 ((uint32_t)0x00002000) /*!< COMP output connected to TIM17 Input Capture 1 */ 00211 #define COMP_Output_TIM4IC3 ((uint32_t)0x00002400) /*!< COMP output connected to TIM4 Input Capture 3 */ 00212 #define COMP_Output_TIM16BKIN ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 Break Input (BKIN) */ 00213 00214 /* Output Redirection specific to COMP6 */ 00215 #define COMP_Output_TIM2IC2 ((uint32_t)0x00001800) /*!< COMP output connected to TIM2 Input Capture 2 */ 00216 #define COMP_Output_COMP6TIM2OCREFCLR ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 OCREF Clear */ 00217 #define COMP_Output_TIM16OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM16 OCREF Clear */ 00218 #define COMP_Output_TIM16IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 Input Capture 1 */ 00219 #define COMP_Output_TIM4IC4 ((uint32_t)0x00002C00) /*!< COMP output connected to TIM4 Input Capture 4 */ 00220 00221 #define COMP_Output_HRTIM1_FLT8 ((uint32_t)0x00003000) /*!< COMP output connected to HRTIM1 FLT8 */ 00222 #define COMP_Output_HRTIM1_EE3_2 ((uint32_t)0x00003400) /*!< COMP output connected to HRTIM1 EE3_2*/ 00223 #define COMP_Output_HRTIM1_EE8_2 ((uint32_t)0x00003800) /*!< COMP output connected to HRTIM1 EE8_2 */ 00224 00225 /* Output Redirection specific to COMP7 */ 00226 #define COMP_Output_TIM2IC3 ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 Input Capture 3 */ 00227 #define COMP_Output_TIM1IC2 ((uint32_t)0x00002400) /*!< COMP output connected to TIM1 Input Capture 2 */ 00228 #define COMP_Output_TIM17OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 OCREF Clear */ 00229 #define COMP_Output_TIM17BKIN ((uint32_t)0x00002C00) /*!< COMP output connected to TIM16 Break Input (BKIN) */ 00230 00231 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_Output_None) || \ 00232 ((OUTPUT) == COMP_Output_TIM1BKIN) || \ 00233 ((OUTPUT) == COMP_Output_TIM1IC1) || \ 00234 ((OUTPUT) == COMP_Output_TIM1OCREFCLR) || \ 00235 ((OUTPUT) == COMP_Output_TIM2IC4) || \ 00236 ((OUTPUT) == COMP_Output_TIM2OCREFCLR) || \ 00237 ((OUTPUT) == COMP_Output_COMP6TIM2OCREFCLR) || \ 00238 ((OUTPUT) == COMP_Output_TIM3IC1) || \ 00239 ((OUTPUT) == COMP_Output_TIM3OCREFCLR) || \ 00240 ((OUTPUT) == COMP_Output_TIM8BKIN) || \ 00241 ((OUTPUT) == COMP_Output_TIM1BKIN2) || \ 00242 ((OUTPUT) == COMP_Output_TIM8BKIN2) || \ 00243 ((OUTPUT) == COMP_Output_TIM2OCREFCLR) || \ 00244 ((OUTPUT) == COMP_Output_TIM1BKIN2_TIM8BKIN2) || \ 00245 ((OUTPUT) == COMP_Output_TIM3IC2) || \ 00246 ((OUTPUT) == COMP_Output_TIM4IC1) || \ 00247 ((OUTPUT) == COMP_Output_TIM15IC1) || \ 00248 ((OUTPUT) == COMP_Output_TIM15BKIN) || \ 00249 ((OUTPUT) == COMP_Output_TIM8OCREFCLR) || \ 00250 ((OUTPUT) == COMP_Output_TIM3IC3) || \ 00251 ((OUTPUT) == COMP_Output_TIM4IC1) || \ 00252 ((OUTPUT) == COMP_Output_TIM15IC1) || \ 00253 ((OUTPUT) == COMP_Output_TIM2IC1) || \ 00254 ((OUTPUT) == COMP_Output_TIM4IC3) || \ 00255 ((OUTPUT) == COMP_Output_TIM16BKIN) || \ 00256 ((OUTPUT) == COMP_Output_TIM17IC1) || \ 00257 ((OUTPUT) == COMP_Output_TIM2IC2) || \ 00258 ((OUTPUT) == COMP_Output_TIM16IC1) || \ 00259 ((OUTPUT) == COMP_Output_TIM4IC4) || \ 00260 ((OUTPUT) == COMP_Output_TIM16OCREFCLR) || \ 00261 ((OUTPUT) == COMP_Output_TIM2IC3) || \ 00262 ((OUTPUT) == COMP_Output_TIM1IC2) || \ 00263 ((OUTPUT) == COMP_Output_TIM17BKIN) || \ 00264 ((OUTPUT) == COMP_Output_TIM17OCREFCLR) || \ 00265 ((OUTPUT) == COMP_Output_HRTIM1_FLT6) || \ 00266 ((OUTPUT) == COMP_Output_HRTIM1_EE1_2) || \ 00267 ((OUTPUT) == COMP_Output_HRTIM1_EE6_2) || \ 00268 ((OUTPUT) == COMP_Output_HRTIM1_FLT7) || \ 00269 ((OUTPUT) == COMP_Output_HRTIM1_EE2_2) || \ 00270 ((OUTPUT) == COMP_Output_HRTIM1_EE7_2) || \ 00271 ((OUTPUT) == COMP_Output_HRTIM1_FLT8) || \ 00272 ((OUTPUT) == COMP_Output_HRTIM1_EE3_2) || \ 00273 ((OUTPUT) == COMP_Output_HRTIM1_EE8_2) || \ 00274 ((OUTPUT) == COMP_Output_TIM20BKIN) || \ 00275 ((OUTPUT) == COMP_Output_TIM20BKIN2) || \ 00276 ((OUTPUT) == COMP_Output_TIM1BKIN2_TIM8BKIN2_TIM20BKIN2)|| \ 00277 ((OUTPUT) == COMP_Output_TIM20OCREFCLR)) 00278 00279 /** 00280 * @} 00281 */ 00282 00283 /** @defgroup COMP_BlankingSrce 00284 * @{ 00285 */ 00286 00287 /* No blanking source can be selected for all comparators */ 00288 #define COMP_BlankingSrce_None ((uint32_t)0x00000000) /*!< No blanking source */ 00289 00290 /* Blanking source common for COMP1, COMP2, COMP3 and COMP7 */ 00291 #define COMP_BlankingSrce_TIM1OC5 COMP_CSR_COMPxBLANKING_0 /*!< TIM1 OC5 selected as blanking source for compartor */ 00292 00293 /* Blanking source common for COMP1 and COMP2 */ 00294 #define COMP_BlankingSrce_TIM2OC3 COMP_CSR_COMPxBLANKING_1 /*!< TIM2 OC5 selected as blanking source for compartor */ 00295 00296 /* Blanking source common for COMP1, COMP2 and COMP5 */ 00297 #define COMP_BlankingSrce_TIM3OC3 ((uint32_t)0x000C0000) /*!< TIM2 OC3 selected as blanking source for compartor */ 00298 00299 /* Blanking source common for COMP3 and COMP6 */ 00300 #define COMP_BlankingSrce_TIM2OC4 ((uint32_t)0x000C0000) /*!< TIM2 OC4 selected as blanking source for compartor */ 00301 00302 /* Blanking source common for COMP4, COMP5, COMP6 and COMP7 */ 00303 #define COMP_BlankingSrce_TIM8OC5 COMP_CSR_COMPxBLANKING_1 /*!< TIM8 OC5 selected as blanking source for compartor */ 00304 00305 /* Blanking source for COMP4 */ 00306 #define COMP_BlankingSrce_TIM3OC4 COMP_CSR_COMPxBLANKING_0 /*!< TIM3 OC4 selected as blanking source for compartor */ 00307 #define COMP_BlankingSrce_TIM15OC1 ((uint32_t)0x000C0000) /*!< TIM15 OC1 selected as blanking source for compartor */ 00308 00309 /* Blanking source common for COMP6 and COMP7 */ 00310 #define COMP_BlankingSrce_TIM15OC2 COMP_CSR_COMPxBLANKING_2 /*!< TIM15 OC2 selected as blanking source for compartor */ 00311 00312 #define IS_COMP_BLANKING_SOURCE(SOURCE) (((SOURCE) == COMP_BlankingSrce_None) || \ 00313 ((SOURCE) == COMP_BlankingSrce_TIM1OC5) || \ 00314 ((SOURCE) == COMP_BlankingSrce_TIM2OC3) || \ 00315 ((SOURCE) == COMP_BlankingSrce_TIM3OC3) || \ 00316 ((SOURCE) == COMP_BlankingSrce_TIM2OC4) || \ 00317 ((SOURCE) == COMP_BlankingSrce_TIM8OC5) || \ 00318 ((SOURCE) == COMP_BlankingSrce_TIM3OC4) || \ 00319 ((SOURCE) == COMP_BlankingSrce_TIM15OC1) || \ 00320 ((SOURCE) == COMP_BlankingSrce_TIM15OC2)) 00321 /** 00322 * @} 00323 */ 00324 00325 /** @defgroup COMP_OutputPoloarity 00326 * @{ 00327 */ 00328 #define COMP_OutputPol_NonInverted ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */ 00329 #define COMP_OutputPol_Inverted COMP_CSR_COMPxPOL /*!< COMP output on GPIO is inverted */ 00330 00331 #define IS_COMP_OUTPUT_POL(POL) (((POL) == COMP_OutputPol_NonInverted) || \ 00332 ((POL) == COMP_OutputPol_Inverted)) 00333 00334 /** 00335 * @} 00336 */ 00337 00338 /** @defgroup COMP_Hysteresis 00339 * @{ 00340 */ 00341 /* Please refer to the electrical characteristics in the device datasheet for 00342 the hysteresis level */ 00343 #define COMP_Hysteresis_No 0x00000000 /*!< No hysteresis */ 00344 #define COMP_Hysteresis_Low COMP_CSR_COMPxHYST_0 /*!< Hysteresis level low */ 00345 #define COMP_Hysteresis_Medium COMP_CSR_COMPxHYST_1 /*!< Hysteresis level medium */ 00346 #define COMP_Hysteresis_High COMP_CSR_COMPxHYST /*!< Hysteresis level high */ 00347 00348 #define IS_COMP_HYSTERESIS(HYSTERESIS) (((HYSTERESIS) == COMP_Hysteresis_No) || \ 00349 ((HYSTERESIS) == COMP_Hysteresis_Low) || \ 00350 ((HYSTERESIS) == COMP_Hysteresis_Medium) || \ 00351 ((HYSTERESIS) == COMP_Hysteresis_High)) 00352 /** 00353 * @} 00354 */ 00355 00356 /** @defgroup COMP_Mode 00357 * @{ 00358 */ 00359 /* Please refer to the electrical characteristics in the device datasheet for 00360 the power consumption values */ 00361 #define COMP_Mode_HighSpeed 0x00000000 /*!< High Speed */ 00362 #define COMP_Mode_MediumSpeed COMP_CSR_COMPxMODE_0 /*!< Medium Speed */ 00363 #define COMP_Mode_LowPower COMP_CSR_COMPxMODE_1 /*!< Low power mode */ 00364 #define COMP_Mode_UltraLowPower COMP_CSR_COMPxMODE /*!< Ultra-low power mode */ 00365 00366 #define IS_COMP_MODE(MODE) (((MODE) == COMP_Mode_UltraLowPower) || \ 00367 ((MODE) == COMP_Mode_LowPower) || \ 00368 ((MODE) == COMP_Mode_MediumSpeed) || \ 00369 ((MODE) == COMP_Mode_HighSpeed)) 00370 /** 00371 * @} 00372 */ 00373 00374 /** @defgroup COMP_OutputLevel 00375 * @{ 00376 */ 00377 /* When output polarity is not inverted, comparator output is high when 00378 the non-inverting input is at a higher voltage than the inverting input */ 00379 #define COMP_OutputLevel_High COMP_CSR_COMPxOUT 00380 /* When output polarity is not inverted, comparator output is low when 00381 the non-inverting input is at a lower voltage than the inverting input*/ 00382 #define COMP_OutputLevel_Low ((uint32_t)0x00000000) 00383 00384 /** 00385 * @} 00386 */ 00387 00388 /** @defgroup COMP_WindowMode 00389 * @{ 00390 */ 00391 #define IS_COMP_WINDOW(WINDOW) (((WINDOW) == COMP_Selection_COMP2) || \ 00392 ((WINDOW) == COMP_Selection_COMP4) || \ 00393 ((WINDOW) == COMP_Selection_COMP6)) 00394 /** 00395 * @} 00396 */ 00397 00398 /** 00399 * @} 00400 */ 00401 00402 /* Exported macro ------------------------------------------------------------*/ 00403 /* Exported functions ------------------------------------------------------- */ 00404 00405 /* Function used to set the COMP configuration to the default reset state ****/ 00406 void COMP_DeInit(uint32_t COMP_Selection); 00407 00408 /* Initialization and Configuration functions *********************************/ 00409 void COMP_Init(uint32_t COMP_Selection, COMP_InitTypeDef* COMP_InitStruct); 00410 void COMP_StructInit(COMP_InitTypeDef* COMP_InitStruct); 00411 void COMP_Cmd(uint32_t COMP_Selection, FunctionalState NewState); 00412 void COMP_SwitchCmd(uint32_t COMP_Selection, FunctionalState NewState); 00413 uint32_t COMP_GetOutputLevel(uint32_t COMP_Selection); 00414 00415 /* Window mode control function ***********************************************/ 00416 void COMP_WindowCmd(uint32_t COMP_Selection, FunctionalState NewState); 00417 00418 /* COMP configuration locking function ****************************************/ 00419 void COMP_LockConfig(uint32_t COMP_Selection); 00420 00421 #ifdef __cplusplus 00422 } 00423 #endif 00424 00425 #endif /*__STM32F30x_COMP_H */ 00426 00427 /** 00428 * @} 00429 */ 00430 00431 /** 00432 * @} 00433 */ 00434 00435 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 17:34:44 by
