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 635 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 |
|
|
|
68 |
|
|
//*****************************************************************************
|
69 |
|
|
//
|
70 |
|
|
// Prototypes for the APIs.
|
71 |
|
|
//
|
72 |
|
|
//*****************************************************************************
|
73 |
|
|
extern void ADCIntRegister(unsigned long ulBase, unsigned long ulSequenceNum,
|
74 |
|
|
void (*pfnHandler)(void));
|
75 |
|
|
extern void ADCIntUnregister(unsigned long ulBase,
|
76 |
|
|
unsigned long ulSequenceNum);
|
77 |
|
|
extern void ADCIntDisable(unsigned long ulBase, unsigned long ulSequenceNum);
|
78 |
|
|
extern void ADCIntEnable(unsigned long ulBase, unsigned long ulSequenceNum);
|
79 |
|
|
extern unsigned long ADCIntStatus(unsigned long ulBase,
|
80 |
|
|
unsigned long ulSequenceNum,
|
81 |
|
|
tBoolean bMasked);
|
82 |
|
|
extern void ADCIntClear(unsigned long ulBase, unsigned long ulSequenceNum);
|
83 |
|
|
extern void ADCSequenceEnable(unsigned long ulBase,
|
84 |
|
|
unsigned long ulSequenceNum);
|
85 |
|
|
extern void ADCSequenceDisable(unsigned long ulBase,
|
86 |
|
|
unsigned long ulSequenceNum);
|
87 |
|
|
extern void ADCSequenceConfigure(unsigned long ulBase,
|
88 |
|
|
unsigned long ulSequenceNum,
|
89 |
|
|
unsigned long ulTrigger,
|
90 |
|
|
unsigned long ulPriority);
|
91 |
|
|
extern void ADCSequenceStepConfigure(unsigned long ulBase,
|
92 |
|
|
unsigned long ulSequenceNum,
|
93 |
|
|
unsigned long ulStep,
|
94 |
|
|
unsigned long ulConfig);
|
95 |
|
|
extern long ADCSequenceOverflow(unsigned long ulBase,
|
96 |
|
|
unsigned long ulSequenceNum);
|
97 |
|
|
extern long ADCSequenceUnderflow(unsigned long ulBase,
|
98 |
|
|
unsigned long ulSequenceNum);
|
99 |
|
|
extern long ADCSequenceDataGet(unsigned long ulBase,
|
100 |
|
|
unsigned long ulSequenceNum,
|
101 |
|
|
unsigned long *pulBuffer);
|
102 |
|
|
extern void ADCProcessorTrigger(unsigned long ulBase,
|
103 |
|
|
unsigned long ulSequenceNum);
|
104 |
|
|
extern void ADCSoftwareOversampleConfigure(unsigned long ulBase,
|
105 |
|
|
unsigned long ulSequenceNum,
|
106 |
|
|
unsigned long ulFactor);
|
107 |
|
|
extern void ADCSoftwareOversampleStepConfigure(unsigned long ulBase,
|
108 |
|
|
unsigned long ulSequenceNum,
|
109 |
|
|
unsigned long ulStep,
|
110 |
|
|
unsigned long ulConfig);
|
111 |
|
|
extern void ADCSoftwareOversampleDataGet(unsigned long ulBase,
|
112 |
|
|
unsigned long ulSequenceNum,
|
113 |
|
|
unsigned long *pulBuffer,
|
114 |
|
|
unsigned long ulCount);
|
115 |
|
|
|
116 |
|
|
#ifdef __cplusplus
|
117 |
|
|
}
|
118 |
|
|
#endif
|
119 |
|
|
|
120 |
|
|
#endif // __ADC_H__
|