LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
acmp_11xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC11xx analog comparator driver
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licenser disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __ACMP_11XX_H_
33 #define __ACMP_11XX_H_
34 
35 #if defined(CHIP_LPC11AXX)
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
52 typedef enum CHIP_ACMP_POS_INPUT {
53  ACMP_POSIN_VLO = (0 << 8),
54  ACMP_POSIN_ACMP_I1 = (1 << 8),
55  ACMP_POSIN_ACMP_I2 = (2 << 8),
56  ACMP_POSIN_ACMP_I3 = (3 << 8),
57  ACMP_POSIN_ACMP_I4 = (4 << 8),
58  ACMP_POSIN_ACMP_I5 = (5 << 8),
59  ACMP_POSIN_INT_REF = (6 << 8),
60  ACMP_POSIN_TEMPSENS = (7 << 8)
62 
66 typedef enum CHIP_ACMP_NEG_INPUT {
67  ACMP_NEGIN_VLO = (0 << 11),
68  ACMP_NEGIN_ACMP_I1 = (1 << 11),
69  ACMP_NEGIN_ACMP_I2 = (2 << 11),
70  ACMP_NEGIN_ACMP_I3 = (3 << 11),
71  ACMP_NEGIN_ACMP_I4 = (4 << 11),
72  ACMP_NEGIN_ACMP_I5 = (5 << 11),
73  ACMP_NEGIN_INT_REF = (6 << 11)
75 
81 void Chip_ACMP_Init(LPC_CMP_T *pACMP);
82 
88 void Chip_ACMP_Deinit(LPC_CMP_T *pACMP);
89 
96 {
97  return IP_ACMP_GetCompStatus(pACMP);
98 }
99 
106 {
107  IP_ACMP_EdgeClear(pACMP);
108 }
109 
117 {
118  IP_ACMP_SetEdgeSelection(pACMP, edgeSel);
119 }
120 
127 {
129 }
130 
137 {
139 }
140 
148 {
149  IP_ACMP_SetPosVoltRef(pACMP, (uint32_t) Posinput);
150 }
151 
159 {
160  IP_ACMP_SetNegVoltRef(pACMP, (uint32_t) Neginput);
161 }
162 
170 {
171  IP_ACMP_SetHysteresis(pACMP, hys);
172 }
173 
184  CHIP_ACMP_POS_INPUT_T Posinput, CHIP_ACMP_NEG_INPUT_T Neginput,
185  IP_ACMP_HYS_001_T hys)
186 {
187  IP_ACMP_SetupAMCPRefs(pACMP, edgeSel, (uint32_t) Posinput,
188  (uint32_t) Neginput, hys);
189 }
190 
199 STATIC INLINE void Chip_ACMP_SetupVoltLadder(LPC_CMP_T *pACMP, uint32_t ladsel, bool ladrefVDDCMP)
200 {
201  IP_ACMP_SetupVoltLadder(pACMP, (ladsel << 1), ladrefVDDCMP);
202 }
203 
210 {
212 }
213 
220 {
222 }
223 
228 #ifdef __cplusplus
229 }
230 #endif
231 
232 #endif /* defined(CHIP_LPC11AXX) */
233 
234 #endif /* __ACMP_11XX_H_ */