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:
237:f3da66175598
test with CLOCK_SETUP = 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 237:f3da66175598 1 /**
mbed_official 237:f3da66175598 2 ******************************************************************************
mbed_official 237:f3da66175598 3 * @file stm32f3xx_hal_comp_ex.h
mbed_official 237:f3da66175598 4 * @author MCD Application Team
mbed_official 237:f3da66175598 5 * @version V1.0.1
mbed_official 237:f3da66175598 6 * @date 18-June-2014
mbed_official 237:f3da66175598 7 * @brief Header file of COMP HAL Extension module.
mbed_official 237:f3da66175598 8 ******************************************************************************
mbed_official 237:f3da66175598 9 * @attention
mbed_official 237:f3da66175598 10 *
mbed_official 237:f3da66175598 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 237:f3da66175598 12 *
mbed_official 237:f3da66175598 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 237:f3da66175598 14 * are permitted provided that the following conditions are met:
mbed_official 237:f3da66175598 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 237:f3da66175598 16 * this list of conditions and the following disclaimer.
mbed_official 237:f3da66175598 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 237:f3da66175598 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 237:f3da66175598 19 * and/or other materials provided with the distribution.
mbed_official 237:f3da66175598 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 237:f3da66175598 21 * may be used to endorse or promote products derived from this software
mbed_official 237:f3da66175598 22 * without specific prior written permission.
mbed_official 237:f3da66175598 23 *
mbed_official 237:f3da66175598 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 237:f3da66175598 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 237:f3da66175598 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 237:f3da66175598 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 237:f3da66175598 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 237:f3da66175598 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 237:f3da66175598 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 237:f3da66175598 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 237:f3da66175598 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 237:f3da66175598 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 237:f3da66175598 34 *
mbed_official 237:f3da66175598 35 ******************************************************************************
mbed_official 237:f3da66175598 36 */
mbed_official 237:f3da66175598 37
mbed_official 237:f3da66175598 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 237:f3da66175598 39 #ifndef __STM32F3xx_HAL_COMP_EX_H
mbed_official 237:f3da66175598 40 #define __STM32F3xx_HAL_COMP_EX_H
mbed_official 237:f3da66175598 41
mbed_official 237:f3da66175598 42 #ifdef __cplusplus
mbed_official 237:f3da66175598 43 extern "C" {
mbed_official 237:f3da66175598 44 #endif
mbed_official 237:f3da66175598 45
mbed_official 237:f3da66175598 46 /* Includes ------------------------------------------------------------------*/
mbed_official 237:f3da66175598 47 #include "stm32f3xx_hal_def.h"
mbed_official 237:f3da66175598 48
mbed_official 237:f3da66175598 49 /** @addtogroup STM32F3xx_HAL_Driver
mbed_official 237:f3da66175598 50 * @{
mbed_official 237:f3da66175598 51 */
mbed_official 237:f3da66175598 52
mbed_official 237:f3da66175598 53 /** @addtogroup COMPEx
mbed_official 237:f3da66175598 54 * @{
mbed_official 237:f3da66175598 55 */
mbed_official 237:f3da66175598 56
mbed_official 237:f3da66175598 57 /* Exported types ------------------------------------------------------------*/
mbed_official 237:f3da66175598 58 /* Exported constants --------------------------------------------------------*/
mbed_official 237:f3da66175598 59 /** @addtogroup COMPEx_Exported_Constants
mbed_official 237:f3da66175598 60 * @{
mbed_official 237:f3da66175598 61 */
mbed_official 237:f3da66175598 62
mbed_official 237:f3da66175598 63 #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx)
mbed_official 237:f3da66175598 64 /** @defgroup COMPEx_InvertingInput COMP_InvertingInput (STM32F302xC/STM32F303xC/STM32F358xx Product devices)
mbed_official 237:f3da66175598 65 * @{
mbed_official 237:f3da66175598 66 */
mbed_official 237:f3da66175598 67 #define COMP_INVERTINGINPUT_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 68 #define COMP_INVERTINGINPUT_1_2VREFINT COMP_CSR_COMPxINSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 69 #define COMP_INVERTINGINPUT_3_4VREFINT COMP_CSR_COMPxINSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 70 #define COMP_INVERTINGINPUT_VREFINT (COMP_CSR_COMPxINSEL_1|COMP_CSR_COMPxINSEL_0) /*!< VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 71 #define COMP_INVERTINGINPUT_DAC1_CH1 COMP_CSR_COMPxINSEL_2 /*!< DAC1_CH1_OUT (PA4) connected to comparator inverting input */
mbed_official 237:f3da66175598 72 #define COMP_INVERTINGINPUT_DAC1_CH2 (COMP_CSR_COMPxINSEL_2|COMP_CSR_COMPxINSEL_0) /*!< DAC1_CH2_OUT (PA5) connected to comparator inverting input */
mbed_official 237:f3da66175598 73 #define COMP_INVERTINGINPUT_IO1 (COMP_CSR_COMPxINSEL_2|COMP_CSR_COMPxINSEL_1) /*!< I/O1 (PA0 for COMP1, PA2 for COMP2, PD15 for COMP3,
mbed_official 237:f3da66175598 74 PE8 for COMP4, PD13 for COMP5, PD10 for COMP6,
mbed_official 237:f3da66175598 75 PC0 for COMP7) connected to comparator inverting input */
mbed_official 237:f3da66175598 76 #define COMP_INVERTINGINPUT_IO2 COMP_CSR_COMPxINSEL /*!< I/O2 (PB12 for COMP3, PB2 for COMP4, PB10 for COMP5,
mbed_official 237:f3da66175598 77 PB15 for COMP6) connected to comparator inverting input */
mbed_official 237:f3da66175598 78 /* Aliases for compatibility */
mbed_official 237:f3da66175598 79 #define COMP_INVERTINGINPUT_DAC1 COMP_INVERTINGINPUT_DAC1_CH1
mbed_official 237:f3da66175598 80 #define COMP_INVERTINGINPUT_DAC2 COMP_INVERTINGINPUT_DAC1_CH2
mbed_official 237:f3da66175598 81
mbed_official 237:f3da66175598 82 #define IS_COMP_INVERTINGINPUT(INPUT) (((INPUT) == COMP_INVERTINGINPUT_1_4VREFINT) || \
mbed_official 237:f3da66175598 83 ((INPUT) == COMP_INVERTINGINPUT_1_2VREFINT) || \
mbed_official 237:f3da66175598 84 ((INPUT) == COMP_INVERTINGINPUT_3_4VREFINT) || \
mbed_official 237:f3da66175598 85 ((INPUT) == COMP_INVERTINGINPUT_VREFINT) || \
mbed_official 237:f3da66175598 86 ((INPUT) == COMP_INVERTINGINPUT_DAC1_CH1) || \
mbed_official 237:f3da66175598 87 ((INPUT) == COMP_INVERTINGINPUT_DAC1_CH2) || \
mbed_official 237:f3da66175598 88 ((INPUT) == COMP_INVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 89 ((INPUT) == COMP_INVERTINGINPUT_IO2))
mbed_official 237:f3da66175598 90 /**
mbed_official 237:f3da66175598 91 * @}
mbed_official 237:f3da66175598 92 */
mbed_official 237:f3da66175598 93 #elif defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
mbed_official 237:f3da66175598 94 /** @defgroup COMPEx_InvertingInput COMP_InvertingInput (STM32F301x8/STM32F302x8/STM32F318xx Product devices)
mbed_official 237:f3da66175598 95 * @{
mbed_official 237:f3da66175598 96 */
mbed_official 237:f3da66175598 97 #define COMP_INVERTINGINPUT_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 98 #define COMP_INVERTINGINPUT_1_2VREFINT COMP_CSR_COMPxINSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 99 #define COMP_INVERTINGINPUT_3_4VREFINT COMP_CSR_COMPxINSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 100 #define COMP_INVERTINGINPUT_VREFINT (COMP_CSR_COMPxINSEL_1|COMP_CSR_COMPxINSEL_0) /*!< VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 101 #define COMP_INVERTINGINPUT_DAC1_CH1 COMP_CSR_COMPxINSEL_2 /*!< DAC1_CH1_OUT (PA4) connected to comparator inverting input */
mbed_official 237:f3da66175598 102 #define COMP_INVERTINGINPUT_IO1 (COMP_CSR_COMPxINSEL_2|COMP_CSR_COMPxINSEL_1) /*!< I/O1 (PA2 for COMP2, PB2 for COMP4, PB15 for COMP6)
mbed_official 237:f3da66175598 103 connected to comparator inverting input */
mbed_official 237:f3da66175598 104 /* Aliases for compatibility */
mbed_official 237:f3da66175598 105 #define COMP_INVERTINGINPUT_DAC1 COMP_INVERTINGINPUT_DAC1_CH1
mbed_official 237:f3da66175598 106
mbed_official 237:f3da66175598 107 #define IS_COMP_INVERTINGINPUT(INPUT) (((INPUT) == COMP_INVERTINGINPUT_1_4VREFINT) || \
mbed_official 237:f3da66175598 108 ((INPUT) == COMP_INVERTINGINPUT_1_2VREFINT) || \
mbed_official 237:f3da66175598 109 ((INPUT) == COMP_INVERTINGINPUT_3_4VREFINT) || \
mbed_official 237:f3da66175598 110 ((INPUT) == COMP_INVERTINGINPUT_VREFINT) || \
mbed_official 237:f3da66175598 111 ((INPUT) == COMP_INVERTINGINPUT_DAC1_CH1) || \
mbed_official 237:f3da66175598 112 ((INPUT) == COMP_INVERTINGINPUT_IO1))
mbed_official 237:f3da66175598 113 /**
mbed_official 237:f3da66175598 114 * @}
mbed_official 237:f3da66175598 115 */
mbed_official 237:f3da66175598 116 #elif defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
mbed_official 237:f3da66175598 117 /** @defgroup COMPEx_InvertingInput COMP_InvertingInput (STM32F303x8/STM32F334x8/STM32F328xx Product devices)
mbed_official 237:f3da66175598 118 * @{
mbed_official 237:f3da66175598 119 */
mbed_official 237:f3da66175598 120 #define COMP_INVERTINGINPUT_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 121 #define COMP_INVERTINGINPUT_1_2VREFINT COMP_CSR_COMPxINSEL_0 /*!< 1/2 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 122 #define COMP_INVERTINGINPUT_3_4VREFINT COMP_CSR_COMPxINSEL_1 /*!< 3/4 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 123 #define COMP_INVERTINGINPUT_VREFINT (COMP_CSR_COMPxINSEL_1|COMP_CSR_COMPxINSEL_0) /*!< VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 124 #define COMP_INVERTINGINPUT_DAC1_CH1 COMP_CSR_COMPxINSEL_2 /*!< DAC1_CH1_OUT (PA4) connected to comparator inverting input */
mbed_official 237:f3da66175598 125 #define COMP_INVERTINGINPUT_DAC1_CH2 (COMP_CSR_COMPxINSEL_2|COMP_CSR_COMPxINSEL_0) /*!< DAC1_CH2_OUT (PA5) connected to comparator inverting input */
mbed_official 237:f3da66175598 126 #define COMP_INVERTINGINPUT_IO1 (COMP_CSR_COMPxINSEL_2|COMP_CSR_COMPxINSEL_1) /*!< I/O1 (PA2 for COMP2, PB2 for COMP4, PB15 for COMP6)
mbed_official 237:f3da66175598 127 connected to comparator inverting input */
mbed_official 237:f3da66175598 128 #define COMP_INVERTINGINPUT_DAC2_CH1 COMP_CSR_COMPxINSEL_3 /*!< DAC2_CH1_OUT connected to comparator inverting input */
mbed_official 237:f3da66175598 129 /* Aliases for compatibility */
mbed_official 237:f3da66175598 130 #define COMP_INVERTINGINPUT_DAC1 COMP_INVERTINGINPUT_DAC1_CH1
mbed_official 237:f3da66175598 131 #define COMP_INVERTINGINPUT_DAC2 COMP_INVERTINGINPUT_DAC1_CH2
mbed_official 237:f3da66175598 132
mbed_official 237:f3da66175598 133 #define IS_COMP_INVERTINGINPUT(INPUT) (((INPUT) == COMP_INVERTINGINPUT_1_4VREFINT) || \
mbed_official 237:f3da66175598 134 ((INPUT) == COMP_INVERTINGINPUT_1_2VREFINT) || \
mbed_official 237:f3da66175598 135 ((INPUT) == COMP_INVERTINGINPUT_3_4VREFINT) || \
mbed_official 237:f3da66175598 136 ((INPUT) == COMP_INVERTINGINPUT_VREFINT) || \
mbed_official 237:f3da66175598 137 ((INPUT) == COMP_INVERTINGINPUT_DAC1_CH1) || \
mbed_official 237:f3da66175598 138 ((INPUT) == COMP_INVERTINGINPUT_DAC1_CH2) || \
mbed_official 237:f3da66175598 139 ((INPUT) == COMP_INVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 140 ((INPUT) == COMP_INVERTINGINPUT_DAC2_CH1))
mbed_official 237:f3da66175598 141 /**
mbed_official 237:f3da66175598 142 * @}
mbed_official 237:f3da66175598 143 */
mbed_official 237:f3da66175598 144 #elif defined(STM32F373xC) || defined(STM32F378xx)
mbed_official 237:f3da66175598 145 /** @defgroup COMPEx_InvertingInput COMP_InvertingInput (STM32F373xC/STM32F378xx Product devices)
mbed_official 237:f3da66175598 146 * @{
mbed_official 237:f3da66175598 147 */
mbed_official 237:f3da66175598 148 #define COMP_INVERTINGINPUT_1_4VREFINT ((uint32_t)0x00000000) /*!< 1/4 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 149 #define COMP_INVERTINGINPUT_1_2VREFINT ((uint32_t)COMP_CSR_COMPxINSEL_0) /*!< 1/2 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 150 #define COMP_INVERTINGINPUT_3_4VREFINT ((uint32_t)COMP_CSR_COMPxINSEL_1) /*!< 3/4 VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 151 #define COMP_INVERTINGINPUT_VREFINT ((uint32_t)(COMP_CSR_COMPxINSEL_1|COMP_CSR_COMPxINSEL_0)) /*!< VREFINT connected to comparator inverting input */
mbed_official 237:f3da66175598 152 #define COMP_INVERTINGINPUT_DAC1_CH1 ((uint32_t)COMP_CSR_COMPxINSEL_2) /*!< DAC1_CH1_OUT (PA4) connected to comparator inverting input */
mbed_official 237:f3da66175598 153 #define COMP_INVERTINGINPUT_DAC1_CH2 ((uint32_t)(COMP_CSR_COMPxINSEL_2|COMP_CSR_COMPxINSEL_0)) /*!< DAC1_CH2_OUT (PA5) connected to comparator inverting input */
mbed_official 237:f3da66175598 154 #define COMP_INVERTINGINPUT_IO1 ((uint32_t)(COMP_CSR_COMPxINSEL_2|COMP_CSR_COMPxINSEL_1)) /*!< I/O1 (PA0 for COMP1, PA2 for COMP2) connected to comparator inverting input */
mbed_official 237:f3da66175598 155 #define COMP_INVERTINGINPUT_DAC2_CH1 ((uint32_t)COMP_CSR_COMPxINSEL) /*!< DAC2_CH1_OUT connected to comparator inverting input */
mbed_official 237:f3da66175598 156 /* Aliases for compatibility */
mbed_official 237:f3da66175598 157 #define COMP_INVERTINGINPUT_DAC1 COMP_INVERTINGINPUT_DAC1_CH1
mbed_official 237:f3da66175598 158 #define COMP_INVERTINGINPUT_DAC2 COMP_INVERTINGINPUT_DAC1_CH2
mbed_official 237:f3da66175598 159
mbed_official 237:f3da66175598 160 #define IS_COMP_INVERTINGINPUT(INPUT) (((INPUT) == COMP_INVERTINGINPUT_1_4VREFINT) || \
mbed_official 237:f3da66175598 161 ((INPUT) == COMP_INVERTINGINPUT_1_2VREFINT) || \
mbed_official 237:f3da66175598 162 ((INPUT) == COMP_INVERTINGINPUT_3_4VREFINT) || \
mbed_official 237:f3da66175598 163 ((INPUT) == COMP_INVERTINGINPUT_VREFINT) || \
mbed_official 237:f3da66175598 164 ((INPUT) == COMP_INVERTINGINPUT_DAC1_CH1) || \
mbed_official 237:f3da66175598 165 ((INPUT) == COMP_INVERTINGINPUT_DAC1_CH2) || \
mbed_official 237:f3da66175598 166 ((INPUT) == COMP_INVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 167 ((INPUT) == COMP_INVERTINGINPUT_DAC2_CH1))
mbed_official 237:f3da66175598 168 /**
mbed_official 237:f3da66175598 169 * @}
mbed_official 237:f3da66175598 170 */
mbed_official 237:f3da66175598 171 #endif /* STM32F302xC || STM32F303xC || STM32F358xx */
mbed_official 237:f3da66175598 172
mbed_official 237:f3da66175598 173 #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx)
mbed_official 237:f3da66175598 174 /** @defgroup COMPEx_NonInvertingInput COMPEx_NonInvertingInput (STM32F302xC/STM32F303xC/STM32F358xx Product devices)
mbed_official 237:f3da66175598 175 * @{
mbed_official 237:f3da66175598 176 */
mbed_official 237:f3da66175598 177 #define COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< I/O1 (PA1 for COMP1, PA7 for COMP2, PB14 for COMP3,
mbed_official 237:f3da66175598 178 PB0 for COMP4, PD12 for COMP5, PD11 for COMP6,
mbed_official 237:f3da66175598 179 PA0 for COMP7) connected to comparator non inverting input */
mbed_official 237:f3da66175598 180 #define COMP_NONINVERTINGINPUT_IO2 COMP_CSR_COMPxNONINSEL /*!< I/O2 (PA3 for COMP2, PD14 for COMP3, PE7 for COMP4, PB13 for COMP5,
mbed_official 237:f3da66175598 181 PB11 for COMP6, PC1 for COMP7) connected to comparator non inverting input */
mbed_official 237:f3da66175598 182 #define COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED COMP1_CSR_COMP1SW1 /*!< DAC ouput connected to comparator COMP1 non inverting input */
mbed_official 237:f3da66175598 183
mbed_official 237:f3da66175598 184 #define IS_COMP_NONINVERTINGINPUT(INPUT) (((INPUT) == COMP_NONINVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 185 ((INPUT) == COMP_NONINVERTINGINPUT_IO2) || \
mbed_official 237:f3da66175598 186 ((INPUT) == COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED))
mbed_official 237:f3da66175598 187
mbed_official 237:f3da66175598 188 /* STM32F302xB/xC, STM32F303xB/xC, STM32F358xx devices comparator instances non inverting source values */
mbed_official 237:f3da66175598 189 #define IS_COMP_NONINVERTINGINPUT_INSTANCE(INSTANCE, INPUT) \
mbed_official 237:f3da66175598 190 ((((INSTANCE) == COMP1) && \
mbed_official 237:f3da66175598 191 (((INPUT) == COMP_NONINVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 192 ((INPUT) == COMP_NONINVERTINGINPUT_IO2) || \
mbed_official 237:f3da66175598 193 ((INPUT) == COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED))) \
mbed_official 237:f3da66175598 194 || \
mbed_official 237:f3da66175598 195 ((((INPUT) == COMP_NONINVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 196 ((INPUT) == COMP_NONINVERTINGINPUT_IO2))))
mbed_official 237:f3da66175598 197
mbed_official 237:f3da66175598 198 #define COMP_CSR_COMPxNONINSEL_MASK (COMP_CSR_COMPxNONINSEL | COMP1_CSR_COMP1SW1) /*!< COMP_CSR_COMPxNONINSEL mask */
mbed_official 237:f3da66175598 199 /**
mbed_official 237:f3da66175598 200 * @}
mbed_official 237:f3da66175598 201 */
mbed_official 237:f3da66175598 202 #elif defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
mbed_official 237:f3da66175598 203 /** @defgroup COMPEx_NonInvertingInput COMPEx_NonInvertingInput (STM32F301x8/STM32F302x8/STM32F318xx Product devices)
mbed_official 237:f3da66175598 204 * @{
mbed_official 237:f3da66175598 205 */
mbed_official 237:f3da66175598 206 #define COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< I/O1 (PA7 for COMP2, PB0 for COMP4, PB11 for COMP6)
mbed_official 237:f3da66175598 207 connected to comparator non inverting input */
mbed_official 237:f3da66175598 208 #define COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED COMP2_CSR_COMP2INPDAC /*!< DAC ouput connected to comparator COMP2 non inverting input */
mbed_official 237:f3da66175598 209
mbed_official 237:f3da66175598 210 #define IS_COMP_NONINVERTINGINPUT(INPUT) (((INPUT) == COMP_NONINVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 211 ((INPUT) == COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED))
mbed_official 237:f3da66175598 212
mbed_official 237:f3da66175598 213 /* STM32F301x6/x8, STM32F302x6/x8, STM32F318xx devices comparator instances non inverting source values */
mbed_official 237:f3da66175598 214 #define IS_COMP_NONINVERTINGINPUT_INSTANCE(INSTANCE, INPUT) \
mbed_official 237:f3da66175598 215 ((((INSTANCE) == COMP2) && \
mbed_official 237:f3da66175598 216 (((INPUT) == COMP_NONINVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 217 ((INPUT) == COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED))) \
mbed_official 237:f3da66175598 218 || \
mbed_official 237:f3da66175598 219 (((INPUT) == COMP_NONINVERTINGINPUT_IO1)))
mbed_official 237:f3da66175598 220
mbed_official 237:f3da66175598 221 #define COMP_CSR_COMPxNONINSEL_MASK (COMP2_CSR_COMP2INPDAC) /*!< COMP_CSR_COMPxNONINSEL mask */
mbed_official 237:f3da66175598 222 /**
mbed_official 237:f3da66175598 223 * @}
mbed_official 237:f3da66175598 224 */
mbed_official 237:f3da66175598 225 #elif defined(STM32F373xC) || defined(STM32F378xx)
mbed_official 237:f3da66175598 226 /** @defgroup COMPEx_NonInvertingInput COMPEx_NonInvertingInput (STM32F373xC/STM32F378xx Product devices)
mbed_official 237:f3da66175598 227 * @{
mbed_official 237:f3da66175598 228 */
mbed_official 237:f3da66175598 229 #define COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< I/O1 (PA1 for COMP1, PA3 for COMP2)
mbed_official 237:f3da66175598 230 connected to comparator non inverting input */
mbed_official 237:f3da66175598 231 #define COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED COMP_CSR_COMP1SW1 /*!< DAC ouput connected to comparator COMP1 non inverting input */
mbed_official 237:f3da66175598 232
mbed_official 237:f3da66175598 233 #define IS_COMP_NONINVERTINGINPUT(INPUT) (((INPUT) == COMP_NONINVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 234 ((INPUT) == COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED))
mbed_official 237:f3da66175598 235
mbed_official 237:f3da66175598 236 /* STM32F373xB/xC, STM32F378xx devices comparator instances non inverting source values */
mbed_official 237:f3da66175598 237 #define IS_COMP_NONINVERTINGINPUT_INSTANCE(INSTANCE, INPUT) \
mbed_official 237:f3da66175598 238 ((((INSTANCE) == COMP1) && \
mbed_official 237:f3da66175598 239 (((INPUT) == COMP_NONINVERTINGINPUT_IO1) || \
mbed_official 237:f3da66175598 240 ((INPUT) == COMP_NONINVERTINGINPUT_DAC1SWITCHCLOSED))) \
mbed_official 237:f3da66175598 241 || \
mbed_official 237:f3da66175598 242 (((INPUT) == COMP_NONINVERTINGINPUT_IO1)))
mbed_official 237:f3da66175598 243
mbed_official 237:f3da66175598 244 #define COMP_CSR_COMPxNONINSEL_MASK (COMP_CSR_COMP1SW1) /*!< COMP_CSR_COMPxNONINSEL mask */
mbed_official 237:f3da66175598 245 /**
mbed_official 237:f3da66175598 246 * @}
mbed_official 237:f3da66175598 247 */
mbed_official 237:f3da66175598 248 #else
mbed_official 237:f3da66175598 249 /** @defgroup COMPEx_NonInvertingInput COMPEx_NonInvertingInput (Other Product devices)
mbed_official 237:f3da66175598 250 * @{
mbed_official 237:f3da66175598 251 */
mbed_official 237:f3da66175598 252 #define COMP_NONINVERTINGINPUT_IO1 ((uint32_t)0x00000000) /*!< I/O1 (PA7 for COMP2, PB0 for COMP4, PB11 for COMP6)
mbed_official 237:f3da66175598 253 connected to comparator non inverting input */
mbed_official 237:f3da66175598 254 /*!< Non inverting input not available */
mbed_official 237:f3da66175598 255 #define IS_COMP_NONINVERTINGINPUT(INPUT) ((INPUT) == (INPUT)) /*!< Multiple selection not available: check always true */
mbed_official 237:f3da66175598 256
mbed_official 237:f3da66175598 257 #define IS_COMP_NONINVERTINGINPUT_INSTANCE(INSTANCE, INPUT) ((INPUT) == (INPUT)) /*!< Multiple selection not available: check always true */
mbed_official 237:f3da66175598 258
mbed_official 237:f3da66175598 259 #define COMP_CSR_COMPxNONINSEL_MASK ((uint32_t)0x00000000) /*!< Mask empty: feature not available */
mbed_official 237:f3da66175598 260 /**
mbed_official 237:f3da66175598 261 * @}
mbed_official 237:f3da66175598 262 */
mbed_official 237:f3da66175598 263 #endif /* STM32F302xC || STM32F303xC || STM32F358xx */
mbed_official 237:f3da66175598 264
mbed_official 237:f3da66175598 265 #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx)
mbed_official 237:f3da66175598 266 /** @defgroup COMPEx_Output COMPEx_Output (STM32F302xC/STM32F303xC/STM32F358xx Product devices)
mbed_official 237:f3da66175598 267 * @{
mbed_official 237:f3da66175598 268 */
mbed_official 237:f3da66175598 269 #define COMP_OUTPUT_NONE ((uint32_t)0x00000000) /*!< COMP output isn't connected to other peripherals */
mbed_official 237:f3da66175598 270 /* Output Redirection common for all comparators COMP1...COMP7 */
mbed_official 237:f3da66175598 271 #define COMP_OUTPUT_TIM1BKIN COMP_CSR_COMPxOUTSEL_0 /*!< COMP output connected to TIM1 Break Input (BKIN) */
mbed_official 237:f3da66175598 272 #define COMP_OUTPUT_TIM1BKIN2 ((uint32_t)0x00000800) /*!< COMP output connected to TIM1 Break Input 2 (BKIN2) */
mbed_official 237:f3da66175598 273 #define COMP_OUTPUT_TIM8BKIN ((uint32_t)0x00000C00) /*!< COMP output connected to TIM8 Break Input (BKIN) */
mbed_official 237:f3da66175598 274 #define COMP_OUTPUT_TIM8BKIN2 ((uint32_t)0x00001000) /*!< COMP output connected to TIM8 Break Input 2 (BKIN2) */
mbed_official 237:f3da66175598 275 #define COMP_OUTPUT_TIM1BKIN2_TIM8BKIN2 ((uint32_t)0x00001400) /*!< COMP output connected to TIM1 Break Input 2 and TIM8 Break Input 2 */
mbed_official 237:f3da66175598 276 /* Output Redirection common for COMP1, COMP2 and COMP3 */
mbed_official 237:f3da66175598 277 #define COMP_OUTPUT_TIM1OCREFCLR ((uint32_t)0x00001800) /*!< COMP output connected to TIM1 OCREF Clear */
mbed_official 237:f3da66175598 278 /* Output Redirection common for COMP1 and COMP2 */
mbed_official 237:f3da66175598 279 #define COMP_OUTPUT_TIM1IC1 ((uint32_t)0x00001C00) /*!< COMP output connected to TIM1 Input Capture 1 */
mbed_official 237:f3da66175598 280 #define COMP_OUTPUT_TIM2IC4 ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 Input Capture 4 */
mbed_official 237:f3da66175598 281 #define COMP_OUTPUT_TIM2OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM2 OCREF Clear */
mbed_official 237:f3da66175598 282 #define COMP_OUTPUT_TIM3IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM3 Input Capture 1 */
mbed_official 237:f3da66175598 283 #define COMP_OUTPUT_TIM3OCREFCLR ((uint32_t)0x00002C00) /*!< COMP output connected to TIM3 OCREF Clear */
mbed_official 237:f3da66175598 284 /* Output Redirection specific to COMP3 */
mbed_official 237:f3da66175598 285 #define COMP_OUTPUT_TIM4IC1 ((uint32_t)0x00001C00) /*!< COMP output connected to TIM4 Input Capture 1 */
mbed_official 237:f3da66175598 286 #define COMP_OUTPUT_TIM3IC2 ((uint32_t)0x00002000) /*!< COMP output connected to TIM3 Input Capture 2 */
mbed_official 237:f3da66175598 287 #define COMP_OUTPUT_TIM15IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM15 Input Capture 1 */
mbed_official 237:f3da66175598 288 #define COMP_OUTPUT_TIM15BKIN ((uint32_t)0x00002C00) /*!< COMP output connected to TIM15 Break Input (BKIN) */
mbed_official 237:f3da66175598 289 /* Output Redirection specific to COMP4 */
mbed_official 237:f3da66175598 290 #define COMP_OUTPUT_TIM3IC3 ((uint32_t)0x00001800) /*!< COMP output connected to TIM3 Input Capture 3 */
mbed_official 237:f3da66175598 291 #define COMP_OUTPUT_TIM8OCREFCLR ((uint32_t)0x00001C00) /*!< COMP output connected to TIM8 OCREF Clear */
mbed_official 237:f3da66175598 292 #define COMP_OUTPUT_TIM15IC2 ((uint32_t)0x00002000) /*!< COMP output connected to TIM15 Input Capture 2 */
mbed_official 237:f3da66175598 293 #define COMP_OUTPUT_TIM4IC2 ((uint32_t)0x00002400) /*!< COMP output connected to TIM4 Input Capture 2 */
mbed_official 237:f3da66175598 294 #define COMP_OUTPUT_TIM15OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM15 OCREF Clear */
mbed_official 237:f3da66175598 295 #define COMP_OUTPUT_TIM3OCREFCLR ((uint32_t)0x00002C00) /*!< COMP output connected to TIM3 OCREF Clear */
mbed_official 237:f3da66175598 296 /* Output Redirection specific to COMP5 */
mbed_official 237:f3da66175598 297 #define COMP_OUTPUT_TIM2IC1 ((uint32_t)0x00001800) /*!< COMP output connected to TIM2 Input Capture 1 */
mbed_official 237:f3da66175598 298 #define COMP_OUTPUT_TIM8OCREFCLR ((uint32_t)0x00001C00) /*!< COMP output connected to TIM8 OCREF Clear */
mbed_official 237:f3da66175598 299 #define COMP_OUTPUT_TIM17IC1 ((uint32_t)0x00002000) /*!< COMP output connected to TIM17 Input Capture 1 */
mbed_official 237:f3da66175598 300 #define COMP_OUTPUT_TIM4IC3 ((uint32_t)0x00002400) /*!< COMP output connected to TIM4 Input Capture 3 */
mbed_official 237:f3da66175598 301 #define COMP_OUTPUT_TIM16BKIN ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 Break Input (BKIN) */
mbed_official 237:f3da66175598 302 #define COMP_OUTPUT_TIM3OCREFCLR ((uint32_t)0x00002C00) /*!< COMP output connected to TIM3 OCREF Clear */
mbed_official 237:f3da66175598 303 /* Output Redirection specific to COMP6 */
mbed_official 237:f3da66175598 304 #define COMP_OUTPUT_TIM2IC2 ((uint32_t)0x00001800) /*!< COMP output connected to TIM2 Input Capture 2 */
mbed_official 237:f3da66175598 305 #define COMP_OUTPUT_TIM8OCREFCLR ((uint32_t)0x00001C00) /*!< COMP output connected to TIM8 OCREF Clear */
mbed_official 237:f3da66175598 306 #define COMP_OUTPUT_COMP6_TIM2OCREFCLR ((uint32_t)0x00002000) /*!< COMP6 output connected to TIM2 OCREF Clear */
mbed_official 237:f3da66175598 307 #define COMP_OUTPUT_TIM16OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM16 OCREF Clear */
mbed_official 237:f3da66175598 308 #define COMP_OUTPUT_TIM16IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 Input Capture 1 */
mbed_official 237:f3da66175598 309 #define COMP_OUTPUT_TIM4IC4 ((uint32_t)0x00002C00) /*!< COMP output connected to TIM4 Input Capture 4 */
mbed_official 237:f3da66175598 310 /* Output Redirection specific to COMP7 */
mbed_official 237:f3da66175598 311 #define COMP_OUTPUT_TIM1OCREFCLR ((uint32_t)0x00001800) /*!< COMP output connected to TIM1 OCREF Clear */
mbed_official 237:f3da66175598 312 #define COMP_OUTPUT_TIM8OCREFCLR ((uint32_t)0x00001C00) /*!< COMP output connected to TIM8 OCREF Clear */
mbed_official 237:f3da66175598 313 #define COMP_OUTPUT_TIM2IC3 ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 Input Capture 3 */
mbed_official 237:f3da66175598 314 #define COMP_OUTPUT_TIM1IC2 ((uint32_t)0x00002400) /*!< COMP output connected to TIM1 Input Capture 2 */
mbed_official 237:f3da66175598 315 #define COMP_OUTPUT_TIM17OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 OCREF Clear */
mbed_official 237:f3da66175598 316 #define COMP_OUTPUT_TIM17BKIN ((uint32_t)0x00002C00) /*!< COMP output connected to TIM16 Break Input (BKIN) */
mbed_official 237:f3da66175598 317
mbed_official 237:f3da66175598 318 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OUTPUT_NONE) || \
mbed_official 237:f3da66175598 319 ((OUTPUT) == COMP_OUTPUT_TIM1BKIN) || \
mbed_official 237:f3da66175598 320 ((OUTPUT) == COMP_OUTPUT_TIM1BKIN2) || \
mbed_official 237:f3da66175598 321 ((OUTPUT) == COMP_OUTPUT_TIM1BKIN2_TIM8BKIN2) || \
mbed_official 237:f3da66175598 322 ((OUTPUT) == COMP_OUTPUT_TIM1IC1) || \
mbed_official 237:f3da66175598 323 ((OUTPUT) == COMP_OUTPUT_TIM1IC2) || \
mbed_official 237:f3da66175598 324 ((OUTPUT) == COMP_OUTPUT_TIM1OCREFCLR) || \
mbed_official 237:f3da66175598 325 ((OUTPUT) == COMP_OUTPUT_TIM2IC1) || \
mbed_official 237:f3da66175598 326 ((OUTPUT) == COMP_OUTPUT_TIM2IC2) || \
mbed_official 237:f3da66175598 327 ((OUTPUT) == COMP_OUTPUT_TIM2IC3) || \
mbed_official 237:f3da66175598 328 ((OUTPUT) == COMP_OUTPUT_TIM2IC4) || \
mbed_official 237:f3da66175598 329 ((OUTPUT) == COMP_OUTPUT_TIM2OCREFCLR) || \
mbed_official 237:f3da66175598 330 ((OUTPUT) == COMP_OUTPUT_COMP6_TIM2OCREFCLR) || \
mbed_official 237:f3da66175598 331 ((OUTPUT) == COMP_OUTPUT_TIM3IC1) || \
mbed_official 237:f3da66175598 332 ((OUTPUT) == COMP_OUTPUT_TIM3IC2) || \
mbed_official 237:f3da66175598 333 ((OUTPUT) == COMP_OUTPUT_TIM3IC3) || \
mbed_official 237:f3da66175598 334 ((OUTPUT) == COMP_OUTPUT_TIM3OCREFCLR) || \
mbed_official 237:f3da66175598 335 ((OUTPUT) == COMP_OUTPUT_TIM4IC1) || \
mbed_official 237:f3da66175598 336 ((OUTPUT) == COMP_OUTPUT_TIM4IC2) || \
mbed_official 237:f3da66175598 337 ((OUTPUT) == COMP_OUTPUT_TIM4IC3) || \
mbed_official 237:f3da66175598 338 ((OUTPUT) == COMP_OUTPUT_TIM4IC4) || \
mbed_official 237:f3da66175598 339 ((OUTPUT) == COMP_OUTPUT_TIM8BKIN) || \
mbed_official 237:f3da66175598 340 ((OUTPUT) == COMP_OUTPUT_TIM8BKIN2) || \
mbed_official 237:f3da66175598 341 ((OUTPUT) == COMP_OUTPUT_TIM8OCREFCLR) || \
mbed_official 237:f3da66175598 342 ((OUTPUT) == COMP_OUTPUT_TIM15IC1) || \
mbed_official 237:f3da66175598 343 ((OUTPUT) == COMP_OUTPUT_TIM15IC2) || \
mbed_official 237:f3da66175598 344 ((OUTPUT) == COMP_OUTPUT_TIM15BKIN) || \
mbed_official 237:f3da66175598 345 ((OUTPUT) == COMP_OUTPUT_TIM15OCREFCLR) || \
mbed_official 237:f3da66175598 346 ((OUTPUT) == COMP_OUTPUT_TIM16BKIN) || \
mbed_official 237:f3da66175598 347 ((OUTPUT) == COMP_OUTPUT_TIM16IC1) || \
mbed_official 237:f3da66175598 348 ((OUTPUT) == COMP_OUTPUT_TIM16OCREFCLR) || \
mbed_official 237:f3da66175598 349 ((OUTPUT) == COMP_OUTPUT_TIM17BKIN) || \
mbed_official 237:f3da66175598 350 ((OUTPUT) == COMP_OUTPUT_TIM17IC1) || \
mbed_official 237:f3da66175598 351 ((OUTPUT) == COMP_OUTPUT_TIM17OCREFCLR))
mbed_official 237:f3da66175598 352 /**
mbed_official 237:f3da66175598 353 * @}
mbed_official 237:f3da66175598 354 */
mbed_official 237:f3da66175598 355 #elif defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
mbed_official 237:f3da66175598 356 /** @defgroup COMPEx_Output COMPEx_Output (STM32F301x8/STM32F302x8/STM32F318xx Product devices)
mbed_official 237:f3da66175598 357 * @{
mbed_official 237:f3da66175598 358 */
mbed_official 237:f3da66175598 359 #define COMP_OUTPUT_NONE ((uint32_t)0x00000000) /*!< COMP output isn't connected to other peripherals */
mbed_official 237:f3da66175598 360 /* Output Redirection common for all comparators COMP2, COMP4 and COMP6 */
mbed_official 237:f3da66175598 361 #define COMP_OUTPUT_TIM1BKIN COMP_CSR_COMPxOUTSEL_0 /*!< COMP output connected to TIM1 Break Input (BKIN) */
mbed_official 237:f3da66175598 362 #define COMP_OUTPUT_TIM1BKIN2 ((uint32_t)0x00000800) /*!< COMP output connected to TIM1 Break Input 2 (BKIN2) */
mbed_official 237:f3da66175598 363 /* Output Redirection specific to COMP2 */
mbed_official 237:f3da66175598 364 #define COMP_OUTPUT_TIM1OCREFCLR ((uint32_t)0x00001800) /*!< COMP output connected to TIM1 OCREF Clear */
mbed_official 237:f3da66175598 365 #define COMP_OUTPUT_TIM1IC1 ((uint32_t)0x00001C00) /*!< COMP output connected to TIM1 Input Capture 1 */
mbed_official 237:f3da66175598 366 #define COMP_OUTPUT_TIM2IC4 ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 Input Capture 4 */
mbed_official 237:f3da66175598 367 #define COMP_OUTPUT_TIM2OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM2 OCREF Clear */
mbed_official 237:f3da66175598 368 /* Output Redirection specific to COMP4 */
mbed_official 237:f3da66175598 369 #define COMP_OUTPUT_TIM15IC2 ((uint32_t)0x00002000) /*!< COMP output connected to TIM15 Input Capture 2 */
mbed_official 237:f3da66175598 370 #define COMP_OUTPUT_TIM15OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM15 OCREF Clear */
mbed_official 237:f3da66175598 371 /* Output Redirection specific to COMP6 */
mbed_official 237:f3da66175598 372 #define COMP_OUTPUT_TIM2IC2 ((uint32_t)0x00001800) /*!< COMP output connected to TIM2 Input Capture 2 */
mbed_official 237:f3da66175598 373 #define COMP_OUTPUT_COMP6_TIM2OCREFCLR ((uint32_t)0x00002000) /*!< COMP6 output connected to TIM2 OCREF Clear */
mbed_official 237:f3da66175598 374 #define COMP_OUTPUT_TIM16OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM16 OCREF Clear */
mbed_official 237:f3da66175598 375 #define COMP_OUTPUT_TIM16IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 Input Capture 1 */
mbed_official 237:f3da66175598 376
mbed_official 237:f3da66175598 377 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OUTPUT_NONE) || \
mbed_official 237:f3da66175598 378 ((OUTPUT) == COMP_OUTPUT_TIM1BKIN) || \
mbed_official 237:f3da66175598 379 ((OUTPUT) == COMP_OUTPUT_TIM1BKIN2) || \
mbed_official 237:f3da66175598 380 ((OUTPUT) == COMP_OUTPUT_TIM1IC1) || \
mbed_official 237:f3da66175598 381 ((OUTPUT) == COMP_OUTPUT_TIM1OCREFCLR) || \
mbed_official 237:f3da66175598 382 ((OUTPUT) == COMP_OUTPUT_TIM2IC2) || \
mbed_official 237:f3da66175598 383 ((OUTPUT) == COMP_OUTPUT_TIM2IC4) || \
mbed_official 237:f3da66175598 384 ((OUTPUT) == COMP_OUTPUT_TIM2OCREFCLR) || \
mbed_official 237:f3da66175598 385 ((OUTPUT) == COMP_OUTPUT_COMP6_TIM2OCREFCLR) || \
mbed_official 237:f3da66175598 386 ((OUTPUT) == COMP_OUTPUT_TIM15IC2) || \
mbed_official 237:f3da66175598 387 ((OUTPUT) == COMP_OUTPUT_TIM15OCREFCLR) || \
mbed_official 237:f3da66175598 388 ((OUTPUT) == COMP_OUTPUT_TIM16IC1) || \
mbed_official 237:f3da66175598 389 ((OUTPUT) == COMP_OUTPUT_TIM16OCREFCLR))
mbed_official 237:f3da66175598 390 /**
mbed_official 237:f3da66175598 391 * @}
mbed_official 237:f3da66175598 392 */
mbed_official 237:f3da66175598 393 #elif defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
mbed_official 237:f3da66175598 394 /** @defgroup COMPEx_Output COMPEx_Output (STM32F303x8/STM32F334x8/STM32F328xx Product devices)
mbed_official 237:f3da66175598 395 * @{
mbed_official 237:f3da66175598 396 */
mbed_official 237:f3da66175598 397 #define COMP_OUTPUT_NONE ((uint32_t)0x00000000) /*!< COMP output isn't connected to other peripherals */
mbed_official 237:f3da66175598 398 /* Output Redirection common for all comparators COMP2, COMP4 and COMP6 */
mbed_official 237:f3da66175598 399 #define COMP_OUTPUT_TIM1BKIN COMP_CSR_COMPxOUTSEL_0 /*!< COMP output connected to TIM1 Break Input (BKIN) */
mbed_official 237:f3da66175598 400 #define COMP_OUTPUT_TIM1BKIN2 ((uint32_t)0x00000800) /*!< COMP output connected to TIM1 Break Input 2 (BKIN2) */
mbed_official 237:f3da66175598 401 /* Output Redirection specific to COMP2 */
mbed_official 237:f3da66175598 402 #define COMP_OUTPUT_TIM1OCREFCLR ((uint32_t)0x00001800) /*!< COMP output connected to TIM1 OCREF Clear */
mbed_official 237:f3da66175598 403 #define COMP_OUTPUT_TIM1IC1 ((uint32_t)0x00001C00) /*!< COMP output connected to TIM1 Input Capture 1 */
mbed_official 237:f3da66175598 404 #define COMP_OUTPUT_TIM2IC4 ((uint32_t)0x00002000) /*!< COMP output connected to TIM2 Input Capture 4 */
mbed_official 237:f3da66175598 405 #define COMP_OUTPUT_TIM2OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM2 OCREF Clear */
mbed_official 237:f3da66175598 406 #define COMP_OUTPUT_TIM3IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM3 Input Capture 1 */
mbed_official 237:f3da66175598 407 #define COMP_OUTPUT_TIM3OCREFCLR ((uint32_t)0x00002C00) /*!< COMP output connected to TIM3 OCREF Clear */
mbed_official 237:f3da66175598 408 /* Output Redirection specific to COMP4 */
mbed_official 237:f3da66175598 409 #define COMP_OUTPUT_TIM3IC3 ((uint32_t)0x00001800) /*!< COMP output connected to TIM3 Input Capture 3 */
mbed_official 237:f3da66175598 410 #define COMP_OUTPUT_TIM15IC2 ((uint32_t)0x00002000) /*!< COMP output connected to TIM15 Input Capture 2 */
mbed_official 237:f3da66175598 411 #define COMP_OUTPUT_TIM15OCREFCLR ((uint32_t)0x00002800) /*!< COMP output connected to TIM15 OCREF Clear */
mbed_official 237:f3da66175598 412 #define COMP_OUTPUT_TIM3OCREFCLR ((uint32_t)0x00002C00) /*!< COMP output connected to TIM3 OCREF Clear */
mbed_official 237:f3da66175598 413 /* Output Redirection specific to COMP6 */
mbed_official 237:f3da66175598 414 #define COMP_OUTPUT_TIM2IC2 ((uint32_t)0x00001800) /*!< COMP output connected to TIM2 Input Capture 2 */
mbed_official 237:f3da66175598 415 #define COMP_OUTPUT_COMP6_TIM2OCREFCLR ((uint32_t)0x00002000) /*!< COMP6 output connected to TIM2 OCREF Clear */
mbed_official 237:f3da66175598 416 #define COMP_OUTPUT_TIM16OCREFCLR ((uint32_t)0x00002400) /*!< COMP output connected to TIM16 OCREF Clear */
mbed_official 237:f3da66175598 417 #define COMP_OUTPUT_TIM16IC1 ((uint32_t)0x00002800) /*!< COMP output connected to TIM16 Input Capture 1 */
mbed_official 237:f3da66175598 418
mbed_official 237:f3da66175598 419 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OUTPUT_NONE) || \
mbed_official 237:f3da66175598 420 ((OUTPUT) == COMP_OUTPUT_TIM1BKIN) || \
mbed_official 237:f3da66175598 421 ((OUTPUT) == COMP_OUTPUT_TIM1BKIN2) || \
mbed_official 237:f3da66175598 422 ((OUTPUT) == COMP_OUTPUT_TIM1IC1) || \
mbed_official 237:f3da66175598 423 ((OUTPUT) == COMP_OUTPUT_TIM1OCREFCLR) || \
mbed_official 237:f3da66175598 424 ((OUTPUT) == COMP_OUTPUT_TIM2IC2) || \
mbed_official 237:f3da66175598 425 ((OUTPUT) == COMP_OUTPUT_TIM2IC4) || \
mbed_official 237:f3da66175598 426 ((OUTPUT) == COMP_OUTPUT_TIM2OCREFCLR) || \
mbed_official 237:f3da66175598 427 ((OUTPUT) == COMP_OUTPUT_COMP6_TIM2OCREFCLR) || \
mbed_official 237:f3da66175598 428 ((OUTPUT) == COMP_OUTPUT_TIM3IC1) || \
mbed_official 237:f3da66175598 429 ((OUTPUT) == COMP_OUTPUT_TIM3IC3) || \
mbed_official 237:f3da66175598 430 ((OUTPUT) == COMP_OUTPUT_TIM3OCREFCLR) || \
mbed_official 237:f3da66175598 431 ((OUTPUT) == COMP_OUTPUT_TIM15IC2) || \
mbed_official 237:f3da66175598 432 ((OUTPUT) == COMP_OUTPUT_TIM15OCREFCLR) || \
mbed_official 237:f3da66175598 433 ((OUTPUT) == COMP_OUTPUT_TIM16IC1) || \
mbed_official 237:f3da66175598 434 ((OUTPUT) == COMP_OUTPUT_TIM16OCREFCLR))
mbed_official 237:f3da66175598 435 /**
mbed_official 237:f3da66175598 436 * @}
mbed_official 237:f3da66175598 437 */
mbed_official 237:f3da66175598 438 #else
mbed_official 237:f3da66175598 439 /** @defgroup COMPEx_Output COMPEx_Output (STM32F373xC/STM32F378xx Product devices)
mbed_official 237:f3da66175598 440 * @{
mbed_official 237:f3da66175598 441 */
mbed_official 237:f3da66175598 442 /* Output Redirection common for all comparators COMP1 and COMP2 */
mbed_official 237:f3da66175598 443 #define COMP_OUTPUT_NONE ((uint32_t)0x0000) /*!< COMP output isn't connected to other peripherals */
mbed_official 237:f3da66175598 444 #define COMP_OUTPUT_TIM3IC1 ((uint32_t)0x0200) /*!< COMP output connected to TIM1 Input Capture 1 */
mbed_official 237:f3da66175598 445 #define COMP_OUTPUT_TIM3OCREFCLR ((uint32_t)0x0300) /*!< COMP output connected to TIM3 OCREF Clear */
mbed_official 237:f3da66175598 446 #define COMP_OUTPUT_TIM2IC4 ((uint32_t)0x0400) /*!< COMP output connected to TIM2 Input Capture 4 */
mbed_official 237:f3da66175598 447 #define COMP_OUTPUT_TIM2OCREFCLR ((uint32_t)0x0500) /*!< COMP output connected to TIM2 OCREF Clear */
mbed_official 237:f3da66175598 448 /* Output Redirection specific to COMP1 */
mbed_official 237:f3da66175598 449 #define COMP_OUTPUT_TIM15BKIN ((uint32_t)0x0100) /*!< COMP output connected to TIM15 Break Input */
mbed_official 237:f3da66175598 450 #define COMP_OUTPUT_TIM5IC4 ((uint32_t)0x0600) /*!< COMP output connected to TIM5 Input Capture 4 */
mbed_official 237:f3da66175598 451 #define COMP_OUTPUT_TIM5OCREFCLR ((uint32_t)0x0700) /*!< COMP output connected to TIM5 OCREF Clear */
mbed_official 237:f3da66175598 452 /* Output Redirection specific to COMP2 */
mbed_official 237:f3da66175598 453 #define COMP_OUTPUT_TIM16BKIN ((uint32_t)0x0100) /*!< COMP output connected to TIM16 Break Input */
mbed_official 237:f3da66175598 454 #define COMP_OUTPUT_TIM4IC1 ((uint32_t)0x0200) /*!< COMP output connected to TIM4 Input Capture 1 */
mbed_official 237:f3da66175598 455 #define COMP_OUTPUT_TIM4OCREFCLR ((uint32_t)0x0300) /*!< COMP output connected to TIM4 OCREF Clear */
mbed_official 237:f3da66175598 456
mbed_official 237:f3da66175598 457 #define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OUTPUT_NONE) || \
mbed_official 237:f3da66175598 458 ((OUTPUT) == COMP_OUTPUT_TIM2IC4) || \
mbed_official 237:f3da66175598 459 ((OUTPUT) == COMP_OUTPUT_TIM2OCREFCLR) || \
mbed_official 237:f3da66175598 460 ((OUTPUT) == COMP_OUTPUT_TIM3IC1) || \
mbed_official 237:f3da66175598 461 ((OUTPUT) == COMP_OUTPUT_TIM3OCREFCLR) || \
mbed_official 237:f3da66175598 462 ((OUTPUT) == COMP_OUTPUT_TIM4IC1) || \
mbed_official 237:f3da66175598 463 ((OUTPUT) == COMP_OUTPUT_TIM4OCREFCLR) || \
mbed_official 237:f3da66175598 464 ((OUTPUT) == COMP_OUTPUT_TIM5IC4) || \
mbed_official 237:f3da66175598 465 ((OUTPUT) == COMP_OUTPUT_TIM5OCREFCLR) || \
mbed_official 237:f3da66175598 466 ((OUTPUT) == COMP_OUTPUT_TIM15BKIN) || \
mbed_official 237:f3da66175598 467 ((OUTPUT) == COMP_OUTPUT_TIM16BKIN))
mbed_official 237:f3da66175598 468 /**
mbed_official 237:f3da66175598 469 * @}
mbed_official 237:f3da66175598 470 */
mbed_official 237:f3da66175598 471 #endif /* STM32F302xC || STM32F303xC || STM32F358xx */
mbed_official 237:f3da66175598 472
mbed_official 237:f3da66175598 473 #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx)
mbed_official 237:f3da66175598 474 /** @defgroup COMPEx_WindowMode COMPEx_WindowMode (STM32F302xC/STM32F303xC/STM32F358xx Product devices)
mbed_official 237:f3da66175598 475 * @{
mbed_official 237:f3da66175598 476 */
mbed_official 237:f3da66175598 477 #define COMP_WINDOWMODE_DISABLED ((uint32_t)0x00000000) /*!< Window mode disabled */
mbed_official 237:f3da66175598 478 #define COMP_WINDOWMODE_ENABLED COMP_CSR_COMPxWNDWEN /*!< Window mode enabled: non inverting input of comparator X (x=2,4,6)
mbed_official 237:f3da66175598 479 is connected to the non inverting input of comparator X-1 */
mbed_official 237:f3da66175598 480 #define IS_COMP_WINDOWMODE(WINDOWMODE) (((WINDOWMODE) == COMP_WINDOWMODE_DISABLED) || \
mbed_official 237:f3da66175598 481 ((WINDOWMODE) == COMP_WINDOWMODE_ENABLED))
mbed_official 237:f3da66175598 482
mbed_official 237:f3da66175598 483 #define COMP_CSR_COMPxWNDWEN_MASK COMP_CSR_COMPxWNDWEN /*!< COMP_CSR_COMPxWNDWEN mask */
mbed_official 237:f3da66175598 484 /**
mbed_official 237:f3da66175598 485 * @}
mbed_official 237:f3da66175598 486 */
mbed_official 237:f3da66175598 487 #elif defined(STM32F373xC) || defined(STM32F378xx)
mbed_official 237:f3da66175598 488 /** @defgroup COMPEx_WindowMode COMPEx_WindowMode (STM32F373xC/STM32F378xx Product devices)
mbed_official 237:f3da66175598 489 * @{
mbed_official 237:f3da66175598 490 */
mbed_official 237:f3da66175598 491 #define COMP_WINDOWMODE_DISABLED ((uint32_t)0x00000000) /*!< Window mode disabled */
mbed_official 237:f3da66175598 492 #define COMP_WINDOWMODE_ENABLED ((uint32_t)COMP_CSR_COMPxWNDWEN) /*!< Window mode enabled: non inverting input of comparator 2
mbed_official 237:f3da66175598 493 is connected to the non inverting input of comparator 1 (PA1) */
mbed_official 237:f3da66175598 494 #define IS_COMP_WINDOWMODE(WINDOWMODE) (((WINDOWMODE) == COMP_WINDOWMODE_DISABLED) || \
mbed_official 237:f3da66175598 495 ((WINDOWMODE) == COMP_WINDOWMODE_ENABLED))
mbed_official 237:f3da66175598 496
mbed_official 237:f3da66175598 497 #define COMP_CSR_COMPxWNDWEN_MASK COMP_CSR_COMPxWNDWEN /*!< COMP_CSR_COMPxWNDWEN mask */
mbed_official 237:f3da66175598 498 /**
mbed_official 237:f3da66175598 499 * @}
mbed_official 237:f3da66175598 500 */
mbed_official 237:f3da66175598 501 #else
mbed_official 237:f3da66175598 502 /** @defgroup COMPEx_WindowMode COMPEx_WindowMode (Other Product devices)
mbed_official 237:f3da66175598 503 * @{
mbed_official 237:f3da66175598 504 */
mbed_official 237:f3da66175598 505 #define COMP_WINDOWMODE_DISABLED ((uint32_t)0x00000000) /*!< Window mode disabled (not available) */
mbed_official 237:f3da66175598 506
mbed_official 237:f3da66175598 507 #define IS_COMP_WINDOWMODE(WINDOWMODE) ((WINDOWMODE) == (WINDOWMODE)) /*!< Not available: check always true */
mbed_official 237:f3da66175598 508
mbed_official 237:f3da66175598 509 #define COMP_CSR_COMPxWNDWEN_MASK ((uint32_t)0x00000000) /*!< Mask empty: feature not available */
mbed_official 237:f3da66175598 510 /**
mbed_official 237:f3da66175598 511 * @}
mbed_official 237:f3da66175598 512 */
mbed_official 237:f3da66175598 513 #endif /* STM32F302xC || STM32F303xC || STM32F358xx */
mbed_official 237:f3da66175598 514
mbed_official 237:f3da66175598 515 /** @defgroup COMPEx_Mode
mbed_official 237:f3da66175598 516 * @{
mbed_official 237:f3da66175598 517 */
mbed_official 237:f3da66175598 518 #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
mbed_official 237:f3da66175598 519 defined(STM32F373xC) || defined(STM32F378xx)
mbed_official 237:f3da66175598 520
mbed_official 237:f3da66175598 521 /* Please refer to the electrical characteristics in the device datasheet for
mbed_official 237:f3da66175598 522 the power consumption values */
mbed_official 237:f3da66175598 523 #define COMP_MODE_HIGHSPEED ((uint32_t)0x00000000) /*!< High Speed */
mbed_official 237:f3da66175598 524 #define COMP_MODE_MEDIUMSPEED COMP_CSR_COMPxMODE_0 /*!< Medium Speed */
mbed_official 237:f3da66175598 525 #define COMP_MODE_LOWPOWER COMP_CSR_COMPxMODE_1 /*!< Low power mode */
mbed_official 237:f3da66175598 526 #define COMP_MODE_ULTRALOWPOWER COMP_CSR_COMPxMODE /*!< Ultra-low power mode */
mbed_official 237:f3da66175598 527
mbed_official 237:f3da66175598 528 #define IS_COMP_MODE(MODE) (((MODE) == COMP_MODE_HIGHSPEED) || \
mbed_official 237:f3da66175598 529 ((MODE) == COMP_MODE_MEDIUMSPEED) || \
mbed_official 237:f3da66175598 530 ((MODE) == COMP_MODE_LOWPOWER) || \
mbed_official 237:f3da66175598 531 ((MODE) == COMP_MODE_ULTRALOWPOWER))
mbed_official 237:f3da66175598 532
mbed_official 237:f3da66175598 533 #define COMP_CSR_COMPxMODE_MASK COMP_CSR_COMPxMODE /*!< COMP_CSR_COMPxMODE Mask */
mbed_official 237:f3da66175598 534
mbed_official 237:f3da66175598 535 #else
mbed_official 237:f3da66175598 536
mbed_official 237:f3da66175598 537 /*!< Power mode not available */
mbed_official 237:f3da66175598 538 #define IS_COMP_MODE(MODE) ((MODE) == (MODE)) /*!< Not available: check always true */
mbed_official 237:f3da66175598 539
mbed_official 237:f3da66175598 540 #define COMP_CSR_COMPxMODE_MASK ((uint32_t)0x00000000) /*!< Mask empty: feature not available */
mbed_official 237:f3da66175598 541
mbed_official 237:f3da66175598 542 #endif /* STM32F302xC || STM32F303xC || STM32F358xx || */
mbed_official 237:f3da66175598 543 /* STM32F373xC || STM32F378xx */
mbed_official 237:f3da66175598 544 /**
mbed_official 237:f3da66175598 545 * @}
mbed_official 237:f3da66175598 546 */
mbed_official 237:f3da66175598 547
mbed_official 237:f3da66175598 548 /** @defgroup COMPEx_Hysteresis
mbed_official 237:f3da66175598 549 * @{
mbed_official 237:f3da66175598 550 */
mbed_official 237:f3da66175598 551 #if defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
mbed_official 237:f3da66175598 552 defined(STM32F373xC) || defined(STM32F378xx)
mbed_official 237:f3da66175598 553
mbed_official 237:f3da66175598 554 #define COMP_HYSTERESIS_NONE ((uint32_t)0x00000000) /*!< No hysteresis */
mbed_official 237:f3da66175598 555 #define COMP_HYSTERESIS_LOW COMP_CSR_COMPxHYST_0 /*!< Hysteresis level low */
mbed_official 237:f3da66175598 556 #define COMP_HYSTERESIS_MEDIUM COMP_CSR_COMPxHYST_1 /*!< Hysteresis level medium */
mbed_official 237:f3da66175598 557 #define COMP_HYSTERESIS_HIGH COMP_CSR_COMPxHYST /*!< Hysteresis level high */
mbed_official 237:f3da66175598 558
mbed_official 237:f3da66175598 559 #define IS_COMP_HYSTERESIS(HYSTERESIS) (((HYSTERESIS) == COMP_HYSTERESIS_NONE) || \
mbed_official 237:f3da66175598 560 ((HYSTERESIS) == COMP_HYSTERESIS_LOW) || \
mbed_official 237:f3da66175598 561 ((HYSTERESIS) == COMP_HYSTERESIS_MEDIUM) || \
mbed_official 237:f3da66175598 562 ((HYSTERESIS) == COMP_HYSTERESIS_HIGH))
mbed_official 237:f3da66175598 563
mbed_official 237:f3da66175598 564 #define COMP_CSR_COMPxHYST_MASK COMP_CSR_COMPxHYST /*!< COMP_CSR_COMPxHYST Mask */
mbed_official 237:f3da66175598 565
mbed_official 237:f3da66175598 566 #else
mbed_official 237:f3da66175598 567
mbed_official 237:f3da66175598 568 #define COMP_HYSTERESIS_NONE ((uint32_t)0x00000000) /*!< No hysteresis */
mbed_official 237:f3da66175598 569
mbed_official 237:f3da66175598 570 #define IS_COMP_HYSTERESIS(HYSTERESIS) ((HYSTERESIS) == (HYSTERESIS)) /*!< Not available: check always true */
mbed_official 237:f3da66175598 571
mbed_official 237:f3da66175598 572 #define COMP_CSR_COMPxHYST_MASK ((uint32_t)0x00000000) /*!< Mask empty: feature not available */
mbed_official 237:f3da66175598 573
mbed_official 237:f3da66175598 574 #endif /* STM32F302xC || STM32F303xC || STM32F358xx || */
mbed_official 237:f3da66175598 575 /* STM32F373xC || STM32F378xx */
mbed_official 237:f3da66175598 576 /**
mbed_official 237:f3da66175598 577 * @}
mbed_official 237:f3da66175598 578 */
mbed_official 237:f3da66175598 579
mbed_official 237:f3da66175598 580 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \
mbed_official 237:f3da66175598 581 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
mbed_official 237:f3da66175598 582 /** @defgroup COMPEx_BlankingSrce COMPEx_BlankingSrce (STM32F301x8/STM32F302x8/STM32F303x8/STM32F334x8/STM32F318xx/STM32F328xx Product devices)
mbed_official 237:f3da66175598 583 * @{
mbed_official 237:f3da66175598 584 */
mbed_official 237:f3da66175598 585 /* No blanking source can be selected for all comparators */
mbed_official 237:f3da66175598 586 #define COMP_BLANKINGSRCE_NONE ((uint32_t)0x00000000) /*!< No blanking source */
mbed_official 237:f3da66175598 587 /* Blanking source for COMP2 */
mbed_official 237:f3da66175598 588 #define COMP_BLANKINGSRCE_TIM1OC5 COMP_CSR_COMPxBLANKING_0 /*!< TIM1 OC5 selected as blanking source for compartor */
mbed_official 237:f3da66175598 589 #define COMP_BLANKINGSRCE_TIM2OC3 COMP_CSR_COMPxBLANKING_1 /*!< TIM2 OC3 selected as blanking source for compartor */
mbed_official 237:f3da66175598 590 #define COMP_BLANKINGSRCE_TIM3OC3 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM3 OC3 selected as blanking source for compartor */
mbed_official 237:f3da66175598 591 /* Blanking source for COMP4 */
mbed_official 237:f3da66175598 592 #define COMP_BLANKINGSRCE_TIM3OC4 COMP_CSR_COMPxBLANKING_0 /*!< TIM3 OC4 selected as blanking source for compartor */
mbed_official 237:f3da66175598 593 #define COMP_BLANKINGSRCE_TIM15OC1 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM15 OC1 selected as blanking source for compartor */
mbed_official 237:f3da66175598 594 /* Blanking source for COMP6 */
mbed_official 237:f3da66175598 595 #define COMP_BLANKINGSRCE_TIM2OC4 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM2 OC4 selected as blanking source for compartor */
mbed_official 237:f3da66175598 596 #define COMP_BLANKINGSRCE_TIM15OC2 COMP_CSR_COMPxBLANKING_2 /*!< TIM15 OC2 selected as blanking source for compartor */
mbed_official 237:f3da66175598 597 #define IS_COMP_BLANKINGSRCE(SOURCE) (((SOURCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 598 ((SOURCE) == COMP_BLANKINGSRCE_TIM1OC5) || \
mbed_official 237:f3da66175598 599 ((SOURCE) == COMP_BLANKINGSRCE_TIM2OC3) || \
mbed_official 237:f3da66175598 600 ((SOURCE) == COMP_BLANKINGSRCE_TIM3OC3) || \
mbed_official 237:f3da66175598 601 ((SOURCE) == COMP_BLANKINGSRCE_TIM3OC4) || \
mbed_official 237:f3da66175598 602 ((SOURCE) == COMP_BLANKINGSRCE_TIM2OC4) || \
mbed_official 237:f3da66175598 603 ((SOURCE) == COMP_BLANKINGSRCE_TIM15OC1) || \
mbed_official 237:f3da66175598 604 ((SOURCE) == COMP_BLANKINGSRCE_TIM15OC2))
mbed_official 237:f3da66175598 605
mbed_official 237:f3da66175598 606 /* STM32F301x6/x8, STM32F302x6/x8, STM32F303x6/x8, STM32F334x4/6/8, STM32F318xx/STM32F328xx devices comparator instances blanking source values */
mbed_official 237:f3da66175598 607 #define IS_COMP_BLANKINGSRCE_INSTANCE(INSTANCE, BLANKINGSRCE) \
mbed_official 237:f3da66175598 608 ((((INSTANCE) == COMP2) && \
mbed_official 237:f3da66175598 609 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 610 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM1OC5) || \
mbed_official 237:f3da66175598 611 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM2OC3) || \
mbed_official 237:f3da66175598 612 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM3OC3))) \
mbed_official 237:f3da66175598 613 || \
mbed_official 237:f3da66175598 614 (((INSTANCE) == COMP4) && \
mbed_official 237:f3da66175598 615 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 616 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM3OC4) || \
mbed_official 237:f3da66175598 617 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM15OC1))) \
mbed_official 237:f3da66175598 618 || \
mbed_official 237:f3da66175598 619 (((INSTANCE) == COMP6) && \
mbed_official 237:f3da66175598 620 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 621 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM2OC4) || \
mbed_official 237:f3da66175598 622 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM15OC2))))
mbed_official 237:f3da66175598 623
mbed_official 237:f3da66175598 624 #define COMP_CSR_COMPxBLANKING_MASK COMP_CSR_COMPxBLANKING /*!< COMP_CSR_COMPxBLANKING mask */
mbed_official 237:f3da66175598 625
mbed_official 237:f3da66175598 626 /**
mbed_official 237:f3da66175598 627 * @}
mbed_official 237:f3da66175598 628 */
mbed_official 237:f3da66175598 629
mbed_official 237:f3da66175598 630 /** @defgroup COMPEx_ExtiLineEvent COMPEx_ExtiLineEvent (STM32F301x8/STM32F302x8/STM32F303x8/STM32F334x8/STM32F318xx/STM32F328xx Product devices)
mbed_official 237:f3da66175598 631 * Elements values convention: XXXXZYYY
mbed_official 237:f3da66175598 632 * - XXXX : Interrupt mask in the register list where Z equal 0x0
mbed_official 237:f3da66175598 633 * - YYY : Interrupt mask in the register list where Z equal 0x1
mbed_official 237:f3da66175598 634 * - Z : register index(4bits)
mbed_official 237:f3da66175598 635 * - 0x0: EMR/IMR/RTSR/FTSR register
mbed_official 237:f3da66175598 636 * - 0x1: EMR2/IMR2/RTSR2/FTSR2 register
mbed_official 237:f3da66175598 637 * @{
mbed_official 237:f3da66175598 638 */
mbed_official 237:f3da66175598 639 #define COMP_EXTI_LINE_MASK ((uint32_t)0xffff0fff) /*!< Mask on possible line values */
mbed_official 237:f3da66175598 640 #define COMP_EXTI_LINE_REG_MASK ((uint32_t)0x00001000) /*!< Mask on possible register values */
mbed_official 237:f3da66175598 641 #define COMP_EXTI_LINE_COMP2_EVENT ((uint32_t)0x00400000) /*!< External interrupt line 22 Connected to COMP2 */
mbed_official 237:f3da66175598 642 #define COMP_EXTI_LINE_COMP4_EVENT ((uint32_t)0x40000000) /*!< External interrupt line 30 Connected to COMP4 */
mbed_official 237:f3da66175598 643 #define COMP_EXTI_LINE_COMP6_EVENT ((uint32_t)0x00001001) /*!< External interrupt line 32 Connected to COMP6 */
mbed_official 237:f3da66175598 644
mbed_official 237:f3da66175598 645 /**
mbed_official 237:f3da66175598 646 * @}
mbed_official 237:f3da66175598 647 */
mbed_official 237:f3da66175598 648 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || */
mbed_official 237:f3da66175598 649 /* STM32F303x8 || STM32F334x8 || STM32F328xx */
mbed_official 237:f3da66175598 650
mbed_official 237:f3da66175598 651 #if defined(STM32F302xC)
mbed_official 237:f3da66175598 652 /** @defgroup COMPEx_BlankingSrce COMPEx_BlankingSrce (STM32F302xC Product devices)
mbed_official 237:f3da66175598 653 * @{
mbed_official 237:f3da66175598 654 */
mbed_official 237:f3da66175598 655 /* No blanking source can be selected for all comparators */
mbed_official 237:f3da66175598 656 #define COMP_BLANKINGSRCE_NONE ((uint32_t)0x00000000) /*!< No blanking source */
mbed_official 237:f3da66175598 657 /* Blanking source common for COMP1 and COMP2 */
mbed_official 237:f3da66175598 658 #define COMP_BLANKINGSRCE_TIM1OC5 COMP_CSR_COMPxBLANKING_0 /*!< TIM1 OC5 selected as blanking source for compartor */
mbed_official 237:f3da66175598 659 /* Blanking source common for COMP1 and COMP2 */
mbed_official 237:f3da66175598 660 #define COMP_BLANKINGSRCE_TIM2OC3 COMP_CSR_COMPxBLANKING_1 /*!< TIM2 OC3 selected as blanking source for compartor */
mbed_official 237:f3da66175598 661 /* Blanking source common for COMP1 and COMP2 */
mbed_official 237:f3da66175598 662 #define COMP_BLANKINGSRCE_TIM3OC3 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM3 OC3 selected as blanking source for compartor */
mbed_official 237:f3da66175598 663 /* Blanking source for COMP4 */
mbed_official 237:f3da66175598 664 #define COMP_BLANKINGSRCE_TIM3OC4 COMP_CSR_COMPxBLANKING_0 /*!< TIM3 OC4 selected as blanking source for compartor */
mbed_official 237:f3da66175598 665 #define COMP_BLANKINGSRCE_TIM15OC1 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM15 OC1 selected as blanking source for compartor */
mbed_official 237:f3da66175598 666 /* Blanking source for COMP6 */
mbed_official 237:f3da66175598 667 #define COMP_BLANKINGSRCE_TIM2OC4 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM2 OC4 selected as blanking source for compartor */
mbed_official 237:f3da66175598 668 #define COMP_BLANKINGSRCE_TIM15OC2 COMP_CSR_COMPxBLANKING_2 /*!< TIM15 OC2 selected as blanking source for compartor */
mbed_official 237:f3da66175598 669
mbed_official 237:f3da66175598 670 #define IS_COMP_BLANKINGSRCE(SOURCE) (((SOURCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 671 ((SOURCE) == COMP_BLANKINGSRCE_TIM1OC5) || \
mbed_official 237:f3da66175598 672 ((SOURCE) == COMP_BLANKINGSRCE_TIM2OC3) || \
mbed_official 237:f3da66175598 673 ((SOURCE) == COMP_BLANKINGSRCE_TIM3OC3) || \
mbed_official 237:f3da66175598 674 ((SOURCE) == COMP_BLANKINGSRCE_TIM3OC4) || \
mbed_official 237:f3da66175598 675 ((SOURCE) == COMP_BLANKINGSRCE_TIM2OC4) || \
mbed_official 237:f3da66175598 676 ((SOURCE) == COMP_BLANKINGSRCE_TIM15OC1) || \
mbed_official 237:f3da66175598 677 ((SOURCE) == COMP_BLANKINGSRCE_TIM15OC2))
mbed_official 237:f3da66175598 678
mbed_official 237:f3da66175598 679 /* STM32F302xB/STM32F302xC devices comparator instances blanking source values */
mbed_official 237:f3da66175598 680 #define IS_COMP_BLANKINGSRCE_INSTANCE(INSTANCE, BLANKINGSRCE) \
mbed_official 237:f3da66175598 681 (((((INSTANCE) == COMP1) || ((INSTANCE) == COMP2)) && \
mbed_official 237:f3da66175598 682 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 683 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM1OC5) || \
mbed_official 237:f3da66175598 684 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM2OC3) || \
mbed_official 237:f3da66175598 685 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM3OC3))) \
mbed_official 237:f3da66175598 686 || \
mbed_official 237:f3da66175598 687 (((INSTANCE) == COMP4) && \
mbed_official 237:f3da66175598 688 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 689 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM3OC4) || \
mbed_official 237:f3da66175598 690 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM15OC1))) \
mbed_official 237:f3da66175598 691 || \
mbed_official 237:f3da66175598 692 (((INSTANCE) == COMP6) && \
mbed_official 237:f3da66175598 693 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 694 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM2OC4) || \
mbed_official 237:f3da66175598 695 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM15OC2))))
mbed_official 237:f3da66175598 696
mbed_official 237:f3da66175598 697 #define COMP_CSR_COMPxBLANKING_MASK COMP_CSR_COMPxBLANKING /*!< COMP_CSR_COMPxBLANKING mask */
mbed_official 237:f3da66175598 698
mbed_official 237:f3da66175598 699 /**
mbed_official 237:f3da66175598 700 * @}
mbed_official 237:f3da66175598 701 */
mbed_official 237:f3da66175598 702
mbed_official 237:f3da66175598 703 /** @defgroup COMPEx_ExtiLineEvent COMPEx_ExtiLineEvent (STM32F302xC Product devices)
mbed_official 237:f3da66175598 704 * Elements values convention: XXXXZYYY
mbed_official 237:f3da66175598 705 * - XXXX : Interrupt mask in the register list where Z equal 0x0
mbed_official 237:f3da66175598 706 * - YYY : Interrupt mask in the register list where Z equal 0x1
mbed_official 237:f3da66175598 707 * - Z : register index(4bits)
mbed_official 237:f3da66175598 708 * - 0x0: EMR/IMR/RTSR/FTSR register
mbed_official 237:f3da66175598 709 * - 0x1: EMR2/IMR2/RTSR2/FTSR2 register
mbed_official 237:f3da66175598 710 * @{
mbed_official 237:f3da66175598 711 */
mbed_official 237:f3da66175598 712 #define COMP_EXTI_LINE_MASK ((uint32_t)0xffff0fff) /*!< Mask on possible line values */
mbed_official 237:f3da66175598 713 #define COMP_EXTI_LINE_REG_MASK ((uint32_t)0x00001000) /*!< Mask on possible register values */
mbed_official 237:f3da66175598 714 #define COMP_EXTI_LINE_COMP1_EVENT ((uint32_t)0x00200000) /*!< External interrupt line 21 Connected to COMP1 */
mbed_official 237:f3da66175598 715 #define COMP_EXTI_LINE_COMP2_EVENT ((uint32_t)0x00400000) /*!< External interrupt line 22 Connected to COMP2 */
mbed_official 237:f3da66175598 716 #define COMP_EXTI_LINE_COMP4_EVENT ((uint32_t)0x40000000) /*!< External interrupt line 30 Connected to COMP4 */
mbed_official 237:f3da66175598 717 #define COMP_EXTI_LINE_COMP6_EVENT ((uint32_t)0x00001001) /*!< External interrupt line 32 Connected to COMP6 */
mbed_official 237:f3da66175598 718
mbed_official 237:f3da66175598 719 /**
mbed_official 237:f3da66175598 720 * @}
mbed_official 237:f3da66175598 721 */
mbed_official 237:f3da66175598 722 #endif /* STM32F302xC */
mbed_official 237:f3da66175598 723
mbed_official 237:f3da66175598 724 #if defined(STM32F303xC) || defined(STM32F358xx)
mbed_official 237:f3da66175598 725 /** @defgroup COMPEx_BlankingSrce COMPEx_BlankingSrce (STM32F303xC/STM32F358xx Product devices)
mbed_official 237:f3da66175598 726 * @{
mbed_official 237:f3da66175598 727 */
mbed_official 237:f3da66175598 728 /* No blanking source can be selected for all comparators */
mbed_official 237:f3da66175598 729 #define COMP_BLANKINGSRCE_NONE ((uint32_t)0x00000000) /*!< No blanking source */
mbed_official 237:f3da66175598 730 /* Blanking source common for COMP1, COMP2, COMP3 and COMP7 */
mbed_official 237:f3da66175598 731 #define COMP_BLANKINGSRCE_TIM1OC5 COMP_CSR_COMPxBLANKING_0 /*!< TIM1 OC5 selected as blanking source for compartor */
mbed_official 237:f3da66175598 732 /* Blanking source common for COMP1 and COMP2 */
mbed_official 237:f3da66175598 733 #define COMP_BLANKINGSRCE_TIM2OC3 COMP_CSR_COMPxBLANKING_1 /*!< TIM2 OC5 selected as blanking source for compartor */
mbed_official 237:f3da66175598 734 /* Blanking source common for COMP1, COMP2 and COMP5 */
mbed_official 237:f3da66175598 735 #define COMP_BLANKINGSRCE_TIM3OC3 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM2 OC3 selected as blanking source for compartor */
mbed_official 237:f3da66175598 736 /* Blanking source common for COMP3 and COMP6 */
mbed_official 237:f3da66175598 737 #define COMP_BLANKINGSRCE_TIM2OC4 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM2 OC4 selected as blanking source for compartor */
mbed_official 237:f3da66175598 738 /* Blanking source common for COMP4, COMP5, COMP6 and COMP7 */
mbed_official 237:f3da66175598 739 #define COMP_BLANKINGSRCE_TIM8OC5 COMP_CSR_COMPxBLANKING_1 /*!< TIM8 OC5 selected as blanking source for compartor */
mbed_official 237:f3da66175598 740 /* Blanking source for COMP4 */
mbed_official 237:f3da66175598 741 #define COMP_BLANKINGSRCE_TIM3OC4 COMP_CSR_COMPxBLANKING_0 /*!< TIM3 OC4 selected as blanking source for compartor */
mbed_official 237:f3da66175598 742 #define COMP_BLANKINGSRCE_TIM15OC1 (COMP_CSR_COMPxBLANKING_0|COMP_CSR_COMPxBLANKING_1) /*!< TIM15 OC1 selected as blanking source for compartor */
mbed_official 237:f3da66175598 743 /* Blanking source common for COMP6 and COMP7 */
mbed_official 237:f3da66175598 744 #define COMP_BLANKINGSRCE_TIM15OC2 COMP_CSR_COMPxBLANKING_2 /*!< TIM15 OC2 selected as blanking source for compartor */
mbed_official 237:f3da66175598 745
mbed_official 237:f3da66175598 746 #define IS_COMP_BLANKINGSRCE(SOURCE) (((SOURCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 747 ((SOURCE) == COMP_BLANKINGSRCE_TIM1OC5) || \
mbed_official 237:f3da66175598 748 ((SOURCE) == COMP_BLANKINGSRCE_TIM2OC3) || \
mbed_official 237:f3da66175598 749 ((SOURCE) == COMP_BLANKINGSRCE_TIM3OC3) || \
mbed_official 237:f3da66175598 750 ((SOURCE) == COMP_BLANKINGSRCE_TIM2OC4) || \
mbed_official 237:f3da66175598 751 ((SOURCE) == COMP_BLANKINGSRCE_TIM8OC5) || \
mbed_official 237:f3da66175598 752 ((SOURCE) == COMP_BLANKINGSRCE_TIM3OC4) || \
mbed_official 237:f3da66175598 753 ((SOURCE) == COMP_BLANKINGSRCE_TIM15OC1) || \
mbed_official 237:f3da66175598 754 ((SOURCE) == COMP_BLANKINGSRCE_TIM15OC2))
mbed_official 237:f3da66175598 755
mbed_official 237:f3da66175598 756 /* STM32F303xB/STM32F303xC/STM32F358xx devices comparator instances blanking source values */
mbed_official 237:f3da66175598 757 #define IS_COMP_BLANKINGSRCE_INSTANCE(INSTANCE, BLANKINGSRCE) \
mbed_official 237:f3da66175598 758 (((((INSTANCE) == COMP1) || ((INSTANCE) == COMP2)) && \
mbed_official 237:f3da66175598 759 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 760 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM1OC5) || \
mbed_official 237:f3da66175598 761 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM2OC3) || \
mbed_official 237:f3da66175598 762 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM3OC3))) \
mbed_official 237:f3da66175598 763 || \
mbed_official 237:f3da66175598 764 (((INSTANCE) == COMP3) && \
mbed_official 237:f3da66175598 765 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 766 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM1OC5) || \
mbed_official 237:f3da66175598 767 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM2OC4))) \
mbed_official 237:f3da66175598 768 || \
mbed_official 237:f3da66175598 769 (((INSTANCE) == COMP4) && \
mbed_official 237:f3da66175598 770 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 771 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM3OC4) || \
mbed_official 237:f3da66175598 772 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM8OC5) || \
mbed_official 237:f3da66175598 773 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM15OC1))) \
mbed_official 237:f3da66175598 774 || \
mbed_official 237:f3da66175598 775 (((INSTANCE) == COMP5) && \
mbed_official 237:f3da66175598 776 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 777 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM8OC5) || \
mbed_official 237:f3da66175598 778 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM3OC3))) \
mbed_official 237:f3da66175598 779 || \
mbed_official 237:f3da66175598 780 (((INSTANCE) == COMP6) && \
mbed_official 237:f3da66175598 781 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 782 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM8OC5) || \
mbed_official 237:f3da66175598 783 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM2OC4) || \
mbed_official 237:f3da66175598 784 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM15OC2))) \
mbed_official 237:f3da66175598 785 || \
mbed_official 237:f3da66175598 786 (((INSTANCE) == COMP7) && \
mbed_official 237:f3da66175598 787 (((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE) || \
mbed_official 237:f3da66175598 788 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM1OC5) || \
mbed_official 237:f3da66175598 789 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM8OC5) || \
mbed_official 237:f3da66175598 790 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_TIM15OC2))))
mbed_official 237:f3da66175598 791
mbed_official 237:f3da66175598 792 #define COMP_CSR_COMPxBLANKING_MASK COMP_CSR_COMPxBLANKING /*!< COMP_CSR_COMPxBLANKING mask */
mbed_official 237:f3da66175598 793
mbed_official 237:f3da66175598 794 /**
mbed_official 237:f3da66175598 795 * @}
mbed_official 237:f3da66175598 796 */
mbed_official 237:f3da66175598 797
mbed_official 237:f3da66175598 798 /** @defgroup COMPEx_ExtiLineEvent COMPEx_ExtiLineEvent (STM32F303xC/STM32F358xx Product devices)
mbed_official 237:f3da66175598 799 * Elements values convention: XXXXZYYY
mbed_official 237:f3da66175598 800 * - XXXX : Interrupt mask in the register list where Z equal 0x0
mbed_official 237:f3da66175598 801 * - YYY : Interrupt mask in the register list where Z equal 0x1
mbed_official 237:f3da66175598 802 * - Z : register index(4bits)
mbed_official 237:f3da66175598 803 * - 0x0: EMR/IMR/RTSR/FTSR register
mbed_official 237:f3da66175598 804 * - 0x1: EMR2/IMR2/RTSR2/FTSR2 register
mbed_official 237:f3da66175598 805 * @{
mbed_official 237:f3da66175598 806 */
mbed_official 237:f3da66175598 807 #define COMP_EXTI_LINE_MASK ((uint32_t)0xffff0fff) /*!< Mask on possible line values */
mbed_official 237:f3da66175598 808 #define COMP_EXTI_LINE_REG_MASK ((uint32_t)0x00001000) /*!< Mask on possible register values */
mbed_official 237:f3da66175598 809 #define COMP_EXTI_LINE_COMP1_EVENT ((uint32_t)0x00200000) /*!< External interrupt line 21 Connected to COMP1 */
mbed_official 237:f3da66175598 810 #define COMP_EXTI_LINE_COMP2_EVENT ((uint32_t)0x00400000) /*!< External interrupt line 22 Connected to COMP2 */
mbed_official 237:f3da66175598 811 #define COMP_EXTI_LINE_COMP3_EVENT ((uint32_t)0x20000000) /*!< External interrupt line 29 Connected to COMP3 */
mbed_official 237:f3da66175598 812 #define COMP_EXTI_LINE_COMP4_EVENT ((uint32_t)0x40000000) /*!< External interrupt line 30 Connected to COMP4 */
mbed_official 237:f3da66175598 813 #define COMP_EXTI_LINE_COMP5_EVENT ((uint32_t)0x80000000) /*!< External interrupt line 31 Connected to COMP5 */
mbed_official 237:f3da66175598 814 #define COMP_EXTI_LINE_COMP6_EVENT ((uint32_t)0x00001001) /*!< External interrupt line 32 Connected to COMP6 */
mbed_official 237:f3da66175598 815 #define COMP_EXTI_LINE_COMP7_EVENT ((uint32_t)0x00001002) /*!< External interrupt line 33 Connected to COMP7 */
mbed_official 237:f3da66175598 816
mbed_official 237:f3da66175598 817 /**
mbed_official 237:f3da66175598 818 * @}
mbed_official 237:f3da66175598 819 */
mbed_official 237:f3da66175598 820 #endif /* STM32F303xC || STM32F358xx */
mbed_official 237:f3da66175598 821
mbed_official 237:f3da66175598 822 #if defined(STM32F373xC) ||defined(STM32F378xx)
mbed_official 237:f3da66175598 823 /** @defgroup COMPEx_BlankingSrce COMPEx_BlankingSrce (STM32F373xC/STM32F378xx Product devices)
mbed_official 237:f3da66175598 824 * @{
mbed_official 237:f3da66175598 825 */
mbed_official 237:f3da66175598 826 /* No blanking source can be selected for all comparators */
mbed_official 237:f3da66175598 827 #define COMP_BLANKINGSRCE_NONE ((uint32_t)0x00000000) /*!< No blanking source */
mbed_official 237:f3da66175598 828
mbed_official 237:f3da66175598 829 #define IS_COMP_BLANKINGSRCE(SOURCE) ((SOURCE) == (SOURCE)) /*!< Not available: check always true */
mbed_official 237:f3da66175598 830
mbed_official 237:f3da66175598 831 /* STM32F373xB/STM32F373xC/STM32F378xx devices comparator instances blanking source values */
mbed_official 237:f3da66175598 832 #define IS_COMP_BLANKINGSRCE_INSTANCE(INSTANCE, BLANKINGSRCE) \
mbed_official 237:f3da66175598 833 ((((INSTANCE) == COMP1) || ((INSTANCE) == COMP2)) && \
mbed_official 237:f3da66175598 834 ((BLANKINGSRCE) == COMP_BLANKINGSRCE_NONE))
mbed_official 237:f3da66175598 835
mbed_official 237:f3da66175598 836 #define COMP_CSR_COMPxBLANKING_MASK ((uint32_t)0x00000000) /*!< Mask empty: feature not available */
mbed_official 237:f3da66175598 837
mbed_official 237:f3da66175598 838 /**
mbed_official 237:f3da66175598 839 * @}
mbed_official 237:f3da66175598 840 */
mbed_official 237:f3da66175598 841
mbed_official 237:f3da66175598 842 /** @defgroup COMPEx_ExtiLineEvent COMPEx_ExtiLineEvent (STM32F373xC/STM32F378xx Product devices)
mbed_official 237:f3da66175598 843 * Elements values convention: XXXX0000
mbed_official 237:f3da66175598 844 * - XXXX : Interrupt mask in the EMR/IMR/RTSR/FTSR register
mbed_official 237:f3da66175598 845 * @{
mbed_official 237:f3da66175598 846 */
mbed_official 237:f3da66175598 847 #define COMP_EXTI_LINE_COMP1_EVENT ((uint32_t)0x00200000) /*!< External interrupt line 21 Connected to COMP1 */
mbed_official 237:f3da66175598 848 #define COMP_EXTI_LINE_COMP2_EVENT ((uint32_t)0x00400000) /*!< External interrupt line 22 Connected to COMP2 */
mbed_official 237:f3da66175598 849
mbed_official 237:f3da66175598 850 /**
mbed_official 237:f3da66175598 851 * @}
mbed_official 237:f3da66175598 852 */
mbed_official 237:f3da66175598 853 #endif /* STM32F373xC || STM32F378xx */
mbed_official 237:f3da66175598 854
mbed_official 237:f3da66175598 855 #if defined(STM32F373xC) || defined(STM32F378xx)
mbed_official 237:f3da66175598 856 /* CSR register reset value */
mbed_official 237:f3da66175598 857 #define COMP_CSR_RESET_VALUE ((uint32_t)0x00000000)
mbed_official 237:f3da66175598 858 #define COMP_CSR_RESET_PARAMETERS_MASK ((uint32_t)0x00003FFF)
mbed_official 237:f3da66175598 859 #define COMP_CSR_UPDATE_PARAMETERS_MASK ((uint32_t)0x00003FFE)
mbed_official 237:f3da66175598 860 /* CSR COMP1/COMP2 shift */
mbed_official 237:f3da66175598 861 #define COMP_CSR_COMP1_SHIFT 0U
mbed_official 237:f3da66175598 862 #define COMP_CSR_COMP2_SHIFT 16U
mbed_official 237:f3da66175598 863 #else
mbed_official 237:f3da66175598 864 /* CSR register reset value */
mbed_official 237:f3da66175598 865 #define COMP_CSR_RESET_VALUE ((uint32_t)0x00000000)
mbed_official 237:f3da66175598 866 #endif /* STM32F373xC || STM32F378xx */
mbed_official 237:f3da66175598 867 /* CSR masks redefinition for internal use */
mbed_official 237:f3da66175598 868 #define COMP_CSR_COMPxINSEL_MASK COMP_CSR_COMPxINSEL /*!< COMP_CSR_COMPxINSEL Mask */
mbed_official 237:f3da66175598 869 #define COMP_CSR_COMPxOUTSEL_MASK COMP_CSR_COMPxOUTSEL /*!< COMP_CSR_COMPxOUTSEL Mask */
mbed_official 237:f3da66175598 870 #define COMP_CSR_COMPxPOL_MASK COMP_CSR_COMPxPOL /*!< COMP_CSR_COMPxPOL Mask */
mbed_official 237:f3da66175598 871
mbed_official 237:f3da66175598 872 /**
mbed_official 237:f3da66175598 873 * @}
mbed_official 237:f3da66175598 874 */
mbed_official 237:f3da66175598 875
mbed_official 237:f3da66175598 876 /* Exported macro ------------------------------------------------------------*/
mbed_official 237:f3da66175598 877 #if defined(STM32F373xC) ||defined(STM32F378xx)
mbed_official 237:f3da66175598 878 /**
mbed_official 237:f3da66175598 879 * @brief Checks whether the specified EXTI line flag is set or not.
mbed_official 237:f3da66175598 880 * @param __FLAG__: specifies the COMP Exti sources to be checked.
mbed_official 237:f3da66175598 881 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 882 * @retval The state of __FLAG__ (SET or RESET).
mbed_official 237:f3da66175598 883 */
mbed_official 237:f3da66175598 884 #define __HAL_COMP_EXTI_GET_FLAG(__FLAG__) (EXTI->PR & (__FLAG__))
mbed_official 237:f3da66175598 885
mbed_official 237:f3da66175598 886 /**
mbed_official 237:f3da66175598 887 * @brief Clear the COMP Exti flags.
mbed_official 237:f3da66175598 888 * @param __FLAG__: specifies the COMP Exti sources to be cleared.
mbed_official 237:f3da66175598 889 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 890 * @retval None.
mbed_official 237:f3da66175598 891 */
mbed_official 237:f3da66175598 892 #define __HAL_COMP_EXTI_CLEAR_FLAG(__FLAG__) (EXTI->PR = (__FLAG__))
mbed_official 237:f3da66175598 893
mbed_official 237:f3da66175598 894 /**
mbed_official 237:f3da66175598 895 * @brief Enable the COMP Exti Line.
mbed_official 237:f3da66175598 896 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
mbed_official 237:f3da66175598 897 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 898 * @retval None.
mbed_official 237:f3da66175598 899 */
mbed_official 237:f3da66175598 900 #define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) (EXTI->IMR |= (__EXTILINE__))
mbed_official 237:f3da66175598 901
mbed_official 237:f3da66175598 902 /**
mbed_official 237:f3da66175598 903 * @brief Disable the COMP Exti Line.
mbed_official 237:f3da66175598 904 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
mbed_official 237:f3da66175598 905 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 906 * @retval None.
mbed_official 237:f3da66175598 907 */
mbed_official 237:f3da66175598 908 #define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) (EXTI->IMR &= ~(__EXTILINE__))
mbed_official 237:f3da66175598 909
mbed_official 237:f3da66175598 910 /**
mbed_official 237:f3da66175598 911 * @brief Enable the Exti Line rising edge trigger.
mbed_official 237:f3da66175598 912 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
mbed_official 237:f3da66175598 913 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 914 * @retval None.
mbed_official 237:f3da66175598 915 */
mbed_official 237:f3da66175598 916 #define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) (EXTI->RTSR |= (__EXTILINE__))
mbed_official 237:f3da66175598 917
mbed_official 237:f3da66175598 918 /**
mbed_official 237:f3da66175598 919 * @brief Disable the Exti Line rising edge trigger.
mbed_official 237:f3da66175598 920 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
mbed_official 237:f3da66175598 921 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 922 * @retval None.
mbed_official 237:f3da66175598 923 */
mbed_official 237:f3da66175598 924 #define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) (EXTI->RTSR &= ~(__EXTILINE__))
mbed_official 237:f3da66175598 925
mbed_official 237:f3da66175598 926 /**
mbed_official 237:f3da66175598 927 * @brief Enable the Exti Line falling edge trigger.
mbed_official 237:f3da66175598 928 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
mbed_official 237:f3da66175598 929 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 930 * @retval None.
mbed_official 237:f3da66175598 931 */
mbed_official 237:f3da66175598 932 #define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) (EXTI->FTSR |= (__EXTILINE__))
mbed_official 237:f3da66175598 933
mbed_official 237:f3da66175598 934 /**
mbed_official 237:f3da66175598 935 * @brief Disable the Exti Line falling edge trigger.
mbed_official 237:f3da66175598 936 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
mbed_official 237:f3da66175598 937 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 938 * @retval None.
mbed_official 237:f3da66175598 939 */
mbed_official 237:f3da66175598 940 #define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) (EXTI->FTSR &= ~(__EXTILINE__))
mbed_official 237:f3da66175598 941
mbed_official 237:f3da66175598 942 /**
mbed_official 237:f3da66175598 943 * @brief Init a comparator instance
mbed_official 237:f3da66175598 944 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 945 * @note The common output selection is checked versus the COMP instance to set the right output configuration
mbed_official 237:f3da66175598 946 * @retval None.
mbed_official 237:f3da66175598 947 */
mbed_official 237:f3da66175598 948 #define COMP_OUTPUT_COMP2_TIM2IC4 ((uint32_t)0x0400) /*!< COMP2 output connected to TIM2 Input Capture 4 */
mbed_official 237:f3da66175598 949 #define COMP_OUTPUT_COMP2_TIM2OCREFCLR ((uint32_t)0x0500) /*!< COMP2 output connected to TIM4 OCREF Clear */
mbed_official 237:f3da66175598 950 #define COMP_OUTPUT_COMP2_TIM3IC1 ((uint32_t)0x0600) /*!< COMP2 output connected to TIM3 Input Capture 1 */
mbed_official 237:f3da66175598 951 #define COMP_OUTPUT_COMP2_TIM3OCREFCLR ((uint32_t)0x0700) /*!< COMP2 output connected to TIM3 OCREF Clear */
mbed_official 237:f3da66175598 952
mbed_official 237:f3da66175598 953 #define COMP_INIT(__HANDLE__) \
mbed_official 237:f3da66175598 954 do { \
mbed_official 237:f3da66175598 955 uint32_t regshift = COMP_CSR_COMP1_SHIFT; \
mbed_official 237:f3da66175598 956 uint32_t compoutput = (__HANDLE__)->Init.Output; \
mbed_official 237:f3da66175598 957 \
mbed_official 237:f3da66175598 958 if((__HANDLE__)->Instance == COMP2) \
mbed_official 237:f3da66175598 959 { \
mbed_official 237:f3da66175598 960 regshift = COMP_CSR_COMP2_SHIFT; \
mbed_official 237:f3da66175598 961 switch((__HANDLE__)->Init.Output) \
mbed_official 237:f3da66175598 962 { \
mbed_official 237:f3da66175598 963 case COMP_OUTPUT_TIM2IC4: \
mbed_official 237:f3da66175598 964 compoutput = COMP_OUTPUT_COMP2_TIM2IC4; \
mbed_official 237:f3da66175598 965 break; \
mbed_official 237:f3da66175598 966 case COMP_OUTPUT_TIM2OCREFCLR: \
mbed_official 237:f3da66175598 967 compoutput = COMP_OUTPUT_COMP2_TIM2OCREFCLR; \
mbed_official 237:f3da66175598 968 break; \
mbed_official 237:f3da66175598 969 case COMP_OUTPUT_TIM3IC1: \
mbed_official 237:f3da66175598 970 compoutput = COMP_OUTPUT_COMP2_TIM3IC1; \
mbed_official 237:f3da66175598 971 break; \
mbed_official 237:f3da66175598 972 case COMP_OUTPUT_TIM3OCREFCLR: \
mbed_official 237:f3da66175598 973 compoutput = COMP_OUTPUT_COMP2_TIM3OCREFCLR; \
mbed_official 237:f3da66175598 974 break; \
mbed_official 237:f3da66175598 975 default: \
mbed_official 237:f3da66175598 976 break; \
mbed_official 237:f3da66175598 977 } \
mbed_official 237:f3da66175598 978 } \
mbed_official 237:f3da66175598 979 \
mbed_official 237:f3da66175598 980 MODIFY_REG(COMP->CSR, \
mbed_official 237:f3da66175598 981 (COMP_CSR_COMPxINSEL | COMP_CSR_COMPxNONINSEL_MASK | \
mbed_official 237:f3da66175598 982 COMP_CSR_COMPxOUTSEL | COMP_CSR_COMPxPOL | \
mbed_official 237:f3da66175598 983 COMP_CSR_COMPxHYST | COMP_CSR_COMPxMODE) << regshift, \
mbed_official 237:f3da66175598 984 ((__HANDLE__)->Init.InvertingInput | \
mbed_official 237:f3da66175598 985 (__HANDLE__)->Init.NonInvertingInput | \
mbed_official 237:f3da66175598 986 compoutput | \
mbed_official 237:f3da66175598 987 (__HANDLE__)->Init.OutputPol | \
mbed_official 237:f3da66175598 988 (__HANDLE__)->Init.Hysteresis | \
mbed_official 237:f3da66175598 989 (__HANDLE__)->Init.Mode) << regshift); \
mbed_official 237:f3da66175598 990 \
mbed_official 237:f3da66175598 991 if((__HANDLE__)->Init.WindowMode != COMP_WINDOWMODE_DISABLED) \
mbed_official 237:f3da66175598 992 { \
mbed_official 237:f3da66175598 993 COMP->CSR |= COMP_CSR_WNDWEN; \
mbed_official 237:f3da66175598 994 } \
mbed_official 237:f3da66175598 995 } while(0)
mbed_official 237:f3da66175598 996
mbed_official 237:f3da66175598 997 /**
mbed_official 237:f3da66175598 998 * @brief DeInit a comparator instance
mbed_official 237:f3da66175598 999 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1000 * @retval None.
mbed_official 237:f3da66175598 1001 */
mbed_official 237:f3da66175598 1002 #define COMP_DEINIT(__HANDLE__) \
mbed_official 237:f3da66175598 1003 do { \
mbed_official 237:f3da66175598 1004 uint32_t regshift = COMP_CSR_COMP1_SHIFT; \
mbed_official 237:f3da66175598 1005 \
mbed_official 237:f3da66175598 1006 if((__HANDLE__)->Instance == COMP2) \
mbed_official 237:f3da66175598 1007 { \
mbed_official 237:f3da66175598 1008 regshift = COMP_CSR_COMP2_SHIFT; \
mbed_official 237:f3da66175598 1009 } \
mbed_official 237:f3da66175598 1010 MODIFY_REG(COMP->CSR, \
mbed_official 237:f3da66175598 1011 COMP_CSR_RESET_PARAMETERS_MASK << regshift, \
mbed_official 237:f3da66175598 1012 COMP_CSR_RESET_VALUE << regshift); \
mbed_official 237:f3da66175598 1013 } while(0)
mbed_official 237:f3da66175598 1014
mbed_official 237:f3da66175598 1015 /**
mbed_official 237:f3da66175598 1016 * @brief Start a comparator instance
mbed_official 237:f3da66175598 1017 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1018 * @retval None.
mbed_official 237:f3da66175598 1019 */
mbed_official 237:f3da66175598 1020 #define COMP_START(__HANDLE__) \
mbed_official 237:f3da66175598 1021 do { \
mbed_official 237:f3da66175598 1022 uint32_t regshift = COMP_CSR_COMP1_SHIFT; \
mbed_official 237:f3da66175598 1023 \
mbed_official 237:f3da66175598 1024 if((__HANDLE__)->Instance == COMP2) \
mbed_official 237:f3da66175598 1025 { \
mbed_official 237:f3da66175598 1026 regshift = COMP_CSR_COMP2_SHIFT; \
mbed_official 237:f3da66175598 1027 } \
mbed_official 237:f3da66175598 1028 SET_BIT(COMP->CSR, (uint32_t)COMP_CSR_COMPxEN << regshift); \
mbed_official 237:f3da66175598 1029 } while(0)
mbed_official 237:f3da66175598 1030
mbed_official 237:f3da66175598 1031 /**
mbed_official 237:f3da66175598 1032 * @brief Stop a comparator instance
mbed_official 237:f3da66175598 1033 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1034 * @retval None.
mbed_official 237:f3da66175598 1035 */
mbed_official 237:f3da66175598 1036 #define COMP_STOP(__HANDLE__) \
mbed_official 237:f3da66175598 1037 do { \
mbed_official 237:f3da66175598 1038 uint32_t regshift = COMP_CSR_COMP1_SHIFT; \
mbed_official 237:f3da66175598 1039 \
mbed_official 237:f3da66175598 1040 if((__HANDLE__)->Instance == COMP2) \
mbed_official 237:f3da66175598 1041 { \
mbed_official 237:f3da66175598 1042 regshift = COMP_CSR_COMP2_SHIFT; \
mbed_official 237:f3da66175598 1043 } \
mbed_official 237:f3da66175598 1044 CLEAR_BIT(COMP->CSR, (uint32_t)COMP_CSR_COMPxEN << regshift); \
mbed_official 237:f3da66175598 1045 } while(0)
mbed_official 237:f3da66175598 1046
mbed_official 237:f3da66175598 1047 /**
mbed_official 237:f3da66175598 1048 * @brief Lock a comparator instance
mbed_official 237:f3da66175598 1049 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1050 * @retval None.
mbed_official 237:f3da66175598 1051 */
mbed_official 237:f3da66175598 1052 #define COMP_LOCK(__HANDLE__) \
mbed_official 237:f3da66175598 1053 do { \
mbed_official 237:f3da66175598 1054 uint32_t regshift = COMP_CSR_COMP1_SHIFT; \
mbed_official 237:f3da66175598 1055 \
mbed_official 237:f3da66175598 1056 if((__HANDLE__)->Instance == COMP2) \
mbed_official 237:f3da66175598 1057 { \
mbed_official 237:f3da66175598 1058 regshift = COMP_CSR_COMP2_SHIFT; \
mbed_official 237:f3da66175598 1059 } \
mbed_official 237:f3da66175598 1060 SET_BIT(COMP->CSR, (uint32_t)COMP_CSR_COMPxLOCK << regshift); \
mbed_official 237:f3da66175598 1061 } while(0)
mbed_official 237:f3da66175598 1062
mbed_official 237:f3da66175598 1063 #else
mbed_official 237:f3da66175598 1064 /**
mbed_official 237:f3da66175598 1065 * @brief Checks whether the specified EXTI line flag is set or not.
mbed_official 237:f3da66175598 1066 * @param __EXTILINE__: specifies the COMP Exti sources to be checked.
mbed_official 237:f3da66175598 1067 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1068 * @retval The state of __FLAG__ (SET or RESET).
mbed_official 237:f3da66175598 1069 */
mbed_official 237:f3da66175598 1070 #define __HAL_COMP_EXTI_GET_FLAG(__EXTILINE__) \
mbed_official 237:f3da66175598 1071 ((((__EXTILINE__) & COMP_EXTI_LINE_REG_MASK) != RESET) ? (EXTI->PR2 & (__EXTILINE__)) : (EXTI->PR & (__EXTILINE__)))
mbed_official 237:f3da66175598 1072
mbed_official 237:f3da66175598 1073 /**
mbed_official 237:f3da66175598 1074 * @brief Clear the COMP Exti flags.
mbed_official 237:f3da66175598 1075 * @param __EXTILINE__: specifies the COMP Exti sources to be cleared.
mbed_official 237:f3da66175598 1076 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1077 * @retval None.
mbed_official 237:f3da66175598 1078 */
mbed_official 237:f3da66175598 1079 #define __HAL_COMP_EXTI_CLEAR_FLAG(__EXTILINE__) \
mbed_official 237:f3da66175598 1080 ((((__EXTILINE__) & COMP_EXTI_LINE_REG_MASK) != RESET) ? (EXTI->PR2 = (__EXTILINE__)) : (EXTI->PR = (__EXTILINE__)))
mbed_official 237:f3da66175598 1081
mbed_official 237:f3da66175598 1082 /**
mbed_official 237:f3da66175598 1083 * @brief Enable the COMP Exti Line.
mbed_official 237:f3da66175598 1084 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
mbed_official 237:f3da66175598 1085 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1086 * @retval None.
mbed_official 237:f3da66175598 1087 */
mbed_official 237:f3da66175598 1088 #define __HAL_COMP_EXTI_ENABLE_IT(__EXTILINE__) \
mbed_official 237:f3da66175598 1089 ((((__EXTILINE__) & COMP_EXTI_LINE_REG_MASK) != RESET) ? (EXTI->IMR2 |= (__EXTILINE__)) : (EXTI->IMR |= (__EXTILINE__)))
mbed_official 237:f3da66175598 1090
mbed_official 237:f3da66175598 1091 /**
mbed_official 237:f3da66175598 1092 * @brief Disable the COMP Exti Line.
mbed_official 237:f3da66175598 1093 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
mbed_official 237:f3da66175598 1094 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1095 * @retval None.
mbed_official 237:f3da66175598 1096 */
mbed_official 237:f3da66175598 1097 #define __HAL_COMP_EXTI_DISABLE_IT(__EXTILINE__) \
mbed_official 237:f3da66175598 1098 ((((__EXTILINE__) & COMP_EXTI_LINE_REG_MASK) != RESET) ? (EXTI->IMR2 &= ~(__EXTILINE__)) : (EXTI->IMR &= ~(__EXTILINE__)))
mbed_official 237:f3da66175598 1099
mbed_official 237:f3da66175598 1100 /**
mbed_official 237:f3da66175598 1101 * @brief Enable the Exti Line rising edge trigger.
mbed_official 237:f3da66175598 1102 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
mbed_official 237:f3da66175598 1103 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1104 * @retval None.
mbed_official 237:f3da66175598 1105 */
mbed_official 237:f3da66175598 1106 #define __HAL_COMP_EXTI_RISING_IT_ENABLE(__EXTILINE__) \
mbed_official 237:f3da66175598 1107 ((((__EXTILINE__) & COMP_EXTI_LINE_REG_MASK) != RESET) ? (EXTI->RTSR2 |= (__EXTILINE__)) : (EXTI->RTSR |= (__EXTILINE__)))
mbed_official 237:f3da66175598 1108
mbed_official 237:f3da66175598 1109 /**
mbed_official 237:f3da66175598 1110 * @brief Disable the Exti Line rising edge trigger.
mbed_official 237:f3da66175598 1111 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
mbed_official 237:f3da66175598 1112 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1113 * @retval None.
mbed_official 237:f3da66175598 1114 */
mbed_official 237:f3da66175598 1115 #define __HAL_COMP_EXTI_RISING_IT_DISABLE(__EXTILINE__) \
mbed_official 237:f3da66175598 1116 ((((__EXTILINE__) & COMP_EXTI_LINE_REG_MASK) != RESET) ? (EXTI->RTSR2 &= ~(__EXTILINE__)) : (EXTI->RTSR &= ~(__EXTILINE__)))
mbed_official 237:f3da66175598 1117
mbed_official 237:f3da66175598 1118 /**
mbed_official 237:f3da66175598 1119 * @brief Enable the Exti Line falling edge trigger.
mbed_official 237:f3da66175598 1120 * @param __EXTILINE__: specifies the COMP Exti sources to be enabled.
mbed_official 237:f3da66175598 1121 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1122 * @retval None.
mbed_official 237:f3da66175598 1123 */
mbed_official 237:f3da66175598 1124 #define __HAL_COMP_EXTI_FALLING_IT_ENABLE(__EXTILINE__) \
mbed_official 237:f3da66175598 1125 ((((__EXTILINE__) & COMP_EXTI_LINE_REG_MASK) != RESET) ? (EXTI->FTSR2 |= (__EXTILINE__)) : (EXTI->FTSR |= (__EXTILINE__)))
mbed_official 237:f3da66175598 1126
mbed_official 237:f3da66175598 1127 /**
mbed_official 237:f3da66175598 1128 * @brief Disable the Exti Line falling edge trigger.
mbed_official 237:f3da66175598 1129 * @param __EXTILINE__: specifies the COMP Exti sources to be disabled.
mbed_official 237:f3da66175598 1130 * This parameter can be a value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1131 * @retval None.
mbed_official 237:f3da66175598 1132 */
mbed_official 237:f3da66175598 1133 #define __HAL_COMP_EXTI_FALLING_IT_DISABLE(__EXTILINE__) \
mbed_official 237:f3da66175598 1134 ((((__EXTILINE__) & COMP_EXTI_LINE_REG_MASK) != RESET) ? (EXTI->FTSR2 &= ~(__EXTILINE__)) : (EXTI->FTSR &= ~(__EXTILINE__)))
mbed_official 237:f3da66175598 1135
mbed_official 237:f3da66175598 1136
mbed_official 237:f3da66175598 1137 /**
mbed_official 237:f3da66175598 1138 * @brief Init a comparator instance
mbed_official 237:f3da66175598 1139 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1140 * @retval None.
mbed_official 237:f3da66175598 1141 */
mbed_official 237:f3da66175598 1142 #define COMP_INIT(__HANDLE__) \
mbed_official 237:f3da66175598 1143 do { \
mbed_official 237:f3da66175598 1144 __IO uint32_t csrreg = 0; \
mbed_official 237:f3da66175598 1145 \
mbed_official 237:f3da66175598 1146 csrreg = READ_REG((__HANDLE__)->Instance->CSR); \
mbed_official 237:f3da66175598 1147 MODIFY_REG(csrreg, COMP_CSR_COMPxINSEL_MASK, (__HANDLE__)->Init.InvertingInput); \
mbed_official 237:f3da66175598 1148 MODIFY_REG(csrreg, COMP_CSR_COMPxNONINSEL_MASK, (__HANDLE__)->Init.NonInvertingInput); \
mbed_official 237:f3da66175598 1149 MODIFY_REG(csrreg, COMP_CSR_COMPxBLANKING_MASK, (__HANDLE__)->Init.BlankingSrce); \
mbed_official 237:f3da66175598 1150 MODIFY_REG(csrreg, COMP_CSR_COMPxOUTSEL_MASK, (__HANDLE__)->Init.Output); \
mbed_official 237:f3da66175598 1151 MODIFY_REG(csrreg, COMP_CSR_COMPxPOL_MASK, (__HANDLE__)->Init.OutputPol); \
mbed_official 237:f3da66175598 1152 MODIFY_REG(csrreg, COMP_CSR_COMPxHYST_MASK, (__HANDLE__)->Init.Hysteresis); \
mbed_official 237:f3da66175598 1153 MODIFY_REG(csrreg, COMP_CSR_COMPxMODE_MASK, (__HANDLE__)->Init.Mode); \
mbed_official 237:f3da66175598 1154 MODIFY_REG(csrreg, COMP_CSR_COMPxWNDWEN_MASK, (__HANDLE__)->Init.WindowMode); \
mbed_official 237:f3da66175598 1155 WRITE_REG((__HANDLE__)->Instance->CSR, csrreg); \
mbed_official 237:f3da66175598 1156 } while(0)
mbed_official 237:f3da66175598 1157
mbed_official 237:f3da66175598 1158 /**
mbed_official 237:f3da66175598 1159 * @brief DeInit a comparator instance
mbed_official 237:f3da66175598 1160 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1161 * @retval None.
mbed_official 237:f3da66175598 1162 */
mbed_official 237:f3da66175598 1163 #define COMP_DEINIT(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->CSR, COMP_CSR_RESET_VALUE)
mbed_official 237:f3da66175598 1164
mbed_official 237:f3da66175598 1165 /**
mbed_official 237:f3da66175598 1166 * @brief Start a comparator instance
mbed_official 237:f3da66175598 1167 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1168 * @retval None.
mbed_official 237:f3da66175598 1169 */
mbed_official 237:f3da66175598 1170 #define COMP_START(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_COMPxEN)
mbed_official 237:f3da66175598 1171
mbed_official 237:f3da66175598 1172 /**
mbed_official 237:f3da66175598 1173 * @brief Stop a comparator instance
mbed_official 237:f3da66175598 1174 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1175 * @retval None.
mbed_official 237:f3da66175598 1176 */
mbed_official 237:f3da66175598 1177 #define COMP_STOP(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_COMPxEN)
mbed_official 237:f3da66175598 1178
mbed_official 237:f3da66175598 1179 /**
mbed_official 237:f3da66175598 1180 * @brief Lock a comparator instance
mbed_official 237:f3da66175598 1181 * @param __HANDLE__: specifies the COMP handle
mbed_official 237:f3da66175598 1182 * @retval None.
mbed_official 237:f3da66175598 1183 */
mbed_official 237:f3da66175598 1184 #define COMP_LOCK(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, COMP_CSR_COMPxLOCK)
mbed_official 237:f3da66175598 1185
mbed_official 237:f3da66175598 1186 #endif /* STM32F373xC || STM32F378xx */
mbed_official 237:f3da66175598 1187
mbed_official 237:f3da66175598 1188 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) || \
mbed_official 237:f3da66175598 1189 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx)
mbed_official 237:f3da66175598 1190 /**
mbed_official 237:f3da66175598 1191 * @brief Get the specified EXTI line for a comparator instance
mbed_official 237:f3da66175598 1192 * @param __INSTANCE__: specifies the COMP instance.
mbed_official 237:f3da66175598 1193 * @retval value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1194 */
mbed_official 237:f3da66175598 1195 #define __HAL_COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP2) ? COMP_EXTI_LINE_COMP2_EVENT : \
mbed_official 237:f3da66175598 1196 ((__INSTANCE__) == COMP4) ? COMP_EXTI_LINE_COMP4_EVENT : \
mbed_official 237:f3da66175598 1197 COMP_EXTI_LINE_COMP6_EVENT)
mbed_official 237:f3da66175598 1198 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx || */
mbed_official 237:f3da66175598 1199 /* STM32F303x8 || STM32F334x8 || STM32F328xx */
mbed_official 237:f3da66175598 1200
mbed_official 237:f3da66175598 1201 #if defined(STM32F302xC)
mbed_official 237:f3da66175598 1202 /**
mbed_official 237:f3da66175598 1203 * @brief Get the specified EXTI line for a comparator instance
mbed_official 237:f3da66175598 1204 * @param __INSTANCE__: specifies the COMP instance.
mbed_official 237:f3da66175598 1205 * @retval value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1206 */
mbed_official 237:f3da66175598 1207 #define __HAL_COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1_EVENT : \
mbed_official 237:f3da66175598 1208 ((__INSTANCE__) == COMP2) ? COMP_EXTI_LINE_COMP2_EVENT : \
mbed_official 237:f3da66175598 1209 ((__INSTANCE__) == COMP4) ? COMP_EXTI_LINE_COMP4_EVENT : \
mbed_official 237:f3da66175598 1210 COMP_EXTI_LINE_COMP6_EVENT)
mbed_official 237:f3da66175598 1211 #endif /* STM32F302xC */
mbed_official 237:f3da66175598 1212
mbed_official 237:f3da66175598 1213 #if defined(STM32F303xC) || defined(STM32F358xx)
mbed_official 237:f3da66175598 1214 /**
mbed_official 237:f3da66175598 1215 * @brief Get the specified EXTI line for a comparator instance
mbed_official 237:f3da66175598 1216 * @param __INSTANCE__: specifies the COMP instance.
mbed_official 237:f3da66175598 1217 * @retval value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1218 */
mbed_official 237:f3da66175598 1219 #define __HAL_COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1_EVENT : \
mbed_official 237:f3da66175598 1220 ((__INSTANCE__) == COMP2) ? COMP_EXTI_LINE_COMP2_EVENT : \
mbed_official 237:f3da66175598 1221 ((__INSTANCE__) == COMP3) ? COMP_EXTI_LINE_COMP3_EVENT : \
mbed_official 237:f3da66175598 1222 ((__INSTANCE__) == COMP4) ? COMP_EXTI_LINE_COMP4_EVENT : \
mbed_official 237:f3da66175598 1223 ((__INSTANCE__) == COMP5) ? COMP_EXTI_LINE_COMP5_EVENT : \
mbed_official 237:f3da66175598 1224 ((__INSTANCE__) == COMP6) ? COMP_EXTI_LINE_COMP6_EVENT : \
mbed_official 237:f3da66175598 1225 COMP_EXTI_LINE_COMP7_EVENT)
mbed_official 237:f3da66175598 1226 #endif /* STM32F303xC || STM32F358xx */
mbed_official 237:f3da66175598 1227
mbed_official 237:f3da66175598 1228 #if defined(STM32F373xC) ||defined(STM32F378xx)
mbed_official 237:f3da66175598 1229 /**
mbed_official 237:f3da66175598 1230 * @brief Get the specified EXTI line for a comparator instance
mbed_official 237:f3da66175598 1231 * @param __INSTANCE__: specifies the COMP instance.
mbed_official 237:f3da66175598 1232 * @retval value of @ref COMPEx_ExtiLineEvent
mbed_official 237:f3da66175598 1233 */
mbed_official 237:f3da66175598 1234 #define __HAL_COMP_GET_EXTI_LINE(__INSTANCE__) (((__INSTANCE__) == COMP1) ? COMP_EXTI_LINE_COMP1_EVENT : \
mbed_official 237:f3da66175598 1235 COMP_EXTI_LINE_COMP2_EVENT)
mbed_official 237:f3da66175598 1236 #endif /* STM32F373xC || STM32F378xx */
mbed_official 237:f3da66175598 1237
mbed_official 237:f3da66175598 1238
mbed_official 237:f3da66175598 1239 /* Exported functions --------------------------------------------------------*/
mbed_official 237:f3da66175598 1240
mbed_official 237:f3da66175598 1241 /* Initialization and de-initialization functions ****************************/
mbed_official 237:f3da66175598 1242 /* IO operation functions *****************************************************/
mbed_official 237:f3da66175598 1243 /* Peripheral Control functions ***********************************************/
mbed_official 237:f3da66175598 1244 /* Peripheral State and Error functions ***************************************/
mbed_official 237:f3da66175598 1245
mbed_official 237:f3da66175598 1246 /**
mbed_official 237:f3da66175598 1247 * @}
mbed_official 237:f3da66175598 1248 */
mbed_official 237:f3da66175598 1249
mbed_official 237:f3da66175598 1250 /**
mbed_official 237:f3da66175598 1251 * @}
mbed_official 237:f3da66175598 1252 */
mbed_official 237:f3da66175598 1253
mbed_official 237:f3da66175598 1254 #ifdef __cplusplus
mbed_official 237:f3da66175598 1255 }
mbed_official 237:f3da66175598 1256 #endif
mbed_official 237:f3da66175598 1257
mbed_official 237:f3da66175598 1258 #endif /* __STM32F3xx_HAL_COMP_EX_H */
mbed_official 237:f3da66175598 1259
mbed_official 237:f3da66175598 1260 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/