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