mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
157:90e3acc479a2
test with CLOCK_SETUP = 0

Who changed what in which revision?

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