1 |
610 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// adc.h - ADC headers for using the ADC driver functions.
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved.
|
6 |
|
|
//
|
7 |
|
|
// Software License Agreement
|
8 |
|
|
//
|
9 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
10 |
|
|
// exclusively on LMI's microcontroller products.
|
11 |
|
|
//
|
12 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
13 |
|
|
// applicable copyright laws. All rights are reserved. You may not combine
|
14 |
|
|
// this software with "viral" open-source software in order to form a larger
|
15 |
|
|
// program. Any use in violation of the foregoing restrictions may subject
|
16 |
|
|
// the user to criminal sanctions under applicable laws, as well as to civil
|
17 |
|
|
// liability for the breach of the terms and conditions of this license.
|
18 |
|
|
//
|
19 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
20 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
21 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
22 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
23 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
24 |
|
|
//
|
25 |
|
|
// This is part of revision 2523 of the Stellaris Peripheral Driver Library.
|
26 |
|
|
//
|
27 |
|
|
//*****************************************************************************
|
28 |
|
|
|
29 |
|
|
#ifndef __ADC_H__
|
30 |
|
|
#define __ADC_H__
|
31 |
|
|
|
32 |
|
|
//*****************************************************************************
|
33 |
|
|
//
|
34 |
|
|
// If building with a C++ compiler, make all of the definitions in this header
|
35 |
|
|
// have a C binding.
|
36 |
|
|
//
|
37 |
|
|
//*****************************************************************************
|
38 |
|
|
#ifdef __cplusplus
|
39 |
|
|
extern "C"
|
40 |
|
|
{
|
41 |
|
|
#endif
|
42 |
|
|
|
43 |
|
|
//*****************************************************************************
|
44 |
|
|
//
|
45 |
|
|
// Values that can be passed to ADCSequenceConfigure as the ulTrigger
|
46 |
|
|
// parameter.
|
47 |
|
|
//
|
48 |
|
|
//*****************************************************************************
|
49 |
|
|
#define ADC_TRIGGER_PROCESSOR 0x00000000 // Processor event
|
50 |
|
|
#define ADC_TRIGGER_COMP0 0x00000001 // Analog comparator 0 event
|
51 |
|
|
#define ADC_TRIGGER_COMP1 0x00000002 // Analog comparator 1 event
|
52 |
|
|
#define ADC_TRIGGER_COMP2 0x00000003 // Analog comparator 2 event
|
53 |
|
|
#define ADC_TRIGGER_EXTERNAL 0x00000004 // External event
|
54 |
|
|
#define ADC_TRIGGER_TIMER 0x00000005 // Timer event
|
55 |
|
|
#define ADC_TRIGGER_PWM0 0x00000006 // PWM0 event
|
56 |
|
|
#define ADC_TRIGGER_PWM1 0x00000007 // PWM1 event
|
57 |
|
|
#define ADC_TRIGGER_PWM2 0x00000008 // PWM2 event
|
58 |
|
|
#define ADC_TRIGGER_ALWAYS 0x0000000F // Always event
|
59 |
|
|
|
60 |
|
|
//*****************************************************************************
|
61 |
|
|
//
|
62 |
|
|
// Values that can be passed to ADCSequenceStepConfigure as the ulConfig
|
63 |
|
|
// parameter.
|
64 |
|
|
//
|
65 |
|
|
//*****************************************************************************
|
66 |
|
|
#define ADC_CTL_TS 0x00000080 // Temperature sensor select
|
67 |
|
|
#define ADC_CTL_IE 0x00000040 // Interrupt enable
|
68 |
|
|
#define ADC_CTL_END 0x00000020 // Sequence end select
|
69 |
|
|
#define ADC_CTL_D 0x00000010 // Differential select
|
70 |
|
|
#define ADC_CTL_CH0 0x00000000 // Input channel 0
|
71 |
|
|
#define ADC_CTL_CH1 0x00000001 // Input channel 1
|
72 |
|
|
#define ADC_CTL_CH2 0x00000002 // Input channel 2
|
73 |
|
|
#define ADC_CTL_CH3 0x00000003 // Input channel 3
|
74 |
|
|
#define ADC_CTL_CH4 0x00000004 // Input channel 4
|
75 |
|
|
#define ADC_CTL_CH5 0x00000005 // Input channel 5
|
76 |
|
|
#define ADC_CTL_CH6 0x00000006 // Input channel 6
|
77 |
|
|
#define ADC_CTL_CH7 0x00000007 // Input channel 7
|
78 |
|
|
|
79 |
|
|
//*****************************************************************************
|
80 |
|
|
//
|
81 |
|
|
// Prototypes for the APIs.
|
82 |
|
|
//
|
83 |
|
|
//*****************************************************************************
|
84 |
|
|
extern void ADCIntRegister(unsigned long ulBase, unsigned long ulSequenceNum,
|
85 |
|
|
void (*pfnHandler)(void));
|
86 |
|
|
extern void ADCIntUnregister(unsigned long ulBase,
|
87 |
|
|
unsigned long ulSequenceNum);
|
88 |
|
|
extern void ADCIntDisable(unsigned long ulBase, unsigned long ulSequenceNum);
|
89 |
|
|
extern void ADCIntEnable(unsigned long ulBase, unsigned long ulSequenceNum);
|
90 |
|
|
extern unsigned long ADCIntStatus(unsigned long ulBase,
|
91 |
|
|
unsigned long ulSequenceNum,
|
92 |
|
|
tBoolean bMasked);
|
93 |
|
|
extern void ADCIntClear(unsigned long ulBase, unsigned long ulSequenceNum);
|
94 |
|
|
extern void ADCSequenceEnable(unsigned long ulBase,
|
95 |
|
|
unsigned long ulSequenceNum);
|
96 |
|
|
extern void ADCSequenceDisable(unsigned long ulBase,
|
97 |
|
|
unsigned long ulSequenceNum);
|
98 |
|
|
extern void ADCSequenceConfigure(unsigned long ulBase,
|
99 |
|
|
unsigned long ulSequenceNum,
|
100 |
|
|
unsigned long ulTrigger,
|
101 |
|
|
unsigned long ulPriority);
|
102 |
|
|
extern void ADCSequenceStepConfigure(unsigned long ulBase,
|
103 |
|
|
unsigned long ulSequenceNum,
|
104 |
|
|
unsigned long ulStep,
|
105 |
|
|
unsigned long ulConfig);
|
106 |
|
|
extern long ADCSequenceOverflow(unsigned long ulBase,
|
107 |
|
|
unsigned long ulSequenceNum);
|
108 |
|
|
extern void ADCSequenceOverflowClear(unsigned long ulBase,
|
109 |
|
|
unsigned long ulSequenceNum);
|
110 |
|
|
extern long ADCSequenceUnderflow(unsigned long ulBase,
|
111 |
|
|
unsigned long ulSequenceNum);
|
112 |
|
|
extern void ADCSequenceUnderflowClear(unsigned long ulBase,
|
113 |
|
|
unsigned long ulSequenceNum);
|
114 |
|
|
extern long ADCSequenceDataGet(unsigned long ulBase,
|
115 |
|
|
unsigned long ulSequenceNum,
|
116 |
|
|
unsigned long *pulBuffer);
|
117 |
|
|
extern void ADCProcessorTrigger(unsigned long ulBase,
|
118 |
|
|
unsigned long ulSequenceNum);
|
119 |
|
|
extern void ADCSoftwareOversampleConfigure(unsigned long ulBase,
|
120 |
|
|
unsigned long ulSequenceNum,
|
121 |
|
|
unsigned long ulFactor);
|
122 |
|
|
extern void ADCSoftwareOversampleStepConfigure(unsigned long ulBase,
|
123 |
|
|
unsigned long ulSequenceNum,
|
124 |
|
|
unsigned long ulStep,
|
125 |
|
|
unsigned long ulConfig);
|
126 |
|
|
extern void ADCSoftwareOversampleDataGet(unsigned long ulBase,
|
127 |
|
|
unsigned long ulSequenceNum,
|
128 |
|
|
unsigned long *pulBuffer,
|
129 |
|
|
unsigned long ulCount);
|
130 |
|
|
extern void ADCHardwareOversampleConfigure(unsigned long ulBase,
|
131 |
|
|
unsigned long ulFactor);
|
132 |
|
|
|
133 |
|
|
//*****************************************************************************
|
134 |
|
|
//
|
135 |
|
|
// Mark the end of the C bindings section for C++ compilers.
|
136 |
|
|
//
|
137 |
|
|
//*****************************************************************************
|
138 |
|
|
#ifdef __cplusplus
|
139 |
|
|
}
|
140 |
|
|
#endif
|
141 |
|
|
|
142 |
|
|
#endif // __ADC_H__
|