EFM32 Wonder Gecko Software Documentation  efm32wg-doc-4.2.1
em_acmp.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __SILICON_LABS_EM_ACMP_H__
34 #define __SILICON_LABS_EM_ACMP_H__
35 
36 #include "em_device.h"
37 #if defined(ACMP_COUNT) && (ACMP_COUNT > 0)
38 
39 #include <stdint.h>
40 #include <stdbool.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /***************************************************************************/
51 /***************************************************************************/
56 /*******************************************************************************
57  ******************************** ENUMS ************************************
58  ******************************************************************************/
59 
62 typedef enum
63 {
68 #if defined(_ACMP_INPUTSEL_CSRESSEL_RES4)
69  acmpResistor4 = _ACMP_INPUTSEL_CSRESSEL_RES4,
70  acmpResistor5 = _ACMP_INPUTSEL_CSRESSEL_RES5,
71  acmpResistor6 = _ACMP_INPUTSEL_CSRESSEL_RES6,
72  acmpResistor7 = _ACMP_INPUTSEL_CSRESSEL_RES7,
73 #endif
75 
78 typedef enum
79 {
80 #if defined(_ACMP_CTRL_HYSTSEL_MASK)
89 #endif
90 #if defined(_ACMP_HYSTERESIS0_HYST_MASK)
91  acmpHysteresisLevel0 = _ACMP_HYSTERESIS0_HYST_HYST0,
92  acmpHysteresisLevel1 = _ACMP_HYSTERESIS0_HYST_HYST1,
93  acmpHysteresisLevel2 = _ACMP_HYSTERESIS0_HYST_HYST2,
94  acmpHysteresisLevel3 = _ACMP_HYSTERESIS0_HYST_HYST3,
95  acmpHysteresisLevel4 = _ACMP_HYSTERESIS0_HYST_HYST4,
96  acmpHysteresisLevel5 = _ACMP_HYSTERESIS0_HYST_HYST5,
97  acmpHysteresisLevel6 = _ACMP_HYSTERESIS0_HYST_HYST6,
98  acmpHysteresisLevel7 = _ACMP_HYSTERESIS0_HYST_HYST7,
99  acmpHysteresisLevel8 = _ACMP_HYSTERESIS0_HYST_HYST8,
100  acmpHysteresisLevel9 = _ACMP_HYSTERESIS0_HYST_HYST9,
101  acmpHysteresisLevel10 = _ACMP_HYSTERESIS0_HYST_HYST10,
102  acmpHysteresisLevel11 = _ACMP_HYSTERESIS0_HYST_HYST11,
103  acmpHysteresisLevel12 = _ACMP_HYSTERESIS0_HYST_HYST12,
104  acmpHysteresisLevel13 = _ACMP_HYSTERESIS0_HYST_HYST13,
105  acmpHysteresisLevel14 = _ACMP_HYSTERESIS0_HYST_HYST14,
106  acmpHysteresisLevel15 = _ACMP_HYSTERESIS0_HYST_HYST15,
107 #endif
109 
110 #if defined(_ACMP_CTRL_WARMTIME_MASK)
111 
113 typedef enum
114 {
132 #endif
133 
134 #if defined(_ACMP_CTRL_INPUTRANGE_MASK)
135 
138 typedef enum
139 {
140  acmpInputRangeFull = _ACMP_CTRL_INPUTRANGE_FULL,
141  acmpInputRangeHigh = _ACMP_CTRL_INPUTRANGE_GTVDDDIV2,
142  acmpInputRangeLow = _ACMP_CTRL_INPUTRANGE_LTVDDDIV2
143 } ACMP_InputRange_TypeDef;
144 #endif
145 
146 #if defined(_ACMP_CTRL_PWRSEL_MASK)
147 
150 typedef enum
151 {
152  acmpPowerSourceAvdd = _ACMP_CTRL_PWRSEL_AVDD,
153  acmpPowerSourceVddVreg = _ACMP_CTRL_PWRSEL_VREGVDD,
154  acmpPowerSourceIOVdd0 = _ACMP_CTRL_PWRSEL_IOVDD0,
155  acmpPowerSourceIOVdd1 = _ACMP_CTRL_PWRSEL_IOVDD1,
156 } ACMP_PowerSource_TypeDef;
157 #endif
158 
159 #if defined(_ACMP_CTRL_ACCURACY_MASK)
160 
163 typedef enum
164 {
165  acmpAccuracyLow = _ACMP_CTRL_ACCURACY_LOW,
166  acmpAccuracyHigh = _ACMP_CTRL_ACCURACY_HIGH
167 } ACMP_Accuracy_TypeDef;
168 #endif
169 
170 #if defined(_ACMP_INPUTSEL_VASEL_MASK)
171 
173 typedef enum
174 {
175  acmpVAInputVDD = _ACMP_INPUTSEL_VASEL_VDD,
176  acmpVAInputAPORT2YCH0 = _ACMP_INPUTSEL_VASEL_APORT2YCH0,
177  acmpVAInputAPORT2YCH2 = _ACMP_INPUTSEL_VASEL_APORT2YCH2,
178  acmpVAInputAPORT2YCH4 = _ACMP_INPUTSEL_VASEL_APORT2YCH4,
179  acmpVAInputAPORT2YCH6 = _ACMP_INPUTSEL_VASEL_APORT2YCH6,
180  acmpVAInputAPORT2YCH8 = _ACMP_INPUTSEL_VASEL_APORT2YCH8,
181  acmpVAInputAPORT2YCH10 = _ACMP_INPUTSEL_VASEL_APORT2YCH10,
182  acmpVAInputAPORT2YCH12 = _ACMP_INPUTSEL_VASEL_APORT2YCH12,
183  acmpVAInputAPORT2YCH14 = _ACMP_INPUTSEL_VASEL_APORT2YCH14,
184  acmpVAInputAPORT2YCH16 = _ACMP_INPUTSEL_VASEL_APORT2YCH16,
185  acmpVAInputAPORT2YCH18 = _ACMP_INPUTSEL_VASEL_APORT2YCH18,
186  acmpVAInputAPORT2YCH20 = _ACMP_INPUTSEL_VASEL_APORT2YCH20,
187  acmpVAInputAPORT2YCH22 = _ACMP_INPUTSEL_VASEL_APORT2YCH22,
188  acmpVAInputAPORT2YCH24 = _ACMP_INPUTSEL_VASEL_APORT2YCH24,
189  acmpVAInputAPORT2YCH26 = _ACMP_INPUTSEL_VASEL_APORT2YCH26,
190  acmpVAInputAPORT2YCH28 = _ACMP_INPUTSEL_VASEL_APORT2YCH28,
191  acmpVAInputAPORT2YCH30 = _ACMP_INPUTSEL_VASEL_APORT2YCH30,
192  acmpVAInputAPORT1XCH0 = _ACMP_INPUTSEL_VASEL_APORT1XCH0,
193  acmpVAInputAPORT1YCH1 = _ACMP_INPUTSEL_VASEL_APORT1YCH1,
194  acmpVAInputAPORT1XCH2 = _ACMP_INPUTSEL_VASEL_APORT1XCH2,
195  acmpVAInputAPORT1YCH3 = _ACMP_INPUTSEL_VASEL_APORT1YCH3,
196  acmpVAInputAPORT1XCH4 = _ACMP_INPUTSEL_VASEL_APORT1XCH4,
197  acmpVAInputAPORT1YCH5 = _ACMP_INPUTSEL_VASEL_APORT1YCH5,
198  acmpVAInputAPORT1XCH6 = _ACMP_INPUTSEL_VASEL_APORT1XCH6,
199  acmpVAInputAPORT1YCH7 = _ACMP_INPUTSEL_VASEL_APORT1YCH7,
200  acmpVAInputAPORT1XCH8 = _ACMP_INPUTSEL_VASEL_APORT1XCH8,
201  acmpVAInputAPORT1YCH9 = _ACMP_INPUTSEL_VASEL_APORT1YCH9,
202  acmpVAInputAPORT1XCH10 = _ACMP_INPUTSEL_VASEL_APORT1XCH10,
203  acmpVAInputAPORT1YCH11 = _ACMP_INPUTSEL_VASEL_APORT1YCH11,
204  acmpVAInputAPORT1XCH12 = _ACMP_INPUTSEL_VASEL_APORT1XCH12,
205  acmpVAInputAPORT1YCH13 = _ACMP_INPUTSEL_VASEL_APORT1YCH13,
206  acmpVAInputAPORT1XCH14 = _ACMP_INPUTSEL_VASEL_APORT1XCH14,
207  acmpVAInputAPORT1YCH15 = _ACMP_INPUTSEL_VASEL_APORT1YCH15,
208  acmpVAInputAPORT1XCH16 = _ACMP_INPUTSEL_VASEL_APORT1XCH16,
209  acmpVAInputAPORT1YCH17 = _ACMP_INPUTSEL_VASEL_APORT1YCH17,
210  acmpVAInputAPORT1XCH18 = _ACMP_INPUTSEL_VASEL_APORT1XCH18,
211  acmpVAInputAPORT1YCH19 = _ACMP_INPUTSEL_VASEL_APORT1YCH19,
212  acmpVAInputAPORT1XCH20 = _ACMP_INPUTSEL_VASEL_APORT1XCH20,
213  acmpVAInputAPORT1YCH21 = _ACMP_INPUTSEL_VASEL_APORT1YCH21,
214  acmpVAInputAPORT1XCH22 = _ACMP_INPUTSEL_VASEL_APORT1XCH22,
215  acmpVAInputAPORT1YCH23 = _ACMP_INPUTSEL_VASEL_APORT1YCH23,
216  acmpVAInputAPORT1XCH24 = _ACMP_INPUTSEL_VASEL_APORT1XCH24,
217  acmpVAInputAPORT1YCH25 = _ACMP_INPUTSEL_VASEL_APORT1YCH25,
218  acmpVAInputAPORT1XCH26 = _ACMP_INPUTSEL_VASEL_APORT1XCH26,
219  acmpVAInputAPORT1YCH27 = _ACMP_INPUTSEL_VASEL_APORT1YCH27,
220  acmpVAInputAPORT1XCH28 = _ACMP_INPUTSEL_VASEL_APORT1XCH28,
221  acmpVAInputAPORT1YCH29 = _ACMP_INPUTSEL_VASEL_APORT1YCH29,
222  acmpVAInputAPORT1XCH30 = _ACMP_INPUTSEL_VASEL_APORT1XCH30,
223  acmpVAInputAPORT1YCH31 = _ACMP_INPUTSEL_VASEL_APORT1YCH31
224 } ACMP_VAInput_TypeDef;
225 #endif
226 
227 #if defined(_ACMP_INPUTSEL_VBSEL_MASK)
228 
232 typedef enum
233 {
234  acmpVBInput1V25 = _ACMP_INPUTSEL_VBSEL_1V25,
235  acmpVBInput2V5 = _ACMP_INPUTSEL_VBSEL_2V5
236 } ACMP_VBInput_TypeDef;
237 #endif
238 
239 #if defined(_ACMP_INPUTSEL_VLPSEL_MASK)
240 
243 typedef enum
244 {
245  acmpVLPInputVADIV = _ACMP_INPUTSEL_VLPSEL_VADIV,
246  acmpVLPInputVBDIV = _ACMP_INPUTSEL_VLPSEL_VBDIV
247 } ACMP_VLPInput_Typedef;
248 #endif
249 
250 #if defined(_SILICON_LABS_32B_PLATFORM_2)
251 
252 typedef enum
253 {
254  acmpInputAPORT0XCH0 = _ACMP_INPUTSEL_POSSEL_APORT0XCH0,
255  acmpInputAPORT0XCH1 = _ACMP_INPUTSEL_POSSEL_APORT0XCH1,
256  acmpInputAPORT0XCH2 = _ACMP_INPUTSEL_POSSEL_APORT0XCH2,
257  acmpInputAPORT0XCH3 = _ACMP_INPUTSEL_POSSEL_APORT0XCH3,
258  acmpInputAPORT0XCH4 = _ACMP_INPUTSEL_POSSEL_APORT0XCH4,
259  acmpInputAPORT0XCH5 = _ACMP_INPUTSEL_POSSEL_APORT0XCH5,
260  acmpInputAPORT0XCH6 = _ACMP_INPUTSEL_POSSEL_APORT0XCH6,
261  acmpInputAPORT0XCH7 = _ACMP_INPUTSEL_POSSEL_APORT0XCH7,
262  acmpInputAPORT0XCH8 = _ACMP_INPUTSEL_POSSEL_APORT0XCH8,
263  acmpInputAPORT0XCH9 = _ACMP_INPUTSEL_POSSEL_APORT0XCH9,
264  acmpInputAPORT0XCH10 = _ACMP_INPUTSEL_POSSEL_APORT0XCH10,
265  acmpInputAPORT0XCH11 = _ACMP_INPUTSEL_POSSEL_APORT0XCH11,
266  acmpInputAPORT0XCH12 = _ACMP_INPUTSEL_POSSEL_APORT0XCH12,
267  acmpInputAPORT0XCH13 = _ACMP_INPUTSEL_POSSEL_APORT0XCH13,
268  acmpInputAPORT0XCH14 = _ACMP_INPUTSEL_POSSEL_APORT0XCH14,
269  acmpInputAPORT0XCH15 = _ACMP_INPUTSEL_POSSEL_APORT0XCH15,
270  acmpInputAPORT0YCH0 = _ACMP_INPUTSEL_POSSEL_APORT0YCH0,
271  acmpInputAPORT0YCH1 = _ACMP_INPUTSEL_POSSEL_APORT0YCH1,
272  acmpInputAPORT0YCH2 = _ACMP_INPUTSEL_POSSEL_APORT0YCH2,
273  acmpInputAPORT0YCH3 = _ACMP_INPUTSEL_POSSEL_APORT0YCH3,
274  acmpInputAPORT0YCH4 = _ACMP_INPUTSEL_POSSEL_APORT0YCH4,
275  acmpInputAPORT0YCH5 = _ACMP_INPUTSEL_POSSEL_APORT0YCH5,
276  acmpInputAPORT0YCH6 = _ACMP_INPUTSEL_POSSEL_APORT0YCH6,
277  acmpInputAPORT0YCH7 = _ACMP_INPUTSEL_POSSEL_APORT0YCH7,
278  acmpInputAPORT0YCH8 = _ACMP_INPUTSEL_POSSEL_APORT0YCH8,
279  acmpInputAPORT0YCH9 = _ACMP_INPUTSEL_POSSEL_APORT0YCH9,
280  acmpInputAPORT0YCH10 = _ACMP_INPUTSEL_POSSEL_APORT0YCH10,
281  acmpInputAPORT0YCH11 = _ACMP_INPUTSEL_POSSEL_APORT0YCH11,
282  acmpInputAPORT0YCH12 = _ACMP_INPUTSEL_POSSEL_APORT0YCH12,
283  acmpInputAPORT0YCH13 = _ACMP_INPUTSEL_POSSEL_APORT0YCH13,
284  acmpInputAPORT0YCH14 = _ACMP_INPUTSEL_POSSEL_APORT0YCH14,
285  acmpInputAPORT0YCH15 = _ACMP_INPUTSEL_POSSEL_APORT0YCH15,
286  acmpInputAPORT1XCH0 = _ACMP_INPUTSEL_POSSEL_APORT1XCH0,
287  acmpInputAPORT1YCH1 = _ACMP_INPUTSEL_POSSEL_APORT1YCH1,
288  acmpInputAPORT1XCH2 = _ACMP_INPUTSEL_POSSEL_APORT1XCH2,
289  acmpInputAPORT1YCH3 = _ACMP_INPUTSEL_POSSEL_APORT1YCH3,
290  acmpInputAPORT1XCH4 = _ACMP_INPUTSEL_POSSEL_APORT1XCH4,
291  acmpInputAPORT1YCH5 = _ACMP_INPUTSEL_POSSEL_APORT1YCH5,
292  acmpInputAPORT1XCH6 = _ACMP_INPUTSEL_POSSEL_APORT1XCH6,
293  acmpInputAPORT1YCH7 = _ACMP_INPUTSEL_POSSEL_APORT1YCH7,
294  acmpInputAPORT1XCH8 = _ACMP_INPUTSEL_POSSEL_APORT1XCH8,
295  acmpInputAPORT1YCH9 = _ACMP_INPUTSEL_POSSEL_APORT1YCH9,
296  acmpInputAPORT1XCH10 = _ACMP_INPUTSEL_POSSEL_APORT1XCH10,
297  acmpInputAPORT1YCH11 = _ACMP_INPUTSEL_POSSEL_APORT1YCH11,
298  acmpInputAPORT1XCH12 = _ACMP_INPUTSEL_POSSEL_APORT1XCH12,
299  acmpInputAPORT1YCH13 = _ACMP_INPUTSEL_POSSEL_APORT1YCH13,
300  acmpInputAPORT1XCH14 = _ACMP_INPUTSEL_POSSEL_APORT1XCH14,
301  acmpInputAPORT1YCH15 = _ACMP_INPUTSEL_POSSEL_APORT1YCH15,
302  acmpInputAPORT1XCH16 = _ACMP_INPUTSEL_POSSEL_APORT1XCH16,
303  acmpInputAPORT1YCH17 = _ACMP_INPUTSEL_POSSEL_APORT1YCH17,
304  acmpInputAPORT1XCH18 = _ACMP_INPUTSEL_POSSEL_APORT1XCH18,
305  acmpInputAPORT1YCH19 = _ACMP_INPUTSEL_POSSEL_APORT1YCH19,
306  acmpInputAPORT1XCH20 = _ACMP_INPUTSEL_POSSEL_APORT1XCH20,
307  acmpInputAPORT1YCH21 = _ACMP_INPUTSEL_POSSEL_APORT1YCH21,
308  acmpInputAPORT1XCH22 = _ACMP_INPUTSEL_POSSEL_APORT1XCH22,
309  acmpInputAPORT1YCH23 = _ACMP_INPUTSEL_POSSEL_APORT1YCH23,
310  acmpInputAPORT1XCH24 = _ACMP_INPUTSEL_POSSEL_APORT1XCH24,
311  acmpInputAPORT1YCH25 = _ACMP_INPUTSEL_POSSEL_APORT1YCH25,
312  acmpInputAPORT1XCH26 = _ACMP_INPUTSEL_POSSEL_APORT1XCH26,
313  acmpInputAPORT1YCH27 = _ACMP_INPUTSEL_POSSEL_APORT1YCH27,
314  acmpInputAPORT1XCH28 = _ACMP_INPUTSEL_POSSEL_APORT1XCH28,
315  acmpInputAPORT1YCH29 = _ACMP_INPUTSEL_POSSEL_APORT1YCH29,
316  acmpInputAPORT1XCH30 = _ACMP_INPUTSEL_POSSEL_APORT1XCH30,
317  acmpInputAPORT1YCH31 = _ACMP_INPUTSEL_POSSEL_APORT1YCH31,
318  acmpInputAPORT2YCH0 = _ACMP_INPUTSEL_POSSEL_APORT2YCH0,
319  acmpInputAPORT2XCH1 = _ACMP_INPUTSEL_POSSEL_APORT2XCH1,
320  acmpInputAPORT2YCH2 = _ACMP_INPUTSEL_POSSEL_APORT2YCH2,
321  acmpInputAPORT2XCH3 = _ACMP_INPUTSEL_POSSEL_APORT2XCH3,
322  acmpInputAPORT2YCH4 = _ACMP_INPUTSEL_POSSEL_APORT2YCH4,
323  acmpInputAPORT2XCH5 = _ACMP_INPUTSEL_POSSEL_APORT2XCH5,
324  acmpInputAPORT2YCH6 = _ACMP_INPUTSEL_POSSEL_APORT2YCH6,
325  acmpInputAPORT2XCH7 = _ACMP_INPUTSEL_POSSEL_APORT2XCH7,
326  acmpInputAPORT2YCH8 = _ACMP_INPUTSEL_POSSEL_APORT2YCH8,
327  acmpInputAPORT2XCH9 = _ACMP_INPUTSEL_POSSEL_APORT2XCH9,
328  acmpInputAPORT2YCH10 = _ACMP_INPUTSEL_POSSEL_APORT2YCH10,
329  acmpInputAPORT2XCH11 = _ACMP_INPUTSEL_POSSEL_APORT2XCH11,
330  acmpInputAPORT2YCH12 = _ACMP_INPUTSEL_POSSEL_APORT2YCH12,
331  acmpInputAPORT2XCH13 = _ACMP_INPUTSEL_POSSEL_APORT2XCH13,
332  acmpInputAPORT2YCH14 = _ACMP_INPUTSEL_POSSEL_APORT2YCH14,
333  acmpInputAPORT2XCH15 = _ACMP_INPUTSEL_POSSEL_APORT2XCH15,
334  acmpInputAPORT2YCH16 = _ACMP_INPUTSEL_POSSEL_APORT2YCH16,
335  acmpInputAPORT2XCH17 = _ACMP_INPUTSEL_POSSEL_APORT2XCH17,
336  acmpInputAPORT2YCH18 = _ACMP_INPUTSEL_POSSEL_APORT2YCH18,
337  acmpInputAPORT2XCH19 = _ACMP_INPUTSEL_POSSEL_APORT2XCH19,
338  acmpInputAPORT2YCH20 = _ACMP_INPUTSEL_POSSEL_APORT2YCH20,
339  acmpInputAPORT2XCH21 = _ACMP_INPUTSEL_POSSEL_APORT2XCH21,
340  acmpInputAPORT2YCH22 = _ACMP_INPUTSEL_POSSEL_APORT2YCH22,
341  acmpInputAPORT2XCH23 = _ACMP_INPUTSEL_POSSEL_APORT2XCH23,
342  acmpInputAPORT2YCH24 = _ACMP_INPUTSEL_POSSEL_APORT2YCH24,
343  acmpInputAPORT2XCH25 = _ACMP_INPUTSEL_POSSEL_APORT2XCH25,
344  acmpInputAPORT2YCH26 = _ACMP_INPUTSEL_POSSEL_APORT2YCH26,
345  acmpInputAPORT2XCH27 = _ACMP_INPUTSEL_POSSEL_APORT2XCH27,
346  acmpInputAPORT2YCH28 = _ACMP_INPUTSEL_POSSEL_APORT2YCH28,
347  acmpInputAPORT2XCH29 = _ACMP_INPUTSEL_POSSEL_APORT2XCH29,
348  acmpInputAPORT2YCH30 = _ACMP_INPUTSEL_POSSEL_APORT2YCH30,
349  acmpInputAPORT2XCH31 = _ACMP_INPUTSEL_POSSEL_APORT2XCH31,
350  acmpInputAPORT3XCH0 = _ACMP_INPUTSEL_POSSEL_APORT3XCH0,
351  acmpInputAPORT3YCH1 = _ACMP_INPUTSEL_POSSEL_APORT3YCH1,
352  acmpInputAPORT3XCH2 = _ACMP_INPUTSEL_POSSEL_APORT3XCH2,
353  acmpInputAPORT3YCH3 = _ACMP_INPUTSEL_POSSEL_APORT3YCH3,
354  acmpInputAPORT3XCH4 = _ACMP_INPUTSEL_POSSEL_APORT3XCH4,
355  acmpInputAPORT3YCH5 = _ACMP_INPUTSEL_POSSEL_APORT3YCH5,
356  acmpInputAPORT3XCH6 = _ACMP_INPUTSEL_POSSEL_APORT3XCH6,
357  acmpInputAPORT3YCH7 = _ACMP_INPUTSEL_POSSEL_APORT3YCH7,
358  acmpInputAPORT3XCH8 = _ACMP_INPUTSEL_POSSEL_APORT3XCH8,
359  acmpInputAPORT3YCH9 = _ACMP_INPUTSEL_POSSEL_APORT3YCH9,
360  acmpInputAPORT3XCH10 = _ACMP_INPUTSEL_POSSEL_APORT3XCH10,
361  acmpInputAPORT3YCH11 = _ACMP_INPUTSEL_POSSEL_APORT3YCH11,
362  acmpInputAPORT3XCH12 = _ACMP_INPUTSEL_POSSEL_APORT3XCH12,
363  acmpInputAPORT3YCH13 = _ACMP_INPUTSEL_POSSEL_APORT3YCH13,
364  acmpInputAPORT3XCH14 = _ACMP_INPUTSEL_POSSEL_APORT3XCH14,
365  acmpInputAPORT3YCH15 = _ACMP_INPUTSEL_POSSEL_APORT3YCH15,
366  acmpInputAPORT3XCH16 = _ACMP_INPUTSEL_POSSEL_APORT3XCH16,
367  acmpInputAPORT3YCH17 = _ACMP_INPUTSEL_POSSEL_APORT3YCH17,
368  acmpInputAPORT3XCH18 = _ACMP_INPUTSEL_POSSEL_APORT3XCH18,
369  acmpInputAPORT3YCH19 = _ACMP_INPUTSEL_POSSEL_APORT3YCH19,
370  acmpInputAPORT3XCH20 = _ACMP_INPUTSEL_POSSEL_APORT3XCH20,
371  acmpInputAPORT3YCH21 = _ACMP_INPUTSEL_POSSEL_APORT3YCH21,
372  acmpInputAPORT3XCH22 = _ACMP_INPUTSEL_POSSEL_APORT3XCH22,
373  acmpInputAPORT3YCH23 = _ACMP_INPUTSEL_POSSEL_APORT3YCH23,
374  acmpInputAPORT3XCH24 = _ACMP_INPUTSEL_POSSEL_APORT3XCH24,
375  acmpInputAPORT3YCH25 = _ACMP_INPUTSEL_POSSEL_APORT3YCH25,
376  acmpInputAPORT3XCH26 = _ACMP_INPUTSEL_POSSEL_APORT3XCH26,
377  acmpInputAPORT3YCH27 = _ACMP_INPUTSEL_POSSEL_APORT3YCH27,
378  acmpInputAPORT3XCH28 = _ACMP_INPUTSEL_POSSEL_APORT3XCH28,
379  acmpInputAPORT3YCH29 = _ACMP_INPUTSEL_POSSEL_APORT3YCH29,
380  acmpInputAPORT3XCH30 = _ACMP_INPUTSEL_POSSEL_APORT3XCH30,
381  acmpInputAPORT3YCH31 = _ACMP_INPUTSEL_POSSEL_APORT3YCH31,
382  acmpInputAPORT4YCH0 = _ACMP_INPUTSEL_POSSEL_APORT4YCH0,
383  acmpInputAPORT4XCH1 = _ACMP_INPUTSEL_POSSEL_APORT4XCH1,
384  acmpInputAPORT4YCH2 = _ACMP_INPUTSEL_POSSEL_APORT4YCH2,
385  acmpInputAPORT4XCH3 = _ACMP_INPUTSEL_POSSEL_APORT4XCH3,
386  acmpInputAPORT4YCH4 = _ACMP_INPUTSEL_POSSEL_APORT4YCH4,
387  acmpInputAPORT4XCH5 = _ACMP_INPUTSEL_POSSEL_APORT4XCH5,
388  acmpInputAPORT4YCH6 = _ACMP_INPUTSEL_POSSEL_APORT4YCH6,
389  acmpInputAPORT4XCH7 = _ACMP_INPUTSEL_POSSEL_APORT4XCH7,
390  acmpInputAPORT4YCH8 = _ACMP_INPUTSEL_POSSEL_APORT4YCH8,
391  acmpInputAPORT4XCH9 = _ACMP_INPUTSEL_POSSEL_APORT4XCH9,
392  acmpInputAPORT4YCH10 = _ACMP_INPUTSEL_POSSEL_APORT4YCH10,
393  acmpInputAPORT4XCH11 = _ACMP_INPUTSEL_POSSEL_APORT4XCH11,
394  acmpInputAPORT4YCH12 = _ACMP_INPUTSEL_POSSEL_APORT4YCH12,
395  acmpInputAPORT4XCH13 = _ACMP_INPUTSEL_POSSEL_APORT4XCH13,
396  acmpInputAPORT4YCH16 = _ACMP_INPUTSEL_POSSEL_APORT4YCH16,
397  acmpInputAPORT4XCH17 = _ACMP_INPUTSEL_POSSEL_APORT4XCH17,
398  acmpInputAPORT4YCH18 = _ACMP_INPUTSEL_POSSEL_APORT4YCH18,
399  acmpInputAPORT4XCH19 = _ACMP_INPUTSEL_POSSEL_APORT4XCH19,
400  acmpInputAPORT4YCH20 = _ACMP_INPUTSEL_POSSEL_APORT4YCH20,
401  acmpInputAPORT4XCH21 = _ACMP_INPUTSEL_POSSEL_APORT4XCH21,
402  acmpInputAPORT4YCH22 = _ACMP_INPUTSEL_POSSEL_APORT4YCH22,
403  acmpInputAPORT4XCH23 = _ACMP_INPUTSEL_POSSEL_APORT4XCH23,
404  acmpInputAPORT4YCH24 = _ACMP_INPUTSEL_POSSEL_APORT4YCH24,
405  acmpInputAPORT4XCH25 = _ACMP_INPUTSEL_POSSEL_APORT4XCH25,
406  acmpInputAPORT4YCH26 = _ACMP_INPUTSEL_POSSEL_APORT4YCH26,
407  acmpInputAPORT4XCH27 = _ACMP_INPUTSEL_POSSEL_APORT4XCH27,
408  acmpInputAPORT4YCH28 = _ACMP_INPUTSEL_POSSEL_APORT4YCH28,
409  acmpInputAPORT4XCH29 = _ACMP_INPUTSEL_POSSEL_APORT4XCH29,
410  acmpInputAPORT4YCH30 = _ACMP_INPUTSEL_POSSEL_APORT4YCH30,
411  acmpInputAPORT4YCH14 = _ACMP_INPUTSEL_POSSEL_APORT4YCH14,
412  acmpInputAPORT4XCH15 = _ACMP_INPUTSEL_POSSEL_APORT4XCH15,
413  acmpInputAPORT4XCH31 = _ACMP_INPUTSEL_POSSEL_APORT4XCH31,
414  acmpInputDACOUT0 = _ACMP_INPUTSEL_POSSEL_DACOUT0,
415  acmpInputDACOUT1 = _ACMP_INPUTSEL_POSSEL_DACOUT1,
416  acmpInputVLP = _ACMP_INPUTSEL_POSSEL_VLP,
417  acmpInputVBDIV = _ACMP_INPUTSEL_POSSEL_VBDIV,
418  acmpInputVADIV = _ACMP_INPUTSEL_POSSEL_VADIV,
419  acmpInputVDD = _ACMP_INPUTSEL_POSSEL_VDD,
420  acmpInputVSS = _ACMP_INPUTSEL_POSSEL_VSS,
422 #else
423 
425 typedef enum
426 {
449 
450 #if defined(_ACMP_INPUTSEL_NEGSEL_DAC0CH0)
451 
453 #endif
454 
455 #if defined(_ACMP_INPUTSEL_NEGSEL_DAC0CH1)
456 
458 #endif
459 
460 #if defined(_ACMP_INPUTSEL_NEGSEL_CAPSENSE)
461 
463 #endif
465 #endif
466 
467 /*******************************************************************************
468  ****************************** STRUCTS ************************************
469  ******************************************************************************/
470 
472 typedef struct
473 {
476  bool fullBias;
477 
478 #if defined(_ACMP_CTRL_HALFBIAS_MASK)
479 
481  bool halfBias;
482 #endif
483 
486  uint32_t biasProg;
487 
488 #if defined(_ACMP_CTRL_WARMTIME_MASK)
489 
492 #endif
493 
494 #if defined(_ACMP_CTRL_HYSTSEL_MASK)
495 
497 #else
498 
499  ACMP_HysteresisLevel_TypeDef hysteresisLevel_0;
500 
502  ACMP_HysteresisLevel_TypeDef hysteresisLevel_1;
503 #endif
504 
508 
509 #if defined(_ACMP_INPUTSEL_LPREF_MASK)
510 
513 #endif
514 
515 #if defined(_ACMP_INPUTSEL_VDDLEVEL_MASK)
516 
518  uint32_t vddLevel;
519 #else
520 
527  uint32_t vddLevelHigh;
528 
536  uint32_t vddLevelLow;
537 #endif
538 
540  bool enable;
542 
544 #if defined(_ACMP_HYSTERESIS0_HYST_MASK)
545 #define ACMP_CAPSENSE_INIT_DEFAULT \
546 { \
547  false, /* Don't use fullBias to lower power consumption */ \
548  0x20, /* Using biasProg value of 0x20 (32) */ \
549  acmpHysteresisLevel8, /* Use hysteresis level 8 when ACMP output is 0 */ \
550  acmpHysteresisLevel8, /* Use hysteresis level 8 when ACMP output is 1 */ \
551  acmpResistor5, /* Use internal resistor value 5 */ \
552  0x30, /* VDD level high */ \
553  0x10, /* VDD level low */ \
554  true /* Enable after init. */ \
555 }
556 #elif defined(_ACMP_CTRL_WARMTIME_MASK)
557 #define ACMP_CAPSENSE_INIT_DEFAULT \
558 { \
559  false, /* fullBias */ \
560  false, /* halfBias */ \
561  0x7, /* biasProg */ \
562  acmpWarmTime512, /* 512 cycle warmup to be safe */ \
563  acmpHysteresisLevel5, \
564  acmpResistor3, \
565  false, /* low power reference */ \
566  0x3D, /* VDD level */ \
567  true /* Enable after init. */ \
568 }
569 #else
570 #define ACMP_CAPSENSE_INIT_DEFAULT \
571 { \
572  false, /* fullBias */ \
573  false, /* halfBias */ \
574  0x7, /* biasProg */ \
575  acmpHysteresisLevel5, \
576  acmpResistor3, \
577  false, /* low power reference */ \
578  0x3D, /* VDD level */ \
579  true /* Enable after init. */ \
580 }
581 #endif
582 
584 typedef struct
585 {
588  bool fullBias;
589 
590 #if defined(_ACMP_CTRL_HALFBIAS_MASK)
591 
593  bool halfBias;
594 #endif
595 
598  uint32_t biasProg;
599 
602 
605 
606 #if defined(_ACMP_CTRL_INPUTRANGE_MASK)
607 
609  ACMP_InputRange_TypeDef inputRange;
610 #endif
611 
612 #if defined(_ACMP_CTRL_ACCURACY_MASK)
613 
616  ACMP_Accuracy_TypeDef accuracy;
617 #endif
618 
619 #if defined(_ACMP_CTRL_PWRSEL_MASK)
620 
621  ACMP_PowerSource_TypeDef powerSource;
622 #endif
623 
624 #if defined(_ACMP_CTRL_WARMTIME_MASK)
625 
628 #endif
629 
630 #if defined(_ACMP_CTRL_HYSTSEL_MASK)
631 
633 #else
634 
635  ACMP_HysteresisLevel_TypeDef hysteresisLevel_0;
636 
638  ACMP_HysteresisLevel_TypeDef hysteresisLevel_1;
639 #endif
640 
641 #if defined(_ACMP_INPUTSEL_VLPSEL_MASK)
642 
644  ACMP_VLPInput_Typedef vlpInput;
645 #endif
646 
649 
650 #if defined(_ACMP_INPUTSEL_LPREF_MASK)
651 
654 #endif
655 
656 #if defined(_ACMP_INPUTSEL_VDDLEVEL_MASK)
657 
659  uint32_t vddLevel;
660 #endif
661 
663  bool enable;
665 
667 #if defined(_ACMP_HYSTERESIS0_HYST_MASK)
668 #define ACMP_INIT_DEFAULT \
669 { \
670  false, /* fullBias */ \
671  0x7, /* biasProg */ \
672  false, /* No interrupt on falling edge. */ \
673  false, /* No interrupt on rising edge. */ \
674  acmpInputRangeFull, /* Input range from 0 to Vdd. */ \
675  acmpAccuracyLow, /* Low accuracy, less current usage. */ \
676  acmpPowerSourceAvdd, /* Use the AVDD supply. */ \
677  acmpHysteresisLevel5, /* Use hysteresis level 5 when output is 0 */ \
678  acmpHysteresisLevel5, /* Use hysteresis level 5 when output is 1 */ \
679  acmpVLPInputVADIV, /* Use VADIV as the VLP input source. */ \
680  false, /* Output 0 when ACMP is inactive. */ \
681  true /* Enable after init. */ \
682 }
683 #elif defined(_ACMP_CTRL_WARMTIME_MASK)
684 #define ACMP_INIT_DEFAULT \
685 { \
686  false, /* fullBias */ \
687  false, /* halfBias */ \
688  0x7, /* biasProg */ \
689  false, /* No interrupt on falling edge. */ \
690  false, /* No interrupt on rising edge. */ \
691  acmpWarmTime512, /* 512 cycle warmup to be safe */ \
692  acmpHysteresisLevel5, \
693  false, /* Disabled emitting inactive value during warmup. */ \
694  false, /* low power reference */ \
695  0x3D, /* VDD level */ \
696  true /* Enable after init. */ \
697 }
698 #else
699 #define ACMP_INIT_DEFAULT \
700 { \
701  false, /* fullBias */ \
702  false, /* halfBias */ \
703  0x7, /* biasProg */ \
704  false, /* No interrupt on falling edge. */ \
705  false, /* No interrupt on rising edge. */ \
706  acmpHysteresisLevel5, \
707  false, /* Disabled emitting inactive value during warmup. */ \
708  false, /* low power reference */ \
709  0x3D, /* VDD level */ \
710  true /* Enable after init. */ \
711 }
712 #endif
713 
714 #if defined(_ACMP_INPUTSEL_VASEL_MASK)
715 
717 typedef struct
718 {
719  ACMP_VAInput_TypeDef input;
728  uint32_t div0;
729 
737  uint32_t div1;
738 } ACMP_VAConfig_TypeDef;
739 
740 #define ACMP_VACONFIG_DEFAULT \
741 { \
742  acmpVAInputVDD, /* Use Vdd as VA voltage input source */ \
743  63, /* No division of the VA source when ACMP output is 0 */ \
744  63, /* No division of the VA source when ACMP output is 1 */ \
745 }
746 #endif
747 
748 #if defined(_ACMP_INPUTSEL_VBSEL_MASK)
749 
751 typedef struct
752 {
753  ACMP_VBInput_TypeDef input;
762  uint32_t div0;
763 
771  uint32_t div1;
772 } ACMP_VBConfig_TypeDef;
773 
774 #define ACMP_VBCONFIG_DEFAULT \
775 { \
776  acmpVBInput1V25, /* Use 1.25 V as VB voltage input source */ \
777  63, /* No division of the VB source when ACMP output is 0 */ \
778  63, /* No division of the VB source when ACMP output is 1 */ \
779 }
780 #endif
781 
782 /*******************************************************************************
783  ***************************** PROTOTYPES **********************************
784  ******************************************************************************/
785 
789 void ACMP_Disable(ACMP_TypeDef *acmp);
790 void ACMP_Enable(ACMP_TypeDef *acmp);
791 void ACMP_GPIOSetup(ACMP_TypeDef *acmp, uint32_t location, bool enable, bool invert);
792 void ACMP_Init(ACMP_TypeDef *acmp, const ACMP_Init_TypeDef *init);
793 void ACMP_Reset(ACMP_TypeDef *acmp);
794 #if defined(_ACMP_INPUTSEL_VASEL_MASK)
795 void ACMP_VASetup(ACMP_TypeDef *acmp, const ACMP_VAConfig_TypeDef *vaconfig);
796 #endif
797 #if defined(_ACMP_INPUTSEL_VBSEL_MASK)
798 void ACMP_VBSetup(ACMP_TypeDef *acmp, const ACMP_VBConfig_TypeDef *vbconfig);
799 #endif
800 
801 /***************************************************************************/
812 __STATIC_INLINE void ACMP_IntClear(ACMP_TypeDef *acmp, uint32_t flags)
813 {
814  acmp->IFC = flags;
815 }
816 
817 
818 /***************************************************************************/
829 __STATIC_INLINE void ACMP_IntDisable(ACMP_TypeDef *acmp, uint32_t flags)
830 {
831  acmp->IEN &= ~(flags);
832 }
833 
834 
835 /***************************************************************************/
851 __STATIC_INLINE void ACMP_IntEnable(ACMP_TypeDef *acmp, uint32_t flags)
852 {
853  acmp->IEN |= flags;
854 }
855 
856 
857 /***************************************************************************/
871 __STATIC_INLINE uint32_t ACMP_IntGet(ACMP_TypeDef *acmp)
872 {
873  return acmp->IF;
874 }
875 
876 
877 /***************************************************************************/
896 __STATIC_INLINE uint32_t ACMP_IntGetEnabled(ACMP_TypeDef *acmp)
897 {
898  uint32_t tmp;
899 
900  /* Store ACMPx->IEN in temporary variable in order to define explicit order
901  * of volatile accesses. */
902  tmp = acmp->IEN;
903 
904  /* Bitwise AND of pending and enabled interrupts */
905  return acmp->IF & tmp;
906 }
907 
908 
909 /***************************************************************************/
920 __STATIC_INLINE void ACMP_IntSet(ACMP_TypeDef *acmp, uint32_t flags)
921 {
922  acmp->IFS = flags;
923 }
924 
928 #ifdef __cplusplus
929 }
930 #endif
931 
932 #endif /* defined(ACMP_COUNT) && (ACMP_COUNT > 0) */
933 #endif /* __SILICON_LABS_EM_ACMP_H__ */
__STATIC_INLINE void ACMP_IntClear(ACMP_TypeDef *acmp, uint32_t flags)
Clear one or more pending ACMP interrupts.
Definition: em_acmp.h:812
ACMP_WarmTime_TypeDef
Definition: em_acmp.h:113
ACMP_CapsenseResistor_TypeDef
Definition: em_acmp.h:62
ACMP_CapsenseResistor_TypeDef resistor
Definition: em_acmp.h:507
void ACMP_Disable(ACMP_TypeDef *acmp)
Disables the ACMP.
Definition: em_acmp.c:211
ACMP_HysteresisLevel_TypeDef hysteresisLevel
Definition: em_acmp.h:496
#define _ACMP_INPUTSEL_NEGSEL_CH7
Definition: efm32wg_acmp.h:194
ACMP_Channel_TypeDef
Definition: em_acmp.h:425
__STATIC_INLINE uint32_t ACMP_IntGet(ACMP_TypeDef *acmp)
Get pending ACMP interrupt flags.
Definition: em_acmp.h:871
#define _ACMP_CTRL_HYSTSEL_HYST3
Definition: efm32wg_acmp.h:95
uint32_t biasProg
Definition: em_acmp.h:598
__STATIC_INLINE uint32_t ACMP_IntGetEnabled(ACMP_TypeDef *acmp)
Get enabled and pending ACMP interrupt flags. Useful for handling more interrupt sources in the same ...
Definition: em_acmp.h:896
void ACMP_CapsenseChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef channel)
Sets the ACMP channel used for capacative sensing.
Definition: em_acmp.c:186
__IO uint32_t IEN
Definition: efm32wg_acmp.h:46
bool interruptOnRisingEdge
Definition: em_acmp.h:604
#define _ACMP_CTRL_WARMTIME_16CYCLES
Definition: efm32wg_acmp.h:114
#define _ACMP_CTRL_WARMTIME_512CYCLES
Definition: efm32wg_acmp.h:119
#define _ACMP_CTRL_WARMTIME_32CYCLES
Definition: efm32wg_acmp.h:115
#define _ACMP_INPUTSEL_NEGSEL_VDD
Definition: efm32wg_acmp.h:198
#define _ACMP_INPUTSEL_NEGSEL_1V25
Definition: efm32wg_acmp.h:196
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
#define _ACMP_INPUTSEL_NEGSEL_CH1
Definition: efm32wg_acmp.h:188
__STATIC_INLINE void ACMP_IntSet(ACMP_TypeDef *acmp, uint32_t flags)
Set one or more pending ACMP interrupts from SW.
Definition: em_acmp.h:920
void ACMP_Enable(ACMP_TypeDef *acmp)
Enables the ACMP.
Definition: em_acmp.c:226
#define _ACMP_INPUTSEL_CSRESSEL_RES1
Definition: efm32wg_acmp.h:235
#define _ACMP_CTRL_HYSTSEL_HYST2
Definition: efm32wg_acmp.h:94
#define _ACMP_INPUTSEL_CSRESSEL_RES0
Definition: efm32wg_acmp.h:234
uint32_t vddLevel
Definition: em_acmp.h:659
#define _ACMP_INPUTSEL_NEGSEL_CAPSENSE
Definition: efm32wg_acmp.h:199
bool lowPowerReferenceEnabled
Definition: em_acmp.h:653
ACMP_WarmTime_TypeDef warmTime
Definition: em_acmp.h:491
#define _ACMP_INPUTSEL_NEGSEL_DAC0CH1
Definition: efm32wg_acmp.h:201
#define _ACMP_CTRL_WARMTIME_128CYCLES
Definition: efm32wg_acmp.h:117
#define _ACMP_CTRL_HYSTSEL_HYST5
Definition: efm32wg_acmp.h:97
#define _ACMP_CTRL_WARMTIME_64CYCLES
Definition: efm32wg_acmp.h:116
void ACMP_ChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef negSel, ACMP_Channel_TypeDef posSel)
Sets which channels should be used in ACMP comparisons.
Definition: em_acmp.c:315
__I uint32_t IF
Definition: efm32wg_acmp.h:47
void ACMP_CapsenseInit(ACMP_TypeDef *acmp, const ACMP_CapsenseInit_TypeDef *init)
Sets up the ACMP for use in capacative sense applications.
Definition: em_acmp.c:110
#define _ACMP_INPUTSEL_NEGSEL_CH0
Definition: efm32wg_acmp.h:187
#define _ACMP_CTRL_HYSTSEL_HYST6
Definition: efm32wg_acmp.h:98
#define _ACMP_INPUTSEL_NEGSEL_CH6
Definition: efm32wg_acmp.h:193
void ACMP_Reset(ACMP_TypeDef *acmp)
Reset ACMP to same state as after a HW reset.
Definition: em_acmp.c:245
ACMP_WarmTime_TypeDef warmTime
Definition: em_acmp.h:627
#define _ACMP_CTRL_HYSTSEL_HYST7
Definition: efm32wg_acmp.h:99
__STATIC_INLINE void ACMP_IntEnable(ACMP_TypeDef *acmp, uint32_t flags)
Enable one or more ACMP interrupts.
Definition: em_acmp.h:851
#define _ACMP_CTRL_WARMTIME_4CYCLES
Definition: efm32wg_acmp.h:112
__IO uint32_t IFS
Definition: efm32wg_acmp.h:48
__STATIC_INLINE void ACMP_IntDisable(ACMP_TypeDef *acmp, uint32_t flags)
Disable one or more ACMP interrupts.
Definition: em_acmp.h:829
#define _ACMP_INPUTSEL_NEGSEL_CH3
Definition: efm32wg_acmp.h:190
#define _ACMP_INPUTSEL_NEGSEL_CH4
Definition: efm32wg_acmp.h:191
#define _ACMP_INPUTSEL_NEGSEL_DAC0CH0
Definition: efm32wg_acmp.h:200
bool interruptOnFallingEdge
Definition: em_acmp.h:601
#define _ACMP_INPUTSEL_CSRESSEL_RES2
Definition: efm32wg_acmp.h:236
__IO uint32_t IFC
Definition: efm32wg_acmp.h:49
#define _ACMP_CTRL_HYSTSEL_HYST1
Definition: efm32wg_acmp.h:93
#define _ACMP_CTRL_HYSTSEL_HYST4
Definition: efm32wg_acmp.h:96
#define _ACMP_CTRL_WARMTIME_256CYCLES
Definition: efm32wg_acmp.h:118
void ACMP_Init(ACMP_TypeDef *acmp, const ACMP_Init_TypeDef *init)
Initialize ACMP.
Definition: em_acmp.c:349
#define _ACMP_INPUTSEL_CSRESSEL_RES3
Definition: efm32wg_acmp.h:237
ACMP_HysteresisLevel_TypeDef
Definition: em_acmp.h:78
void ACMP_GPIOSetup(ACMP_TypeDef *acmp, uint32_t location, bool enable, bool invert)
Sets up GPIO output from the ACMP.
Definition: em_acmp.c:280
#define _ACMP_CTRL_WARMTIME_8CYCLES
Definition: efm32wg_acmp.h:113
#define _ACMP_INPUTSEL_NEGSEL_CH5
Definition: efm32wg_acmp.h:192
#define _ACMP_INPUTSEL_NEGSEL_2V5
Definition: efm32wg_acmp.h:197
#define _ACMP_CTRL_HYSTSEL_HYST0
Definition: efm32wg_acmp.h:92
#define _ACMP_INPUTSEL_NEGSEL_CH2
Definition: efm32wg_acmp.h:189
ACMP_HysteresisLevel_TypeDef hysteresisLevel
Definition: em_acmp.h:632
bool inactiveValue
Definition: em_acmp.h:648