1 /******************************************************************************
2 *  Filename:       aux_adc.h
3 *  Revised:        2020-02-14 11:30:20 +0100 (Fri, 14 Feb 2020)
4 *  Revision:       56760
5 *
6 *  Description:    Defines and prototypes for the AUX Analog-to-Digital
7 *                  Converter
8 *
9 *  Copyright (c) 2015 - 2017, Texas Instruments Incorporated
10 *  All rights reserved.
11 *
12 *  Redistribution and use in source and binary forms, with or without
13 *  modification, are permitted provided that the following conditions are met:
14 *
15 *  1) Redistributions of source code must retain the above copyright notice,
16 *     this list of conditions and the following disclaimer.
17 *
18 *  2) Redistributions in binary form must reproduce the above copyright notice,
19 *     this list of conditions and the following disclaimer in the documentation
20 *     and/or other materials provided with the distribution.
21 *
22 *  3) Neither the name of the ORGANIZATION nor the names of its contributors may
23 *     be used to endorse or promote products derived from this software without
24 *     specific prior written permission.
25 *
26 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 *  POSSIBILITY OF SUCH DAMAGE.
37 *
38 ******************************************************************************/
39 
40 //*****************************************************************************
41 //
42 //! \addtogroup aux_group
43 //! @{
44 //! \addtogroup auxadc_api
45 //! @{
46 //
47 //*****************************************************************************
48 
49 #ifndef __AUX_ADC_H__
50 #define __AUX_ADC_H__
51 
52 //*****************************************************************************
53 //
54 // If building with a C++ compiler, make all of the definitions in this header
55 // have a C binding.
56 //
57 //*****************************************************************************
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif
62 
63 #include <stdbool.h>
64 #include <stdint.h>
65 #include "../inc/hw_types.h"
66 #include "../inc/hw_memmap.h"
67 #include "../inc/hw_event.h"
68 #include "../inc/hw_adi.h"
69 #include "../inc/hw_adi_4_aux.h"
70 #include "../inc/hw_aux_anaif.h"
71 #include "rom.h"
72 
73 //*****************************************************************************
74 //
75 // Support for DriverLib in ROM:
76 // This section renames all functions that are not "static inline", so that
77 // calling these functions will default to implementation in flash. At the end
78 // of this file a second renaming will change the defaults to implementation in
79 // ROM for available functions.
80 //
81 // To force use of the implementation in flash, e.g. for debugging:
82 // - Globally: Define DRIVERLIB_NOROM at project level
83 // - Per function: Use prefix "NOROM_" when calling the function
84 //
85 //*****************************************************************************
86 #if !defined(DOXYGEN)
87     #define AUXADCDisable                   NOROM_AUXADCDisable
88     #define AUXADCEnableAsync               NOROM_AUXADCEnableAsync
89     #define AUXADCEnableSync                NOROM_AUXADCEnableSync
90     #define AUXADCDisableInputScaling       NOROM_AUXADCDisableInputScaling
91     #define AUXADCFlushFifo                 NOROM_AUXADCFlushFifo
92     #define AUXADCReadFifo                  NOROM_AUXADCReadFifo
93     #define AUXADCPopFifo                   NOROM_AUXADCPopFifo
94     #define AUXADCGetAdjustmentGain         NOROM_AUXADCGetAdjustmentGain
95     #define AUXADCGetAdjustmentOffset       NOROM_AUXADCGetAdjustmentOffset
96     #define AUXADCValueToMicrovolts         NOROM_AUXADCValueToMicrovolts
97     #define AUXADCMicrovoltsToValue         NOROM_AUXADCMicrovoltsToValue
98     #define AUXADCAdjustValueForGainAndOffset NOROM_AUXADCAdjustValueForGainAndOffset
99     #define AUXADCUnadjustValueForGainAndOffset NOROM_AUXADCUnadjustValueForGainAndOffset
100 #endif
101 
102 //*****************************************************************************
103 //
104 // Defines for ADC reference sources.
105 //
106 //*****************************************************************************
107 #define AUXADC_REF_FIXED                    (0 << ADI_4_AUX_ADCREF0_SRC_S)
108 #define AUXADC_REF_VDDS_REL                 (1 << ADI_4_AUX_ADCREF0_SRC_S)
109 
110 //*****************************************************************************
111 //
112 // Defines for the ADC FIFO status bits.
113 //
114 //*****************************************************************************
115 #define AUXADC_FIFO_EMPTY_M                 (AUX_ANAIF_ADCFIFOSTAT_EMPTY_M)
116 #define AUXADC_FIFO_ALMOST_FULL_M           (AUX_ANAIF_ADCFIFOSTAT_ALMOST_FULL_M)
117 #define AUXADC_FIFO_FULL_M                  (AUX_ANAIF_ADCFIFOSTAT_FULL_M)
118 #define AUXADC_FIFO_UNDERFLOW_M             (AUX_ANAIF_ADCFIFOSTAT_UNDERFLOW_M)
119 #define AUXADC_FIFO_OVERFLOW_M              (AUX_ANAIF_ADCFIFOSTAT_OVERFLOW_M)
120 
121 //*****************************************************************************
122 //
123 // Defines for supported ADC triggers.
124 //
125 //*****************************************************************************
126 #define AUXADC_TRIGGER_MANUAL               (EVENT_AUXSEL0_EV_NONE)
127 #define AUXADC_TRIGGER_GPT0A                (EVENT_AUXSEL0_EV_GPT0A)
128 #define AUXADC_TRIGGER_GPT0B                (EVENT_AUXSEL0_EV_GPT0B)
129 #define AUXADC_TRIGGER_GPT1A                (EVENT_AUXSEL0_EV_GPT1A)
130 #define AUXADC_TRIGGER_GPT1B                (EVENT_AUXSEL0_EV_GPT1B)
131 #define AUXADC_TRIGGER_GPT2A                (EVENT_AUXSEL0_EV_GPT2A)
132 #define AUXADC_TRIGGER_GPT2B                (EVENT_AUXSEL0_EV_GPT2B)
133 #define AUXADC_TRIGGER_GPT3A                (EVENT_AUXSEL0_EV_GPT3A)
134 #define AUXADC_TRIGGER_GPT3B                (EVENT_AUXSEL0_EV_GPT3B)
135 // Additional triggers specific for cc26x2 and cc13x2 devices
136 #define AUXADC_TRIGGER_GPT0A_CMP            (EVENT_AUXSEL0_EV_GPT0A_CMP)
137 #define AUXADC_TRIGGER_GPT0B_CMP            (EVENT_AUXSEL0_EV_GPT0B_CMP)
138 #define AUXADC_TRIGGER_GPT1A_CMP            (EVENT_AUXSEL0_EV_GPT1A_CMP)
139 #define AUXADC_TRIGGER_GPT1B_CMP            (EVENT_AUXSEL0_EV_GPT1B_CMP)
140 #define AUXADC_TRIGGER_GPT2A_CMP            (EVENT_AUXSEL0_EV_GPT2A_CMP)
141 #define AUXADC_TRIGGER_GPT2B_CMP            (EVENT_AUXSEL0_EV_GPT2B_CMP)
142 #define AUXADC_TRIGGER_GPT3A_CMP            (EVENT_AUXSEL0_EV_GPT3A_CMP)
143 #define AUXADC_TRIGGER_GPT3B_CMP            (EVENT_AUXSEL0_EV_GPT3B_CMP)
144 
145 //*****************************************************************************
146 //
147 // Defines for ADC sampling type for synchronous operation.
148 //
149 //*****************************************************************************
150 #define AUXADC_SAMPLE_TIME_2P7_US           3
151 #define AUXADC_SAMPLE_TIME_5P3_US           4
152 #define AUXADC_SAMPLE_TIME_10P6_US          5
153 #define AUXADC_SAMPLE_TIME_21P3_US          6
154 #define AUXADC_SAMPLE_TIME_42P6_US          7
155 #define AUXADC_SAMPLE_TIME_85P3_US          8
156 #define AUXADC_SAMPLE_TIME_170_US           9
157 #define AUXADC_SAMPLE_TIME_341_US           10
158 #define AUXADC_SAMPLE_TIME_682_US           11
159 #define AUXADC_SAMPLE_TIME_1P37_MS          12
160 #define AUXADC_SAMPLE_TIME_2P73_MS          13
161 #define AUXADC_SAMPLE_TIME_5P46_MS          14
162 #define AUXADC_SAMPLE_TIME_10P9_MS          15
163 
164 //*****************************************************************************
165 //
166 // Equivalent voltages for fixed ADC reference, in microvolts.
167 //
168 //*****************************************************************************
169 #define AUXADC_FIXED_REF_VOLTAGE_NORMAL     4300000
170 #define AUXADC_FIXED_REF_VOLTAGE_UNSCALED   1478500
171 
172 
173 //*****************************************************************************
174 //
175 // API Functions and prototypes
176 //
177 //*****************************************************************************
178 
179 
180 //*****************************************************************************
181 //
182 //! \brief Disables the ADC.
183 //!
184 //! This function must be called:
185 //! - Before re-enabling the ADC using \ref AUXADCEnableAsync() or
186 //!   \ref AUXADCEnableSync()
187 //! - Before entering system standby
188 //
189 //*****************************************************************************
190 extern void AUXADCDisable(void);
191 
192 //*****************************************************************************
193 //
194 //! \brief Enables the ADC for asynchronous operation.
195 //!
196 //! In asynchronous operation, the ADC samples continuously between
197 //! conversions.
198 //!
199 //! The ADC trigger starts the conversion. Note that the first conversion may
200 //! be invalid if the sampling period is too short.
201 //!
202 //! ADC input scaling is enabled by default after device reset, and is also re-
203 //! enabled by \ref AUXADCDisable(). To disable input scaling, call
204 //! \ref AUXADCDisableInputScaling() before calling \ref AUXADCEnableAsync().
205 //!
206 //! \param refSource
207 //!     ADC reference source:
208 //!     - \ref AUXADC_REF_FIXED (nominally 4.3 V)
209 //!     - \ref AUXADC_REF_VDDS_REL (nominally VDDS)
210 //! \param trigger
211 //!     ADC conversion trigger:
212 //!     - \ref AUXADC_TRIGGER_MANUAL
213 //!     - \ref AUXADC_TRIGGER_GPT0A
214 //!     - \ref AUXADC_TRIGGER_GPT0B
215 //!     - \ref AUXADC_TRIGGER_GPT1A
216 //!     - \ref AUXADC_TRIGGER_GPT1B
217 //!     - \ref AUXADC_TRIGGER_GPT2A
218 //!     - \ref AUXADC_TRIGGER_GPT2B
219 //!     - \ref AUXADC_TRIGGER_GPT3A
220 //!     - \ref AUXADC_TRIGGER_GPT3B
221 //
222 //*****************************************************************************
223 extern void AUXADCEnableAsync(uint32_t refSource, uint32_t trigger);
224 
225 //*****************************************************************************
226 //
227 //! \brief Enables the ADC for synchronous operation.
228 //!
229 //! In synchronous operation, the ADC is idle between a conversion and
230 //! subsequent samplings.
231 //!
232 //! The ADC trigger starts sampling with specified duration, followed by the
233 //! conversion. Note that the first conversion may be invalid if the initial
234 //! sampling period is too short.
235 //!
236 //! ADC input scaling is enabled by default after device reset, and is also re-
237 //! enabled by \ref AUXADCDisable(). To disable input scaling, call
238 //! \ref AUXADCDisableInputScaling() before calling \ref AUXADCEnableSync().
239 //!
240 //! \param refSource
241 //!     ADC reference source:
242 //!     - \ref AUXADC_REF_FIXED (nominally 4.3 V)
243 //!     - \ref AUXADC_REF_VDDS_REL (nominally VDDS)
244 //! \param sampleTime
245 //!     ADC sampling time:
246 //!     - \ref AUXADC_SAMPLE_TIME_2P7_US
247 //!     - \ref AUXADC_SAMPLE_TIME_5P3_US
248 //!     - \ref AUXADC_SAMPLE_TIME_10P6_US
249 //!     - \ref AUXADC_SAMPLE_TIME_21P3_US
250 //!     - \ref AUXADC_SAMPLE_TIME_42P6_US
251 //!     - \ref AUXADC_SAMPLE_TIME_85P3_US
252 //!     - \ref AUXADC_SAMPLE_TIME_170_US
253 //!     - \ref AUXADC_SAMPLE_TIME_341_US
254 //!     - \ref AUXADC_SAMPLE_TIME_682_US
255 //!     - \ref AUXADC_SAMPLE_TIME_1P37_MS
256 //!     - \ref AUXADC_SAMPLE_TIME_2P73_MS
257 //!     - \ref AUXADC_SAMPLE_TIME_5P46_MS
258 //!     - \ref AUXADC_SAMPLE_TIME_10P9_MS
259 //! \param trigger
260 //!     ADC conversion trigger:
261 //!     - \ref AUXADC_TRIGGER_MANUAL
262 //!     - \ref AUXADC_TRIGGER_GPT0A
263 //!     - \ref AUXADC_TRIGGER_GPT0B
264 //!     - \ref AUXADC_TRIGGER_GPT1A
265 //!     - \ref AUXADC_TRIGGER_GPT1B
266 //!     - \ref AUXADC_TRIGGER_GPT2A
267 //!     - \ref AUXADC_TRIGGER_GPT2B
268 //!     - \ref AUXADC_TRIGGER_GPT3A
269 //!     - \ref AUXADC_TRIGGER_GPT3B
270 //
271 //*****************************************************************************
272 extern void AUXADCEnableSync(uint32_t refSource, uint32_t sampleTime, uint32_t trigger);
273 
274 //*****************************************************************************
275 //
276 //! \brief Disables scaling of the ADC input.
277 //!
278 //! By default, the ADC operates internally on a version of the input signal
279 //! that has been scaled down by a factor <tt>1408 / 4095</tt>. This function
280 //! disables that scaling, allowing for a trade-off between dynamic range and
281 //! and resolution.
282 //!
283 //! \note This function must only be called while the ADC is disabled, before
284 //!       calling \ref AUXADCEnableSync() or \ref AUXADCEnableAsync().
285 //! \note Different input maximum ratings apply when input scaling is disabled.
286 //!       Violating these may damage the device.
287 //
288 //*****************************************************************************
289 extern void AUXADCDisableInputScaling(void);
290 
291 //*****************************************************************************
292 //
293 //! \brief Flushes the ADC FIFO.
294 //!
295 //! This empties the FIFO and clears the underflow/overflow flags.
296 //!
297 //! Note: This function must only be called while the ADC is enabled.
298 //
299 //*****************************************************************************
300 extern void AUXADCFlushFifo(void);
301 
302 //*****************************************************************************
303 //
304 //! \brief Generates a single manual ADC trigger.
305 //!
306 //! For synchronous mode, the trigger starts sampling followed by conversion.
307 //! For asynchronous mode, the trigger starts conversion.
308 //
309 //*****************************************************************************
310 __STATIC_INLINE void
AUXADCGenManualTrigger(void)311 AUXADCGenManualTrigger(void)
312 {
313     HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCTRIG) = 0;
314 }
315 
316 //*****************************************************************************
317 //
318 //! \brief Returns flags indicating the status of the ADC FIFO.
319 //!
320 //! The flags indicate FIFO empty, full and almost full, and whether
321 //! overflow/underflow has occurred.
322 //!
323 //! \return
324 //!     A combination (bitwise OR) of the following flags:
325 //!     - \ref AUXADC_FIFO_EMPTY_M
326 //!     - \ref AUXADC_FIFO_ALMOST_FULL_M
327 //!     - \ref AUXADC_FIFO_FULL_M
328 //!     - \ref AUXADC_FIFO_UNDERFLOW_M
329 //!     - \ref AUXADC_FIFO_OVERFLOW_M
330 //
331 //*****************************************************************************
332 __STATIC_INLINE uint32_t
AUXADCGetFifoStatus(void)333 AUXADCGetFifoStatus(void)
334 {
335     return HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCFIFOSTAT);
336 }
337 
338 //*****************************************************************************
339 //
340 //! \brief Waits for and returns the first sample in the ADC FIFO.
341 //!
342 //! This function waits until there is at least one sample in the ADC FIFO. It
343 //! then pops and returns the first sample from the FIFO.
344 //!
345 //! \note This procedure will deadlock if called without setting up ADC trigger
346 //!       generation in advance. The trigger can either be manual or periodical
347 //!       (using a GPT).
348 //!
349 //! \return The first (12-bit) sample from the ADC FIFO
350 //
351 //*****************************************************************************
352 extern uint32_t AUXADCReadFifo(void);
353 
354 //*****************************************************************************
355 //
356 //! \brief Returns the first sample in the ADC FIFO, without waiting.
357 //!
358 //! This function does not wait, and must only be called when there is at least
359 //! one sample in the ADC FIFO. Otherwise the call will generate FIFO underflow
360 //! (\ref AUXADC_FIFO_UNDERFLOW_M).
361 //!
362 //! \return The first (12-bit) sample from the ADC FIFO, or an undefined value
363 //!         if the FIFO is empty
364 //
365 //*****************************************************************************
366 extern uint32_t AUXADCPopFifo(void);
367 
368 //*****************************************************************************
369 //
370 //! \brief Selects internal or external input for the ADC.
371 //!
372 //! Note that calling this function also selects the same input for AUX_COMPB.
373 //!
374 //! \param input
375 //!     Internal/external input selection:
376 //!     - \ref ADC_COMPB_IN_DCOUPL
377 //!     - \ref ADC_COMPB_IN_VSS
378 //!     - \ref ADC_COMPB_IN_VDDS
379 //!     - \ref ADC_COMPB_IN_AUXIO7
380 //!     - \ref ADC_COMPB_IN_AUXIO6
381 //!     - \ref ADC_COMPB_IN_AUXIO5
382 //!     - \ref ADC_COMPB_IN_AUXIO4
383 //!     - \ref ADC_COMPB_IN_AUXIO3
384 //!     - \ref ADC_COMPB_IN_AUXIO2
385 //!     - \ref ADC_COMPB_IN_AUXIO1
386 //!     - \ref ADC_COMPB_IN_AUXIO0
387 //
388 //*****************************************************************************
389 __STATIC_INLINE void
AUXADCSelectInput(uint32_t input)390 AUXADCSelectInput(uint32_t input)
391 {
392     HapiSelectADCCompBInput(input);
393 }
394 
395 //*****************************************************************************
396 //
397 //! \brief Returns the gain value used when adjusting for ADC gain/offset.
398 //!
399 //! The function returns the gain value to be used with
400 //! \ref AUXADCAdjustValueForGainAndOffset() or
401 //! \ref AUXADCUnadjustValueForGainAndOffset(). The gain value is found during
402 //! chip manufacturing and is stored in the factory configuration, FCFG1.
403 //!
404 //! \param refSource
405 //!     ADC reference source:
406 //!     - \ref AUXADC_REF_FIXED (nominally 4.3 V)
407 //!     - \ref AUXADC_REF_VDDS_REL (nominally VDDS)
408 //!
409 //! \return
410 //!     The gain value to be used in adjustments
411 //
412 //*****************************************************************************
413 extern int32_t AUXADCGetAdjustmentGain(uint32_t refSource);
414 
415 //*****************************************************************************
416 //
417 //! \brief Returns the offset value used when adjusting for ADC gain/offset.
418 //!
419 //! The function returns the offset value to be used with
420 //! \ref AUXADCAdjustValueForGainAndOffset() or
421 //! \ref AUXADCUnadjustValueForGainAndOffset(). The offset value is found
422 //! during chip manufacturing and is stored in the factory configuration,
423 //! FCFG1.
424 //!
425 //! \param refSource
426 //!     ADC reference source:
427 //!     - \ref AUXADC_REF_FIXED (nominally 4.3 V)
428 //!     - \ref AUXADC_REF_VDDS_REL (nominally VDDS)
429 //!
430 //! \return
431 //!     The offset value to be used in adjustments
432 //
433 //*****************************************************************************
434 extern int32_t AUXADCGetAdjustmentOffset(uint32_t refSource);
435 
436 //*****************************************************************************
437 //
438 //! \brief Converts an "adjusted" ADC value to microvolts.
439 //!
440 //! This function can only be used when measuring with fixed ADC reference
441 //! (\ref AUXADC_REF_FIXED). The specified reference voltage accounts for
442 //! whether the sampled ADC input is scaled down before conversion or not.
443 //!
444 //! \param fixedRefVoltage
445 //!     Fixed reference voltage, in microvolts
446 //!     - \ref AUXADC_FIXED_REF_VOLTAGE_NORMAL when using scaled input (normal)
447 //!     - \ref AUXADC_FIXED_REF_VOLTAGE_UNSCALED when using unscaled input
448 //! \param adcValue
449 //!     The ADC value
450 //!
451 //! \return
452 //!     The corresponding number of microvolts
453 //
454 //*****************************************************************************
455 extern int32_t AUXADCValueToMicrovolts(int32_t fixedRefVoltage, int32_t adcValue);
456 
457 //*****************************************************************************
458 //
459 //! \brief Converts a number of microvolts to corresponding "adjusted" ADC value.
460 //!
461 //! This function can only be used when measuring with fixed ADC reference
462 //! (\ref AUXADC_REF_FIXED). The specified reference voltage accounts for
463 //! whether the sampled ADC input is scaled down before conversion or not.
464 //!
465 //! \param fixedRefVoltage
466 //!     Fixed reference voltage, in microvolts
467 //!     - \ref AUXADC_FIXED_REF_VOLTAGE_NORMAL when using scaled input (normal)
468 //!     - \ref AUXADC_FIXED_REF_VOLTAGE_UNSCALED when using unscaled input
469 //! \param microvolts
470 //!     The number of microvolts
471 //!
472 //! \return
473 //!     The corresponding expected ADC value (adjusted for ADC gain/offset)
474 //
475 //*****************************************************************************
476 extern int32_t AUXADCMicrovoltsToValue(int32_t fixedRefVoltage, int32_t microvolts);
477 
478 //*****************************************************************************
479 //
480 //! \brief Performs ADC value gain and offset adjustment.
481 //!
482 //! This function takes a measured ADC value compensates for the internal gain
483 //! and offset in the ADC.
484 //!
485 //! \param adcValue
486 //!     12-bit ADC unadjusted value
487 //! \param gain
488 //!     Gain adjustment value provided by \ref AUXADCGetAdjustmentGain()
489 //! \param offset
490 //!     Offset adjustment value provided by \ref AUXADCGetAdjustmentOffset()
491 //!
492 //! \return
493 //!     12-bit ADC adjusted value
494 //
495 //*****************************************************************************
496 extern int32_t AUXADCAdjustValueForGainAndOffset(int32_t adcValue, int32_t gain, int32_t offset);
497 
498 //*****************************************************************************
499 //
500 //! \brief Performs the inverse of the ADC value gain and offset adjustment.
501 //!
502 //! This function finds the expected measured ADC value, without gain and
503 //! offset compensation, for a given "ideal" ADC value. The function can for
504 //! example be used to find ADC value thresholds to be used in Sensor
505 //! Controller task configurations.
506 //!
507 //! \param adcValue
508 //!     12-bit ADC adjusted value
509 //! \param gain
510 //!     Gain adjustment value provided by \ref AUXADCGetAdjustmentGain()
511 //! \param offset
512 //!     Offset adjustment value provided by \ref AUXADCGetAdjustmentOffset()
513 //!
514 //! \return
515 //!     12-bit ADC unadjusted value
516 //
517 //*****************************************************************************
518 extern int32_t AUXADCUnadjustValueForGainAndOffset(int32_t adcValue, int32_t gain, int32_t offset);
519 
520 //*****************************************************************************
521 //
522 // Support for DriverLib in ROM:
523 // Redirect to implementation in ROM when available.
524 //
525 //*****************************************************************************
526 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
527     #include "../driverlib/rom.h"
528     #ifdef ROM_AUXADCDisable
529         #undef  AUXADCDisable
530         #define AUXADCDisable                   ROM_AUXADCDisable
531     #endif
532     #ifdef ROM_AUXADCEnableAsync
533         #undef  AUXADCEnableAsync
534         #define AUXADCEnableAsync               ROM_AUXADCEnableAsync
535     #endif
536     #ifdef ROM_AUXADCEnableSync
537         #undef  AUXADCEnableSync
538         #define AUXADCEnableSync                ROM_AUXADCEnableSync
539     #endif
540     #ifdef ROM_AUXADCDisableInputScaling
541         #undef  AUXADCDisableInputScaling
542         #define AUXADCDisableInputScaling       ROM_AUXADCDisableInputScaling
543     #endif
544     #ifdef ROM_AUXADCFlushFifo
545         #undef  AUXADCFlushFifo
546         #define AUXADCFlushFifo                 ROM_AUXADCFlushFifo
547     #endif
548     #ifdef ROM_AUXADCReadFifo
549         #undef  AUXADCReadFifo
550         #define AUXADCReadFifo                  ROM_AUXADCReadFifo
551     #endif
552     #ifdef ROM_AUXADCPopFifo
553         #undef  AUXADCPopFifo
554         #define AUXADCPopFifo                   ROM_AUXADCPopFifo
555     #endif
556     #ifdef ROM_AUXADCGetAdjustmentGain
557         #undef  AUXADCGetAdjustmentGain
558         #define AUXADCGetAdjustmentGain         ROM_AUXADCGetAdjustmentGain
559     #endif
560     #ifdef ROM_AUXADCGetAdjustmentOffset
561         #undef  AUXADCGetAdjustmentOffset
562         #define AUXADCGetAdjustmentOffset       ROM_AUXADCGetAdjustmentOffset
563     #endif
564     #ifdef ROM_AUXADCValueToMicrovolts
565         #undef  AUXADCValueToMicrovolts
566         #define AUXADCValueToMicrovolts         ROM_AUXADCValueToMicrovolts
567     #endif
568     #ifdef ROM_AUXADCMicrovoltsToValue
569         #undef  AUXADCMicrovoltsToValue
570         #define AUXADCMicrovoltsToValue         ROM_AUXADCMicrovoltsToValue
571     #endif
572     #ifdef ROM_AUXADCAdjustValueForGainAndOffset
573         #undef  AUXADCAdjustValueForGainAndOffset
574         #define AUXADCAdjustValueForGainAndOffset ROM_AUXADCAdjustValueForGainAndOffset
575     #endif
576     #ifdef ROM_AUXADCUnadjustValueForGainAndOffset
577         #undef  AUXADCUnadjustValueForGainAndOffset
578         #define AUXADCUnadjustValueForGainAndOffset ROM_AUXADCUnadjustValueForGainAndOffset
579     #endif
580 #endif
581 
582 //*****************************************************************************
583 //
584 // Mark the end of the C bindings section for C++ compilers.
585 //
586 //*****************************************************************************
587 #ifdef __cplusplus
588 }
589 #endif
590 
591 #endif // __AUX_ADC_H__
592 
593 //*****************************************************************************
594 //
595 //! Close the Doxygen group.
596 //! @}
597 //! @}
598 //
599 //*****************************************************************************
600