MotorWare f2806x Driver API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

adc.c
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2 * Copyright (c) 2015, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * --/COPYRIGHT--*/
37
38
39 // **************************************************************************
40 // the includes
41 #include "sw/drivers/adc/src/32b/f28x/f2806x/adc.h"
42
43
44 // assembly file
45 extern void usDelay(uint32_t Count);
46
47
48 // **************************************************************************
49 // the defines
50
51
52 // **************************************************************************
53 // the globals
54
55
56 // **************************************************************************
57 // the functions
58
59 void ADC_disable(ADC_Handle adcHandle)
60 {
61 ADC_Obj *adc = (ADC_Obj *)adcHandle;
62
63
64 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
65
66 adc->ADCCTL1 &= (~ADC_ADCCTL1_ADCENABLE_BITS);
67
68 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
69
70 return;
71 } // end of ADC_disable() function
72
73
74 void ADC_disableBandGap(ADC_Handle adcHandle)
75 {
76 ADC_Obj *adc = (ADC_Obj *)adcHandle;
77
78
79 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
80
81 // clear the bits
82 adc->ADCCTL1 &= (~ADC_ADCCTL1_ADCBGPWD_BITS);
83
84 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
85
86 return;
87 } // end of ADC_disableBandGap() function
88
89
90 void ADC_disableInt(ADC_Handle adcHandle,const ADC_IntNumber_e intNumber)
91 {
92 ADC_Obj *adc = (ADC_Obj *)adcHandle;
93 uint_least8_t regNumber = intNumber >> 1;
94 uint16_t clearValue = ADC_INTSELxNy_INTE_BITS <<
95 (ADC_INTSELxNy_NUMBITS_PER_REG - (((intNumber+1) & 0x1) << ADC_INTSELxNy_LOG2_NUMBITS_PER_REG));
96
97
98 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
99
100 // clear the bits
101 adc->INTSELxNy[regNumber] &= (~clearValue);
102
103 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
104
105 return;
106 } // end of ADC_disableInt() function
107
108
109 void ADC_disableRefBuffers(ADC_Handle adcHandle)
110 {
111 ADC_Obj *adc = (ADC_Obj *)adcHandle;
112
113
114 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
115
116 // clear the bits
117 adc->ADCCTL1 &= (~ADC_ADCCTL1_ADCREFPWD_BITS);
118
119 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
120
121 return;
122 } // end of ADC_disableRefBuffers() function
123
124
125 void ADC_enable(ADC_Handle adcHandle)
126 {
127 ADC_Obj *adc = (ADC_Obj *)adcHandle;
128
129
130 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
131
132 // set the bits
133 adc->ADCCTL1 |= ADC_ADCCTL1_ADCENABLE_BITS;
134
135 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
136
137 return;
138 } // end of ADC_enable() function
139
140
141 void ADC_enableBandGap(ADC_Handle adcHandle)
142 {
143 ADC_Obj *adc = (ADC_Obj *)adcHandle;
144
145
146 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
147
148 // set the bits
149 adc->ADCCTL1 |= ADC_ADCCTL1_ADCBGPWD_BITS;
150
151 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
152
153 return;
154 } // end of ADC_enableBandGap() function
155
156
157 void ADC_enableInt(ADC_Handle adcHandle,const ADC_IntNumber_e intNumber)
158 {
159 ADC_Obj *adc = (ADC_Obj *)adcHandle;
160 uint_least8_t regNumber = intNumber >> 1;
161 uint_least8_t lShift = ADC_INTSELxNy_NUMBITS_PER_REG - (((intNumber+1) & 0x1) << ADC_INTSELxNy_LOG2_NUMBITS_PER_REG);
162 uint16_t setValue = ADC_INTSELxNy_INTE_BITS << lShift;
163
164
165 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
166
167 // set the value
168 adc->INTSELxNy[regNumber] |= setValue;
169
170 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
171
172 return;
173 } // end of ADC_enableInt() function
174
175
176 void ADC_enableRefBuffers(ADC_Handle adcHandle)
177 {
178 ADC_Obj *adc = (ADC_Obj *)adcHandle;
179
180
181 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
182
183 // set the bits
184 adc->ADCCTL1 |= ADC_ADCCTL1_ADCREFPWD_BITS;
185
186 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
187
188 return;
189 } // end of ADC_enableRefBuffers() function
190
191
192 // current sampled last
193 ADC_Handle ADC_init(void *pMemory,const size_t numBytes)
194 {
195 ADC_Handle adcHandle;
196
197
198 if(numBytes < sizeof(ADC_Obj))
199 return((ADC_Handle)NULL);
200
201
202 // assign the handle
203 adcHandle = (ADC_Handle)pMemory;
204
205 return(adcHandle);
206 } // end of ADC_init() function
207
208
209 void ADC_powerDown(ADC_Handle adcHandle)
210 {
211 ADC_Obj *adc = (ADC_Obj *)adcHandle;
212
213
214 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
215
216 // clear the bits
217 adc->ADCCTL1 &= (~ADC_ADCCTL1_ADCPWDN_BITS);
218
219 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
220
221 return;
222 } // end of ADC_powerDown() function
223
224
225 void ADC_powerUp(ADC_Handle adcHandle)
226 {
227 ADC_Obj *adc = (ADC_Obj *)adcHandle;
228
229
230 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
231
232 // set the bits
233 adc->ADCCTL1 |= ADC_ADCCTL1_ADCPWDN_BITS;
234
235 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
236
237 return;
238 } // end of ADC_powerUp() function
239
240
241 void ADC_reset(ADC_Handle adcHandle)
242 {
243 ADC_Obj *adc = (ADC_Obj *)adcHandle;
244
245
246 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
247
248 // set the bits
249 adc->ADCCTL1 |= (uint16_t)ADC_ADCCTL1_RESET_BITS;
250
251 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
252
253 return;
254 } // end of ADC_reset() function
255
256
257 void ADC_setSampleOverlapMode(ADC_Handle adcHandle, ADC_ADCCTL2_ADCNONOVERLAP_e OverLap)
258 {
259 ADC_Obj *adc = (ADC_Obj *)adcHandle;
260
261
262 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
263
264 // set the bits
265 if(OverLap == ADC_ADCCTL2_Overlap)
266 adc->ADCCTL2 &= ~((uint16_t)(ADC_ADCCTL2_ADCNONOVERLAP_BITS));
267 else
268 adc->ADCCTL2 |= (uint16_t)ADC_ADCCTL2_ADCNONOVERLAP_BITS;
269
270 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
271
272 return;
273 } // end of ADC_setSampleOverlapMode() function
274
275
276 void ADC_setIntMode(ADC_Handle adcHandle,const ADC_IntNumber_e intNumber,const ADC_IntMode_e intMode)
277 {
278 ADC_Obj *adc = (ADC_Obj *)adcHandle;
279 uint_least8_t regNumber = intNumber >> 1;
280 uint_least8_t lShift = (ADC_INTSELxNy_NUMBITS_PER_REG - (((intNumber+1) & 0x1) << ADC_INTSELxNy_LOG2_NUMBITS_PER_REG));
281 uint16_t clearValue = ADC_INTSELxNy_INTCONT_BITS << lShift;
282 uint16_t setValue = intMode << lShift;
283
284
285 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
286
287 // clear the bits
288 adc->INTSELxNy[regNumber] &= ~(clearValue);
289
290
291 // set the bits
292 adc->INTSELxNy[regNumber] |= setValue;
293
294 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
295
296 return;
297 } // end of ADC_setIntMode() function
298
299
300 void ADC_setIntPulseGenMode(ADC_Handle adcHandle,const ADC_IntPulseGenMode_e pulseMode)
301 {
302 ADC_Obj *adc = (ADC_Obj *)adcHandle;
303
304
305 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
306
307 // clear the bits
308 adc->ADCCTL1 &= (~ADC_ADCCTL1_INTPULSEPOS_BITS);
309
310
311 // set the bits
312 adc->ADCCTL1 |= pulseMode;
313
314 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
315
316 return;
317 } // end of ADC_setIntPulseGenMode() function
318
319
320 void ADC_setIntSrc(ADC_Handle adcHandle,const ADC_IntNumber_e intNumber,const ADC_IntSrc_e intSrc)
321 {
322 ADC_Obj *adc = (ADC_Obj *)adcHandle;
323 uint_least8_t regNumber = intNumber >> 1;
324 uint_least8_t lShift = (ADC_INTSELxNy_NUMBITS_PER_REG - (((intNumber+1) & 0x1) << ADC_INTSELxNy_LOG2_NUMBITS_PER_REG));
325 uint16_t clearValue = ADC_INTSELxNy_INTSEL_BITS << lShift;
326 uint16_t setValue = intSrc << lShift;
327
328
329 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
330
331
332 // clear the bits
333 adc->INTSELxNy[regNumber] &= ~(clearValue);
334
335
336 // set the bits
337 adc->INTSELxNy[regNumber] |= setValue;
338
339
340 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
341
342 return;
343 } // end of ADC_setIntSrc() function
344
345
346 void ADC_setSampleMode(ADC_Handle adcHandle,const ADC_SampleMode_e sampleMode)
347 {
348 ADC_Obj *adc = (ADC_Obj *)adcHandle;
349
350
351 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
352
353 if(sampleMode & ADC_ADCSAMPLEMODE_SEPARATE_FLAG) // separate
354 {
355 adc->ADCSAMPLEMODE &= (~(sampleMode - ADC_ADCSAMPLEMODE_SEPARATE_FLAG));
356 }
357 else
358 {
359 adc->ADCSAMPLEMODE |= sampleMode;
360 }
361
362 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
363
364 return;
365 } // end of ADC_setSampleMode() function
366
367
368 void ADC_setSocChanNumber(ADC_Handle adcHandle,const ADC_SocNumber_e socNumber,const ADC_SocChanNumber_e chanNumber)
369 {
370 ADC_Obj *adc = (ADC_Obj *)adcHandle;
371
372
373 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
374
375 // clear the bits
376 adc->ADCSOCxCTL[socNumber] &= (~ADC_ADCSOCxCTL_CHSEL_BITS);
377
378
379 // set the bits
380 adc->ADCSOCxCTL[socNumber] |= chanNumber;
381
382 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
383
384 return;
385 } // end of ADC_setSocChanNumber() function
386
387
388 void ADC_setSocSampleDelay(ADC_Handle adcHandle,const ADC_SocNumber_e socNumber,const ADC_SocSampleDelay_e sampleDelay)
389 {
390 ADC_Obj *adc = (ADC_Obj *)adcHandle;
391
392
393 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
394
395 // clear the bits
396 adc->ADCSOCxCTL[socNumber] &= (~ADC_ADCSOCxCTL_ACQPS_BITS);
397
398
399 // set the bits
400 adc->ADCSOCxCTL[socNumber] |= sampleDelay;
401
402 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
403
404 return;
405 } // end of ADC_setSocSampleDelay() function
406
407
408 void ADC_setSocTrigSrc(ADC_Handle adcHandle,const ADC_SocNumber_e socNumber,const ADC_SocTrigSrc_e trigSrc)
409 {
410 ADC_Obj *adc = (ADC_Obj *)adcHandle;
411
412
413 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
414
415 // clear the bits
416 adc->ADCSOCxCTL[socNumber] &= (~ADC_ADCSOCxCTL_TRIGSEL_BITS);
417
418
419 // set the bits
420 adc->ADCSOCxCTL[socNumber] |= trigSrc;
421
422 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
423
424 return;
425 } // end of ADC_setSocTrigSrc() function
426
427
428 void ADC_setSocFrc(ADC_Handle adcHandle,const ADC_SocFrc_e socFrc)
429 {
430 ADC_Obj *adc = (ADC_Obj *)adcHandle;
431
432
433 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
434
435 // set the bits
436 adc->ADCSOCFRC1 = 1 << socFrc;
437
438 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
439
440 return;
441 } // end of ADC_setSocFrc() function
442
443
444 void ADC_setSocFrcWord(ADC_Handle adcHandle,const uint16_t socFrc)
445 {
446 ADC_Obj *adc = (ADC_Obj *)adcHandle;
447
448
449 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
450
451 // write the entire word
452 adc->ADCSOCFRC1 = socFrc;
453
454 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
455
456 return;
457 } // end of ADC_setSocFrcWord() function
458
459
460 void ADC_setTempSensorSrc(ADC_Handle adcHandle,const ADC_TempSensorSrc_e sensorSrc)
461 {
462 ADC_Obj *adc = (ADC_Obj *)adcHandle;
463
464
465 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
466
467 // clear the bits
468 adc->ADCCTL1 &= (~ADC_ADCCTL1_TEMPCONV_BITS);
469
470
471 // set the bits
472 adc->ADCCTL1 |= sensorSrc;
473
474 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
475
476 return;
477 } // end of ADC_setTempSensorSrc() function
478
479
480 void ADC_setVoltRefSrc(ADC_Handle adcHandle,const ADC_VoltageRefSrc_e voltSrc)
481 {
482 ADC_Obj *adc = (ADC_Obj *)adcHandle;
483
484
485 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
486
487 // clear the bits
488 adc->ADCCTL1 &= (~ADC_ADCCTL1_ADCREFSEL_BITS);
489
490
491 // set the bits
492 adc->ADCCTL1 |= voltSrc;
493
494 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
495
496 return;
497 } // end of ADC_setVoltRefSrc() function
498
499
500 extern ADC_DivideSelect_e ADC_getDivideSelect(ADC_Handle adcHandle)
501 {
502 ADC_Obj *adc = (ADC_Obj *)adcHandle;
503
504 // get the bits
505 ADC_DivideSelect_e divSelect = (ADC_DivideSelect_e)((adc->ADCCTL2) & (ADC_ADCCTL2_CLKDIV2EN_BITS | ADC_ADCCTL2_CLKDIV4EN_BITS));
506
507 if(divSelect == 4)
508 divSelect = ADC_DivideSelect_ClkIn_by_1;
509
510 return (divSelect);
511 } // end of ADC_getDivideSelect() function
512
513
514 void ADC_setDivideSelect(ADC_Handle adcHandle,const ADC_DivideSelect_e divSelect)
515 {
516 ADC_Obj *adc = (ADC_Obj *)adcHandle;
517
518
519 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
520
521 // clear the bits
522 adc->ADCCTL2 &= (~(ADC_ADCCTL2_CLKDIV2EN_BITS|ADC_ADCCTL2_CLKDIV4EN_BITS));
523
524
525 // set the bits
526 adc->ADCCTL2 |= divSelect;
527
528 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
529
530 return;
531 } // end of ADC_setDivideSelect() function
532
533
534 void ADC_enableNoOverlapMode(ADC_Handle adcHandle)
535 {
536 ADC_Obj *adc = (ADC_Obj *)adcHandle;
537
538
539 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
540
541 // set the bits
542 adc->ADCCTL2 |= ADC_ADCCTL2_ADCNONOVERLAP_BITS;
543
544 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
545
546 return;
547 } // end of ADC_enableNoOverlapMode() function
548
549
550 void ADC_disableNoOverlapMode(ADC_Handle adcHandle)
551 {
552 ADC_Obj *adc = (ADC_Obj *)adcHandle;
553
554
555 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
556
557 // clear the bits
558 adc->ADCCTL2 &= (~(ADC_ADCCTL2_ADCNONOVERLAP_BITS));
559
560 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
561
562 return;
563 } // end of ADC_enableNoOverlapMode() function
564
565
566 void ADC_setupSocTrigSrc(ADC_Handle adcHandle, const ADC_SocNumber_e socNumber, const ADC_IntTriggerSOC_e intTrigSrc)
567 {
568 ADC_Obj *adc = (ADC_Obj *)adcHandle;
569 uint16_t clearValue;
570 uint16_t setValue;
571 uint16_t lShift_socsel1 = socNumber << 1;
572 uint16_t lShift_socsel2 = (socNumber - ADC_SocNumber_8) << 1;
573
574
575 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
576
577 if(socNumber < ADC_SocNumber_8)
578 {
579 clearValue = ADC_ADCINTSOCSELx_SOCx_BITS << lShift_socsel1;
580 setValue = intTrigSrc << lShift_socsel1;
581
582 // clear the bits
583 adc->ADCINTSOCSEL1 &= (~(clearValue));
584
585 // set the bits
586 adc->ADCINTSOCSEL1 |= setValue;
587 }
588 else
589 {
590 clearValue = ADC_ADCINTSOCSELx_SOCx_BITS << lShift_socsel2;
591 setValue = intTrigSrc << lShift_socsel2;
592
593 // clear the bits
594 adc->ADCINTSOCSEL2 &= (~(clearValue));
595
596 // set the bits
597 adc->ADCINTSOCSEL2 |= setValue;
598 }
599
600 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
601
602 return;
603 } // end of ADC_setupSocTrigSrc() function
604
605 void ADC_setOffTrim(ADC_Handle adcHandle, const uint16_t offtrim)
606 {
607 ADC_Obj *adc = (ADC_Obj *)adcHandle;
608
609
610 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
611
612 // set the offtrim bits
613 adc->ADCOFFTRIM = offtrim;
614
615 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
616
617 return;
618 } // end of ADC_setOffTrim() function
619
620 void ADC_enableVoltRefLoConv(ADC_Handle adcHandle)
621 {
622 ADC_Obj *adc = (ADC_Obj *)adcHandle;
623
624
625 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
626
627 // set the bits
628 adc->ADCCTL1 |= ADC_ADCCTL1_VREFLOCONV_BITS;
629
630 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
631
632 return;
633 } // end of ADC_enableVoltRefLoConv() function
634
635 void ADC_disableVoltRefLoConv(ADC_Handle adcHandle)
636 {
637 ADC_Obj *adc = (ADC_Obj *)adcHandle;
638
639
640 ENABLE_PROTECTED_REGISTER_WRITE_MODE;
641
642 // set the bits
643 adc->ADCCTL1 &= (~ADC_ADCCTL1_VREFLOCONV_BITS);
644
645 DISABLE_PROTECTED_REGISTER_WRITE_MODE;
646
647 return;
648 } // end of ADC_disableVoltRefLoConv() function
649
650 // end of file
_ADC_Obj_::ADCINTSOCSEL2
volatile uint16_t ADCINTSOCSEL2
ADC Interrupt Trigger SOC Select 2 Register.
Definition: adc_obj.h:67
ADC_SocTrigSrc_e
ADC_SocTrigSrc_e
Enumeration to define the start of conversion (SOC) trigger source.
Definition: adc.h:456
ADC_setSocTrigSrc
void ADC_setSocTrigSrc(ADC_Handle adcHandle, const ADC_SocNumber_e socNumber, const ADC_SocTrigSrc_e trigSrc)
Sets the start-of-conversion (SOC) trigger source.
Definition: adc.c:408
ADC_IntPulseGenMode_e
ADC_IntPulseGenMode_e
Enumeration to define the analog-to-digital converter (ADC) interrupt pulse generation mode...
Definition: adc.h:279
DISABLE_PROTECTED_REGISTER_WRITE_MODE
#define DISABLE_PROTECTED_REGISTER_WRITE_MODE
Define to disable protected register writes.
Definition: cpu.h:101
ADC_enableBandGap
void ADC_enableBandGap(ADC_Handle adcHandle)
Enables the analog-to-digital converter (ADC) band gap circuit.
Definition: adc.c:141
ADC_setOffTrim
void ADC_setOffTrim(ADC_Handle adcHandle, const uint16_t offtrim)
Sets the offset trim register.
Definition: adc.c:605
ADC_INTSELxNy_INTE_BITS
#define ADC_INTSELxNy_INTE_BITS
Defines the location of the INTE bits in the INTSELxNy register.
Definition: adc.h:157
ADC_SampleMode_e
ADC_SampleMode_e
Enumeration to define the analog-to-digital converter (ADC) sample modes.
Definition: adc.h:334
ADC_SocNumber_e
ADC_SocNumber_e
Enumeration to define the start of conversion (SOC) numbers.
Definition: adc.h:388
ADC_ADCCTL2_CLKDIV2EN_BITS
#define ADC_ADCCTL2_CLKDIV2EN_BITS
Defines the location of the CLKDIV2EN bits in the ADCTL2 register.
Definition: adc.h:133
ADC_IntSrc_e
ADC_IntSrc_e
Enumeration to define the analog-to-digital converter (ADC) interrupt source.
Definition: adc.h:288
ADC_ADCCTL1_ADCPWDN_BITS
#define ADC_ADCCTL1_ADCPWDN_BITS
Defines the location of the ADCPWDN bits in the ADCTL1 register.
Definition: adc.h:113
ADC_setSocFrcWord
void ADC_setSocFrcWord(ADC_Handle adcHandle, const uint16_t socFrc)
Sets the entire start of conversion (SOC) force register.
Definition: adc.c:444
ADC_setupSocTrigSrc
void ADC_setupSocTrigSrc(ADC_Handle adcHandle, const ADC_SocNumber_e socNumber, const ADC_IntTriggerSOC_e intTrigSrc)
Sets the start of conversion (SOC) trigger source.
Definition: adc.c:566
ADC_TempSensorSrc_e
ADC_TempSensorSrc_e
Enumeration to define the temperature sensor source.
Definition: adc.h:484
_ADC_Obj_::ADCSOCFRC1
volatile uint16_t ADCSOCFRC1
ADC SOC Force 1 Register.
Definition: adc_obj.h:71
ADC_SocFrc_e
ADC_SocFrc_e
Enumeration to define the soc force values.
Definition: adc.h:502
ADC_reset
void ADC_reset(ADC_Handle adcHandle)
Resets the analog-to-digital converter (ADC)
Definition: adc.c:241
ADC_setIntPulseGenMode
void ADC_setIntPulseGenMode(ADC_Handle adcHandle, const ADC_IntPulseGenMode_e pulseMode)
Sets the interrupt pulse generation mode.
Definition: adc.c:300
ADC_disableVoltRefLoConv
void ADC_disableVoltRefLoConv(ADC_Handle adcHandle)
Disables conversion of the voltage reference low signal for calibration.
Definition: adc.c:635
ADC_ADCSOCxCTL_ACQPS_BITS
#define ADC_ADCSOCxCTL_ACQPS_BITS
Defines the location of the ACQPS bits in the ADCSOCxCTL register.
Definition: adc.h:165
_ADC_Obj_::ADCSAMPLEMODE
volatile uint16_t ADCSAMPLEMODE
ADC Sample Mode Register.
Definition: adc_obj.h:64
ADC_ADCCTL1_ADCENABLE_BITS
#define ADC_ADCCTL1_ADCENABLE_BITS
Defines the location of the ADCENABLE bits in the ADCTL1 register.
Definition: adc.h:125
ADC_enableVoltRefLoConv
void ADC_enableVoltRefLoConv(ADC_Handle adcHandle)
Enables conversion of the voltage reference low signal for calibration.
Definition: adc.c:620
ADC_INTSELxNy_INTSEL_BITS
#define ADC_INTSELxNy_INTSEL_BITS
Defines the location of the INTSEL bits in the INTSELxNy register.
Definition: adc.h:153
ADC_ADCSOCxCTL_TRIGSEL_BITS
#define ADC_ADCSOCxCTL_TRIGSEL_BITS
Defines the location of the TRIGSEL bits in the ADCSOCxCTL register.
Definition: adc.h:173
ADC_enableNoOverlapMode
void ADC_enableNoOverlapMode(ADC_Handle adcHandle)
Enables no overlap mode.
Definition: adc.c:534
ADC_setIntMode
void ADC_setIntMode(ADC_Handle adcHandle, const ADC_IntNumber_e intNumber, const ADC_IntMode_e intMode)
Sets the interrupt mode.
Definition: adc.c:276
ADC_getDivideSelect
ADC_DivideSelect_e ADC_getDivideSelect(ADC_Handle adcHandle)
Gets the analog-to-digital converter (ADC) divide select value.
Definition: adc.c:500
ADC_disableRefBuffers
void ADC_disableRefBuffers(ADC_Handle adcHandle)
Disables the analog-to-digital converter (ADC) reference buffers circuit.
Definition: adc.c:109
ADC_enable
void ADC_enable(ADC_Handle adcHandle)
Enables the analog-to-digital converter (ADC)
Definition: adc.c:125
_ADC_Obj_::ADCCTL2
volatile uint16_t ADCCTL2
ADC Control Register 2.
Definition: adc.h:530
adc.h
Contains public interface to various functions related to the analog-to-digital converter (ADC) objec...
_ADC_Obj_::ADCSOCxCTL
volatile uint16_t ADCSOCxCTL[16]
ADC SOCx Control Registers.
Definition: adc_obj.h:77
_ADC_Obj_::ADCCTL1
volatile uint16_t ADCCTL1
ADC Control Register 1.
Definition: adc_obj.h:54
ADC_DivideSelect_e
ADC_DivideSelect_e
Enumeration to define the start of conversion (SOC) numbers.
Definition: adc.h:223
ADC_IntTriggerSOC_e
ADC_IntTriggerSOC_e
Enumeration to define the analog-to-digital converter (ADC) input trigger SOC Select 1 Register group...
Definition: adc.h:269
_ADC_Obj_::ADCINTSOCSEL1
volatile uint16_t ADCINTSOCSEL1
ADC Interrupt Trigger SOC Select 1 Register.
Definition: adc_obj.h:66
ADC_setSampleMode
void ADC_setSampleMode(ADC_Handle adcHandle, const ADC_SampleMode_e sampleMode)
Sets the sample mode.
Definition: adc.c:346
ADC_disableNoOverlapMode
void ADC_disableNoOverlapMode(ADC_Handle adcHandle)
Disables no overlap mode.
Definition: adc.c:550
_ADC_Obj_
Defines the analog-to-digital converter (ADC) object.
Definition: adc_obj.h:50
ENABLE_PROTECTED_REGISTER_WRITE_MODE
#define ENABLE_PROTECTED_REGISTER_WRITE_MODE
Define to allow protected register writes.
Definition: cpu.h:93
ADC_Handle
struct _ADC_Obj_ * ADC_Handle
Defines the analog-to-digital converter (ADC) handle.
Definition: adc_obj.h:88
ADC_init
ADC_Handle ADC_init(void *pMemory, const size_t numBytes)
Initializes the analog-to-digital converter (ADC) object handle.
Definition: adc.c:193
ADC_ADCCTL1_ADCREFPWD_BITS
#define ADC_ADCCTL1_ADCREFPWD_BITS
Defines the location of the ADCREFPWD bits in the ADCTL1 register.
Definition: adc.h:105
ADC_disableBandGap
void ADC_disableBandGap(ADC_Handle adcHandle)
Disables the analog-to-digital converter (ADC) band gap circuit.
Definition: adc.c:74
ADC_INTSELxNy_NUMBITS_PER_REG
#define ADC_INTSELxNy_NUMBITS_PER_REG
Defines the number of bits per INTSELxNy register.
Definition: adc.h:145
ADC_IntNumber_e
ADC_IntNumber_e
Enumeration to define the analog-to-digital converter (ADC) interrupt number.
Definition: adc.h:232
ADC_setVoltRefSrc
void ADC_setVoltRefSrc(ADC_Handle adcHandle, const ADC_VoltageRefSrc_e voltSrc)
Sets the voltage reference source.
Definition: adc.c:480
ADC_VoltageRefSrc_e
ADC_VoltageRefSrc_e
Enumeration to define the voltage reference source.
Definition: adc.h:493
ADC_enableInt
void ADC_enableInt(ADC_Handle adcHandle, const ADC_IntNumber_e intNumber)
Enables the analog-to-digital converter (ADC) interrupt.
Definition: adc.c:157
ADC_setSampleOverlapMode
void ADC_setSampleOverlapMode(ADC_Handle adcHandle, ADC_ADCCTL2_ADCNONOVERLAP_e OverLap)
Definition: adc.c:257
ADC_ADCCTL1_ADCBGPWD_BITS
#define ADC_ADCCTL1_ADCBGPWD_BITS
Defines the location of the ADCBGPWD bits in the ADCTL1 register.
Definition: adc.h:109
ADC_INTSELxNy_INTCONT_BITS
#define ADC_INTSELxNy_INTCONT_BITS
Defines the location of the INTCONT bits in the INTSELxNy register.
Definition: adc.h:161
ADC_ADCCTL1_RESET_BITS
#define ADC_ADCCTL1_RESET_BITS
Defines the location of the RESET bits in the ADCTL1 register.
Definition: adc.h:129
_ADC_Obj_::INTSELxNy
volatile uint16_t INTSELxNy[5]
ADC Interrupt Select x and y Register.
Definition: adc_obj.h:60
ADC_DivideSelect_ClkIn_by_1
Denotes Main Clock Prescaling of 0.
Definition: adc.h:225
ADC_ADCSAMPLEMODE_SEPARATE_FLAG
#define ADC_ADCSAMPLEMODE_SEPARATE_FLAG
Define for the channel separate flag.
Definition: adc.h:214
ADC_ADCSOCxCTL_CHSEL_BITS
#define ADC_ADCSOCxCTL_CHSEL_BITS
Defines the location of the CHSEL bits in the ADCSOCxCTL register.
Definition: adc.h:169
ADC_SocSampleDelay_e
ADC_SocSampleDelay_e
Enumeration to define the start of conversion (SOC) sample delays.
Definition: adc.h:411
ADC_ADCCTL2_ADCNONOVERLAP_BITS
#define ADC_ADCCTL2_ADCNONOVERLAP_BITS
Defines the location of the ADCNONOVERLAP bits in the ADCTL2 register.
Definition: adc.h:141
ADC_setSocChanNumber
void ADC_setSocChanNumber(ADC_Handle adcHandle, const ADC_SocNumber_e socNumber, const ADC_SocChanNumber_e chanNumber)
Sets the start-of-conversion (SOC) channel number.
Definition: adc.c:368
ADC_enableRefBuffers
void ADC_enableRefBuffers(ADC_Handle adcHandle)
Enables the analog-to-digital converter (ADC) reference buffers circuit.
Definition: adc.c:176
ADC_ADCCTL2_Overlap
Denotes that sample and conversion overlap is allowed.
Definition: adc.h:262
ADC_powerDown
void ADC_powerDown(ADC_Handle adcHandle)
Powers down the analog-to-digital converter (ADC)
Definition: adc.c:209
ADC_setIntSrc
void ADC_setIntSrc(ADC_Handle adcHandle, const ADC_IntNumber_e intNumber, const ADC_IntSrc_e intSrc)
Sets the interrupt source.
Definition: adc.c:320
usDelay
void usDelay(uint32_t Count)
ADC_ADCINTSOCSELx_SOCx_BITS
#define ADC_ADCINTSOCSELx_SOCx_BITS
Defines the location of the SOCx bits in the ADCINTSOCSELx register.
Definition: adc.h:177
ADC_IntMode_e
ADC_IntMode_e
Enumeration to define the analog-to-digital converter (ADC) interrupt mode.
Definition: adc.h:251
ADC_SocChanNumber_e
ADC_SocChanNumber_e
Enumeration to define the start of conversion (SOC) channel numbers.
Definition: adc.h:357
ADC_setTempSensorSrc
void ADC_setTempSensorSrc(ADC_Handle adcHandle, const ADC_TempSensorSrc_e sensorSrc)
Sets the temperature sensor source.
Definition: adc.c:460
ADC_setSocFrc
void ADC_setSocFrc(ADC_Handle adcHandle, const ADC_SocFrc_e socFrc)
Sets the start-of-conversion (SOC) force register.
Definition: adc.c:428
ADC_SocNumber_8
Denotes SOC8.
Definition: adc.h:398
_ADC_Obj_::ADCOFFTRIM
volatile uint16_t ADCOFFTRIM
ADC Offset Trim Register.
Definition: adc_obj.h:80
ADC_INTSELxNy_LOG2_NUMBITS_PER_REG
#define ADC_INTSELxNy_LOG2_NUMBITS_PER_REG
Defines the log2() of the number of bits per INTSELxNy register.
Definition: adc.h:149
ADC_ADCCTL2_ADCNONOVERLAP_e
ADC_ADCCTL2_ADCNONOVERLAP_e
Enumeration to define the analog-to-digital converter (ADC) sample and conversion overlap setting...
Definition: adc.h:260
ADC_powerUp
void ADC_powerUp(ADC_Handle adcHandle)
Powers up the analog-to-digital converter (ADC)
Definition: adc.c:225
ADC_disableInt
void ADC_disableInt(ADC_Handle adcHandle, const ADC_IntNumber_e intNumber)
Disables the analog-to-digital converter (ADC) interrupt.
Definition: adc.c:90
ADC_ADCCTL1_INTPULSEPOS_BITS
#define ADC_ADCCTL1_INTPULSEPOS_BITS
Defines the location of the INTPULSEPOS bits in the ADCTL1 register.
Definition: adc.h:97
ADC_ADCCTL2_CLKDIV4EN_BITS
#define ADC_ADCCTL2_CLKDIV4EN_BITS
Defines the location of the CLKDIV4EN bits in the ADCTL2 register.
Definition: adc.h:137
ADC_setSocSampleDelay
void ADC_setSocSampleDelay(ADC_Handle adcHandle, const ADC_SocNumber_e socNumber, const ADC_SocSampleDelay_e sampleDelay)
Sets the start-of-conversion (SOC) sample delay.
Definition: adc.c:388
ADC_ADCCTL1_TEMPCONV_BITS
#define ADC_ADCCTL1_TEMPCONV_BITS
Defines the location of the TEMPCONV bits in the ADCTL1 register.
Definition: adc.h:89
ADC_ADCCTL1_ADCREFSEL_BITS
#define ADC_ADCCTL1_ADCREFSEL_BITS
Defines the location of the ADCREFSEL bits in the ADCTL1 register.
Definition: adc.h:101
ADC_disable
void ADC_disable(ADC_Handle adcHandle)
Disables the analog-to-digital converter (ADC)
Definition: adc.c:59
ADC_ADCCTL1_VREFLOCONV_BITS
#define ADC_ADCCTL1_VREFLOCONV_BITS
Defines the location of the VREFLOCONV bits in the ADCTL1 register.
Definition: adc.h:93
ADC_setDivideSelect
void ADC_setDivideSelect(ADC_Handle adcHandle, const ADC_DivideSelect_e divSelect)
Sets the analog-to-digital converter (ADC) divide select value.
Definition: adc.c:514