MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.91.13.01
timer_a.h
1 //*****************************************************************************
2 //
3 // timer_a.h - Driver for the TIMER_A Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_TIMER_A_H__
8 #define __MSP430WARE_TIMER_A_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_TxA7__
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 // The following is a parameter used for Timer_A_getCounterValue that
29 // determines the maximum difference in counts of the TAxR register for a
30 // majority vote.
31 //
32 //*****************************************************************************
33 #define TIMER_A_THRESHOLD 50
34 
35 //*****************************************************************************
36 //
37 //! \brief Used in the Timer_A_initContinuousMode() function as the param
38 //! parameter.
39 //
40 //*****************************************************************************
42  //! Selects Clock source.
43  //! \n Valid values are:
44  //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
45  //! - \b TIMER_A_CLOCKSOURCE_ACLK
46  //! - \b TIMER_A_CLOCKSOURCE_SMCLK
47  //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
48  uint16_t clockSource;
49  //! Is the desired divider for the clock source
50  //! \n Valid values are:
51  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default]
52  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
53  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
54  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
55  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
56  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
57  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
58  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
59  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
60  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
61  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
62  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
63  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
64  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
65  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
66  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
67  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
68  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
69  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
70  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
72  //! Is to enable or disable Timer_A interrupt
73  //! \n Valid values are:
74  //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE
75  //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default]
77  //! Decides if Timer_A clock divider, count direction, count need to be
78  //! reset.
79  //! \n Valid values are:
80  //! - \b TIMER_A_DO_CLEAR
81  //! - \b TIMER_A_SKIP_CLEAR [Default]
82  uint16_t timerClear;
83  //! Whether to start the timer immediately
84  bool startTimer;
86 
87 //*****************************************************************************
88 //
89 //! \brief Used in the Timer_A_initCaptureMode() function as the param
90 //! parameter.
91 //
92 //*****************************************************************************
94  //! Selects the Capture register being used. Refer to datasheet to ensure
95  //! the device has the capture compare register being used.
96  //! \n Valid values are:
97  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
98  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
99  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
100  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
101  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
102  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
103  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
104  uint16_t captureRegister;
105  //! Is the capture mode selected.
106  //! \n Valid values are:
107  //! - \b TIMER_A_CAPTUREMODE_NO_CAPTURE [Default]
108  //! - \b TIMER_A_CAPTUREMODE_RISING_EDGE
109  //! - \b TIMER_A_CAPTUREMODE_FALLING_EDGE
110  //! - \b TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE
111  uint16_t captureMode;
112  //! Decides the Input Select
113  //! \n Valid values are:
114  //! - \b TIMER_A_CAPTURE_INPUTSELECT_CCIxA
115  //! - \b TIMER_A_CAPTURE_INPUTSELECT_CCIxB
116  //! - \b TIMER_A_CAPTURE_INPUTSELECT_GND
117  //! - \b TIMER_A_CAPTURE_INPUTSELECT_Vcc
119  //! Decides if capture source should be synchronized with timer clock
120  //! \n Valid values are:
121  //! - \b TIMER_A_CAPTURE_ASYNCHRONOUS [Default]
122  //! - \b TIMER_A_CAPTURE_SYNCHRONOUS
124  //! Is to enable or disable timer captureComapre interrupt.
125  //! \n Valid values are:
126  //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default]
127  //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE
129  //! Specifies the output mode.
130  //! \n Valid values are:
131  //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default]
132  //! - \b TIMER_A_OUTPUTMODE_SET
133  //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET
134  //! - \b TIMER_A_OUTPUTMODE_SET_RESET
135  //! - \b TIMER_A_OUTPUTMODE_TOGGLE
136  //! - \b TIMER_A_OUTPUTMODE_RESET
137  //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET
138  //! - \b TIMER_A_OUTPUTMODE_RESET_SET
141 
142 //*****************************************************************************
143 //
144 //! \brief Used in the Timer_A_initUpDownMode() function as the param
145 //! parameter.
146 //
147 //*****************************************************************************
149  //! Selects Clock source.
150  //! \n Valid values are:
151  //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
152  //! - \b TIMER_A_CLOCKSOURCE_ACLK
153  //! - \b TIMER_A_CLOCKSOURCE_SMCLK
154  //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
155  uint16_t clockSource;
156  //! Is the desired divider for the clock source
157  //! \n Valid values are:
158  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default]
159  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
160  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
161  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
162  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
163  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
164  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
165  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
166  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
167  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
168  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
169  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
170  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
171  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
172  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
173  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
174  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
175  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
176  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
177  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
179  //! Is the specified Timer_A period
180  uint16_t timerPeriod;
181  //! Is to enable or disable Timer_A interrupt
182  //! \n Valid values are:
183  //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE
184  //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default]
186  //! Is to enable or disable Timer_A CCR0 captureComapre interrupt.
187  //! \n Valid values are:
188  //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE
189  //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default]
191  //! Decides if Timer_A clock divider, count direction, count need to be
192  //! reset.
193  //! \n Valid values are:
194  //! - \b TIMER_A_DO_CLEAR
195  //! - \b TIMER_A_SKIP_CLEAR [Default]
196  uint16_t timerClear;
197  //! Whether to start the timer immediately
200 
201 //*****************************************************************************
202 //
203 //! \brief Used in the Timer_A_outputPWM() function as the param parameter.
204 //
205 //*****************************************************************************
206 typedef struct Timer_A_outputPWMParam {
207  //! Selects Clock source.
208  //! \n Valid values are:
209  //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
210  //! - \b TIMER_A_CLOCKSOURCE_ACLK
211  //! - \b TIMER_A_CLOCKSOURCE_SMCLK
212  //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
213  uint16_t clockSource;
214  //! Is the desired divider for the clock source
215  //! \n Valid values are:
216  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default]
217  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
218  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
219  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
220  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
221  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
222  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
223  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
224  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
225  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
226  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
227  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
228  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
229  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
230  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
231  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
232  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
233  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
234  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
235  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
237  //! Selects the desired timer period
238  uint16_t timerPeriod;
239  //! Selects the compare register being used. Refer to datasheet to ensure
240  //! the device has the capture compare register being used.
241  //! \n Valid values are:
242  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
243  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
244  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
245  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
246  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
247  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
248  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
249  uint16_t compareRegister;
250  //! Specifies the output mode.
251  //! \n Valid values are:
252  //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default]
253  //! - \b TIMER_A_OUTPUTMODE_SET
254  //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET
255  //! - \b TIMER_A_OUTPUTMODE_SET_RESET
256  //! - \b TIMER_A_OUTPUTMODE_TOGGLE
257  //! - \b TIMER_A_OUTPUTMODE_RESET
258  //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET
259  //! - \b TIMER_A_OUTPUTMODE_RESET_SET
261  //! Specifies the dutycycle for the generated waveform
262  uint16_t dutyCycle;
264 
265 //*****************************************************************************
266 //
267 //! \brief Used in the Timer_A_initUpMode() function as the param parameter.
268 //
269 //*****************************************************************************
270 typedef struct Timer_A_initUpModeParam {
271  //! Selects Clock source.
272  //! \n Valid values are:
273  //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
274  //! - \b TIMER_A_CLOCKSOURCE_ACLK
275  //! - \b TIMER_A_CLOCKSOURCE_SMCLK
276  //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
277  uint16_t clockSource;
278  //! Is the desired divider for the clock source
279  //! \n Valid values are:
280  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default]
281  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
282  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
283  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
284  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
285  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
286  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
287  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
288  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
289  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
290  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
291  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
292  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
293  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
294  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
295  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
296  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
297  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
298  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
299  //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
301  //! Is the specified Timer_A period. This is the value that gets written
302  //! into the CCR0. Limited to 16 bits[uint16_t]
303  uint16_t timerPeriod;
304  //! Is to enable or disable Timer_A interrupt
305  //! \n Valid values are:
306  //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE
307  //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default]
309  //! Is to enable or disable Timer_A CCR0 captureComapre interrupt.
310  //! \n Valid values are:
311  //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE
312  //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default]
314  //! Decides if Timer_A clock divider, count direction, count need to be
315  //! reset.
316  //! \n Valid values are:
317  //! - \b TIMER_A_DO_CLEAR
318  //! - \b TIMER_A_SKIP_CLEAR [Default]
319  uint16_t timerClear;
320  //! Whether to start the timer immediately
323 
324 //*****************************************************************************
325 //
326 //! \brief Used in the Timer_A_initCompareMode() function as the param
327 //! parameter.
328 //
329 //*****************************************************************************
331  //! Selects the Capture register being used. Refer to datasheet to ensure
332  //! the device has the capture compare register being used.
333  //! \n Valid values are:
334  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
335  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
336  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
337  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
338  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
339  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
340  //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
341  uint16_t compareRegister;
342  //! Is to enable or disable timer captureComapre interrupt.
343  //! \n Valid values are:
344  //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default]
345  //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE
347  //! Specifies the output mode.
348  //! \n Valid values are:
349  //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default]
350  //! - \b TIMER_A_OUTPUTMODE_SET
351  //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET
352  //! - \b TIMER_A_OUTPUTMODE_SET_RESET
353  //! - \b TIMER_A_OUTPUTMODE_TOGGLE
354  //! - \b TIMER_A_OUTPUTMODE_RESET
355  //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET
356  //! - \b TIMER_A_OUTPUTMODE_RESET_SET
358  //! Is the count to be compared with in compare mode
359  uint16_t compareValue;
361 
362 
363 //*****************************************************************************
364 //
365 // The following are values that can be passed to the param parameter for
366 // functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(),
367 // Timer_A_initUpDownMode(), and Timer_A_outputPWM().
368 //
369 //*****************************************************************************
370 #define TIMER_A_CLOCKSOURCE_DIVIDER_1 0x00
371 #define TIMER_A_CLOCKSOURCE_DIVIDER_2 0x08
372 #define TIMER_A_CLOCKSOURCE_DIVIDER_3 0x02
373 #define TIMER_A_CLOCKSOURCE_DIVIDER_4 0x10
374 #define TIMER_A_CLOCKSOURCE_DIVIDER_5 0x04
375 #define TIMER_A_CLOCKSOURCE_DIVIDER_6 0x05
376 #define TIMER_A_CLOCKSOURCE_DIVIDER_7 0x06
377 #define TIMER_A_CLOCKSOURCE_DIVIDER_8 0x18
378 #define TIMER_A_CLOCKSOURCE_DIVIDER_10 0x0C
379 #define TIMER_A_CLOCKSOURCE_DIVIDER_12 0x0D
380 #define TIMER_A_CLOCKSOURCE_DIVIDER_14 0x0E
381 #define TIMER_A_CLOCKSOURCE_DIVIDER_16 0x0F
382 #define TIMER_A_CLOCKSOURCE_DIVIDER_20 0x14
383 #define TIMER_A_CLOCKSOURCE_DIVIDER_24 0x15
384 #define TIMER_A_CLOCKSOURCE_DIVIDER_28 0x16
385 #define TIMER_A_CLOCKSOURCE_DIVIDER_32 0x17
386 #define TIMER_A_CLOCKSOURCE_DIVIDER_40 0x1C
387 #define TIMER_A_CLOCKSOURCE_DIVIDER_48 0x1D
388 #define TIMER_A_CLOCKSOURCE_DIVIDER_56 0x1E
389 #define TIMER_A_CLOCKSOURCE_DIVIDER_64 0x1F
390 
391 //*****************************************************************************
392 //
393 // The following are values that can be passed to the timerMode parameter for
394 // functions: Timer_A_startCounter().
395 //
396 //*****************************************************************************
397 #define TIMER_A_STOP_MODE MC_0
398 #define TIMER_A_UP_MODE MC_1
399 #define TIMER_A_CONTINUOUS_MODE MC_2
400 #define TIMER_A_UPDOWN_MODE MC_3
401 
402 //*****************************************************************************
403 //
404 // The following are values that can be passed to the param parameter for
405 // functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(), and
406 // Timer_A_initUpDownMode().
407 //
408 //*****************************************************************************
409 #define TIMER_A_DO_CLEAR TACLR
410 #define TIMER_A_SKIP_CLEAR 0x00
411 
412 //*****************************************************************************
413 //
414 // The following are values that can be passed to the param parameter for
415 // functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(),
416 // Timer_A_initUpDownMode(), and Timer_A_outputPWM().
417 //
418 //*****************************************************************************
419 #define TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK TASSEL__TACLK
420 #define TIMER_A_CLOCKSOURCE_ACLK TASSEL__ACLK
421 #define TIMER_A_CLOCKSOURCE_SMCLK TASSEL__SMCLK
422 #define TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK TASSEL__INCLK
423 
424 //*****************************************************************************
425 //
426 // The following are values that can be passed to the param parameter for
427 // functions: Timer_A_initContinuousMode(), Timer_A_initUpMode(), and
428 // Timer_A_initUpDownMode().
429 //
430 //*****************************************************************************
431 #define TIMER_A_TAIE_INTERRUPT_ENABLE TAIE
432 #define TIMER_A_TAIE_INTERRUPT_DISABLE 0x00
433 
434 //*****************************************************************************
435 //
436 // The following are values that can be passed to the param parameter for
437 // functions: Timer_A_initUpMode(), and Timer_A_initUpDownMode().
438 //
439 //*****************************************************************************
440 #define TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE CCIE
441 #define TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE 0x00
442 
443 //*****************************************************************************
444 //
445 // The following are values that can be passed to the param parameter for
446 // functions: Timer_A_initCaptureMode(), and Timer_A_initCompareMode().
447 //
448 //*****************************************************************************
449 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE 0x00
450 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE CCIE
451 
452 //*****************************************************************************
453 //
454 // The following are values that can be passed to the param parameter for
455 // functions: Timer_A_initCaptureMode().
456 //
457 //*****************************************************************************
458 #define TIMER_A_CAPTURE_INPUTSELECT_CCIxA CCIS_0
459 #define TIMER_A_CAPTURE_INPUTSELECT_CCIxB CCIS_1
460 #define TIMER_A_CAPTURE_INPUTSELECT_GND CCIS_2
461 #define TIMER_A_CAPTURE_INPUTSELECT_Vcc CCIS_3
462 
463 //*****************************************************************************
464 //
465 // The following are values that can be passed to the compareOutputMode
466 // parameter for functions: Timer_A_setOutputMode(); the param parameter for
467 // functions: Timer_A_initCaptureMode(), Timer_A_initCompareMode(), and
468 // Timer_A_outputPWM().
469 //
470 //*****************************************************************************
471 #define TIMER_A_OUTPUTMODE_OUTBITVALUE OUTMOD_0
472 #define TIMER_A_OUTPUTMODE_SET OUTMOD_1
473 #define TIMER_A_OUTPUTMODE_TOGGLE_RESET OUTMOD_2
474 #define TIMER_A_OUTPUTMODE_SET_RESET OUTMOD_3
475 #define TIMER_A_OUTPUTMODE_TOGGLE OUTMOD_4
476 #define TIMER_A_OUTPUTMODE_RESET OUTMOD_5
477 #define TIMER_A_OUTPUTMODE_TOGGLE_SET OUTMOD_6
478 #define TIMER_A_OUTPUTMODE_RESET_SET OUTMOD_7
479 
480 //*****************************************************************************
481 //
482 // The following are values that can be passed to the compareRegister parameter
483 // for functions: Timer_A_setCompareValue(), and Timer_A_setOutputMode(); the
484 // captureCompareRegister parameter for functions:
485 // Timer_A_enableCaptureCompareInterrupt(),
486 // Timer_A_disableCaptureCompareInterrupt(),
487 // Timer_A_getCaptureCompareInterruptStatus(),
488 // Timer_A_getSynchronizedCaptureCompareInput(),
489 // Timer_A_getOutputForOutputModeOutBitValue(),
490 // Timer_A_getCaptureCompareCount(),
491 // Timer_A_setOutputForOutputModeOutBitValue(), and
492 // Timer_A_clearCaptureCompareInterrupt(); the param parameter for functions:
493 // Timer_A_initCaptureMode(), Timer_A_initCompareMode(), and
494 // Timer_A_outputPWM().
495 //
496 //*****************************************************************************
497 #define TIMER_A_CAPTURECOMPARE_REGISTER_0 0x02
498 #define TIMER_A_CAPTURECOMPARE_REGISTER_1 0x04
499 #define TIMER_A_CAPTURECOMPARE_REGISTER_2 0x06
500 #define TIMER_A_CAPTURECOMPARE_REGISTER_3 0x08
501 #define TIMER_A_CAPTURECOMPARE_REGISTER_4 0x0A
502 #define TIMER_A_CAPTURECOMPARE_REGISTER_5 0x0C
503 #define TIMER_A_CAPTURECOMPARE_REGISTER_6 0x0E
504 
505 //*****************************************************************************
506 //
507 // The following are values that can be passed to the param parameter for
508 // functions: Timer_A_initCaptureMode().
509 //
510 //*****************************************************************************
511 #define TIMER_A_CAPTUREMODE_NO_CAPTURE CM_0
512 #define TIMER_A_CAPTUREMODE_RISING_EDGE CM_1
513 #define TIMER_A_CAPTUREMODE_FALLING_EDGE CM_2
514 #define TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE CM_3
515 
516 //*****************************************************************************
517 //
518 // The following are values that can be passed to the param parameter for
519 // functions: Timer_A_initCaptureMode().
520 //
521 //*****************************************************************************
522 #define TIMER_A_CAPTURE_ASYNCHRONOUS 0x00
523 #define TIMER_A_CAPTURE_SYNCHRONOUS SCS
524 
525 //*****************************************************************************
526 //
527 // The following are values that can be passed to the mask parameter for
528 // functions: Timer_A_getCaptureCompareInterruptStatus() as well as returned by
529 // the Timer_A_getCaptureCompareInterruptStatus() function.
530 //
531 //*****************************************************************************
532 #define TIMER_A_CAPTURE_OVERFLOW COV
533 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG CCIFG
534 
535 //*****************************************************************************
536 //
537 // The following are values that can be passed to the synchronized parameter
538 // for functions: Timer_A_getSynchronizedCaptureCompareInput().
539 //
540 //*****************************************************************************
541 #define TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT SCCI
542 #define TIMER_A_READ_CAPTURE_COMPARE_INPUT CCI
543 
544 //*****************************************************************************
545 //
546 // The following are values that can be passed toThe following are values that
547 // can be returned by the Timer_A_getSynchronizedCaptureCompareInput()
548 // function.
549 //
550 //*****************************************************************************
551 #define TIMER_A_CAPTURECOMPARE_INPUT_HIGH 0x01
552 #define TIMER_A_CAPTURECOMPARE_INPUT_LOW 0x00
553 
554 //*****************************************************************************
555 //
556 // The following are values that can be passed to the outputModeOutBitValue
557 // parameter for functions: Timer_A_setOutputForOutputModeOutBitValue() as well
558 // as returned by the Timer_A_getOutputForOutputModeOutBitValue() function.
559 //
560 //*****************************************************************************
561 #define TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH OUT
562 #define TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW 0x00
563 
564 //*****************************************************************************
565 //
566 // The following are values that can be passed toThe following are values that
567 // can be returned by the Timer_A_getInterruptStatus() function.
568 //
569 //*****************************************************************************
570 #define TIMER_A_INTERRUPT_NOT_PENDING 0x00
571 #define TIMER_A_INTERRUPT_PENDING 0x01
572 
573 //*****************************************************************************
574 //
575 // Prototypes for the APIs.
576 //
577 //*****************************************************************************
578 
579 //*****************************************************************************
580 //
581 //! \brief Starts Timer_A counter
582 //!
583 //! This function assumes that the timer has been previously configured using
584 //! Timer_A_initContinuousMode, Timer_A_initUpMode or Timer_A_initUpDownMode.
585 //!
586 //! \param baseAddress is the base address of the TIMER_A module.
587 //! \param timerMode mode to put the timer in
588 //! Valid values are:
589 //! - \b TIMER_A_STOP_MODE
590 //! - \b TIMER_A_UP_MODE
591 //! - \b TIMER_A_CONTINUOUS_MODE [Default]
592 //! - \b TIMER_A_UPDOWN_MODE
593 //!
594 //! Modified bits of \b TAxCTL register.
595 //!
596 //! \return None
597 //
598 //*****************************************************************************
599 extern void Timer_A_startCounter(uint16_t baseAddress,
600  uint16_t timerMode);
601 
602 //*****************************************************************************
603 //
604 //! \brief Configures Timer_A in continuous mode.
605 //!
606 //! \param baseAddress is the base address of the TIMER_A module.
607 //! \param param is the pointer to struct for continuous mode initialization.
608 //!
609 //! Modified bits of \b TAxCTL register.
610 //!
611 //! \return None
612 //
613 //*****************************************************************************
614 extern void Timer_A_initContinuousMode(uint16_t baseAddress,
616 
617 //*****************************************************************************
618 //
619 //! \brief Configures Timer_A in up mode.
620 //!
621 //! \param baseAddress is the base address of the TIMER_A module.
622 //! \param param is the pointer to struct for up mode initialization.
623 //!
624 //! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register and bits
625 //! of \b TAxCCR0 register.
626 //!
627 //! \return None
628 //
629 //*****************************************************************************
630 extern void Timer_A_initUpMode(uint16_t baseAddress,
631  Timer_A_initUpModeParam *param);
632 
633 //*****************************************************************************
634 //
635 //! \brief Configures Timer_A in up down mode.
636 //!
637 //! \param baseAddress is the base address of the TIMER_A module.
638 //! \param param is the pointer to struct for up-down mode initialization.
639 //!
640 //! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register and bits
641 //! of \b TAxCCR0 register.
642 //!
643 //! \return None
644 //
645 //*****************************************************************************
646 extern void Timer_A_initUpDownMode(uint16_t baseAddress,
648 
649 //*****************************************************************************
650 //
651 //! \brief Initializes Capture Mode
652 //!
653 //! \param baseAddress is the base address of the TIMER_A module.
654 //! \param param is the pointer to struct for capture mode initialization.
655 //!
656 //! Modified bits of \b TAxCCTLn register.
657 //!
658 //! \return None
659 //
660 //*****************************************************************************
661 extern void Timer_A_initCaptureMode(uint16_t baseAddress,
663 
664 //*****************************************************************************
665 //
666 //! \brief Initializes Compare Mode
667 //!
668 //! \param baseAddress is the base address of the TIMER_A module.
669 //! \param param is the pointer to struct for compare mode initialization.
670 //!
671 //! Modified bits of \b TAxCCRn register and bits of \b TAxCCTLn register.
672 //!
673 //! \return None
674 //
675 //*****************************************************************************
676 extern void Timer_A_initCompareMode(uint16_t baseAddress,
678 
679 //*****************************************************************************
680 //
681 //! \brief Enable timer interrupt
682 //!
683 //! Does not clear interrupt flags
684 //!
685 //! \param baseAddress is the base address of the TIMER_A module.
686 //!
687 //! Modified bits of \b TAxCTL register.
688 //!
689 //! \return None
690 //
691 //*****************************************************************************
692 extern void Timer_A_enableInterrupt(uint16_t baseAddress);
693 
694 //*****************************************************************************
695 //
696 //! \brief Disable timer interrupt
697 //!
698 //! \param baseAddress is the base address of the TIMER_A module.
699 //!
700 //! Modified bits of \b TAxCTL register.
701 //!
702 //! \return None
703 //
704 //*****************************************************************************
705 extern void Timer_A_disableInterrupt(uint16_t baseAddress);
706 
707 //*****************************************************************************
708 //
709 //! \brief Get timer interrupt status
710 //!
711 //! \param baseAddress is the base address of the TIMER_A module.
712 //!
713 //! \return One of the following:
714 //! - \b TIMER_A_INTERRUPT_NOT_PENDING
715 //! - \b TIMER_A_INTERRUPT_PENDING
716 //! \n indicating the Timer_A interrupt status
717 //
718 //*****************************************************************************
719 extern uint32_t Timer_A_getInterruptStatus(uint16_t baseAddress);
720 
721 //*****************************************************************************
722 //
723 //! \brief Enable capture compare interrupt
724 //!
725 //! Does not clear interrupt flags
726 //!
727 //! \param baseAddress is the base address of the TIMER_A module.
728 //! \param captureCompareRegister is the selected capture compare register
729 //! Valid values are:
730 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
731 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
732 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
733 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
734 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
735 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
736 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
737 //!
738 //! Modified bits of \b TAxCCTLn register.
739 //!
740 //! \return None
741 //
742 //*****************************************************************************
743 extern void Timer_A_enableCaptureCompareInterrupt(uint16_t baseAddress,
744  uint16_t captureCompareRegister);
745 
746 //*****************************************************************************
747 //
748 //! \brief Disable capture compare interrupt
749 //!
750 //! \param baseAddress is the base address of the TIMER_A module.
751 //! \param captureCompareRegister is the selected capture compare register
752 //! Valid values are:
753 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
754 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
755 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
756 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
757 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
758 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
759 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
760 //!
761 //! Modified bits of \b TAxCCTLn register.
762 //!
763 //! \return None
764 //
765 //*****************************************************************************
766 extern void Timer_A_disableCaptureCompareInterrupt(uint16_t baseAddress,
767  uint16_t captureCompareRegister);
768 
769 //*****************************************************************************
770 //
771 //! \brief Return capture compare interrupt status
772 //!
773 //! \param baseAddress is the base address of the TIMER_A module.
774 //! \param captureCompareRegister is the selected capture compare register
775 //! Valid values are:
776 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
777 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
778 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
779 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
780 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
781 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
782 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
783 //! \param mask is the mask for the interrupt status
784 //! Mask value is the logical OR of any of the following:
785 //! - \b TIMER_A_CAPTURE_OVERFLOW
786 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG
787 //!
788 //! \return Logical OR of any of the following:
789 //! - \b TIMER_A_CAPTURE_OVERFLOW
790 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG
791 //! \n indicating the status of the masked interrupts
792 //
793 //*****************************************************************************
794 extern uint32_t Timer_A_getCaptureCompareInterruptStatus(uint16_t baseAddress,
795  uint16_t captureCompareRegister,
796  uint16_t mask);
797 
798 //*****************************************************************************
799 //
800 //! \brief Reset/Clear the timer clock divider, count direction, count
801 //!
802 //! \param baseAddress is the base address of the TIMER_A module.
803 //!
804 //! Modified bits of \b TAxCTL register.
805 //!
806 //! \return None
807 //
808 //*****************************************************************************
809 extern void Timer_A_clear(uint16_t baseAddress);
810 
811 //*****************************************************************************
812 //
813 //! \brief Get synchronized capturecompare input
814 //!
815 //! \param baseAddress is the base address of the TIMER_A module.
816 //! \param captureCompareRegister
817 //! Valid values are:
818 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
819 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
820 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
821 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
822 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
823 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
824 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
825 //! \param synchronized
826 //! Valid values are:
827 //! - \b TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT
828 //! - \b TIMER_A_READ_CAPTURE_COMPARE_INPUT
829 //!
830 //! \return One of the following:
831 //! - \b TIMER_A_CAPTURECOMPARE_INPUT_HIGH
832 //! - \b TIMER_A_CAPTURECOMPARE_INPUT_LOW
833 //
834 //*****************************************************************************
835 extern uint8_t Timer_A_getSynchronizedCaptureCompareInput(uint16_t baseAddress,
836  uint16_t captureCompareRegister,
837  uint16_t synchronized);
838 
839 //*****************************************************************************
840 //
841 //! \brief Get output bit for output mode
842 //!
843 //! \param baseAddress is the base address of the TIMER_A module.
844 //! \param captureCompareRegister
845 //! Valid values are:
846 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
847 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
848 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
849 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
850 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
851 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
852 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
853 //!
854 //! \return One of the following:
855 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH
856 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW
857 //
858 //*****************************************************************************
859 extern uint8_t Timer_A_getOutputForOutputModeOutBitValue(uint16_t baseAddress,
860  uint16_t captureCompareRegister);
861 
862 //*****************************************************************************
863 //
864 //! \brief Get current capturecompare count
865 //!
866 //! \param baseAddress is the base address of the TIMER_A module.
867 //! \param captureCompareRegister
868 //! Valid values are:
869 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
870 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
871 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
872 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
873 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
874 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
875 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
876 //!
877 //! \return Current count as an uint16_t
878 //
879 //*****************************************************************************
880 extern uint16_t Timer_A_getCaptureCompareCount(uint16_t baseAddress,
881  uint16_t captureCompareRegister);
882 
883 //*****************************************************************************
884 //
885 //! \brief Set output bit for output mode
886 //!
887 //! \param baseAddress is the base address of the TIMER_A module.
888 //! \param captureCompareRegister
889 //! Valid values are:
890 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
891 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
892 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
893 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
894 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
895 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
896 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
897 //! \param outputModeOutBitValue is the value to be set for out bit
898 //! Valid values are:
899 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH
900 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW
901 //!
902 //! Modified bits of \b TAxCCTLn register.
903 //!
904 //! \return None
905 //
906 //*****************************************************************************
907 extern void Timer_A_setOutputForOutputModeOutBitValue(uint16_t baseAddress,
908  uint16_t captureCompareRegister,
909  uint8_t outputModeOutBitValue);
910 
911 //*****************************************************************************
912 //
913 //! \brief Generate a PWM with timer running in up mode
914 //!
915 //! \param baseAddress is the base address of the TIMER_A module.
916 //! \param param is the pointer to struct for PWM configuration.
917 //!
918 //! Modified bits of \b TAxCTL register, bits of \b TAxCCTL0 register, bits of
919 //! \b TAxCCR0 register and bits of \b TAxCCTLn register.
920 //!
921 //! \return None
922 //
923 //*****************************************************************************
924 extern void Timer_A_outputPWM(uint16_t baseAddress,
925  Timer_A_outputPWMParam *param);
926 
927 //*****************************************************************************
928 //
929 //! \brief Stops the timer
930 //!
931 //! \param baseAddress is the base address of the TIMER_A module.
932 //!
933 //! Modified bits of \b TAxCTL register.
934 //!
935 //! \return None
936 //
937 //*****************************************************************************
938 extern void Timer_A_stop(uint16_t baseAddress);
939 
940 //*****************************************************************************
941 //
942 //! \brief Sets the value of the capture-compare register
943 //!
944 //! \param baseAddress is the base address of the TIMER_A module.
945 //! \param compareRegister selects the Capture register being used. Refer to
946 //! datasheet to ensure the device has the capture compare register
947 //! being used.
948 //! Valid values are:
949 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
950 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
951 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
952 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
953 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
954 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
955 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
956 //! \param compareValue is the count to be compared with in compare mode
957 //!
958 //! Modified bits of \b TAxCCRn register.
959 //!
960 //! \return None
961 //
962 //*****************************************************************************
963 extern void Timer_A_setCompareValue(uint16_t baseAddress,
964  uint16_t compareRegister,
965  uint16_t compareValue);
966 
967 //*****************************************************************************
968 //
969 //! \brief Sets the output mode
970 //!
971 //! Sets the output mode for the timer even the timer is already running.
972 //!
973 //! \param baseAddress is the base address of the TIMER_A module.
974 //! \param compareRegister selects the compare register being used.
975 //! Valid values are:
976 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
977 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
978 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
979 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
980 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
981 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
982 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
983 //! \param compareOutputMode specifies the output mode.
984 //! Valid values are:
985 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default]
986 //! - \b TIMER_A_OUTPUTMODE_SET
987 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET
988 //! - \b TIMER_A_OUTPUTMODE_SET_RESET
989 //! - \b TIMER_A_OUTPUTMODE_TOGGLE
990 //! - \b TIMER_A_OUTPUTMODE_RESET
991 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET
992 //! - \b TIMER_A_OUTPUTMODE_RESET_SET
993 //!
994 //! Modified bits are \b OUTMOD of \b TAxCCTLn register.
995 //!
996 //! \return None
997 //
998 //*****************************************************************************
999 extern void Timer_A_setOutputMode(uint16_t baseAddress,
1000  uint16_t compareRegister,
1001  uint16_t compareOutputMode);
1002 
1003 //*****************************************************************************
1004 //
1005 //! \brief Clears the Timer TAIFG interrupt flag
1006 //!
1007 //! \param baseAddress is the base address of the TIMER_A module.
1008 //!
1009 //! Modified bits are \b TAIFG of \b TAxCTL register.
1010 //!
1011 //! \return None
1012 //
1013 //*****************************************************************************
1014 extern void Timer_A_clearTimerInterrupt(uint16_t baseAddress);
1015 
1016 //*****************************************************************************
1017 //
1018 //! \brief Clears the capture-compare interrupt flag
1019 //!
1020 //! \param baseAddress is the base address of the TIMER_A module.
1021 //! \param captureCompareRegister selects the Capture-compare register being
1022 //! used.
1023 //! Valid values are:
1024 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
1025 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
1026 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
1027 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
1028 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
1029 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
1030 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
1031 //!
1032 //! Modified bits are \b CCIFG of \b TAxCCTLn register.
1033 //!
1034 //! \return None
1035 //
1036 //*****************************************************************************
1037 extern void Timer_A_clearCaptureCompareInterrupt(uint16_t baseAddress,
1038  uint16_t captureCompareRegister);
1039 
1040 //*****************************************************************************
1041 //
1042 //! \brief Reads the current timer count value
1043 //!
1044 //! Reads the current count value of the timer. There is a majority vote system
1045 //! in place to confirm an accurate value is returned. The TIMER_A_THRESHOLD
1046 //! #define in the corresponding header file can be modified so that the votes
1047 //! must be closer together for a consensus to occur.
1048 //!
1049 //! \param baseAddress is the base address of the TIMER_A module.
1050 //!
1051 //! \return Majority vote of timer count value
1052 //
1053 //*****************************************************************************
1054 extern uint16_t Timer_A_getCounterValue(uint16_t baseAddress);
1055 
1056 //*****************************************************************************
1057 //
1058 // Mark the end of the C bindings section for C++ compilers.
1059 //
1060 //*****************************************************************************
1061 #ifdef __cplusplus
1062 }
1063 #endif
1064 
1065 #endif
1066 #endif // __MSP430WARE_TIMER_A_H__
void Timer_A_initContinuousMode(uint16_t baseAddress, Timer_A_initContinuousModeParam *param)
Configures Timer_A in continuous mode.
Definition: timer_a.c:29
uint16_t captureOutputMode
Definition: timer_a.h:139
uint16_t timerClear
Definition: timer_a.h:82
uint16_t synchronizeCaptureSource
Definition: timer_a.h:123
bool startTimer
Whether to start the timer immediately.
Definition: timer_a.h:84
void Timer_A_disableCaptureCompareInterrupt(uint16_t baseAddress, uint16_t captureCompareRegister)
Disable capture compare interrupt.
Definition: timer_a.c:179
uint16_t captureRegister
Definition: timer_a.h:104
void Timer_A_startCounter(uint16_t baseAddress, uint16_t timerMode)
Starts Timer_A counter.
Definition: timer_a.c:21
uint16_t clockSourceDivider
Definition: timer_a.h:236
void Timer_A_stop(uint16_t baseAddress)
Stops the timer.
Definition: timer_a.c:270
void Timer_A_clearCaptureCompareInterrupt(uint16_t baseAddress, uint16_t captureCompareRegister)
Clears the capture-compare interrupt flag.
Definition: timer_a.c:295
uint16_t compareOutputMode
Definition: timer_a.h:260
uint16_t timerClear
Definition: timer_a.h:319
uint16_t timerPeriod
Is the specified Timer_A period.
Definition: timer_a.h:180
void Timer_A_enableInterrupt(uint16_t baseAddress)
Enable timer interrupt.
Definition: timer_a.c:157
void Timer_A_clearTimerInterrupt(uint16_t baseAddress)
Clears the Timer TAIFG interrupt flag.
Definition: timer_a.c:290
uint16_t Timer_A_getCaptureCompareCount(uint16_t baseAddress, uint16_t captureCompareRegister)
Get current capturecompare count.
Definition: timer_a.c:225
Used in the Timer_A_initUpDownMode() function as the param parameter.
Definition: timer_a.h:148
uint16_t clockSource
Definition: timer_a.h:48
uint8_t Timer_A_getSynchronizedCaptureCompareInput(uint16_t baseAddress, uint16_t captureCompareRegister, uint16_t synchronized)
Get synchronized capturecompare input.
Definition: timer_a.c:200
uint16_t compareOutputMode
Definition: timer_a.h:357
uint16_t timerInterruptEnable_TAIE
Definition: timer_a.h:185
void Timer_A_initCompareMode(uint16_t baseAddress, Timer_A_initCompareModeParam *param)
Initializes Compare Mode.
Definition: timer_a.c:140
uint16_t dutyCycle
Specifies the dutycycle for the generated waveform.
Definition: timer_a.h:262
bool startTimer
Whether to start the timer immediately.
Definition: timer_a.h:321
uint16_t timerClear
Definition: timer_a.h:196
uint16_t captureCompareInterruptEnable_CCR0_CCIE
Definition: timer_a.h:190
uint16_t compareInterruptEnable
Definition: timer_a.h:346
uint16_t timerPeriod
Definition: timer_a.h:303
void Timer_A_setOutputForOutputModeOutBitValue(uint16_t baseAddress, uint16_t captureCompareRegister, uint8_t outputModeOutBitValue)
Set output bit for output mode.
Definition: timer_a.c:233
uint16_t clockSourceDivider
Definition: timer_a.h:300
Used in the Timer_A_initCaptureMode() function as the param parameter.
Definition: timer_a.h:93
Used in the Timer_A_initUpMode() function as the param parameter.
Definition: timer_a.h:270
Used in the Timer_A_initCompareMode() function as the param parameter.
Definition: timer_a.h:330
void Timer_A_enableCaptureCompareInterrupt(uint16_t baseAddress, uint16_t captureCompareRegister)
Enable capture compare interrupt.
Definition: timer_a.c:172
uint16_t captureMode
Definition: timer_a.h:111
void Timer_A_disableInterrupt(uint16_t baseAddress)
Disable timer interrupt.
Definition: timer_a.c:162
void Timer_A_initUpDownMode(uint16_t baseAddress, Timer_A_initUpDownModeParam *param)
Configures Timer_A in up down mode.
Definition: timer_a.c:86
uint16_t clockSource
Definition: timer_a.h:213
uint16_t compareValue
Is the count to be compared with in compare mode.
Definition: timer_a.h:359
uint16_t captureInputSelect
Definition: timer_a.h:118
void Timer_A_setCompareValue(uint16_t baseAddress, uint16_t compareRegister, uint16_t compareValue)
Sets the value of the capture-compare register.
Definition: timer_a.c:275
void Timer_A_initCaptureMode(uint16_t baseAddress, Timer_A_initCaptureModeParam *param)
Initializes Capture Mode.
Definition: timer_a.c:118
uint16_t Timer_A_getCounterValue(uint16_t baseAddress)
Reads the current timer count value.
Definition: timer_a.c:302
uint32_t Timer_A_getInterruptStatus(uint16_t baseAddress)
Get timer interrupt status.
Definition: timer_a.c:167
Used in the Timer_A_outputPWM() function as the param parameter.
Definition: timer_a.h:206
void Timer_A_outputPWM(uint16_t baseAddress, Timer_A_outputPWMParam *param)
Generate a PWM with timer running in up mode.
Definition: timer_a.c:243
uint16_t compareRegister
Definition: timer_a.h:341
uint16_t timerInterruptEnable_TAIE
Definition: timer_a.h:308
void Timer_A_initUpMode(uint16_t baseAddress, Timer_A_initUpModeParam *param)
Configures Timer_A in up mode.
Definition: timer_a.c:53
bool startTimer
Whether to start the timer immediately.
Definition: timer_a.h:198
uint16_t clockSourceDivider
Definition: timer_a.h:71
uint32_t Timer_A_getCaptureCompareInterruptStatus(uint16_t baseAddress, uint16_t captureCompareRegister, uint16_t mask)
Return capture compare interrupt status.
Definition: timer_a.c:186
uint16_t clockSource
Definition: timer_a.h:155
uint8_t Timer_A_getOutputForOutputModeOutBitValue(uint16_t baseAddress, uint16_t captureCompareRegister)
Get output bit for output mode.
Definition: timer_a.c:213
uint16_t clockSourceDivider
Definition: timer_a.h:178
Used in the Timer_A_initContinuousMode() function as the param parameter.
Definition: timer_a.h:41
void Timer_A_setOutputMode(uint16_t baseAddress, uint16_t compareRegister, uint16_t compareOutputMode)
Sets the output mode.
Definition: timer_a.c:283
uint16_t compareRegister
Definition: timer_a.h:249
void Timer_A_clear(uint16_t baseAddress)
Reset/Clear the timer clock divider, count direction, count.
Definition: timer_a.c:194
uint16_t captureInterruptEnable
Definition: timer_a.h:128
uint16_t timerPeriod
Selects the desired timer period.
Definition: timer_a.h:238
uint16_t timerInterruptEnable_TAIE
Definition: timer_a.h:76
uint16_t captureCompareInterruptEnable_CCR0_CCIE
Definition: timer_a.h:313
uint16_t clockSource
Definition: timer_a.h:277

Copyright 2020, Texas Instruments Incorporated