MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
ctsd16.h
1 //*****************************************************************************
2 //
3 // ctsd16.h - Driver for the CTSD16 Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_CTSD16_H__
8 #define __MSP430WARE_CTSD16_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_CTSD16__
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 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
28 //! \brief Used in the CTSD16_initConverterAdvanced() function as the param
29 //! parameter.
30 //
31 //*****************************************************************************
32 typedef struct CTSD16_initConverterAdvancedParam {
33  //! The converter to initialize.
34  //! \n Valid values are:
35  //! - \b CTSD16_CONVERTER_0
36  //! - \b CTSD16_CONVERTER_1
37  //! - \b CTSD16_CONVERTER_2
38  //! - \b CTSD16_CONVERTER_3
39  //! - \b CTSD16_CONVERTER_4
40  //! - \b CTSD16_CONVERTER_5
41  //! - \b CTSD16_CONVERTER_6
42  uint8_t converter;
43  //! Determines whether the converter will do continuous samples or a single
44  //! sample
45  //! \n Valid values are:
46  //! - \b CTSD16_CONTINUOUS_MODE [Default]
47  //! - \b CTSD16_SINGLE_MODE
48  uint16_t conversionMode;
49  //! \n Valid values are:
50  //! - \b CTSD16_NOT_GROUPED
51  //! - \b CTSD16_GROUPED [Default]
52  uint8_t groupEnable;
53  //! Selects oversampling ratio for the converter
54  //! \n Valid values are:
55  //! - \b CTSD16_INPUT_CH0
56  //! - \b CTSD16_INPUT_CH1
57  //! - \b CTSD16_INPUT_CH2
58  //! - \b CTSD16_INPUT_CH3
59  //! - \b CTSD16_INPUT_CH4
60  //! - \b CTSD16_INPUT_CH5
61  //! - \b CTSD16_INPUT_CH6
62  //! - \b CTSD16_INPUT_CH7
63  //! - \b CTSD16_INPUT_CH8
64  //! - \b CTSD16_INPUT_CH9
65  //! - \b CTSD16_INPUT_CH10
66  //! - \b CTSD16_INPUT_CH11
67  //! - \b CTSD16_INPUT_CH12
68  //! - \b CTSD16_INPUT_CH13
69  //! - \b CTSD16_INPUT_CH14
70  //! - \b CTSD16_INPUT_CH15
71  //! - \b CTSD16_INPUT_CH16
72  //! - \b CTSD16_INPUT_CH17
73  //! - \b CTSD16_INPUT_CH18
74  uint8_t inputChannel;
75  //! Selects how the data format of the results
76  //! \n Valid values are:
77  //! - \b CTSD16_DATA_FORMAT_BINARY [Default]
78  //! - \b CTSD16_DATA_FORMAT_2COMPLEMENT
79  uint8_t dataFormat;
80  //! Determines the rail-to-rail input enabled or disabled.
81  //! \n Valid values are:
82  //! - \b CTSD16_RTR_INPUT_ENABLE
83  //! - \b CTSD16_RTR_INPUT_DISABLE [Default]
84  uint16_t railToRailInput;
85  //! Selects the delay for the interrupt
86  //! \n Valid values are:
87  //! - \b CTSD16_FIRST_SAMPLE_INTERRUPT
88  //! - \b CTSD16_FOURTH_SAMPLE_INTERRUPT [Default]
89  uint16_t interruptDelay;
90  //! Selects oversampling ratio for the converter
91  //! \n Valid values are:
92  //! - \b CTSD16_OVERSAMPLE_32
93  //! - \b CTSD16_OVERSAMPLE_64
94  //! - \b CTSD16_OVERSAMPLE_128
95  //! - \b CTSD16_OVERSAMPLE_256 [Default]
96  uint16_t oversampleRatio;
97  //! Selects the gain for the converter
98  //! \n Valid values are:
99  //! - \b CTSD16_GAIN_1 [Default]
100  //! - \b CTSD16_GAIN_2
101  //! - \b CTSD16_GAIN_4
102  //! - \b CTSD16_GAIN_8
103  //! - \b CTSD16_GAIN_16
104  uint8_t gain;
105 } CTSD16_initConverterAdvancedParam;
106 
107 
108 //*****************************************************************************
109 //
110 // The following are values that can be passed to the converter parameter for
111 // functions: CTSD16_setConverterDataFormat(),
112 // CTSD16_startConverterConversion(), CTSD16_stopConverterConversion(),
113 // CTSD16_setInputChannel(), CTSD16_setInterruptDelay(),
114 // CTSD16_setOversampling(), CTSD16_setGain(), CTSD16_setRailToRailInput(),
115 // CTSD16_getResults(), CTSD16_getHighWordResults(), CTSD16_enableInterrupt(),
116 // CTSD16_disableInterrupt(), CTSD16_clearInterrupt(),
117 // CTSD16_getInterruptStatus(), and CTSD16_initConverter(); the param parameter
118 // for functions: CTSD16_initConverterAdvanced().
119 //
120 //*****************************************************************************
121 #define CTSD16_CONVERTER_0 0
122 #define CTSD16_CONVERTER_1 1
123 #define CTSD16_CONVERTER_2 2
124 #define CTSD16_CONVERTER_3 3
125 #define CTSD16_CONVERTER_4 4
126 #define CTSD16_CONVERTER_5 5
127 #define CTSD16_CONVERTER_6 6
128 
129 //*****************************************************************************
130 //
131 // The following are values that can be passed to the oversampleRatio parameter
132 // for functions: CTSD16_setOversampling(); the param parameter for functions:
133 // CTSD16_initConverterAdvanced().
134 //
135 //*****************************************************************************
136 #define CTSD16_OVERSAMPLE_32 (CTSD16OSR__32)
137 #define CTSD16_OVERSAMPLE_64 (CTSD16OSR__64)
138 #define CTSD16_OVERSAMPLE_128 (CTSD16OSR__128)
139 #define CTSD16_OVERSAMPLE_256 (CTSD16OSR__256)
140 
141 //*****************************************************************************
142 //
143 // The following are values that can be passed to the inputChannel parameter
144 // for functions: CTSD16_initConverter(), and CTSD16_setInputChannel(); the
145 // param parameter for functions: CTSD16_initConverterAdvanced().
146 //
147 //*****************************************************************************
148 #define CTSD16_INPUT_CH0 (CTSD16INCH_0)
149 #define CTSD16_INPUT_CH1 (CTSD16INCH_1)
150 #define CTSD16_INPUT_CH2 (CTSD16INCH_2)
151 #define CTSD16_INPUT_CH3 (CTSD16INCH_3)
152 #define CTSD16_INPUT_CH4 (CTSD16INCH_4)
153 #define CTSD16_INPUT_CH5 (CTSD16INCH_5)
154 #define CTSD16_INPUT_CH6 (CTSD16INCH_6)
155 #define CTSD16_INPUT_CH7 (CTSD16INCH_7)
156 #define CTSD16_INPUT_CH8 (CTSD16INCH_8)
157 #define CTSD16_INPUT_CH9 (CTSD16INCH_9)
158 #define CTSD16_INPUT_CH10 (CTSD16INCH_10)
159 #define CTSD16_INPUT_CH11 (CTSD16INCH_11)
160 #define CTSD16_INPUT_CH12 (CTSD16INCH_12)
161 #define CTSD16_INPUT_CH13 (CTSD16INCH_13)
162 #define CTSD16_INPUT_CH14 (CTSD16INCH_14)
163 #define CTSD16_INPUT_CH15 (CTSD16INCH_15)
164 #define CTSD16_INPUT_CH16 (CTSD16INCH_16)
165 #define CTSD16_INPUT_CH17 (CTSD16INCH_17)
166 #define CTSD16_INPUT_CH18 (CTSD16INCH_18)
167 
168 //*****************************************************************************
169 //
170 // The following are values that can be passed to the dataFormat parameter for
171 // functions: CTSD16_setConverterDataFormat(); the param parameter for
172 // functions: CTSD16_initConverterAdvanced().
173 //
174 //*****************************************************************************
175 #define CTSD16_DATA_FORMAT_BINARY (0x00)
176 #define CTSD16_DATA_FORMAT_2COMPLEMENT (CTSD16DF)
177 
178 //*****************************************************************************
179 //
180 // The following are values that can be passed to the gain parameter for
181 // functions: CTSD16_setGain(); the param parameter for functions:
182 // CTSD16_initConverterAdvanced().
183 //
184 //*****************************************************************************
185 #define CTSD16_GAIN_1 (CTSD16GAIN_1)
186 #define CTSD16_GAIN_2 (CTSD16GAIN_2)
187 #define CTSD16_GAIN_4 (CTSD16GAIN_4)
188 #define CTSD16_GAIN_8 (CTSD16GAIN_8)
189 #define CTSD16_GAIN_16 (CTSD16GAIN_16)
190 
191 //*****************************************************************************
192 //
193 // The following are values that can be passed to the interruptDelay parameter
194 // for functions: CTSD16_setInterruptDelay(); the param parameter for
195 // functions: CTSD16_initConverterAdvanced().
196 //
197 //*****************************************************************************
198 #define CTSD16_FIRST_SAMPLE_INTERRUPT (CTSD16INTDLY)
199 #define CTSD16_FOURTH_SAMPLE_INTERRUPT (0x00)
200 
201 //*****************************************************************************
202 //
203 // The following are values that can be passed to the param parameter for
204 // functions: CTSD16_initConverterAdvanced().
205 //
206 //*****************************************************************************
207 #define CTSD16_NOT_GROUPED (0x00)
208 #define CTSD16_GROUPED (CTSD16GRP)
209 
210 //*****************************************************************************
211 //
212 // The following are values that can be passed to the mask parameter for
213 // functions: CTSD16_enableInterrupt(), CTSD16_disableInterrupt(),
214 // CTSD16_clearInterrupt(), and CTSD16_getInterruptStatus() as well as returned
215 // by the CTSD16_getInterruptStatus() function.
216 //
217 //*****************************************************************************
218 #define CTSD16_CONVERTER_INTERRUPT (CTSD16IE0)
219 #define CTSD16_CONVERTER_OVERFLOW_INTERRUPT (CTSD16OVIE0)
220 
221 //*****************************************************************************
222 //
223 // The following are values that can be passed to the chargePumpBurstRequest
224 // parameter for functions: CTSD16_init().
225 //
226 //*****************************************************************************
227 #define CTSD16_RTR_INPUT_CHARGEPUMP_BURST_REQUEST_ENABLE (CTSD16RRIBURST)
228 #define CTSD16_RTR_INPUT_CHARGEPUMP_BURST_REQUEST_DISABLE (0x0)
229 
230 //*****************************************************************************
231 //
232 // The following are values that can be passed to the referenceSelect parameter
233 // for functions: CTSD16_init().
234 //
235 //*****************************************************************************
236 #define CTSD16_REF_EXTERNAL (0x0)
237 #define CTSD16_REF_INTERNAL (CTSD16REFS)
238 
239 //*****************************************************************************
240 //
241 // The following are values that can be passed to the param parameter for
242 // functions: CTSD16_initConverterAdvanced(); the conversionMode parameter for
243 // functions: CTSD16_initConverter().
244 //
245 //*****************************************************************************
246 #define CTSD16_CONTINUOUS_MODE (0x0)
247 #define CTSD16_SINGLE_MODE (CTSD16SNGL)
248 
249 //*****************************************************************************
250 //
251 // The following are values that can be passed to the railToRailInput parameter
252 // for functions: CTSD16_setRailToRailInput(); the param parameter for
253 // functions: CTSD16_initConverterAdvanced().
254 //
255 //*****************************************************************************
256 #define CTSD16_RTR_INPUT_ENABLE (CTSD16RRI)
257 #define CTSD16_RTR_INPUT_DISABLE (0x0)
258 
259 //*****************************************************************************
260 //
261 // The following are values that can be passed toThe following are values that
262 // can be returned by the CTSD16_isRailToRailInputReady() function.
263 //
264 //*****************************************************************************
265 #define CTSD16_RTR_INPUT_READY (CTSD16RRIRDY)
266 #define CTSD16_RTR_INPUT_NOT_READY (0x0)
267 
268 //*****************************************************************************
269 //
270 // Prototypes for the APIs.
271 //
272 //*****************************************************************************
273 
274 //*****************************************************************************
275 //
276 //! \brief Initializes the CTSD16 Module
277 //!
278 //! This function initializes the CTSD16 module sigma-delta analog-to-digital
279 //! conversions. Specifically the function sets up the clock source for the
280 //! CTSD16 core to use for conversions. Upon completion of the initialization
281 //! the CTSD16 interrupt registers will be reset and the given parameters will
282 //! be set. The converter configuration settings are independent of this
283 //! function. The default clock frequency for CTSD16 is: f_CTSD16 = 1.024MHz
284 //!
285 //! \param baseAddress is the base address of the CTSD16 module.
286 //! \param chargePumpBurstRequest sets the rail-to-rail input charge pump burst
287 //! mode request enabled or disabled.
288 //! Valid values are:
289 //! - \b CTSD16_RTR_INPUT_CHARGEPUMP_BURST_REQUEST_ENABLE
290 //! - \b CTSD16_RTR_INPUT_CHARGEPUMP_BURST_REQUEST_DISABLE [Default]
291 //! \n Modified bits are \b CTSD16RRIBURST of \b CTSD16CTL register.
292 //! \param referenceSelect selects the reference source for the CTSD16 core.
293 //! Valid values are:
294 //! - \b CTSD16_REF_EXTERNAL [Default]
295 //! - \b CTSD16_REF_INTERNAL
296 //! \n Modified bits are \b CTSD16REFS of \b CTSD16CTL register.
297 //!
298 //! \return None
299 //
300 //*****************************************************************************
301 extern void CTSD16_init(uint16_t baseAddress,
302  uint16_t chargePumpBurstRequest,
303  uint8_t referenceSelect);
304 
305 //*****************************************************************************
306 //
307 //! \brief Configure CTSD16 converter
308 //!
309 //! This function initializes a converter of the CTSD16 module. Upon completion
310 //! the converter will be ready for a conversion and can be started with the
311 //! CTSD16_startConverterConversion(). Additional configuration such as data
312 //! format can be configured in CTSD16_setDataFormat().
313 //!
314 //! \param baseAddress is the base address of the CTSD16 module.
315 //! \param converter the converter to initialize.
316 //! Valid values are:
317 //! - \b CTSD16_CONVERTER_0
318 //! - \b CTSD16_CONVERTER_1
319 //! - \b CTSD16_CONVERTER_2
320 //! - \b CTSD16_CONVERTER_3
321 //! - \b CTSD16_CONVERTER_4
322 //! - \b CTSD16_CONVERTER_5
323 //! - \b CTSD16_CONVERTER_6
324 //! \param conversionMode determines whether the converter will do continuous
325 //! samples or a single sample.
326 //! Valid values are:
327 //! - \b CTSD16_CONTINUOUS_MODE [Default]
328 //! - \b CTSD16_SINGLE_MODE
329 //! \n Modified bits are \b CTSD16SNGL of \b CTSD16CTL register.
330 //! \param inputChannel selects oversampling ratio for the converter
331 //! Valid values are:
332 //! - \b CTSD16_INPUT_CH0
333 //! - \b CTSD16_INPUT_CH1
334 //! - \b CTSD16_INPUT_CH2
335 //! - \b CTSD16_INPUT_CH3
336 //! - \b CTSD16_INPUT_CH4
337 //! - \b CTSD16_INPUT_CH5
338 //! - \b CTSD16_INPUT_CH6
339 //! - \b CTSD16_INPUT_CH7
340 //! - \b CTSD16_INPUT_CH8
341 //! - \b CTSD16_INPUT_CH9
342 //! - \b CTSD16_INPUT_CH10
343 //! - \b CTSD16_INPUT_CH11
344 //! - \b CTSD16_INPUT_CH12
345 //! - \b CTSD16_INPUT_CH13
346 //! - \b CTSD16_INPUT_CH14
347 //! - \b CTSD16_INPUT_CH15
348 //! - \b CTSD16_INPUT_CH16
349 //! - \b CTSD16_INPUT_CH17
350 //! - \b CTSD16_INPUT_CH18
351 //! \n Modified bits are \b CTSD16INCHx of \b CTSD16INCTLx register.
352 //!
353 //! \return None
354 //
355 //*****************************************************************************
356 extern void CTSD16_initConverter(uint16_t baseAddress,
357  uint8_t converter,
358  uint16_t conversionMode,
359  uint8_t inputChannel);
360 
361 //*****************************************************************************
362 //
363 //! \brief Configure CTSD16 converter - Advanced Configure
364 //!
365 //! This function initializes a converter of the CTSD16 module with more
366 //! configuration parameters. Upon completion the converter will be ready for a
367 //! conversion and can be started with the CTSD16_startConverterConversion().
368 //!
369 //! \param baseAddress is the base address of the CTSD16 module.
370 //! \param param for initilization
371 //!
372 //! \return None
373 //
374 //*****************************************************************************
375 extern void CTSD16_initConverterAdvanced(uint16_t baseAddress,
376  CTSD16_initConverterAdvancedParam *param);
377 
378 //*****************************************************************************
379 //
380 //! \brief Start Conversion for Converter
381 //!
382 //! This function starts a single converter.
383 //!
384 //! \param baseAddress is the base address of the CTSD16 module.
385 //! \param converter selects the converter that will be started
386 //! Valid values are:
387 //! - \b CTSD16_CONVERTER_0
388 //! - \b CTSD16_CONVERTER_1
389 //! - \b CTSD16_CONVERTER_2
390 //! - \b CTSD16_CONVERTER_3
391 //! - \b CTSD16_CONVERTER_4
392 //! - \b CTSD16_CONVERTER_5
393 //! - \b CTSD16_CONVERTER_6
394 //! \n Modified bits are \b CTSD16SC of \b CTSD16CCTLx register.
395 //!
396 //! \return None
397 //
398 //*****************************************************************************
399 extern void CTSD16_startConverterConversion(uint16_t baseAddress,
400  uint8_t converter);
401 
402 //*****************************************************************************
403 //
404 //! \brief Stop Conversion for Converter
405 //!
406 //! This function stops a single converter.
407 //!
408 //! \param baseAddress is the base address of the CTSD16 module.
409 //! \param converter selects the converter that will be stopped
410 //! Valid values are:
411 //! - \b CTSD16_CONVERTER_0
412 //! - \b CTSD16_CONVERTER_1
413 //! - \b CTSD16_CONVERTER_2
414 //! - \b CTSD16_CONVERTER_3
415 //! - \b CTSD16_CONVERTER_4
416 //! - \b CTSD16_CONVERTER_5
417 //! - \b CTSD16_CONVERTER_6
418 //! \n Modified bits are \b CTSD16SC of \b CTSD16CCTLx register.
419 //!
420 //! \return None
421 //
422 //*****************************************************************************
423 extern void CTSD16_stopConverterConversion(uint16_t baseAddress,
424  uint8_t converter);
425 
426 //*****************************************************************************
427 //
428 //! \brief Set CTSD16 converter data format
429 //!
430 //! This function sets the converter format so that the resulting data can be
431 //! viewed in either binary or 2's complement.
432 //!
433 //! \param baseAddress is the base address of the CTSD16 module.
434 //! \param converter selects the converter that will be configured. Check check
435 //! datasheet for available converters on device.
436 //! Valid values are:
437 //! - \b CTSD16_CONVERTER_0
438 //! - \b CTSD16_CONVERTER_1
439 //! - \b CTSD16_CONVERTER_2
440 //! - \b CTSD16_CONVERTER_3
441 //! - \b CTSD16_CONVERTER_4
442 //! - \b CTSD16_CONVERTER_5
443 //! - \b CTSD16_CONVERTER_6
444 //! \param dataFormat selects how the data format of the results
445 //! Valid values are:
446 //! - \b CTSD16_DATA_FORMAT_BINARY [Default]
447 //! - \b CTSD16_DATA_FORMAT_2COMPLEMENT
448 //! \n Modified bits are \b CTSD16DFx of \b CTSD16CCTLx register.
449 //!
450 //! \return None
451 //
452 //*****************************************************************************
453 extern void CTSD16_setConverterDataFormat(uint16_t baseAddress,
454  uint8_t converter,
455  uint8_t dataFormat);
456 
457 //*****************************************************************************
458 //
459 //! \brief Set the input channel for specified converter
460 //!
461 //! This function configures the input channel. For MSP430F5xx_6xx devices,
462 //! users can choose either analog input or internal temperature input.
463 //!
464 //! \param baseAddress is the base address of the CTSD16 module.
465 //! \param converter selects the converter that will be configured
466 //! Valid values are:
467 //! - \b CTSD16_CONVERTER_0
468 //! - \b CTSD16_CONVERTER_1
469 //! - \b CTSD16_CONVERTER_2
470 //! - \b CTSD16_CONVERTER_3
471 //! - \b CTSD16_CONVERTER_4
472 //! - \b CTSD16_CONVERTER_5
473 //! - \b CTSD16_CONVERTER_6
474 //! \param inputChannel selects oversampling ratio for the converter
475 //! Valid values are:
476 //! - \b CTSD16_INPUT_CH0
477 //! - \b CTSD16_INPUT_CH1
478 //! - \b CTSD16_INPUT_CH2
479 //! - \b CTSD16_INPUT_CH3
480 //! - \b CTSD16_INPUT_CH4
481 //! - \b CTSD16_INPUT_CH5
482 //! - \b CTSD16_INPUT_CH6
483 //! - \b CTSD16_INPUT_CH7
484 //! - \b CTSD16_INPUT_CH8
485 //! - \b CTSD16_INPUT_CH9
486 //! - \b CTSD16_INPUT_CH10
487 //! - \b CTSD16_INPUT_CH11
488 //! - \b CTSD16_INPUT_CH12
489 //! - \b CTSD16_INPUT_CH13
490 //! - \b CTSD16_INPUT_CH14
491 //! - \b CTSD16_INPUT_CH15
492 //! - \b CTSD16_INPUT_CH16
493 //! - \b CTSD16_INPUT_CH17
494 //! - \b CTSD16_INPUT_CH18
495 //! \n Modified bits are \b CTSD16INCHx of \b CTSD16INCTLx register.
496 //!
497 //! \return None
498 //
499 //*****************************************************************************
500 extern void CTSD16_setInputChannel(uint16_t baseAddress,
501  uint8_t converter,
502  uint8_t inputChannel);
503 
504 //*****************************************************************************
505 //
506 //! \brief Enable/Disable rail-to-rail input for specified converter
507 //!
508 //! This function enable/disables rail-to-rail input for specified converter.
509 //!
510 //! \param baseAddress is the base address of the CTSD16 module.
511 //! \param converter selects the converter that will be configured
512 //! Valid values are:
513 //! - \b CTSD16_CONVERTER_0
514 //! - \b CTSD16_CONVERTER_1
515 //! - \b CTSD16_CONVERTER_2
516 //! - \b CTSD16_CONVERTER_3
517 //! - \b CTSD16_CONVERTER_4
518 //! - \b CTSD16_CONVERTER_5
519 //! - \b CTSD16_CONVERTER_6
520 //! \param railToRailInput sets rail-to-rail input enabled/disabled.
521 //! Valid values are:
522 //! - \b CTSD16_RTR_INPUT_ENABLE
523 //! - \b CTSD16_RTR_INPUT_DISABLE [Default]
524 //! \n Modified bits are \b CTSD16RRI of \b CTSD16INCTLx register.
525 //!
526 //! \return None
527 //
528 //*****************************************************************************
529 extern void CTSD16_setRailToRailInput(uint16_t baseAddress,
530  uint8_t converter,
531  uint16_t railToRailInput);
532 
533 //*****************************************************************************
534 //
535 //! \brief Configures the delay for an interrupt to trigger
536 //!
537 //! This function configures the delay for the first interrupt service request
538 //! for the corresponding converter. This feature delays the interrupt request
539 //! for a completed conversion by up to four conversion cycles allowing the
540 //! digital filter to settle prior to generating an interrupt request.
541 //!
542 //! \param baseAddress is the base address of the CTSD16 module.
543 //! \param converter selects the converter that will be stopped
544 //! Valid values are:
545 //! - \b CTSD16_CONVERTER_0
546 //! - \b CTSD16_CONVERTER_1
547 //! - \b CTSD16_CONVERTER_2
548 //! - \b CTSD16_CONVERTER_3
549 //! - \b CTSD16_CONVERTER_4
550 //! - \b CTSD16_CONVERTER_5
551 //! - \b CTSD16_CONVERTER_6
552 //! \param interruptDelay selects the delay for the interrupt
553 //! Valid values are:
554 //! - \b CTSD16_FIRST_SAMPLE_INTERRUPT
555 //! - \b CTSD16_FOURTH_SAMPLE_INTERRUPT [Default]
556 //! \n Modified bits are \b CTSD16INTDLYx of \b CTSD16INCTLx register.
557 //!
558 //! \return None
559 //
560 //*****************************************************************************
561 extern void CTSD16_setInterruptDelay(uint16_t baseAddress,
562  uint8_t converter,
563  uint16_t interruptDelay);
564 
565 //*****************************************************************************
566 //
567 //! \brief Configures the oversampling ratio for a converter
568 //!
569 //! This function configures the oversampling ratio for a given converter.
570 //!
571 //! \param baseAddress is the base address of the CTSD16 module.
572 //! \param converter selects the converter that will be configured
573 //! Valid values are:
574 //! - \b CTSD16_CONVERTER_0
575 //! - \b CTSD16_CONVERTER_1
576 //! - \b CTSD16_CONVERTER_2
577 //! - \b CTSD16_CONVERTER_3
578 //! - \b CTSD16_CONVERTER_4
579 //! - \b CTSD16_CONVERTER_5
580 //! - \b CTSD16_CONVERTER_6
581 //! \param oversampleRatio selects oversampling ratio for the converter
582 //! Valid values are:
583 //! - \b CTSD16_OVERSAMPLE_32
584 //! - \b CTSD16_OVERSAMPLE_64
585 //! - \b CTSD16_OVERSAMPLE_128
586 //! - \b CTSD16_OVERSAMPLE_256 [Default]
587 //! \n Modified bits are \b CTSD16OSRx of \b CTSD16CCTLx register.
588 //!
589 //! \return None
590 //
591 //*****************************************************************************
592 extern void CTSD16_setOversampling(uint16_t baseAddress,
593  uint8_t converter,
594  uint16_t oversampleRatio);
595 
596 //*****************************************************************************
597 //
598 //! \brief Configures the gain for the converter
599 //!
600 //! This function configures the gain for a single converter.
601 //!
602 //! \param baseAddress is the base address of the CTSD16 module.
603 //! \param converter selects the converter that will be configured
604 //! Valid values are:
605 //! - \b CTSD16_CONVERTER_0
606 //! - \b CTSD16_CONVERTER_1
607 //! - \b CTSD16_CONVERTER_2
608 //! - \b CTSD16_CONVERTER_3
609 //! - \b CTSD16_CONVERTER_4
610 //! - \b CTSD16_CONVERTER_5
611 //! - \b CTSD16_CONVERTER_6
612 //! \param gain selects the gain for the converter
613 //! Valid values are:
614 //! - \b CTSD16_GAIN_1 [Default]
615 //! - \b CTSD16_GAIN_2
616 //! - \b CTSD16_GAIN_4
617 //! - \b CTSD16_GAIN_8
618 //! - \b CTSD16_GAIN_16
619 //! \n Modified bits are \b CTSD16GAINx of \b CTSD16INCTLx register.
620 //!
621 //! \return None
622 //
623 //*****************************************************************************
624 extern void CTSD16_setGain(uint16_t baseAddress,
625  uint8_t converter,
626  uint8_t gain);
627 
628 //*****************************************************************************
629 //
630 //! \brief Returns the results for a converter
631 //!
632 //! This function gets the results from the CTSD16MEMx register for upper
633 //! 16-bit and lower 16-bit results, and concatenates them to form a long. The
634 //! actual result is a maximum 24 bits.
635 //!
636 //! \param baseAddress is the base address of the CTSD16 module.
637 //! \param converter selects the converter who's results will be returned
638 //! Valid values are:
639 //! - \b CTSD16_CONVERTER_0
640 //! - \b CTSD16_CONVERTER_1
641 //! - \b CTSD16_CONVERTER_2
642 //! - \b CTSD16_CONVERTER_3
643 //! - \b CTSD16_CONVERTER_4
644 //! - \b CTSD16_CONVERTER_5
645 //! - \b CTSD16_CONVERTER_6
646 //!
647 //! \return Result of conversion
648 //
649 //*****************************************************************************
650 extern uint32_t CTSD16_getResults(uint16_t baseAddress,
651  uint8_t converter);
652 
653 //*****************************************************************************
654 //
655 //! \brief Returns the high word results for a converter
656 //!
657 //! This function gets the upper 16-bit result from the CTSD16MEMx register and
658 //! returns it.
659 //!
660 //! \param baseAddress is the base address of the CTSD16 module.
661 //! \param converter selects the converter who's results will be returned
662 //! Valid values are:
663 //! - \b CTSD16_CONVERTER_0
664 //! - \b CTSD16_CONVERTER_1
665 //! - \b CTSD16_CONVERTER_2
666 //! - \b CTSD16_CONVERTER_3
667 //! - \b CTSD16_CONVERTER_4
668 //! - \b CTSD16_CONVERTER_5
669 //! - \b CTSD16_CONVERTER_6
670 //!
671 //! \return High word result of conversion
672 //
673 //*****************************************************************************
674 extern uint16_t CTSD16_getHighWordResults(uint16_t baseAddress,
675  uint8_t converter);
676 
677 //*****************************************************************************
678 //
679 //! \brief Returns the rail-to-rail input ready status
680 //!
681 //! This function returns the rail-to-rail input ready status.
682 //!
683 //! \param baseAddress is the base address of the CTSD16 module.
684 //!
685 //! \return ready status
686 //! Return Logical OR of any of the following:
687 //! - \b CTSD16_RTR_INPUT_READY
688 //! - \b CTSD16_RTR_INPUT_NOT_READY
689 //! \n Returns the rail-to-rail input ready status.
690 //
691 //*****************************************************************************
692 extern uint16_t CTSD16_isRailToRailInputReady(uint16_t baseAddress);
693 
694 //*****************************************************************************
695 //
696 //! \brief Enables interrupts for the CTSD16 Module
697 //!
698 //! This function enables interrupts for the CTSD16 module. Does not clear
699 //! interrupt flags.
700 //!
701 //! \param baseAddress is the base address of the CTSD16 module.
702 //! \param converter is the selected converter.
703 //! Valid values are:
704 //! - \b CTSD16_CONVERTER_0
705 //! - \b CTSD16_CONVERTER_1
706 //! - \b CTSD16_CONVERTER_2
707 //! - \b CTSD16_CONVERTER_3
708 //! - \b CTSD16_CONVERTER_4
709 //! - \b CTSD16_CONVERTER_5
710 //! - \b CTSD16_CONVERTER_6
711 //! \param mask is the bit mask of the converter interrupt sources to be
712 //! enabled.
713 //! Mask value is the logical OR of any of the following:
714 //! - \b CTSD16_CONVERTER_INTERRUPT
715 //! - \b CTSD16_CONVERTER_OVERFLOW_INTERRUPT
716 //! \n Modified bits are \b CTSD16OVIEx of \b CTSD16IE register.
717 //!
718 //! \return None
719 //
720 //*****************************************************************************
721 extern void CTSD16_enableInterrupt(uint16_t baseAddress,
722  uint8_t converter,
723  uint16_t mask);
724 
725 //*****************************************************************************
726 //
727 //! \brief Disables interrupts for the CTSD16 Module
728 //!
729 //! This function disables interrupts for the CTSD16 module.
730 //!
731 //! \param baseAddress is the base address of the CTSD16 module.
732 //! \param converter is the selected converter.
733 //! Valid values are:
734 //! - \b CTSD16_CONVERTER_0
735 //! - \b CTSD16_CONVERTER_1
736 //! - \b CTSD16_CONVERTER_2
737 //! - \b CTSD16_CONVERTER_3
738 //! - \b CTSD16_CONVERTER_4
739 //! - \b CTSD16_CONVERTER_5
740 //! - \b CTSD16_CONVERTER_6
741 //! \param mask is the bit mask of the converter interrupt sources to be
742 //! disabled.
743 //! Mask value is the logical OR of any of the following:
744 //! - \b CTSD16_CONVERTER_INTERRUPT
745 //! - \b CTSD16_CONVERTER_OVERFLOW_INTERRUPT
746 //! \n Modified bits are \b CTSD16OVIEx of \b CTSD16IE register.
747 //!
748 //! Modified bits of \b SD24BIE register.
749 //!
750 //! \return None
751 //
752 //*****************************************************************************
753 extern void CTSD16_disableInterrupt(uint16_t baseAddress,
754  uint8_t converter,
755  uint16_t mask);
756 
757 //*****************************************************************************
758 //
759 //! \brief Clears interrupts for the CTSD16 Module
760 //!
761 //! This function clears interrupt flags for the CTSD16 module.
762 //!
763 //! \param baseAddress is the base address of the CTSD16 module.
764 //! \param converter is the selected converter.
765 //! Valid values are:
766 //! - \b CTSD16_CONVERTER_0
767 //! - \b CTSD16_CONVERTER_1
768 //! - \b CTSD16_CONVERTER_2
769 //! - \b CTSD16_CONVERTER_3
770 //! - \b CTSD16_CONVERTER_4
771 //! - \b CTSD16_CONVERTER_5
772 //! - \b CTSD16_CONVERTER_6
773 //! \param mask is the bit mask of the converter interrupt sources to clear.
774 //! Mask value is the logical OR of any of the following:
775 //! - \b CTSD16_CONVERTER_INTERRUPT
776 //! - \b CTSD16_CONVERTER_OVERFLOW_INTERRUPT
777 //! \n Modified bits are \b CTSD16OVIFGx of \b CTSD16IFG register.
778 //!
779 //! \return None
780 //
781 //*****************************************************************************
782 extern void CTSD16_clearInterrupt(uint16_t baseAddress,
783  uint8_t converter,
784  uint16_t mask);
785 
786 //*****************************************************************************
787 //
788 //! \brief Returns the interrupt status for the CTSD16 Module
789 //!
790 //! This function returns interrupt flag statuses for the CTSD16 module.
791 //!
792 //! \param baseAddress is the base address of the CTSD16 module.
793 //! \param converter is the selected converter.
794 //! Valid values are:
795 //! - \b CTSD16_CONVERTER_0
796 //! - \b CTSD16_CONVERTER_1
797 //! - \b CTSD16_CONVERTER_2
798 //! - \b CTSD16_CONVERTER_3
799 //! - \b CTSD16_CONVERTER_4
800 //! - \b CTSD16_CONVERTER_5
801 //! - \b CTSD16_CONVERTER_6
802 //! \param mask is the bit mask of the converter interrupt sources to return.
803 //! Mask value is the logical OR of any of the following:
804 //! - \b CTSD16_CONVERTER_INTERRUPT
805 //! - \b CTSD16_CONVERTER_OVERFLOW_INTERRUPT
806 //!
807 //! \return Logical OR of any of the following:
808 //! - \b CTSD16_CONVERTER_INTERRUPT
809 //! - \b CTSD16_CONVERTER_OVERFLOW_INTERRUPT
810 //! \n indicating the status of the masked interrupts
811 //
812 //*****************************************************************************
813 extern uint16_t CTSD16_getInterruptStatus(uint16_t baseAddress,
814  uint8_t converter,
815  uint16_t mask);
816 
817 //*****************************************************************************
818 //
819 // Mark the end of the C bindings section for C++ compilers.
820 //
821 //*****************************************************************************
822 #ifdef __cplusplus
823 }
824 #endif
825 
826 #endif
827 #endif // __MSP430WARE_CTSD16_H__

Copyright 2020, Texas Instruments Incorporated