1 |
610 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// comp.h - Prototypes for the analog comparator driver.
|
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 __COMP_H__
|
30 |
|
|
#define __COMP_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 ComparatorConfigure() as the ulConfig
|
46 |
|
|
// parameter. For each group (i.e. COMP_TRIG_xxx, COMP_INT_xxx, etc.), one of
|
47 |
|
|
// the values may be selected and combined together with values from the other
|
48 |
|
|
// groups via a logical OR.
|
49 |
|
|
//
|
50 |
|
|
//*****************************************************************************
|
51 |
|
|
#define COMP_TRIG_NONE 0x00000000 // No ADC trigger
|
52 |
|
|
#define COMP_TRIG_HIGH 0x00000880 // Trigger when high
|
53 |
|
|
#define COMP_TRIG_LOW 0x00000800 // Trigger when low
|
54 |
|
|
#define COMP_TRIG_FALL 0x00000820 // Trigger on falling edge
|
55 |
|
|
#define COMP_TRIG_RISE 0x00000840 // Trigger on rising edge
|
56 |
|
|
#define COMP_TRIG_BOTH 0x00000860 // Trigger on both edges
|
57 |
|
|
#define COMP_INT_HIGH 0x00000010 // Interrupt when high
|
58 |
|
|
#define COMP_INT_LOW 0x00000000 // Interrupt when low
|
59 |
|
|
#define COMP_INT_FALL 0x00000004 // Interrupt on falling edge
|
60 |
|
|
#define COMP_INT_RISE 0x00000008 // Interrupt on rising edge
|
61 |
|
|
#define COMP_INT_BOTH 0x0000000C // Interrupt on both edges
|
62 |
|
|
#define COMP_ASRCP_PIN 0x00000000 // Dedicated Comp+ pin
|
63 |
|
|
#define COMP_ASRCP_PIN0 0x00000200 // Comp0+ pin
|
64 |
|
|
#define COMP_ASRCP_REF 0x00000400 // Internal voltage reference
|
65 |
|
|
#ifndef DEPRECATED
|
66 |
|
|
#define COMP_OUTPUT_NONE 0x00000000 // No comparator output
|
67 |
|
|
#endif
|
68 |
|
|
#define COMP_OUTPUT_NORMAL 0x00000000 // Comparator output normal
|
69 |
|
|
#define COMP_OUTPUT_INVERT 0x00000002 // Comparator output inverted
|
70 |
|
|
|
71 |
|
|
//*****************************************************************************
|
72 |
|
|
//
|
73 |
|
|
// Values that can be passed to ComparatorSetRef() as the ulRef parameter.
|
74 |
|
|
//
|
75 |
|
|
//*****************************************************************************
|
76 |
|
|
#define COMP_REF_OFF 0x00000000 // Turn off the internal reference
|
77 |
|
|
#define COMP_REF_0V 0x00000300 // Internal reference of 0V
|
78 |
|
|
#define COMP_REF_0_1375V 0x00000301 // Internal reference of 0.1375V
|
79 |
|
|
#define COMP_REF_0_275V 0x00000302 // Internal reference of 0.275V
|
80 |
|
|
#define COMP_REF_0_4125V 0x00000303 // Internal reference of 0.4125V
|
81 |
|
|
#define COMP_REF_0_55V 0x00000304 // Internal reference of 0.55V
|
82 |
|
|
#define COMP_REF_0_6875V 0x00000305 // Internal reference of 0.6875V
|
83 |
|
|
#define COMP_REF_0_825V 0x00000306 // Internal reference of 0.825V
|
84 |
|
|
#define COMP_REF_0_928125V 0x00000201 // Internal reference of 0.928125V
|
85 |
|
|
#define COMP_REF_0_9625V 0x00000307 // Internal reference of 0.9625V
|
86 |
|
|
#define COMP_REF_1_03125V 0x00000202 // Internal reference of 1.03125V
|
87 |
|
|
#define COMP_REF_1_134375V 0x00000203 // Internal reference of 1.134375V
|
88 |
|
|
#define COMP_REF_1_1V 0x00000308 // Internal reference of 1.1V
|
89 |
|
|
#define COMP_REF_1_2375V 0x00000309 // Internal reference of 1.2375V
|
90 |
|
|
#define COMP_REF_1_340625V 0x00000205 // Internal reference of 1.340625V
|
91 |
|
|
#define COMP_REF_1_375V 0x0000030A // Internal reference of 1.375V
|
92 |
|
|
#define COMP_REF_1_44375V 0x00000206 // Internal reference of 1.44375V
|
93 |
|
|
#define COMP_REF_1_5125V 0x0000030B // Internal reference of 1.5125V
|
94 |
|
|
#define COMP_REF_1_546875V 0x00000207 // Internal reference of 1.546875V
|
95 |
|
|
#define COMP_REF_1_65V 0x0000030C // Internal reference of 1.65V
|
96 |
|
|
#define COMP_REF_1_753125V 0x00000209 // Internal reference of 1.753125V
|
97 |
|
|
#define COMP_REF_1_7875V 0x0000030D // Internal reference of 1.7875V
|
98 |
|
|
#define COMP_REF_1_85625V 0x0000020A // Internal reference of 1.85625V
|
99 |
|
|
#define COMP_REF_1_925V 0x0000030E // Internal reference of 1.925V
|
100 |
|
|
#define COMP_REF_1_959375V 0x0000020B // Internal reference of 1.959375V
|
101 |
|
|
#define COMP_REF_2_0625V 0x0000030F // Internal reference of 2.0625V
|
102 |
|
|
#define COMP_REF_2_165625V 0x0000020D // Internal reference of 2.165625V
|
103 |
|
|
#define COMP_REF_2_26875V 0x0000020E // Internal reference of 2.26875V
|
104 |
|
|
#define COMP_REF_2_371875V 0x0000020F // Internal reference of 2.371875V
|
105 |
|
|
|
106 |
|
|
//*****************************************************************************
|
107 |
|
|
//
|
108 |
|
|
// Prototypes for the APIs.
|
109 |
|
|
//
|
110 |
|
|
//*****************************************************************************
|
111 |
|
|
extern void ComparatorConfigure(unsigned long ulBase, unsigned long ulComp,
|
112 |
|
|
unsigned long ulConfig);
|
113 |
|
|
extern void ComparatorRefSet(unsigned long ulBase, unsigned long ulRef);
|
114 |
|
|
extern tBoolean ComparatorValueGet(unsigned long ulBase, unsigned long ulComp);
|
115 |
|
|
extern void ComparatorIntRegister(unsigned long ulBase, unsigned long ulComp,
|
116 |
|
|
void (*pfnHandler)(void));
|
117 |
|
|
extern void ComparatorIntUnregister(unsigned long ulBase,
|
118 |
|
|
unsigned long ulComp);
|
119 |
|
|
extern void ComparatorIntEnable(unsigned long ulBase, unsigned long ulComp);
|
120 |
|
|
extern void ComparatorIntDisable(unsigned long ulBase, unsigned long ulComp);
|
121 |
|
|
extern tBoolean ComparatorIntStatus(unsigned long ulBase, unsigned long ulComp,
|
122 |
|
|
tBoolean bMasked);
|
123 |
|
|
extern void ComparatorIntClear(unsigned long ulBase, unsigned long ulComp);
|
124 |
|
|
|
125 |
|
|
//*****************************************************************************
|
126 |
|
|
//
|
127 |
|
|
// Mark the end of the C bindings section for C++ compilers.
|
128 |
|
|
//
|
129 |
|
|
//*****************************************************************************
|
130 |
|
|
#ifdef __cplusplus
|
131 |
|
|
}
|
132 |
|
|
#endif
|
133 |
|
|
|
134 |
|
|
#endif // __COMP_H__
|