The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
86:04dd9b1680ae
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

Who changed what in which revision?

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