1 /**
2   ******************************************************************************
3   * @file    stm32l1xx_hal_comp_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of COMP HAL Extension module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2017 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef __STM32L1xx_HAL_COMP_EX_H
21 #define __STM32L1xx_HAL_COMP_EX_H
22 
23 #ifdef __cplusplus
24  extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32l1xx_hal_def.h"
29 
30 /** @addtogroup STM32L1xx_HAL_Driver
31   * @{
32   */
33 
34 /** @defgroup COMPEx COMPEx
35   * @{
36   */
37 
38 /* Exported types ------------------------------------------------------------*/
39 /* Exported constants --------------------------------------------------------*/
40 /** @defgroup COMPEx_Exported_Constants COMPEx Exported Constants
41   * @{
42   */
43 
44 /** @defgroup COMPEx_NonInvertingInput COMPEx NonInvertingInput
45   * @{
46   */
47 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX)
48 /* Non-inverting inputs specific to COMP2 */
49 #define COMP_NONINVERTINGINPUT_PB4      RI_IOSWITCH_GR6_1       /*!< I/O pin PB4 connection to COMP2 non-inverting input */
50 #define COMP_NONINVERTINGINPUT_PB5      RI_IOSWITCH_GR6_2       /*!< I/O pin PB5 connection to COMP2 non-inverting input */
51 #define COMP_NONINVERTINGINPUT_PB6      RI_IOSWITCH_GR6_3       /*!< I/O pin PB6 connection to COMP2 non-inverting input */
52 #define COMP_NONINVERTINGINPUT_PB7      RI_IOSWITCH_GR6_4       /*!< I/O pin PB7 connection to COMP2 non-inverting input */
53 
54 /* Non-inverting inputs specific to COMP1 */
55 #define COMP_NONINVERTINGINPUT_NONE     (0x00000000U)           /*!< In case of window mode: No I/O pin connection to COMP1 non-inverting input. Instead, connection to COMP2 non-inverting input. */
56 #define COMP_NONINVERTINGINPUT_PA0      RI_IOSWITCH_CH0         /*!< I/O pin PA0 connection to COMP1 non-inverting input */
57 #define COMP_NONINVERTINGINPUT_PA1      RI_IOSWITCH_CH1         /*!< I/O pin PA1 connection to COMP1 non-inverting input */
58 #define COMP_NONINVERTINGINPUT_PA2      RI_IOSWITCH_CH2         /*!< I/O pin PA2 connection to COMP1 non-inverting input */
59 #define COMP_NONINVERTINGINPUT_PA3      RI_IOSWITCH_CH3         /*!< I/O pin PA3 connection to COMP1 non-inverting input */
60 #define COMP_NONINVERTINGINPUT_PA4      RI_IOSWITCH_CH4         /*!< I/O pin PA4 connection to COMP1 non-inverting input */
61 #define COMP_NONINVERTINGINPUT_PA5      RI_IOSWITCH_CH5         /*!< I/O pin PA5 connection to COMP1 non-inverting input */
62 #define COMP_NONINVERTINGINPUT_PA6      RI_IOSWITCH_CH6         /*!< I/O pin PA6 connection to COMP1 non-inverting input */
63 #define COMP_NONINVERTINGINPUT_PA7      RI_IOSWITCH_CH7         /*!< I/O pin PA7 connection to COMP1 non-inverting input */
64 #define COMP_NONINVERTINGINPUT_PB0      RI_IOSWITCH_CH8         /*!< I/O pin PB0 connection to COMP1 non-inverting input */
65 #define COMP_NONINVERTINGINPUT_PB1      RI_IOSWITCH_CH9         /*!< I/O pin PB1 connection to COMP1 non-inverting input */
66 #define COMP_NONINVERTINGINPUT_PC0      RI_IOSWITCH_CH10        /*!< I/O pin PC0 connection to COMP1 non-inverting input */
67 #define COMP_NONINVERTINGINPUT_PC1      RI_IOSWITCH_CH11        /*!< I/O pin PC1 connection to COMP1 non-inverting input */
68 #define COMP_NONINVERTINGINPUT_PC2      RI_IOSWITCH_CH12        /*!< I/O pin PC2 connection to COMP1 non-inverting input */
69 #define COMP_NONINVERTINGINPUT_PC3      RI_IOSWITCH_CH13        /*!< I/O pin PC3 connection to COMP1 non-inverting input */
70 #define COMP_NONINVERTINGINPUT_PC4      RI_IOSWITCH_CH14        /*!< I/O pin PC4 connection to COMP1 non-inverting input */
71 #define COMP_NONINVERTINGINPUT_PC5      RI_IOSWITCH_CH15        /*!< I/O pin PC5 connection to COMP1 non-inverting input */
72 #define COMP_NONINVERTINGINPUT_PB12     RI_IOSWITCH_CH18        /*!< I/O pin PB12 connection to COMP1 non-inverting input */
73 #define COMP_NONINVERTINGINPUT_PB13     RI_IOSWITCH_CH19        /*!< I/O pin PB13 connection to COMP1 non-inverting input */
74 #define COMP_NONINVERTINGINPUT_PB14     RI_IOSWITCH_CH20        /*!< I/O pin PB14 connection to COMP1 non-inverting input */
75 #define COMP_NONINVERTINGINPUT_PB15     RI_IOSWITCH_CH21        /*!< I/O pin PB15 connection to COMP1 non-inverting input */
76 #define COMP_NONINVERTINGINPUT_PE7      RI_IOSWITCH_CH22        /*!< I/O pin PE7 connection to COMP1 non-inverting input */
77 #define COMP_NONINVERTINGINPUT_PE8      RI_IOSWITCH_CH23        /*!< I/O pin PE8 connection to COMP1 non-inverting input */
78 #define COMP_NONINVERTINGINPUT_PE9      RI_IOSWITCH_CH24        /*!< I/O pin PE9 connection to COMP1 non-inverting input */
79 #define COMP_NONINVERTINGINPUT_PE10     RI_IOSWITCH_CH25        /*!< I/O pin PE10 connection to COMP1 non-inverting input */
80 #define COMP_NONINVERTINGINPUT_PF6      RI_IOSWITCH_CH27        /*!< I/O pin PF6 connection to COMP1 non-inverting input */
81 #define COMP_NONINVERTINGINPUT_PF7      RI_IOSWITCH_CH28        /*!< I/O pin PF7 connection to COMP1 non-inverting input */
82 #define COMP_NONINVERTINGINPUT_PF8      RI_IOSWITCH_CH29        /*!< I/O pin PF8 connection to COMP1 non-inverting input */
83 #define COMP_NONINVERTINGINPUT_PF9      RI_IOSWITCH_CH30        /*!< I/O pin PF9 connection to COMP1 non-inverting input */
84 #define COMP_NONINVERTINGINPUT_PF10     RI_IOSWITCH_CH31        /*!< I/O pin PF10 connection to COMP1 non-inverting input */
85 
86 #define COMP_NONINVERTINGINPUT_OPAMP1   COMP_NONINVERTINGINPUT_PA3  /*!< OPAMP1 output connection to COMP1 non-inverting input */
87 #define COMP_NONINVERTINGINPUT_OPAMP2   COMP_NONINVERTINGINPUT_PB0  /*!< OPAMP2 output connection to COMP1 non-inverting input */
88 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD)
89 #define COMP_NONINVERTINGINPUT_OPAMP3   COMP_NONINVERTINGINPUT_PC3  /*!< OPAMP3 output connection to COMP1 non-inverting input */
90 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD */
91 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */
92 
93 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
94 /* Non-inverting inputs specific to COMP2 */
95 #define COMP_NONINVERTINGINPUT_PB4      RI_IOSWITCH_GR6_1       /*!< I/O pin PB4 connection to COMP2 non-inverting input */
96 #define COMP_NONINVERTINGINPUT_PB5      RI_IOSWITCH_GR6_2       /*!< I/O pin PB5 connection to COMP2 non-inverting input */
97 #define COMP_NONINVERTINGINPUT_PB6      RI_IOSWITCH_GR6_3       /*!< I/O pin PB6 connection to COMP2 non-inverting input */
98 #define COMP_NONINVERTINGINPUT_PB7      RI_IOSWITCH_GR6_4       /*!< I/O pin PB7 connection to COMP2 non-inverting input */
99 
100 /* Non-inverting inputs specific to COMP1 */
101 #define COMP_NONINVERTINGINPUT_NONE     (0x00000000U)  /*!< In case of window mode: No I/O pin connection to COMP1 non-inverting input. Instead, connection to COMP2 non-inverting input. */
102 #define COMP_NONINVERTINGINPUT_PA0      RI_IOSWITCH_CH0         /*!< I/O pin PA0 connection to COMP1 non-inverting input */
103 #define COMP_NONINVERTINGINPUT_PA1      RI_IOSWITCH_CH1         /*!< I/O pin PA1 connection to COMP1 non-inverting input */
104 #define COMP_NONINVERTINGINPUT_PA2      RI_IOSWITCH_CH2         /*!< I/O pin PA2 connection to COMP1 non-inverting input */
105 #define COMP_NONINVERTINGINPUT_PA3      RI_IOSWITCH_CH3         /*!< I/O pin PA3 connection to COMP1 non-inverting input */
106 #define COMP_NONINVERTINGINPUT_PA4      RI_IOSWITCH_CH4         /*!< I/O pin PA4 connection to COMP1 non-inverting input */
107 #define COMP_NONINVERTINGINPUT_PA5      RI_IOSWITCH_CH5         /*!< I/O pin PA5 connection to COMP1 non-inverting input */
108 #define COMP_NONINVERTINGINPUT_PA6      RI_IOSWITCH_CH5         /*!< I/O pin PA5 connection to COMP1 non-inverting input */
109 #define COMP_NONINVERTINGINPUT_PA7      RI_IOSWITCH_CH7         /*!< I/O pin PA7 connection to COMP1 non-inverting input */
110 #define COMP_NONINVERTINGINPUT_PB0      RI_IOSWITCH_CH8         /*!< I/O pin PB0 connection to COMP1 non-inverting input */
111 #define COMP_NONINVERTINGINPUT_PB1      RI_IOSWITCH_CH9         /*!< I/O pin PB1 connection to COMP1 non-inverting input */
112 #define COMP_NONINVERTINGINPUT_PC0      RI_IOSWITCH_CH10        /*!< I/O pin PC0 connection to COMP1 non-inverting input */
113 #define COMP_NONINVERTINGINPUT_PC1      RI_IOSWITCH_CH11        /*!< I/O pin PC1 connection to COMP1 non-inverting input */
114 #define COMP_NONINVERTINGINPUT_PC2      RI_IOSWITCH_CH12        /*!< I/O pin PC2 connection to COMP1 non-inverting input */
115 #define COMP_NONINVERTINGINPUT_PC3      RI_IOSWITCH_CH13        /*!< I/O pin PC3 connection to COMP1 non-inverting input */
116 #define COMP_NONINVERTINGINPUT_PC4      RI_IOSWITCH_CH14        /*!< I/O pin PC4 connection to COMP1 non-inverting input */
117 #define COMP_NONINVERTINGINPUT_PC5      RI_IOSWITCH_CH15        /*!< I/O pin PC5 connection to COMP1 non-inverting input */
118 #define COMP_NONINVERTINGINPUT_PB12     RI_IOSWITCH_CH18        /*!< I/O pin PB12 connection to COMP1 non-inverting input */
119 #define COMP_NONINVERTINGINPUT_PB13     RI_IOSWITCH_CH19        /*!< I/O pin PB13 connection to COMP1 non-inverting input */
120 #define COMP_NONINVERTINGINPUT_PB14     RI_IOSWITCH_CH20        /*!< I/O pin PB14 connection to COMP1 non-inverting input */
121 #define COMP_NONINVERTINGINPUT_PB15     RI_IOSWITCH_CH21        /*!< I/O pin PB15 connection to COMP1 non-inverting input */
122 #define COMP_NONINVERTINGINPUT_PE7      RI_IOSWITCH_CH22        /*!< I/O pin PE7 connection to COMP1 non-inverting input */
123 #define COMP_NONINVERTINGINPUT_PE8      RI_IOSWITCH_CH23        /*!< I/O pin PE8 connection to COMP1 non-inverting input */
124 #define COMP_NONINVERTINGINPUT_PE9      RI_IOSWITCH_CH24        /*!< I/O pin PE9 connection to COMP1 non-inverting input */
125 #define COMP_NONINVERTINGINPUT_PE10     RI_IOSWITCH_CH25        /*!< I/O pin PE10 connection to COMP1 non-inverting input */
126 
127 #define COMP_NONINVERTINGINPUT_OPAMP1   COMP_NONINVERTINGINPUT_PA3  /*!< OPAMP1 output connection to COMP1 non-inverting input */
128 #define COMP_NONINVERTINGINPUT_OPAMP2   COMP_NONINVERTINGINPUT_PB0  /*!< OPAMP2 output connection to COMP1 non-inverting input */
129 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC */
130 
131 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA)
132 /* Non-inverting inputs specific to COMP2 */
133 #define COMP_NONINVERTINGINPUT_PB4      RI_IOSWITCH_GR6_1       /*!< I/O pin PB4 connection to COMP2 non-inverting input */
134 #define COMP_NONINVERTINGINPUT_PB5      RI_IOSWITCH_GR6_2       /*!< I/O pin PB5 connection to COMP2 non-inverting input */
135 
136 /* Non-inverting inputs specific to COMP1 */
137 #define COMP_NONINVERTINGINPUT_NONE     (0x00000000U)  /*!< In case of window mode: No I/O pin connection to COMP1 non-inverting input. Instead, connection to COMP2 non-inverting input. */
138 #define COMP_NONINVERTINGINPUT_PA0      RI_IOSWITCH_CH0         /*!< I/O pin PA0 connection to COMP1 non-inverting input */
139 #define COMP_NONINVERTINGINPUT_PA1      RI_IOSWITCH_CH1         /*!< I/O pin PA1 connection to COMP1 non-inverting input */
140 #define COMP_NONINVERTINGINPUT_PA2      RI_IOSWITCH_CH2         /*!< I/O pin PA2 connection to COMP1 non-inverting input */
141 #define COMP_NONINVERTINGINPUT_PA3      RI_IOSWITCH_CH3         /*!< I/O pin PA3 connection to COMP1 non-inverting input */
142 #define COMP_NONINVERTINGINPUT_PA4      RI_IOSWITCH_CH4         /*!< I/O pin PA4 connection to COMP1 non-inverting input */
143 #define COMP_NONINVERTINGINPUT_PA5      RI_IOSWITCH_CH5         /*!< I/O pin PA5 connection to COMP1 non-inverting input */
144 #define COMP_NONINVERTINGINPUT_PA6      RI_IOSWITCH_CH5         /*!< I/O pin PA5 connection to COMP1 non-inverting input */
145 #define COMP_NONINVERTINGINPUT_PA7      RI_IOSWITCH_CH7         /*!< I/O pin PA7 connection to COMP1 non-inverting input */
146 #define COMP_NONINVERTINGINPUT_PB0      RI_IOSWITCH_CH8         /*!< I/O pin PB0 connection to COMP1 non-inverting input */
147 #define COMP_NONINVERTINGINPUT_PB1      RI_IOSWITCH_CH9         /*!< I/O pin PB1 connection to COMP1 non-inverting input */
148 #define COMP_NONINVERTINGINPUT_PC0      RI_IOSWITCH_CH10        /*!< I/O pin PC0 connection to COMP1 non-inverting input */
149 #define COMP_NONINVERTINGINPUT_PC1      RI_IOSWITCH_CH11        /*!< I/O pin PC1 connection to COMP1 non-inverting input */
150 #define COMP_NONINVERTINGINPUT_PC2      RI_IOSWITCH_CH12        /*!< I/O pin PC2 connection to COMP1 non-inverting input */
151 #define COMP_NONINVERTINGINPUT_PC3      RI_IOSWITCH_CH13        /*!< I/O pin PC3 connection to COMP1 non-inverting input */
152 #define COMP_NONINVERTINGINPUT_PC4      RI_IOSWITCH_CH14        /*!< I/O pin PC4 connection to COMP1 non-inverting input */
153 #define COMP_NONINVERTINGINPUT_PC5      RI_IOSWITCH_CH15        /*!< I/O pin PC5 connection to COMP1 non-inverting input */
154 #define COMP_NONINVERTINGINPUT_PB12     RI_IOSWITCH_CH18        /*!< I/O pin PB12 connection to COMP1 non-inverting input */
155 #define COMP_NONINVERTINGINPUT_PB13     RI_IOSWITCH_CH19        /*!< I/O pin PB13 connection to COMP1 non-inverting input */
156 #define COMP_NONINVERTINGINPUT_PB14     RI_IOSWITCH_CH20        /*!< I/O pin PB14 connection to COMP1 non-inverting input */
157 #define COMP_NONINVERTINGINPUT_PB15     RI_IOSWITCH_CH21        /*!< I/O pin PB15 connection to COMP1 non-inverting input */
158 #define COMP_NONINVERTINGINPUT_PE7      RI_IOSWITCH_CH22        /*!< I/O pin PE7 connection to COMP1 non-inverting input */
159 #define COMP_NONINVERTINGINPUT_PE8      RI_IOSWITCH_CH23        /*!< I/O pin PE8 connection to COMP1 non-inverting input */
160 #define COMP_NONINVERTINGINPUT_PE9      RI_IOSWITCH_CH24        /*!< I/O pin PE9 connection to COMP1 non-inverting input */
161 #define COMP_NONINVERTINGINPUT_PE10     RI_IOSWITCH_CH25        /*!< I/O pin PE10 connection to COMP1 non-inverting input */
162 
163 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA */
164 
165 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX)
166 #define IS_COMP_NONINVERTINGINPUT(INPUT) (((INPUT) == COMP_NONINVERTINGINPUT_PB4)   || \
167                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB5)   || \
168                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB6)   || \
169                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB7)   || \
170                                           ((INPUT) == COMP_NONINVERTINGINPUT_NONE)  || \
171                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA0)   || \
172                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA1)   || \
173                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA2)   || \
174                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA3)   || \
175                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA4)   || \
176                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA5)   || \
177                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA6)   || \
178                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA7)   || \
179                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB0)   || \
180                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB1)   || \
181                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC0)   || \
182                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC1)   || \
183                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC2)   || \
184                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC3)   || \
185                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC4)   || \
186                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC5)   || \
187                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB12)  || \
188                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB13)  || \
189                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB14)  || \
190                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB15)  || \
191                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE7)   || \
192                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE8)   || \
193                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE9)   || \
194                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE10)  || \
195                                           ((INPUT) == COMP_NONINVERTINGINPUT_PF6)   || \
196                                           ((INPUT) == COMP_NONINVERTINGINPUT_PF7)   || \
197                                           ((INPUT) == COMP_NONINVERTINGINPUT_PF8)   || \
198                                           ((INPUT) == COMP_NONINVERTINGINPUT_PF9)   || \
199                                           ((INPUT) == COMP_NONINVERTINGINPUT_PF10)    )
200 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */
201 
202 #if defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) || defined (STM32L162xC)
203 #define IS_COMP_NONINVERTINGINPUT(INPUT) (((INPUT) == COMP_NONINVERTINGINPUT_PB4)   || \
204                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB5)   || \
205                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB6)   || \
206                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB7)   || \
207                                           ((INPUT) == COMP_NONINVERTINGINPUT_NONE)  || \
208                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA0)   || \
209                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA1)   || \
210                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA2)   || \
211                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA3)   || \
212                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA4)   || \
213                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA5)   || \
214                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA6)   || \
215                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA7)   || \
216                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB0)   || \
217                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB1)   || \
218                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC0)   || \
219                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC1)   || \
220                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC2)   || \
221                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC3)   || \
222                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC4)   || \
223                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC5)   || \
224                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB12)  || \
225                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB13)  || \
226                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB14)  || \
227                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB15)  || \
228                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE7)   || \
229                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE8)   || \
230                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE9)   || \
231                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE10)    )
232 #endif /* STM32L100xC || STM32L151xC || STM32L152xC || STM32L162xC */
233 
234 #if defined(STM32L100xB) || defined (STM32L151xB) || defined (STM32L152xB) || defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA)
235 #define IS_COMP_NONINVERTINGINPUT(INPUT) (((INPUT) == COMP_NONINVERTINGINPUT_PB4)   || \
236                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB5)   || \
237                                           ((INPUT) == COMP_NONINVERTINGINPUT_NONE)  || \
238                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA0)   || \
239                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA1)   || \
240                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA2)   || \
241                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA3)   || \
242                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA4)   || \
243                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA5)   || \
244                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA6)   || \
245                                           ((INPUT) == COMP_NONINVERTINGINPUT_PA7)   || \
246                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB0)   || \
247                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB1)   || \
248                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC0)   || \
249                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC1)   || \
250                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC2)   || \
251                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC3)   || \
252                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC4)   || \
253                                           ((INPUT) == COMP_NONINVERTINGINPUT_PC5)   || \
254                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB12)  || \
255                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB13)  || \
256                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB14)  || \
257                                           ((INPUT) == COMP_NONINVERTINGINPUT_PB15)  || \
258                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE7)   || \
259                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE8)   || \
260                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE9)   || \
261                                           ((INPUT) == COMP_NONINVERTINGINPUT_PE10)    )
262 #endif /* STM32L100xB || STM32L151xB || STM32L152xB || STM32L100xBA || STM32L151xBA || STM32L152xBA */
263 
264 /**
265   * @}
266   */
267 
268 /**
269   * @}
270   */
271 
272 
273 /* Exported macro ------------------------------------------------------------*/
274 
275 /** @defgroup COMPEx_Private_Macro COMP Private Macro
276   * @{
277   */
278 
279 /**
280   * @brief Specifies whether Routing Interface (RI) needs to be configured for
281   * switches of comparator non-inverting input.
282   * @param  __HANDLE__ COMP handle.
283   * @retval None.
284   */
285 #if defined(STM32L151xCA) || defined (STM32L151xD) || defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) || defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) || defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) || defined (STM32L162xDX)
286 #define __COMP_ROUTING_INTERFACE_TOBECONFIGURED(__HANDLE__)                    \
287   (((__HANDLE__)->Init.NonInvertingInput != COMP_NONINVERTINGINPUT_NONE) &&    \
288    (READ_BIT(COMP->CSR, COMP_CSR_SW1) == RESET)                            )
289 #else
290 #define __COMP_ROUTING_INTERFACE_TOBECONFIGURED(__HANDLE__)                    \
291   ((__HANDLE__)->Init.NonInvertingInput != COMP_NONINVERTINGINPUT_NONE)
292 #endif /* STM32L151xCA || STM32L151xD || STM32L152xCA || STM32L152xD || STM32L162xCA || STM32L162xD || STM32L151xE || STM32L151xDX || STM32L152xE || STM32L152xDX || STM32L162xE || STM32L162xDX */
293 
294 /**
295   * @}
296   */
297 
298 
299 
300 /* Exported functions --------------------------------------------------------*/
301 
302 
303 /**
304   * @}
305   */
306 
307 /**
308   * @}
309   */
310 
311 #ifdef __cplusplus
312 }
313 #endif
314 
315 #endif /* __STM32L1xx_HAL_COMP_EX_H */
316 
317