1 |
581 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// adc.h - ADC headers for using the ADC driver functions.
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2005,2006 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 Stellaris Family of 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. Any use in violation
|
14 |
|
|
// of the foregoing restrictions may subject the user to criminal sanctions
|
15 |
|
|
// under applicable laws, as well as to civil liability for the breach of the
|
16 |
|
|
// terms and conditions of this license.
|
17 |
|
|
//
|
18 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
19 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
20 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
21 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
22 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
23 |
|
|
//
|
24 |
|
|
// This is part of revision 991 of the Stellaris Driver Library.
|
25 |
|
|
//
|
26 |
|
|
//*****************************************************************************
|
27 |
|
|
|
28 |
|
|
#ifndef __ADC_H__
|
29 |
|
|
#define __ADC_H__
|
30 |
|
|
|
31 |
|
|
#ifdef __cplusplus
|
32 |
|
|
extern "C"
|
33 |
|
|
{
|
34 |
|
|
#endif
|
35 |
|
|
|
36 |
|
|
//*****************************************************************************
|
37 |
|
|
//
|
38 |
|
|
// Values that can be passed to ADCSequenceConfigure as the ulTrigger
|
39 |
|
|
// parameter.
|
40 |
|
|
//
|
41 |
|
|
//*****************************************************************************
|
42 |
|
|
#define ADC_TRIGGER_PROCESSOR 0x00000000 // Processor event
|
43 |
|
|
#define ADC_TRIGGER_COMP0 0x00000001 // Analog comparator 0 event
|
44 |
|
|
#define ADC_TRIGGER_COMP1 0x00000002 // Analog comparator 1 event
|
45 |
|
|
#define ADC_TRIGGER_COMP2 0x00000003 // Analog comparator 2 event
|
46 |
|
|
#define ADC_TRIGGER_EXTERNAL 0x00000004 // External event
|
47 |
|
|
#define ADC_TRIGGER_TIMER 0x00000005 // Timer event
|
48 |
|
|
#define ADC_TRIGGER_PWM0 0x00000006 // PWM0 event
|
49 |
|
|
#define ADC_TRIGGER_PWM1 0x00000007 // PWM1 event
|
50 |
|
|
#define ADC_TRIGGER_PWM2 0x00000008 // PWM2 event
|
51 |
|
|
#define ADC_TRIGGER_ALWAYS 0x0000000F // Always event
|
52 |
|
|
|
53 |
|
|
//*****************************************************************************
|
54 |
|
|
//
|
55 |
|
|
// Values that can be passed to ADCSequenceStepConfigure as the ulConfig
|
56 |
|
|
// parameter.
|
57 |
|
|
//
|
58 |
|
|
//*****************************************************************************
|
59 |
|
|
#define ADC_CTL_TS 0x00000080 // Temperature sensor select
|
60 |
|
|
#define ADC_CTL_IE 0x00000040 // Interrupt enable
|
61 |
|
|
#define ADC_CTL_END 0x00000020 // Sequence end select
|
62 |
|
|
#define ADC_CTL_D 0x00000010 // Differential select
|
63 |
|
|
#define ADC_CTL_CH0 0x00000000 // Input channel 0
|
64 |
|
|
#define ADC_CTL_CH1 0x00000001 // Input channel 1
|
65 |
|
|
#define ADC_CTL_CH2 0x00000002 // Input channel 2
|
66 |
|
|
#define ADC_CTL_CH3 0x00000003 // Input channel 3
|
67 |
|
|
#define ADC_CTL_CH4 0x00000004 // Input channel 4
|
68 |
|
|
#define ADC_CTL_CH5 0x00000005 // Input channel 5
|
69 |
|
|
#define ADC_CTL_CH6 0x00000006 // Input channel 6
|
70 |
|
|
#define ADC_CTL_CH7 0x00000007 // Input channel 7
|
71 |
|
|
|
72 |
|
|
//*****************************************************************************
|
73 |
|
|
//
|
74 |
|
|
// Prototypes for the APIs.
|
75 |
|
|
//
|
76 |
|
|
//*****************************************************************************
|
77 |
|
|
extern void ADCIntRegister(unsigned long ulBase, unsigned long ulSequenceNum,
|
78 |
|
|
void (*pfnHandler)(void));
|
79 |
|
|
extern void ADCIntUnregister(unsigned long ulBase,
|
80 |
|
|
unsigned long ulSequenceNum);
|
81 |
|
|
extern void ADCIntDisable(unsigned long ulBase, unsigned long ulSequenceNum);
|
82 |
|
|
extern void ADCIntEnable(unsigned long ulBase, unsigned long ulSequenceNum);
|
83 |
|
|
extern unsigned long ADCIntStatus(unsigned long ulBase,
|
84 |
|
|
unsigned long ulSequenceNum,
|
85 |
|
|
tBoolean bMasked);
|
86 |
|
|
extern void ADCIntClear(unsigned long ulBase, unsigned long ulSequenceNum);
|
87 |
|
|
extern void ADCSequenceEnable(unsigned long ulBase,
|
88 |
|
|
unsigned long ulSequenceNum);
|
89 |
|
|
extern void ADCSequenceDisable(unsigned long ulBase,
|
90 |
|
|
unsigned long ulSequenceNum);
|
91 |
|
|
extern void ADCSequenceConfigure(unsigned long ulBase,
|
92 |
|
|
unsigned long ulSequenceNum,
|
93 |
|
|
unsigned long ulTrigger,
|
94 |
|
|
unsigned long ulPriority);
|
95 |
|
|
extern void ADCSequenceStepConfigure(unsigned long ulBase,
|
96 |
|
|
unsigned long ulSequenceNum,
|
97 |
|
|
unsigned long ulStep,
|
98 |
|
|
unsigned long ulConfig);
|
99 |
|
|
extern long ADCSequenceOverflow(unsigned long ulBase,
|
100 |
|
|
unsigned long ulSequenceNum);
|
101 |
|
|
extern long ADCSequenceUnderflow(unsigned long ulBase,
|
102 |
|
|
unsigned long ulSequenceNum);
|
103 |
|
|
extern long ADCSequenceDataGet(unsigned long ulBase,
|
104 |
|
|
unsigned long ulSequenceNum,
|
105 |
|
|
unsigned long *pulBuffer);
|
106 |
|
|
extern void ADCProcessorTrigger(unsigned long ulBase,
|
107 |
|
|
unsigned long ulSequenceNum);
|
108 |
|
|
extern void ADCSoftwareOversampleConfigure(unsigned long ulBase,
|
109 |
|
|
unsigned long ulSequenceNum,
|
110 |
|
|
unsigned long ulFactor);
|
111 |
|
|
extern void ADCSoftwareOversampleStepConfigure(unsigned long ulBase,
|
112 |
|
|
unsigned long ulSequenceNum,
|
113 |
|
|
unsigned long ulStep,
|
114 |
|
|
unsigned long ulConfig);
|
115 |
|
|
extern void ADCSoftwareOversampleDataGet(unsigned long ulBase,
|
116 |
|
|
unsigned long ulSequenceNum,
|
117 |
|
|
unsigned long *pulBuffer,
|
118 |
|
|
unsigned long ulCount);
|
119 |
|
|
extern void ADCHardwareOversampleConfigure(unsigned long ulBase,
|
120 |
|
|
unsigned long ulFactor);
|
121 |
|
|
|
122 |
|
|
#ifdef __cplusplus
|
123 |
|
|
}
|
124 |
|
|
#endif
|
125 |
|
|
|
126 |
|
|
#endif // __ADC_H__
|