LPCOpen Platform
v1.03
LPCOpen Platform for NXP LPC Microcontrollers
Main Page
Modules
Data Structures
Files
Related Pages
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
acmp_8xx.h
Go to the documentation of this file.
1
/*
2
* @brief LPC8xx 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_8XX_H_
33
#define __ACMP_8XX_H_
34
35
#ifdef __cplusplus
36
extern
"C"
{
37
#endif
38
50
typedef
enum
CHIP_ACMP_POS_INPUT {
51
ACMP_POSIN_VLO
= (0 << 8),
/* Voltage ladder output */
52
ACMP_POSIN_ACMP_I1
= (1 << 8),
/* ACMP_I1 pin */
53
ACMP_POSIN_ACMP_I2
= (2 << 8),
/* ACMP_I2 pin */
54
ACMP_POSIN_INT_REF
= (6 << 8)
/* Internal reference voltage */
55
}
CHIP_ACMP_POS_INPUT_T
;
56
60
typedef
enum
CHIP_ACMP_NEG_INPUT {
61
ACMP_NEGIN_VLO
= (0 << 11),
/* Voltage ladder output */
62
ACMP_NEGIN_ACMP_I1
= (1 << 11),
/* ACMP_I1 pin */
63
ACMP_NEGIN_ACMP_I2
= (2 << 11),
/* ACMP_I2 pin */
64
ACMP_NEGIN_INT_REF
= (6 << 11)
/* Internal reference voltage */
65
}
CHIP_ACMP_NEG_INPUT_T
;
66
72
void
Chip_ACMP_Init
(
LPC_CMP_T
*pACMP);
73
79
void
Chip_ACMP_Deinit
(
LPC_CMP_T
*pACMP);
80
86
STATIC
INLINE
uint32_t
Chip_ACMP_GetCompStatus
(
LPC_CMP_T
*pACMP)
87
{
88
return
IP_ACMP_GetCompStatus
(pACMP);
89
}
90
96
STATIC
INLINE
void
Chip_ACMP_EdgeClear
(
LPC_CMP_T
*pACMP)
97
{
98
IP_ACMP_EdgeClear
(pACMP);
99
}
100
107
STATIC
INLINE
void
Chip_ACMP_SetEdgeSelection
(
LPC_CMP_T
*pACMP,
IP_ACMP_001_EDGESEL_T
edgeSel)
108
{
109
IP_ACMP_SetEdgeSelection
(pACMP, edgeSel);
110
}
111
117
STATIC
INLINE
void
Chip_ACMP_EnableSyncCompOut
(
LPC_CMP_T
*pACMP)
118
{
119
IP_ACMP_EnableSyncCompOut
(pACMP);
120
}
121
127
STATIC
INLINE
void
Chip_ACMP_DisableSyncCompOut
(
LPC_CMP_T
*pACMP)
128
{
129
IP_ACMP_DisableSyncCompOut
(pACMP);
130
}
131
138
STATIC
INLINE
void
Chip_ACMP_SetPosVoltRef
(
LPC_CMP_T
*pACMP,
CHIP_ACMP_POS_INPUT_T
Posinput)
139
{
140
IP_ACMP_SetPosVoltRef
(pACMP, (
uint32_t
) Posinput);
141
}
142
149
STATIC
INLINE
void
Chip_ACMP_SetNegVoltRef
(
LPC_CMP_T
*pACMP,
CHIP_ACMP_NEG_INPUT_T
Neginput)
150
{
151
IP_ACMP_SetNegVoltRef
(pACMP, (
uint32_t
) Neginput);
152
}
153
160
STATIC
INLINE
void
Chip_ACMP_SetHysteresis
(
LPC_CMP_T
*pACMP,
IP_ACMP_HYS_001_T
hys)
161
{
162
IP_ACMP_SetHysteresis
(pACMP, hys);
163
}
164
174
STATIC
INLINE
void
Chip_ACMP_SetupAMCPRefs
(
LPC_CMP_T
*pACMP,
IP_ACMP_001_EDGESEL_T
edgeSel,
175
CHIP_ACMP_POS_INPUT_T
Posinput,
CHIP_ACMP_NEG_INPUT_T
Neginput,
176
IP_ACMP_HYS_001_T
hys)
177
{
178
IP_ACMP_SetupAMCPRefs
(pACMP, edgeSel, (
uint32_t
) Posinput,
179
(
uint32_t
) Neginput, hys);
180
}
181
190
STATIC
INLINE
void
Chip_ACMP_SetupVoltLadder
(
LPC_CMP_T
*pACMP,
uint32_t
ladsel,
bool
ladrefVDDCMP)
191
{
192
IP_ACMP_SetupVoltLadder
(pACMP, (ladsel << 1), ladrefVDDCMP);
193
}
194
200
STATIC
INLINE
void
Chip_ACMP_EnableVoltLadder
(
LPC_CMP_T
*pACMP)
201
{
202
IP_ACMP_EnableVoltLadder
(pACMP);
203
}
204
210
STATIC
INLINE
void
Chip_ACMP_DisableVoltLadder
(
LPC_CMP_T
*pACMP)
211
{
212
IP_ACMP_DisableVoltLadder
(pACMP);
213
}
214
219
#ifdef __cplusplus
220
}
221
#endif
222
223
#endif
/* __ACMP_8XX_H_ */
software
lpc_core
lpc_chip
chip_8xx
acmp_8xx.h
Generated on Fri May 10 2013 10:42:16 for LPCOpen Platform by
1.8.2