Intel® Quark™ Microcontroller Software Interface  1.4.0
Intel® Quark™ Microcontroller BSP
qm_comparator.h
1 /*
2  * {% copyright %}
3  */
4 
5 #ifndef __QM_COMPARATOR_H__
6 #define __QM_COMPARATOR_H__
7 
8 #include "qm_common.h"
9 #include "qm_soc_regs.h"
10 
11 /**
12  * Analog Comparator.
13  *
14  * @defgroup groupAC Analog Comparator
15  * @{
16  */
17 
18 /**
19  * Analog Comparator configuration type.
20  *
21  * Each bit in the registers controls a single Analog Comparator pin.
22  *
23  * @note There is no way to control comparator interrupts using this
24  * configuration struct: when a comparator is enabled and powered-up, it starts
25  * generating interrupts when proper input conditions are met; however,
26  * comparator interrupts can be masked at interrupt routing level.
27  */
28 typedef struct {
29  uint32_t cmp_en; /**< Comparator enable. */
30  uint32_t reference; /**< Reference voltage, 1b: VREF; 0b: AR_PIN. */
31  uint32_t polarity; /**< 0b: input>ref; 1b: input<ref */
32  uint32_t power; /**< 1b: Normal mode; 0b:Power-down/Shutdown mode */
33 
34  /**
35  * Transfer callback.
36  *
37  * @param[in] data Callback user data.
38  * @param[in] status Comparator interrupt status.
39  */
40  void (*callback)(void *data, uint32_t int_status);
41  void *callback_data; /**< Callback user data. */
43 
44 /**
45  * Set Analog Comparator configuration.
46  *
47  * @param[in] config Analog Comparator configuration. This must not be NULL.
48  *
49  * @return Standard errno return type for QMSI.
50  * @retval 0 on success.
51  * @retval Negative @ref errno for possible error codes.
52  */
53 int qm_ac_set_config(const qm_ac_config_t *const config);
54 
55 /**
56  * @}
57  */
58 
59 #endif /* __QM_COMPARATOR_H__ */
uint32_t power
1b: Normal mode; 0b:Power-down/Shutdown mode
Definition: qm_comparator.h:32
int qm_ac_set_config(const qm_ac_config_t *const config)
Set Analog Comparator configuration.
Definition: qm_comparator.c:36
uint32_t cmp_en
Comparator enable.
Definition: qm_comparator.h:29
uint32_t reference
Reference voltage, 1b: VREF; 0b: AR_PIN.
Definition: qm_comparator.h:30
uint32_t polarity
0b: input>ref; 1b: input<ref
Definition: qm_comparator.h:31
Analog Comparator configuration type.
Definition: qm_comparator.h:28
void * callback_data
Callback user data.
Definition: qm_comparator.h:41