MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
oa.h
1 //*****************************************************************************
2 //
3 // oa.h - Driver for the OA Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_OA_H__
8 #define __MSP430WARE_OA_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_OA_0__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be passed to the positiveInputMask
28 // parameter for functions: OA_openSwitch(), and OA_closeSwitch().
29 //
30 //*****************************************************************************
31 #define OA_POSITIVE_INPUT_TERMINAL_SWITCH0 PSW0
32 #define OA_POSITIVE_INPUT_TERMINAL_SWITCH1 PSW1
33 #define OA_POSITIVE_INPUT_TERMINAL_SWITCH2 PSW2
34 #define OA_POSITIVE_INPUT_TERMINAL_SWITCH3 PSW3
35 #define OA_POSITIVE_INPUT_TERMINAL_NONE 0x00
36 
37 //*****************************************************************************
38 //
39 // The following are values that can be passed to the negativeInputMask
40 // parameter for functions: OA_openSwitch(), and OA_closeSwitch().
41 //
42 //*****************************************************************************
43 #define OA_NEGATIVE_INPUT_TERMINAL_SWITCH0 NSW0
44 #define OA_NEGATIVE_INPUT_TERMINAL_SWITCH1 NSW1
45 #define OA_NEGATIVE_INPUT_TERMINAL_SWITCH2 NSW2
46 #define OA_NEGATIVE_INPUT_TERMINAL_SWITCH3 NSW3
47 #define OA_NEGATIVE_INPUT_TERMINAL_SWITCH4 NSW4
48 #define OA_NEGATIVE_INPUT_TERMINAL_NONE 0x00
49 
50 //*****************************************************************************
51 //
52 // The following are values that can be passed to the groundMask parameter for
53 // functions: OA_openSwitch(), and OA_closeSwitch().
54 //
55 //*****************************************************************************
56 #define OA_GROUND_SWITCH0 GSW0
57 #define OA_GROUND_SWITCH1 GSW1
58 #define OA_GROUND_NONE 0x00
59 
60 //*****************************************************************************
61 //
62 // The following are values that can be passed to the inputTerminal parameter
63 // for functions: OA_getSwitchStatus().
64 //
65 //*****************************************************************************
66 #define OA_POSITIVE_INPUT_TERMINAL_SWITCHES 0x00
67 #define OA_NEGATIVE_INPUT_TERMINAL_SWITCHES 0x01
68 #define OA_GROUND_SWITCHES 0x02
69 
70 //*****************************************************************************
71 //
72 // The following are values that can be passed toThe following are values that
73 // can be returned by the OA_getRailToRailInputReadyStatus() function.
74 //
75 //*****************************************************************************
76 #define OA_INPUT_READY OARRIRDY
77 #define OA_INPUT_NOT_READY 0x00
78 
79 //*****************************************************************************
80 //
81 // The following are values that can be passed toThe following are values that
82 // can be returned by the OA_getRailToRailInputStatus() function.
83 //
84 //*****************************************************************************
85 #define OA_INPUT_ENABLED OARRI
86 #define OA_INPUT_DISABLED (0x00)
87 
88 //*****************************************************************************
89 //
90 // The following are values that can be passed toThe following are values that
91 // can be returned by the OA_getAmplifierModeStatus() function.
92 //
93 //*****************************************************************************
94 #define OA_AMPLIFIER_MODE_ENABLED OAM
95 #define OA_AMPLIFIER_MODE_DISABLED (0x00)
96 
97 //*****************************************************************************
98 //
99 // Prototypes for the APIs.
100 //
101 //*****************************************************************************
102 
103 //*****************************************************************************
104 //
105 //! \brief Opens the positive input terminal, negative input terminal and
106 //! ground switch of the OA Module per user selection
107 //!
108 //! \param baseAddress is the base address of the OA module.
109 //! \param positiveInputMask
110 //! Mask value is the logical OR of any of the following:
111 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCH0
112 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCH1
113 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCH2
114 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCH3
115 //! - \b OA_POSITIVE_INPUT_TERMINAL_NONE
116 //! \param negativeInputMask
117 //! Mask value is the logical OR of any of the following:
118 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH0
119 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH1
120 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH2
121 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH3
122 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH4
123 //! - \b OA_NEGATIVE_INPUT_TERMINAL_NONE
124 //! \param groundMask
125 //! Mask value is the logical OR of any of the following:
126 //! - \b OA_GROUND_SWITCH0
127 //! - \b OA_GROUND_SWITCH1
128 //! - \b OA_GROUND_NONE
129 //!
130 //! \return None
131 //
132 //*****************************************************************************
133 extern void OA_openSwitch(uint16_t baseAddress,
134  uint8_t positiveInputMask,
135  uint8_t negativeInputMask,
136  uint8_t groundMask);
137 
138 //*****************************************************************************
139 //
140 //! \brief Closes the positive input terminal, negative input terminal and
141 //! ground switch of the OA Module per user selection.
142 //!
143 //! \param baseAddress is the base address of the OA module.
144 //! \param positiveInputMask
145 //! Mask value is the logical OR of any of the following:
146 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCH0
147 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCH1
148 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCH2
149 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCH3
150 //! - \b OA_POSITIVE_INPUT_TERMINAL_NONE
151 //! \param negativeInputMask
152 //! Mask value is the logical OR of any of the following:
153 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH0
154 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH1
155 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH2
156 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH3
157 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCH4
158 //! - \b OA_NEGATIVE_INPUT_TERMINAL_NONE
159 //! \param groundMask
160 //! Mask value is the logical OR of any of the following:
161 //! - \b OA_GROUND_SWITCH0
162 //! - \b OA_GROUND_SWITCH1
163 //! - \b OA_GROUND_NONE
164 //!
165 //! \return None
166 //
167 //*****************************************************************************
168 extern void OA_closeSwitch(uint16_t baseAddress,
169  uint8_t positiveInputMask,
170  uint8_t negativeInputMask,
171  uint8_t groundMask);
172 
173 //*****************************************************************************
174 //
175 //! \brief Gets the positive input terminal, negative input terminal and ground
176 //! switch status of the OA Module per user selection.
177 //!
178 //! \param baseAddress is the base address of the OA module.
179 //! \param inputTerminal
180 //! Valid values are:
181 //! - \b OA_POSITIVE_INPUT_TERMINAL_SWITCHES
182 //! - \b OA_NEGATIVE_INPUT_TERMINAL_SWITCHES
183 //! - \b OA_GROUND_SWITCHES
184 //!
185 //! \return Logical OR of the switches that are closed in the selected
186 //! inputTerminal
187 //
188 //*****************************************************************************
189 extern uint8_t OA_getSwitchStatus(uint16_t baseAddress,
190  uint8_t inputTerminal);
191 
192 //*****************************************************************************
193 //
194 //! \brief Gets the rail to rail input ready status
195 //!
196 //! \param baseAddress is the base address of the OA module.
197 //!
198 //! \return One of the following:
199 //! - \b OA_INPUT_READY
200 //! - \b OA_INPUT_NOT_READY
201 //
202 //*****************************************************************************
203 extern uint8_t OA_getRailToRailInputReadyStatus(uint16_t baseAddress);
204 
205 //*****************************************************************************
206 //
207 //! \brief Gets the rail to rail input status
208 //!
209 //! \param baseAddress is the base address of the OA module.
210 //!
211 //! \return One of the following:
212 //! - \b OA_INPUT_ENABLED
213 //! - \b OA_INPUT_DISABLED
214 //
215 //*****************************************************************************
216 extern uint8_t OA_getRailToRailInputStatus(uint16_t baseAddress);
217 
218 //*****************************************************************************
219 //
220 //! \brief Enables the rail to rail input
221 //!
222 //! \param baseAddress is the base address of the OA module.
223 //!
224 //! \return None
225 //
226 //*****************************************************************************
227 extern void OA_enableRailToRailInput(uint16_t baseAddress);
228 
229 //*****************************************************************************
230 //
231 //! \brief Disables the rail to rail input
232 //!
233 //! \param baseAddress is the base address of the OA module.
234 //!
235 //! \return None
236 //
237 //*****************************************************************************
238 extern void OA_disableRailToRailInput(uint16_t baseAddress);
239 
240 //*****************************************************************************
241 //
242 //! \brief Disables the amplifier mode
243 //!
244 //! \param baseAddress is the base address of the OA module.
245 //!
246 //! \return None
247 //
248 //*****************************************************************************
249 extern void OA_disableAmplifierMode(uint16_t baseAddress);
250 
251 //*****************************************************************************
252 //
253 //! \brief Enables the amplifier mode
254 //!
255 //! \param baseAddress is the base address of the OA module.
256 //!
257 //! \return None
258 //
259 //*****************************************************************************
260 extern void OA_enableAmplifierMode(uint16_t baseAddress);
261 
262 //*****************************************************************************
263 //
264 //! \brief Gets the amplifier mode status
265 //!
266 //! \param baseAddress is the base address of the OA module.
267 //!
268 //! \return One of the following:
269 //! - \b OA_AMPLIFIER_MODE_ENABLED
270 //! - \b OA_AMPLIFIER_MODE_DISABLED
271 //
272 //*****************************************************************************
273 extern uint8_t OA_getAmplifierModeStatus(uint16_t baseAddress);
274 
275 //*****************************************************************************
276 //
277 // Mark the end of the C bindings section for C++ compilers.
278 //
279 //*****************************************************************************
280 #ifdef __cplusplus
281 }
282 #endif
283 
284 #endif
285 #endif // __MSP430WARE_OA_H__

Copyright 2020, Texas Instruments Incorporated