summaryrefslogtreecommitdiffstats
path: root/libopencm3/include/libopencm3/lpc43xx/adc.h
blob: c63c1e4c46e4561e8b24d81562f1570e4dd09704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/** @defgroup adc_defines ADC Defines

@brief <b>Defined Constants and Types for the LPC43xx A/D Converter</b>

@ingroup LPC43xx_defines

@version 1.0.0

@author @htmlonly &copy; @endhtmlonly 2012 Michael Ossmann <mike@ossmann.com>

@date 10 March 2013

LGPL License Terms @ref lgpl_license
 */
/*
 * This file is part of the libopencm3 project.
 *
 * Copyright (C) 2012 Michael Ossmann <mike@ossmann.com>
 *
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef LPC43XX_ADC_H
#define LPC43XX_ADC_H

/**@{*/

#include <libopencm3/cm3/common.h>
#include <libopencm3/lpc43xx/memorymap.h>

/* --- Convenience macros -------------------------------------------------- */

/* ADC port base addresses (for convenience) */
#define ADC0                            ADC0_BASE
#define ADC1                            ADC1_BASE


/* --- ADC registers ------------------------------------------------------- */

/* A/D Control Register */
#define ADC_CR(port)                    MMIO32(port + 0x000)
#define ADC0_CR                         ADC_CR(ADC0)
#define ADC1_CR                         ADC_CR(ADC1)

/* A/D Global Data Register */
#define ADC_GDR(port)                   MMIO32(port + 0x004)
#define ADC0_GDR                        ADC_GDR(ADC0)
#define ADC1_GDR                        ADC_GDR(ADC1)

/* A/D Interrupt Enable Register */
#define ADC_INTEN(port)                 MMIO32(port + 0x00C)
#define ADC0_INTEN                      ADC_INTEN(ADC0)
#define ADC1_INTEN                      ADC_INTEN(ADC1)

/* A/D Channel 0 Data Register */
#define ADC_DR0(port)                   MMIO32(port + 0x010)
#define ADC0_DR0                        ADC_DR0(ADC0)
#define ADC1_DR0                        ADC_DR0(ADC1)

/* A/D Channel 1 Data Register */
#define ADC_DR1(port)                   MMIO32(port + 0x014)
#define ADC0_DR1                        ADC_DR1(ADC0)
#define ADC1_DR1                        ADC_DR1(ADC1)

/* A/D Channel 2 Data Register */
#define ADC_DR2(port)                   MMIO32(port + 0x018)
#define ADC0_DR2                        ADC_DR2(ADC0)
#define ADC1_DR2                        ADC_DR2(ADC1)

/* A/D Channel 3 Data Register */
#define ADC_DR3(port)                   MMIO32(port + 0x01C)
#define ADC0_DR3                        ADC_DR3(ADC0)
#define ADC1_DR3                        ADC_DR3(ADC1)

/* A/D Channel 4 Data Register */
#define ADC_DR4(port)                   MMIO32(port + 0x020)
#define ADC0_DR4                        ADC_DR4(ADC0)
#define ADC1_DR4                        ADC_DR4(ADC1)

/* A/D Channel 5 Data Register */
#define ADC_DR5(port)                   MMIO32(port + 0x024)
#define ADC0_DR5                        ADC_DR5(ADC0)
#define ADC1_DR5                        ADC_DR5(ADC1)

/* A/D Channel 6 Data Register */
#define ADC_DR6(port)                   MMIO32(port + 0x028)
#define ADC0_DR6                        ADC_DR6(ADC0)
#define ADC1_DR6                        ADC_DR6(ADC1)

/* A/D Channel 7 Data Register */
#define ADC_DR7(port)                   MMIO32(port + 0x02C)
#define ADC0_DR7                        ADC_DR7(ADC0)
#define ADC1_DR7                        ADC_DR7(ADC1)

/* A/D Status Register */
#define ADC_STAT(port)                  MMIO32(port + 0x030)
#define ADC0_STAT                       ADC_STAT(ADC0)
#define ADC1_STAT                       ADC_STAT(ADC1)

/**@}*/

#endif