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