A simple 128x32 graphical LCD program to quickstart with LCD on ARM mbed IoT Starter Kit. This requires mbed Applciation Shield with FRDM-K64F platform.

Dependencies:   C12832

Committer:
tushki7
Date:
Sun Apr 12 15:45:52 2015 +0000
Revision:
1:eb68c94a8ee5
Parent:
0:60d829a0353a
A simple 128x32 LCD program with ARM mbed IoT Starter Kit;

Who changed what in which revision?

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