libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
adc.h
Go to the documentation of this file.
1/** @defgroup adc_defines ADC Defines
2
3@brief <b>Defined Constants and Types for the LPC43xx A/D Converter</b>
4
5@ingroup LPC43xx_defines
6
7@version 1.0.0
8
9@author @htmlonly &copy; @endhtmlonly 2012 Michael Ossmann <mike@ossmann.com>
10
11@date 10 March 2013
12
13LGPL License Terms @ref lgpl_license
14 */
15/*
16 * This file is part of the libopencm3 project.
17 *
18 * Copyright (C) 2012 Michael Ossmann <mike@ossmann.com>
19 *
20 * This library is free software: you can redistribute it and/or modify
21 * it under the terms of the GNU Lesser General Public License as published by
22 * the Free Software Foundation, either version 3 of the License, or
23 * (at your option) any later version.
24 *
25 * This library is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public License
31 * along with this library. If not, see <http://www.gnu.org/licenses/>.
32 */
33
34#ifndef LPC43XX_ADC_H
35#define LPC43XX_ADC_H
36
37/**@{*/
38
41
42/* --- Convenience macros -------------------------------------------------- */
43
44/* ADC port base addresses (for convenience) */
45#define ADC0 ADC0_BASE
46#define ADC1 ADC1_BASE
47
48
49/* --- ADC registers ------------------------------------------------------- */
50
51/* A/D Control Register */
52#define ADC_CR(port) MMIO32((port) + 0x000)
53#define ADC0_CR ADC_CR(ADC0)
54#define ADC1_CR ADC_CR(ADC1)
55
56/* A/D Global Data Register */
57#define ADC_GDR(port) MMIO32((port) + 0x004)
58#define ADC0_GDR ADC_GDR(ADC0)
59#define ADC1_GDR ADC_GDR(ADC1)
60
61/* A/D Interrupt Enable Register */
62#define ADC_INTEN(port) MMIO32((port) + 0x00C)
63#define ADC0_INTEN ADC_INTEN(ADC0)
64#define ADC1_INTEN ADC_INTEN(ADC1)
65
66/* A/D Channel 0 Data Register */
67#define ADC_DR0(port) MMIO32((port) + 0x010)
68#define ADC0_DR0 ADC_DR0(ADC0)
69#define ADC1_DR0 ADC_DR0(ADC1)
70
71/* A/D Channel 1 Data Register */
72#define ADC_DR1(port) MMIO32((port) + 0x014)
73#define ADC0_DR1 ADC_DR1(ADC0)
74#define ADC1_DR1 ADC_DR1(ADC1)
75
76/* A/D Channel 2 Data Register */
77#define ADC_DR2(port) MMIO32((port) + 0x018)
78#define ADC0_DR2 ADC_DR2(ADC0)
79#define ADC1_DR2 ADC_DR2(ADC1)
80
81/* A/D Channel 3 Data Register */
82#define ADC_DR3(port) MMIO32((port) + 0x01C)
83#define ADC0_DR3 ADC_DR3(ADC0)
84#define ADC1_DR3 ADC_DR3(ADC1)
85
86/* A/D Channel 4 Data Register */
87#define ADC_DR4(port) MMIO32((port) + 0x020)
88#define ADC0_DR4 ADC_DR4(ADC0)
89#define ADC1_DR4 ADC_DR4(ADC1)
90
91/* A/D Channel 5 Data Register */
92#define ADC_DR5(port) MMIO32((port) + 0x024)
93#define ADC0_DR5 ADC_DR5(ADC0)
94#define ADC1_DR5 ADC_DR5(ADC1)
95
96/* A/D Channel 6 Data Register */
97#define ADC_DR6(port) MMIO32((port) + 0x028)
98#define ADC0_DR6 ADC_DR6(ADC0)
99#define ADC1_DR6 ADC_DR6(ADC1)
100
101/* A/D Channel 7 Data Register */
102#define ADC_DR7(port) MMIO32((port) + 0x02C)
103#define ADC0_DR7 ADC_DR7(ADC0)
104#define ADC1_DR7 ADC_DR7(ADC1)
105
106/* A/D Status Register */
107#define ADC_STAT(port) MMIO32((port) + 0x030)
108#define ADC0_STAT ADC_STAT(ADC0)
109#define ADC1_STAT ADC_STAT(ADC1)
110
111/**@}*/
112
113#endif