philippe s. / mbed-dev

Fork of mbed-dev by mbed official

Committer:
bogdanm
Date:
Thu Oct 01 15:25:22 2015 +0300
Revision:
0:9b334a45a8ff
Initial commit on mbed-dev

Replaces mbed-src (now inactive)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:9b334a45a8ff 1 /**
bogdanm 0:9b334a45a8ff 2 ******************************************************************************
bogdanm 0:9b334a45a8ff 3 * @file stm32f30x_comp.h
bogdanm 0:9b334a45a8ff 4 * @author MCD Application Team
bogdanm 0:9b334a45a8ff 5 * @version V1.1.0
bogdanm 0:9b334a45a8ff 6 * @date 27-February-2014
bogdanm 0:9b334a45a8ff 7 * @brief This file contains all the functions prototypes for the COMP firmware
bogdanm 0:9b334a45a8ff 8 * library.
bogdanm 0:9b334a45a8ff 9 ******************************************************************************
bogdanm 0:9b334a45a8ff 10 * @attention
bogdanm 0:9b334a45a8ff 11 *
bogdanm 0:9b334a45a8ff 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 0:9b334a45a8ff 13 *
bogdanm 0:9b334a45a8ff 14 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 0:9b334a45a8ff 15 * are permitted provided that the following conditions are met:
bogdanm 0:9b334a45a8ff 16 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 0:9b334a45a8ff 17 * this list of conditions and the following disclaimer.
bogdanm 0:9b334a45a8ff 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 0:9b334a45a8ff 19 * this list of conditions and the following disclaimer in the documentation
bogdanm 0:9b334a45a8ff 20 * and/or other materials provided with the distribution.
bogdanm 0:9b334a45a8ff 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 0:9b334a45a8ff 22 * may be used to endorse or promote products derived from this software
bogdanm 0:9b334a45a8ff 23 * without specific prior written permission.
bogdanm 0:9b334a45a8ff 24 *
bogdanm 0:9b334a45a8ff 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 0:9b334a45a8ff 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 0:9b334a45a8ff 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 0:9b334a45a8ff 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 0:9b334a45a8ff 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 0:9b334a45a8ff 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 0:9b334a45a8ff 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 0:9b334a45a8ff 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 0:9b334a45a8ff 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 0:9b334a45a8ff 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 0:9b334a45a8ff 35 *
bogdanm 0:9b334a45a8ff 36 ******************************************************************************
bogdanm 0:9b334a45a8ff 37 */
bogdanm 0:9b334a45a8ff 38
bogdanm 0:9b334a45a8ff 39 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 0:9b334a45a8ff 40 #ifndef __STM32F30x_COMP_H
bogdanm 0:9b334a45a8ff 41 #define __STM32F30x_COMP_H
bogdanm 0:9b334a45a8ff 42
bogdanm 0:9b334a45a8ff 43 #ifdef __cplusplus
bogdanm 0:9b334a45a8ff 44 extern "C" {
bogdanm 0:9b334a45a8ff 45 #endif
bogdanm 0:9b334a45a8ff 46
bogdanm 0:9b334a45a8ff 47 /* Includes ------------------------------------------------------------------*/
bogdanm 0:9b334a45a8ff 48 #include "stm32f30x.h"
bogdanm 0:9b334a45a8ff 49
bogdanm 0:9b334a45a8ff 50 /** @addtogroup STM32F30x_StdPeriph_Driver
bogdanm 0:9b334a45a8ff 51 * @{
bogdanm 0:9b334a45a8ff 52 */
bogdanm 0:9b334a45a8ff 53
bogdanm 0:9b334a45a8ff 54 /** @addtogroup COMP
bogdanm 0:9b334a45a8ff 55 * @{
bogdanm 0:9b334a45a8ff 56 */
bogdanm 0:9b334a45a8ff 57
bogdanm 0:9b334a45a8ff 58 /* Exported types ------------------------------------------------------------*/
bogdanm 0:9b334a45a8ff 59
bogdanm 0:9b334a45a8ff 60 /**
bogdanm 0:9b334a45a8ff 61 * @brief COMP Init structure definition
bogdanm 0:9b334a45a8ff 62 */
bogdanm 0:9b334a45a8ff 63
bogdanm 0:9b334a45a8ff 64 typedef struct
bogdanm 0:9b334a45a8ff 65 {
bogdanm 0:9b334a45a8ff 66
bogdanm 0:9b334a45a8ff 67 uint32_t COMP_InvertingInput; /*!< Selects the inverting input of the comparator.
bogdanm 0:9b334a45a8ff 68 This parameter can be a value of @ref COMP_InvertingInput */
bogdanm 0:9b334a45a8ff 69
bogdanm 0:9b334a45a8ff 70 uint32_t COMP_NonInvertingInput; /*!< Selects the non inverting input of the comparator.
bogdanm 0:9b334a45a8ff 71 This parameter can be a value of @ref COMP_NonInvertingInput */
bogdanm 0:9b334a45a8ff 72
bogdanm 0:9b334a45a8ff 73 uint32_t COMP_Output; /*!< Selects the output redirection of the comparator.
bogdanm 0:9b334a45a8ff 74 This parameter can be a value of @ref COMP_Output */
bogdanm 0:9b334a45a8ff 75
bogdanm 0:9b334a45a8ff 76 uint32_t COMP_BlankingSrce; /*!< Selects the output blanking source of the comparator.
bogdanm 0:9b334a45a8ff 77 This parameter can be a value of @ref COMP_BlankingSrce */
bogdanm 0:9b334a45a8ff 78
bogdanm 0:9b334a45a8ff 79 uint32_t COMP_OutputPol; /*!< Selects the output polarity of the comparator.
bogdanm 0:9b334a45a8ff 80 This parameter can be a value of @ref COMP_OutputPoloarity */
bogdanm 0:9b334a45a8ff 81
bogdanm 0:9b334a45a8ff 82 uint32_t COMP_Hysteresis; /*!< Selects the hysteresis voltage of the comparator.
bogdanm 0:9b334a45a8ff 83 This parameter can be a value of @ref COMP_Hysteresis */
bogdanm 0:9b334a45a8ff 84
bogdanm 0:9b334a45a8ff 85 uint32_t COMP_Mode; /*!< Selects the operating mode of the comparator
bogdanm 0:9b334a45a8ff 86 and allows to adjust the speed/consumption.
bogdanm 0:9b334a45a8ff 87 This parameter can be a value of @ref COMP_Mode */
bogdanm 0:9b334a45a8ff 88 }COMP_InitTypeDef;
bogdanm 0:9b334a45a8ff 89
bogdanm 0:9b334a45a8ff 90 /* Exported constants --------------------------------------------------------*/
bogdanm 0:9b334a45a8ff 91
bogdanm 0:9b334a45a8ff 92 /** @defgroup COMP_Exported_Constants
bogdanm 0:9b334a45a8ff 93 * @{
bogdanm 0:9b334a45a8ff 94 */
bogdanm 0:9b334a45a8ff 95
bogdanm 0:9b334a45a8ff 96 /** @defgroup COMP_Selection
bogdanm 0:9b334a45a8ff 97 * @{
bogdanm 0:9b334a45a8ff 98 */
bogdanm 0:9b334a45a8ff 99
bogdanm 0:9b334a45a8ff 100 #define COMP_Selection_COMP1 ((uint32_t)0x00000000) /*!< COMP1 Selection */
bogdanm 0:9b334a45a8ff 101 #define COMP_Selection_COMP2 ((uint32_t)0x00000004) /*!< COMP2 Selection */
bogdanm 0:9b334a45a8ff 102 #define COMP_Selection_COMP3 ((uint32_t)0x00000008) /*!< COMP3 Selection */
bogdanm 0:9b334a45a8ff 103 #define COMP_Selection_COMP4 ((uint32_t)0x0000000C) /*!< COMP4 Selection */
bogdanm 0:9b334a45a8ff 104 #define COMP_Selection_COMP5 ((uint32_t)0x00000010) /*!< COMP5 Selection */
bogdanm 0:9b334a45a8ff 105 #define COMP_Selection_COMP6 ((uint32_t)0x00000014) /*!< COMP6 Selection */
bogdanm 0:9b334a45a8ff 106 #define COMP_Selection_COMP7 ((uint32_t)0x00000018) /*!< COMP7 Selection */
bogdanm 0:9b334a45a8ff 107
bogdanm 0:9b334a45a8ff 108 #define IS_COMP_ALL_PERIPH(PERIPH) (((PERIPH) == COMP_Selection_COMP1) || \
bogdanm 0:9b334a45a8ff 109 ((PERIPH) == COMP_Selection_COMP2) || \
bogdanm 0:9b334a45a8ff 110 ((PERIPH) == COMP_Selection_COMP3) || \
bogdanm 0:9b334a45a8ff 111 ((PERIPH) == COMP_Selection_COMP4) || \
bogdanm 0:9b334a45a8ff 112 ((PERIPH) == COMP_Selection_COMP5) || \
bogdanm 0:9b334a45a8ff 113 ((PERIPH) == COMP_Selection_COMP6) || \
bogdanm 0:9b334a45a8ff 114 ((PERIPH) == COMP_Selection_COMP7))
bogdanm 0:9b334a45a8ff 115
bogdanm 0:9b334a45a8ff 116 /**
bogdanm 0:9b334a45a8ff 117 * @}
bogdanm 0:9b334a45a8ff 118 */
bogdanm 0:9b334a45a8ff 119
bogdanm 0:9b334a45a8ff 120 /** @defgroup COMP_InvertingInput
bogdanm 0:9b334a45a8ff 121 * @{
bogdanm 0:9b334a45a8ff 122 */
bogdanm 0:9b334a45a8ff 123
bogdanm 0:9b334a45a8ff 124 #define COMP_InvertingInput_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 125 #define COMP_InvertingInput_1_2VREFINT COMP_CSR_COMPxINSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 126 #define COMP_InvertingInput_3_4VREFINT COMP_CSR_COMPxINSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 127 #define COMP_InvertingInput_VREFINT ((uint32_t)0x00000030) /*!< VREFINT connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 128 #define COMP_InvertingInput_DAC1OUT1 COMP_CSR_COMPxINSEL_2 /*!< DAC1_OUT1 (PA4) connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 129 #define COMP_InvertingInput_DAC1OUT2 ((uint32_t)0x00000050) /*!< DAC1_OUT2 (PA5) connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 130
bogdanm 0:9b334a45a8ff 131 #define COMP_InvertingInput_IO1 ((uint32_t)0x00000060) /*!< I/O1 (PA0 for COMP1, PA2 for COMP2, PD15 for COMP3,
bogdanm 0:9b334a45a8ff 132 PE8 for COMP4, PD13 for COMP5, PD10 for COMP6,
bogdanm 0:9b334a45a8ff 133 PC0 for COMP7) connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 134
bogdanm 0:9b334a45a8ff 135 #define COMP_InvertingInput_IO2 COMP_CSR_COMPxINSEL /*!< I/O2 (PB12 for COMP3, PB2 for COMP4, PB10 for COMP5,
bogdanm 0:9b334a45a8ff 136 PB15 for COMP6) connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 137
bogdanm 0:9b334a45a8ff 138 #define COMP_InvertingInput_DAC2OUT1 COMP_CSR_COMPxINSEL_3 /*!< DAC2_OUT1 (PA6) connected to comparator inverting input */
bogdanm 0:9b334a45a8ff 139
bogdanm 0:9b334a45a8ff 140 #define IS_COMP_INVERTING_INPUT(INPUT) (((INPUT) == COMP_InvertingInput_1_4VREFINT) || \
bogdanm 0:9b334a45a8ff 141 ((INPUT) == COMP_InvertingInput_1_2VREFINT) || \
bogdanm 0:9b334a45a8ff 142 ((INPUT) == COMP_InvertingInput_3_4VREFINT) || \
bogdanm 0:9b334a45a8ff 143 ((INPUT) == COMP_InvertingInput_VREFINT) || \
bogdanm 0:9b334a45a8ff 144 ((INPUT) == COMP_InvertingInput_DAC1OUT1) || \
bogdanm 0:9b334a45a8ff 145 ((INPUT) == COMP_InvertingInput_DAC1OUT2) || \
bogdanm 0:9b334a45a8ff 146 ((INPUT) == COMP_InvertingInput_IO1) || \
bogdanm 0:9b334a45a8ff 147 ((INPUT) == COMP_InvertingInput_IO2) || \
bogdanm 0:9b334a45a8ff 148 ((INPUT) == COMP_InvertingInput_DAC2OUT1))
bogdanm 0:9b334a45a8ff 149 /**
bogdanm 0:9b334a45a8ff 150 * @}
bogdanm 0:9b334a45a8ff 151 */
bogdanm 0:9b334a45a8ff 152
bogdanm 0:9b334a45a8ff 153 /** @defgroup COMP_NonInvertingInput
bogdanm 0:9b334a45a8ff 154 * @{
bogdanm 0:9b334a45a8ff 155 */
bogdanm 0:9b334a45a8ff 156
bogdanm 0:9b334a45a8ff 157 #define COMP_NonInvertingInput_IO1 ((uint32_t)0x00000000) /*!< I/O1 (PA1 for COMP1, PA7 for COMP2, PB14 for COMP3,
bogdanm 0:9b334a45a8ff 158 PB0 for COMP4, PD12 for COMP5, PD11 for COMP6,
bogdanm 0:9b334a45a8ff 159 PA0 for COMP7) connected to comparator non inverting input */
bogdanm 0:9b334a45a8ff 160
bogdanm 0:9b334a45a8ff 161 #define COMP_NonInvertingInput_IO2 COMP_CSR_COMPxNONINSEL /*!< I/O2 (PA3 for COMP2, PD14 for COMP3, PE7 for COMP4, PB13 for COMP5,
bogdanm 0:9b334a45a8ff 162 PB11 for COMP6, PC1 for COMP7) connected to comparator non inverting input */
bogdanm 0:9b334a45a8ff 163
bogdanm 0:9b334a45a8ff 164 #define IS_COMP_NONINVERTING_INPUT(INPUT) (((INPUT) == COMP_NonInvertingInput_IO1) || \
bogdanm 0:9b334a45a8ff 165 ((INPUT) == COMP_NonInvertingInput_IO2))
bogdanm 0:9b334a45a8ff 166 /**
bogdanm 0:9b334a45a8ff 167 * @}
bogdanm 0:9b334a45a8ff 168 */
bogdanm 0:9b334a45a8ff 169
bogdanm 0:9b334a45a8ff 170 /** @defgroup COMP_Output
bogdanm 0:9b334a45a8ff 171 * @{
bogdanm 0:9b334a45a8ff 172 */
bogdanm 0:9b334a45a8ff 173
bogdanm 0:9b334a45a8ff 174 #define COMP_Output_None ((uint32_t)0x00000000) /*!< COMP output isn't connected to other peripherals */
bogdanm 0:9b334a45a8ff 175
bogdanm 0:9b334a45a8ff 176 /* Output Redirection common for all comparators COMP1...COMP7 */
bogdanm 0:9b334a45a8ff 177 #define COMP_Output_TIM1BKIN COMP_CSR_COMPxOUTSEL_0 /*!< COMP output connected to TIM1 Break Input (BKIN) */
bogdanm 0:9b334a45a8ff 178 #define COMP_Output_TIM1BKIN2 ((uint32_t)0x00000800) /*!< COMP output connected to TIM1 Break Input 2 (BKIN2) */
bogdanm 0:9b334a45a8ff 179 #define COMP_Output_TIM8BKIN ((uint32_t)0x00000C00) /*!< COMP output connected to TIM8 Break Input (BKIN) */
bogdanm 0:9b334a45a8ff 180 #define COMP_Output_TIM8BKIN2 ((uint32_t)0x00001000) /*!< COMP output connected to TIM8 Break Input 2 (BKIN2) */
bogdanm 0:9b334a45a8ff 181 #define COMP_Output_TIM1BKIN2_TIM8BKIN2 ((uint32_t)0x00001400) /*!< COMP output connected to TIM1 Break Input 2 and TIM8 Break Input 2 */
bogdanm 0:9b334a45a8ff 182
bogdanm 0:9b334a45a8ff 183 /* Output Redirection common for COMP1 and COMP2 */
bogdanm 0:9b334a45a8ff 184 #define COMP_Output_TIM1OCREFCLR ((uint32_t)0x00001800) /*!< COMP output connected to TIM1 OCREF Clear */
bogdanm 0:9b334a45a8ff 185 #define COMP_Output_TIM1IC1 ((uint32_t)0x00001C00) /*!< COMP output connected to TIM1 Input Capture 1 */
bogdanm 0:9b334a45a8ff 186 #define COMP_Output_TIM2IC4 ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 Input Capture 4 */
bogdanm 0:9b334a45a8ff 187 #define COMP_Output_TIM2OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM2 OCREF Clear */
bogdanm 0:9b334a45a8ff 188 #define COMP_Output_TIM3IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM3 Input Capture 1 */
bogdanm 0:9b334a45a8ff 189 #define COMP_Output_TIM3OCREFCLR ((uint32_t)0x00002C00) /*!< COMP output connected to TIM3 OCREF Clear */
bogdanm 0:9b334a45a8ff 190
bogdanm 0:9b334a45a8ff 191 /* Output Redirection specific to COMP2 */
bogdanm 0:9b334a45a8ff 192 #define COMP_Output_HRTIM1_FLT6 ((uint32_t)0x00003000) /*!< COMP output connected to HRTIM1 FLT6 */
bogdanm 0:9b334a45a8ff 193 #define COMP_Output_HRTIM1_EE1_2 ((uint32_t)0x00003400) /*!< COMP output connected to HRTIM1 EE1_2*/
bogdanm 0:9b334a45a8ff 194 #define COMP_Output_HRTIM1_EE6_2 ((uint32_t)0x00003800) /*!< COMP output connected to HRTIM1 EE6_2 */
bogdanm 0:9b334a45a8ff 195
bogdanm 0:9b334a45a8ff 196 /* Output Redirection specific to COMP3 */
bogdanm 0:9b334a45a8ff 197 #define COMP_Output_TIM4IC1 ((uint32_t)0x00001C00) /*!< COMP output connected to TIM4 Input Capture 1 */
bogdanm 0:9b334a45a8ff 198 #define COMP_Output_TIM3IC2 ((uint32_t)0x00002000) /*!< COMP output connected to TIM3 Input Capture 2 */
bogdanm 0:9b334a45a8ff 199 #define COMP_Output_TIM15IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM15 Input Capture 1 */
bogdanm 0:9b334a45a8ff 200 #define COMP_Output_TIM15BKIN ((uint32_t)0x00002C00) /*!< COMP output connected to TIM15 Break Input (BKIN) */
bogdanm 0:9b334a45a8ff 201
bogdanm 0:9b334a45a8ff 202 /* Output Redirection specific to COMP4 */
bogdanm 0:9b334a45a8ff 203 #define COMP_Output_TIM3IC3 ((uint32_t)0x00001800) /*!< COMP output connected to TIM3 Input Capture 3 */
bogdanm 0:9b334a45a8ff 204 #define COMP_Output_TIM8OCREFCLR ((uint32_t)0x00001C00) /*!< COMP output connected to TIM8 OCREF Clear */
bogdanm 0:9b334a45a8ff 205 #define COMP_Output_TIM15IC2 ((uint32_t)0x00002000) /*!< COMP output connected to TIM15 Input Capture 2 */
bogdanm 0:9b334a45a8ff 206 #define COMP_Output_TIM4IC2 ((uint32_t)0x00002400) /*!< COMP output connected to TIM4 Input Capture 2 */
bogdanm 0:9b334a45a8ff 207 #define COMP_Output_TIM15OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM15 OCREF Clear */
bogdanm 0:9b334a45a8ff 208
bogdanm 0:9b334a45a8ff 209 #define COMP_Output_HRTIM1_FLT7 ((uint32_t)0x00003000) /*!< COMP output connected to HRTIM1 FLT7 */
bogdanm 0:9b334a45a8ff 210 #define COMP_Output_HRTIM1_EE2_2 ((uint32_t)0x00003400) /*!< COMP output connected to HRTIM1 EE2_2*/
bogdanm 0:9b334a45a8ff 211 #define COMP_Output_HRTIM1_EE7_2 ((uint32_t)0x00003800) /*!< COMP output connected to HRTIM1 EE7_2 */
bogdanm 0:9b334a45a8ff 212
bogdanm 0:9b334a45a8ff 213 /* Output Redirection specific to COMP5 */
bogdanm 0:9b334a45a8ff 214 #define COMP_Output_TIM2IC1 ((uint32_t)0x00001800) /*!< COMP output connected to TIM2 Input Capture 1 */
bogdanm 0:9b334a45a8ff 215 #define COMP_Output_TIM17IC1 ((uint32_t)0x00002000) /*!< COMP output connected to TIM17 Input Capture 1 */
bogdanm 0:9b334a45a8ff 216 #define COMP_Output_TIM4IC3 ((uint32_t)0x00002400) /*!< COMP output connected to TIM4 Input Capture 3 */
bogdanm 0:9b334a45a8ff 217 #define COMP_Output_TIM16BKIN ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 Break Input (BKIN) */
bogdanm 0:9b334a45a8ff 218
bogdanm 0:9b334a45a8ff 219 /* Output Redirection specific to COMP6 */
bogdanm 0:9b334a45a8ff 220 #define COMP_Output_TIM2IC2 ((uint32_t)0x00001800) /*!< COMP output connected to TIM2 Input Capture 2 */
bogdanm 0:9b334a45a8ff 221 #define COMP_Output_COMP6TIM2OCREFCLR ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 OCREF Clear */
bogdanm 0:9b334a45a8ff 222 #define COMP_Output_TIM16OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM16 OCREF Clear */
bogdanm 0:9b334a45a8ff 223 #define COMP_Output_TIM16IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 Input Capture 1 */
bogdanm 0:9b334a45a8ff 224 #define COMP_Output_TIM4IC4 ((uint32_t)0x00002C00) /*!< COMP output connected to TIM4 Input Capture 4 */
bogdanm 0:9b334a45a8ff 225
bogdanm 0:9b334a45a8ff 226 #define COMP_Output_HRTIM1_FLT8 ((uint32_t)0x00003000) /*!< COMP output connected to HRTIM1 FLT8 */
bogdanm 0:9b334a45a8ff 227 #define COMP_Output_HRTIM1_EE3_2 ((uint32_t)0x00003400) /*!< COMP output connected to HRTIM1 EE3_2*/
bogdanm 0:9b334a45a8ff 228 #define COMP_Output_HRTIM1_EE8_2 ((uint32_t)0x00003800) /*!< COMP output connected to HRTIM1 EE8_2 */
bogdanm 0:9b334a45a8ff 229
bogdanm 0:9b334a45a8ff 230 /* Output Redirection specific to COMP7 */
bogdanm 0:9b334a45a8ff 231 #define COMP_Output_TIM2IC3 ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 Input Capture 3 */
bogdanm 0:9b334a45a8ff 232 #define COMP_Output_TIM1IC2 ((uint32_t)0x00002400) /*!< COMP output connected to TIM1 Input Capture 2 */
bogdanm 0:9b334a45a8ff 233 #define COMP_Output_TIM17OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 OCREF Clear */
bogdanm 0:9b334a45a8ff 234 #define COMP_Output_TIM17BKIN ((uint32_t)0x00002C00) /*!< COMP output connected to TIM16 Break Input (BKIN) */
bogdanm 0:9b334a45a8ff 235
bogdanm 0:9b334a45a8ff 236 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_Output_None) || \
bogdanm 0:9b334a45a8ff 237 ((OUTPUT) == COMP_Output_TIM1BKIN) || \
bogdanm 0:9b334a45a8ff 238 ((OUTPUT) == COMP_Output_TIM1IC1) || \
bogdanm 0:9b334a45a8ff 239 ((OUTPUT) == COMP_Output_TIM1OCREFCLR) || \
bogdanm 0:9b334a45a8ff 240 ((OUTPUT) == COMP_Output_TIM2IC4) || \
bogdanm 0:9b334a45a8ff 241 ((OUTPUT) == COMP_Output_TIM2OCREFCLR) || \
bogdanm 0:9b334a45a8ff 242 ((OUTPUT) == COMP_Output_COMP6TIM2OCREFCLR) || \
bogdanm 0:9b334a45a8ff 243 ((OUTPUT) == COMP_Output_TIM3IC1) || \
bogdanm 0:9b334a45a8ff 244 ((OUTPUT) == COMP_Output_TIM3OCREFCLR) || \
bogdanm 0:9b334a45a8ff 245 ((OUTPUT) == COMP_Output_TIM8BKIN) || \
bogdanm 0:9b334a45a8ff 246 ((OUTPUT) == COMP_Output_TIM1BKIN2) || \
bogdanm 0:9b334a45a8ff 247 ((OUTPUT) == COMP_Output_TIM8BKIN2) || \
bogdanm 0:9b334a45a8ff 248 ((OUTPUT) == COMP_Output_TIM2OCREFCLR) || \
bogdanm 0:9b334a45a8ff 249 ((OUTPUT) == COMP_Output_TIM1BKIN2_TIM8BKIN2) || \
bogdanm 0:9b334a45a8ff 250 ((OUTPUT) == COMP_Output_TIM3IC2) || \
bogdanm 0:9b334a45a8ff 251 ((OUTPUT) == COMP_Output_TIM4IC1) || \
bogdanm 0:9b334a45a8ff 252 ((OUTPUT) == COMP_Output_TIM15IC1) || \
bogdanm 0:9b334a45a8ff 253 ((OUTPUT) == COMP_Output_TIM15BKIN) || \
bogdanm 0:9b334a45a8ff 254 ((OUTPUT) == COMP_Output_TIM8OCREFCLR) || \
bogdanm 0:9b334a45a8ff 255 ((OUTPUT) == COMP_Output_TIM3IC3) || \
bogdanm 0:9b334a45a8ff 256 ((OUTPUT) == COMP_Output_TIM4IC1) || \
bogdanm 0:9b334a45a8ff 257 ((OUTPUT) == COMP_Output_TIM15IC1) || \
bogdanm 0:9b334a45a8ff 258 ((OUTPUT) == COMP_Output_TIM2IC1) || \
bogdanm 0:9b334a45a8ff 259 ((OUTPUT) == COMP_Output_TIM4IC3) || \
bogdanm 0:9b334a45a8ff 260 ((OUTPUT) == COMP_Output_TIM16BKIN) || \
bogdanm 0:9b334a45a8ff 261 ((OUTPUT) == COMP_Output_TIM17IC1) || \
bogdanm 0:9b334a45a8ff 262 ((OUTPUT) == COMP_Output_TIM2IC2) || \
bogdanm 0:9b334a45a8ff 263 ((OUTPUT) == COMP_Output_TIM16IC1) || \
bogdanm 0:9b334a45a8ff 264 ((OUTPUT) == COMP_Output_TIM4IC4) || \
bogdanm 0:9b334a45a8ff 265 ((OUTPUT) == COMP_Output_TIM16OCREFCLR) || \
bogdanm 0:9b334a45a8ff 266 ((OUTPUT) == COMP_Output_TIM2IC3) || \
bogdanm 0:9b334a45a8ff 267 ((OUTPUT) == COMP_Output_TIM1IC2) || \
bogdanm 0:9b334a45a8ff 268 ((OUTPUT) == COMP_Output_TIM17BKIN) || \
bogdanm 0:9b334a45a8ff 269 ((OUTPUT) == COMP_Output_TIM17OCREFCLR) || \
bogdanm 0:9b334a45a8ff 270 ((OUTPUT) == COMP_Output_HRTIM1_FLT6) || \
bogdanm 0:9b334a45a8ff 271 ((OUTPUT) == COMP_Output_HRTIM1_EE1_2) || \
bogdanm 0:9b334a45a8ff 272 ((OUTPUT) == COMP_Output_HRTIM1_EE6_2) || \
bogdanm 0:9b334a45a8ff 273 ((OUTPUT) == COMP_Output_HRTIM1_FLT7) || \
bogdanm 0:9b334a45a8ff 274 ((OUTPUT) == COMP_Output_HRTIM1_EE2_2) || \
bogdanm 0:9b334a45a8ff 275 ((OUTPUT) == COMP_Output_HRTIM1_EE7_2) || \
bogdanm 0:9b334a45a8ff 276 ((OUTPUT) == COMP_Output_HRTIM1_FLT8) || \
bogdanm 0:9b334a45a8ff 277 ((OUTPUT) == COMP_Output_HRTIM1_EE3_2) || \
bogdanm 0:9b334a45a8ff 278 ((OUTPUT) == COMP_Output_HRTIM1_EE8_2))
bogdanm 0:9b334a45a8ff 279
bogdanm 0:9b334a45a8ff 280 /**
bogdanm 0:9b334a45a8ff 281 * @}
bogdanm 0:9b334a45a8ff 282 */
bogdanm 0:9b334a45a8ff 283
bogdanm 0:9b334a45a8ff 284 /** @defgroup COMP_BlankingSrce
bogdanm 0:9b334a45a8ff 285 * @{
bogdanm 0:9b334a45a8ff 286 */
bogdanm 0:9b334a45a8ff 287
bogdanm 0:9b334a45a8ff 288 /* No blanking source can be selected for all comparators */
bogdanm 0:9b334a45a8ff 289 #define COMP_BlankingSrce_None ((uint32_t)0x00000000) /*!< No blanking source */
bogdanm 0:9b334a45a8ff 290
bogdanm 0:9b334a45a8ff 291 /* Blanking source common for COMP1, COMP2, COMP3 and COMP7 */
bogdanm 0:9b334a45a8ff 292 #define COMP_BlankingSrce_TIM1OC5 COMP_CSR_COMPxBLANKING_0 /*!< TIM1 OC5 selected as blanking source for compartor */
bogdanm 0:9b334a45a8ff 293
bogdanm 0:9b334a45a8ff 294 /* Blanking source common for COMP1 and COMP2 */
bogdanm 0:9b334a45a8ff 295 #define COMP_BlankingSrce_TIM2OC3 COMP_CSR_COMPxBLANKING_1 /*!< TIM2 OC5 selected as blanking source for compartor */
bogdanm 0:9b334a45a8ff 296
bogdanm 0:9b334a45a8ff 297 /* Blanking source common for COMP1, COMP2 and COMP5 */
bogdanm 0:9b334a45a8ff 298 #define COMP_BlankingSrce_TIM3OC3 ((uint32_t)0x000C0000) /*!< TIM2 OC3 selected as blanking source for compartor */
bogdanm 0:9b334a45a8ff 299
bogdanm 0:9b334a45a8ff 300 /* Blanking source common for COMP3 and COMP6 */
bogdanm 0:9b334a45a8ff 301 #define COMP_BlankingSrce_TIM2OC4 ((uint32_t)0x000C0000) /*!< TIM2 OC4 selected as blanking source for compartor */
bogdanm 0:9b334a45a8ff 302
bogdanm 0:9b334a45a8ff 303 /* Blanking source common for COMP4, COMP5, COMP6 and COMP7 */
bogdanm 0:9b334a45a8ff 304 #define COMP_BlankingSrce_TIM8OC5 COMP_CSR_COMPxBLANKING_1 /*!< TIM8 OC5 selected as blanking source for compartor */
bogdanm 0:9b334a45a8ff 305
bogdanm 0:9b334a45a8ff 306 /* Blanking source for COMP4 */
bogdanm 0:9b334a45a8ff 307 #define COMP_BlankingSrce_TIM3OC4 COMP_CSR_COMPxBLANKING_0 /*!< TIM3 OC4 selected as blanking source for compartor */
bogdanm 0:9b334a45a8ff 308 #define COMP_BlankingSrce_TIM15OC1 ((uint32_t)0x000C0000) /*!< TIM15 OC1 selected as blanking source for compartor */
bogdanm 0:9b334a45a8ff 309
bogdanm 0:9b334a45a8ff 310 /* Blanking source common for COMP6 and COMP7 */
bogdanm 0:9b334a45a8ff 311 #define COMP_BlankingSrce_TIM15OC2 COMP_CSR_COMPxBLANKING_2 /*!< TIM15 OC2 selected as blanking source for compartor */
bogdanm 0:9b334a45a8ff 312
bogdanm 0:9b334a45a8ff 313 #define IS_COMP_BLANKING_SOURCE(SOURCE) (((SOURCE) == COMP_BlankingSrce_None) || \
bogdanm 0:9b334a45a8ff 314 ((SOURCE) == COMP_BlankingSrce_TIM1OC5) || \
bogdanm 0:9b334a45a8ff 315 ((SOURCE) == COMP_BlankingSrce_TIM2OC3) || \
bogdanm 0:9b334a45a8ff 316 ((SOURCE) == COMP_BlankingSrce_TIM3OC3) || \
bogdanm 0:9b334a45a8ff 317 ((SOURCE) == COMP_BlankingSrce_TIM2OC4) || \
bogdanm 0:9b334a45a8ff 318 ((SOURCE) == COMP_BlankingSrce_TIM8OC5) || \
bogdanm 0:9b334a45a8ff 319 ((SOURCE) == COMP_BlankingSrce_TIM3OC4) || \
bogdanm 0:9b334a45a8ff 320 ((SOURCE) == COMP_BlankingSrce_TIM15OC1) || \
bogdanm 0:9b334a45a8ff 321 ((SOURCE) == COMP_BlankingSrce_TIM15OC2))
bogdanm 0:9b334a45a8ff 322 /**
bogdanm 0:9b334a45a8ff 323 * @}
bogdanm 0:9b334a45a8ff 324 */
bogdanm 0:9b334a45a8ff 325
bogdanm 0:9b334a45a8ff 326 /** @defgroup COMP_OutputPoloarity
bogdanm 0:9b334a45a8ff 327 * @{
bogdanm 0:9b334a45a8ff 328 */
bogdanm 0:9b334a45a8ff 329 #define COMP_OutputPol_NonInverted ((uint32_t)0x00000000) /*!< COMP output on GPIO isn't inverted */
bogdanm 0:9b334a45a8ff 330 #define COMP_OutputPol_Inverted COMP_CSR_COMPxPOL /*!< COMP output on GPIO is inverted */
bogdanm 0:9b334a45a8ff 331
bogdanm 0:9b334a45a8ff 332 #define IS_COMP_OUTPUT_POL(POL) (((POL) == COMP_OutputPol_NonInverted) || \
bogdanm 0:9b334a45a8ff 333 ((POL) == COMP_OutputPol_Inverted))
bogdanm 0:9b334a45a8ff 334
bogdanm 0:9b334a45a8ff 335 /**
bogdanm 0:9b334a45a8ff 336 * @}
bogdanm 0:9b334a45a8ff 337 */
bogdanm 0:9b334a45a8ff 338
bogdanm 0:9b334a45a8ff 339 /** @defgroup COMP_Hysteresis
bogdanm 0:9b334a45a8ff 340 * @{
bogdanm 0:9b334a45a8ff 341 */
bogdanm 0:9b334a45a8ff 342 /* Please refer to the electrical characteristics in the device datasheet for
bogdanm 0:9b334a45a8ff 343 the hysteresis level */
bogdanm 0:9b334a45a8ff 344 #define COMP_Hysteresis_No 0x00000000 /*!< No hysteresis */
bogdanm 0:9b334a45a8ff 345 #define COMP_Hysteresis_Low COMP_CSR_COMPxHYST_0 /*!< Hysteresis level low */
bogdanm 0:9b334a45a8ff 346 #define COMP_Hysteresis_Medium COMP_CSR_COMPxHYST_1 /*!< Hysteresis level medium */
bogdanm 0:9b334a45a8ff 347 #define COMP_Hysteresis_High COMP_CSR_COMPxHYST /*!< Hysteresis level high */
bogdanm 0:9b334a45a8ff 348
bogdanm 0:9b334a45a8ff 349 #define IS_COMP_HYSTERESIS(HYSTERESIS) (((HYSTERESIS) == COMP_Hysteresis_No) || \
bogdanm 0:9b334a45a8ff 350 ((HYSTERESIS) == COMP_Hysteresis_Low) || \
bogdanm 0:9b334a45a8ff 351 ((HYSTERESIS) == COMP_Hysteresis_Medium) || \
bogdanm 0:9b334a45a8ff 352 ((HYSTERESIS) == COMP_Hysteresis_High))
bogdanm 0:9b334a45a8ff 353 /**
bogdanm 0:9b334a45a8ff 354 * @}
bogdanm 0:9b334a45a8ff 355 */
bogdanm 0:9b334a45a8ff 356
bogdanm 0:9b334a45a8ff 357 /** @defgroup COMP_Mode
bogdanm 0:9b334a45a8ff 358 * @{
bogdanm 0:9b334a45a8ff 359 */
bogdanm 0:9b334a45a8ff 360 /* Please refer to the electrical characteristics in the device datasheet for
bogdanm 0:9b334a45a8ff 361 the power consumption values */
bogdanm 0:9b334a45a8ff 362 #define COMP_Mode_HighSpeed 0x00000000 /*!< High Speed */
bogdanm 0:9b334a45a8ff 363 #define COMP_Mode_MediumSpeed COMP_CSR_COMPxMODE_0 /*!< Medium Speed */
bogdanm 0:9b334a45a8ff 364 #define COMP_Mode_LowPower COMP_CSR_COMPxMODE_1 /*!< Low power mode */
bogdanm 0:9b334a45a8ff 365 #define COMP_Mode_UltraLowPower COMP_CSR_COMPxMODE /*!< Ultra-low power mode */
bogdanm 0:9b334a45a8ff 366
bogdanm 0:9b334a45a8ff 367 #define IS_COMP_MODE(MODE) (((MODE) == COMP_Mode_UltraLowPower) || \
bogdanm 0:9b334a45a8ff 368 ((MODE) == COMP_Mode_LowPower) || \
bogdanm 0:9b334a45a8ff 369 ((MODE) == COMP_Mode_MediumSpeed) || \
bogdanm 0:9b334a45a8ff 370 ((MODE) == COMP_Mode_HighSpeed))
bogdanm 0:9b334a45a8ff 371 /**
bogdanm 0:9b334a45a8ff 372 * @}
bogdanm 0:9b334a45a8ff 373 */
bogdanm 0:9b334a45a8ff 374
bogdanm 0:9b334a45a8ff 375 /** @defgroup COMP_OutputLevel
bogdanm 0:9b334a45a8ff 376 * @{
bogdanm 0:9b334a45a8ff 377 */
bogdanm 0:9b334a45a8ff 378 /* When output polarity is not inverted, comparator output is high when
bogdanm 0:9b334a45a8ff 379 the non-inverting input is at a higher voltage than the inverting input */
bogdanm 0:9b334a45a8ff 380 #define COMP_OutputLevel_High COMP_CSR_COMPxOUT
bogdanm 0:9b334a45a8ff 381 /* When output polarity is not inverted, comparator output is low when
bogdanm 0:9b334a45a8ff 382 the non-inverting input is at a lower voltage than the inverting input*/
bogdanm 0:9b334a45a8ff 383 #define COMP_OutputLevel_Low ((uint32_t)0x00000000)
bogdanm 0:9b334a45a8ff 384
bogdanm 0:9b334a45a8ff 385 /**
bogdanm 0:9b334a45a8ff 386 * @}
bogdanm 0:9b334a45a8ff 387 */
bogdanm 0:9b334a45a8ff 388
bogdanm 0:9b334a45a8ff 389 /** @defgroup COMP_WindowMode
bogdanm 0:9b334a45a8ff 390 * @{
bogdanm 0:9b334a45a8ff 391 */
bogdanm 0:9b334a45a8ff 392 #define IS_COMP_WINDOW(WINDOW) (((WINDOW) == COMP_Selection_COMP2) || \
bogdanm 0:9b334a45a8ff 393 ((WINDOW) == COMP_Selection_COMP4) || \
bogdanm 0:9b334a45a8ff 394 ((WINDOW) == COMP_Selection_COMP6))
bogdanm 0:9b334a45a8ff 395 /**
bogdanm 0:9b334a45a8ff 396 * @}
bogdanm 0:9b334a45a8ff 397 */
bogdanm 0:9b334a45a8ff 398
bogdanm 0:9b334a45a8ff 399 /**
bogdanm 0:9b334a45a8ff 400 * @}
bogdanm 0:9b334a45a8ff 401 */
bogdanm 0:9b334a45a8ff 402
bogdanm 0:9b334a45a8ff 403 /* Exported macro ------------------------------------------------------------*/
bogdanm 0:9b334a45a8ff 404 /* Exported functions ------------------------------------------------------- */
bogdanm 0:9b334a45a8ff 405
bogdanm 0:9b334a45a8ff 406 /* Function used to set the COMP configuration to the default reset state ****/
bogdanm 0:9b334a45a8ff 407 void COMP_DeInit(uint32_t COMP_Selection);
bogdanm 0:9b334a45a8ff 408
bogdanm 0:9b334a45a8ff 409 /* Initialization and Configuration functions *********************************/
bogdanm 0:9b334a45a8ff 410 void COMP_Init(uint32_t COMP_Selection, COMP_InitTypeDef* COMP_InitStruct);
bogdanm 0:9b334a45a8ff 411 void COMP_StructInit(COMP_InitTypeDef* COMP_InitStruct);
bogdanm 0:9b334a45a8ff 412 void COMP_Cmd(uint32_t COMP_Selection, FunctionalState NewState);
bogdanm 0:9b334a45a8ff 413 void COMP_SwitchCmd(uint32_t COMP_Selection, FunctionalState NewState);
bogdanm 0:9b334a45a8ff 414 uint32_t COMP_GetOutputLevel(uint32_t COMP_Selection);
bogdanm 0:9b334a45a8ff 415
bogdanm 0:9b334a45a8ff 416 /* Window mode control function ***********************************************/
bogdanm 0:9b334a45a8ff 417 void COMP_WindowCmd(uint32_t COMP_Selection, FunctionalState NewState);
bogdanm 0:9b334a45a8ff 418
bogdanm 0:9b334a45a8ff 419 /* COMP configuration locking function ****************************************/
bogdanm 0:9b334a45a8ff 420 void COMP_LockConfig(uint32_t COMP_Selection);
bogdanm 0:9b334a45a8ff 421
bogdanm 0:9b334a45a8ff 422 #ifdef __cplusplus
bogdanm 0:9b334a45a8ff 423 }
bogdanm 0:9b334a45a8ff 424 #endif
bogdanm 0:9b334a45a8ff 425
bogdanm 0:9b334a45a8ff 426 #endif /*__STM32F30x_COMP_H */
bogdanm 0:9b334a45a8ff 427
bogdanm 0:9b334a45a8ff 428 /**
bogdanm 0:9b334a45a8ff 429 * @}
bogdanm 0:9b334a45a8ff 430 */
bogdanm 0:9b334a45a8ff 431
bogdanm 0:9b334a45a8ff 432 /**
bogdanm 0:9b334a45a8ff 433 * @}
bogdanm 0:9b334a45a8ff 434 */
bogdanm 0:9b334a45a8ff 435
bogdanm 0:9b334a45a8ff 436 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/