MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.21.00.08
 All Data Structures Functions Variables Modules Pages
timer_b.h
1 //*****************************************************************************
2 //
3 // timer_b.h - Driver for the TIMER_B Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_TIMER_B_H__
8 #define __MSP430WARE_TIMER_B_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_TxB7__
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_B_getCounterValue that
29 // determines the maximum difference in counts of the TAxR register for a
30 // majority vote.
31 //
32 //*****************************************************************************
33 #define TIMER_B_THRESHOLD 50
34 
35 //*****************************************************************************
36 //
37 //! \brief Used in the Timer_B_outputPWM() function as the param parameter.
38 //
39 //*****************************************************************************
40 typedef struct Timer_B_outputPWMParam {
41  //! Selects the clock source
42  //! \n Valid values are:
43  //! - \b TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
44  //! - \b TIMER_B_CLOCKSOURCE_ACLK
45  //! - \b TIMER_B_CLOCKSOURCE_SMCLK
46  //! - \b TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
47  uint16_t clockSource;
48  //! Is the divider for Clock source.
49  //! \n Valid values are:
50  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_1 [Default]
51  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_2
52  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_3
53  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_4
54  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_5
55  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_6
56  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_7
57  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_8
58  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_10
59  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_12
60  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_14
61  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_16
62  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_20
63  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_24
64  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_28
65  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_32
66  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_40
67  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_48
68  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_56
69  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_64
71  //! Selects the desired Timer_B period
72  uint16_t timerPeriod;
73  //! Selects the compare register being used. Refer to datasheet to ensure
74  //! the device has the compare register being used.
75  //! \n Valid values are:
76  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
77  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
78  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
79  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
80  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
81  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
82  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
83  uint16_t compareRegister;
84  //! Specifies the output mode.
85  //! \n Valid values are:
86  //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE [Default]
87  //! - \b TIMER_B_OUTPUTMODE_SET
88  //! - \b TIMER_B_OUTPUTMODE_TOGGLE_RESET
89  //! - \b TIMER_B_OUTPUTMODE_SET_RESET
90  //! - \b TIMER_B_OUTPUTMODE_TOGGLE
91  //! - \b TIMER_B_OUTPUTMODE_RESET
92  //! - \b TIMER_B_OUTPUTMODE_TOGGLE_SET
93  //! - \b TIMER_B_OUTPUTMODE_RESET_SET
95  //! Specifies the dutycycle for the generated waveform
96  uint16_t dutyCycle;
98 
99 //*****************************************************************************
100 //
101 //! \brief Used in the Timer_B_initUpMode() function as the param parameter.
102 //
103 //*****************************************************************************
104 typedef struct Timer_B_initUpModeParam {
105  //! Selects the clock source
106  //! \n Valid values are:
107  //! - \b TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
108  //! - \b TIMER_B_CLOCKSOURCE_ACLK
109  //! - \b TIMER_B_CLOCKSOURCE_SMCLK
110  //! - \b TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
111  uint16_t clockSource;
112  //! Is the divider for Clock source.
113  //! \n Valid values are:
114  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_1 [Default]
115  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_2
116  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_3
117  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_4
118  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_5
119  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_6
120  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_7
121  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_8
122  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_10
123  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_12
124  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_14
125  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_16
126  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_20
127  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_24
128  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_28
129  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_32
130  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_40
131  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_48
132  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_56
133  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_64
135  //! Is the specified Timer_B period. This is the value that gets written
136  //! into the CCR0. Limited to 16 bits[uint16_t]
137  uint16_t timerPeriod;
138  //! Is to enable or disable Timer_B interrupt
139  //! \n Valid values are:
140  //! - \b TIMER_B_TBIE_INTERRUPT_ENABLE
141  //! - \b TIMER_B_TBIE_INTERRUPT_DISABLE [Default]
143  //! Is to enable or disable Timer_B CCR0 capture compare interrupt.
144  //! \n Valid values are:
145  //! - \b TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE
146  //! - \b TIMER_B_CCIE_CCR0_INTERRUPT_DISABLE [Default]
148  //! Decides if Timer_B clock divider, count direction, count need to be
149  //! reset.
150  //! \n Valid values are:
151  //! - \b TIMER_B_DO_CLEAR
152  //! - \b TIMER_B_SKIP_CLEAR [Default]
153  uint16_t timerClear;
154  //! Whether to start the timer immediately
157 
158 //*****************************************************************************
159 //
160 //! \brief Used in the Timer_B_initCaptureMode() function as the param
161 //! parameter.
162 //
163 //*****************************************************************************
165  //! Selects the capture register being used. Refer to datasheet to ensure
166  //! the device has the capture register being used.
167  //! \n Valid values are:
168  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
169  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
170  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
171  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
172  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
173  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
174  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
175  uint16_t captureRegister;
176  //! Is the capture mode selected.
177  //! \n Valid values are:
178  //! - \b TIMER_B_CAPTUREMODE_NO_CAPTURE [Default]
179  //! - \b TIMER_B_CAPTUREMODE_RISING_EDGE
180  //! - \b TIMER_B_CAPTUREMODE_FALLING_EDGE
181  //! - \b TIMER_B_CAPTUREMODE_RISING_AND_FALLING_EDGE
182  uint16_t captureMode;
183  //! Decides the Input Select
184  //! \n Valid values are:
185  //! - \b TIMER_B_CAPTURE_INPUTSELECT_CCIxA [Default]
186  //! - \b TIMER_B_CAPTURE_INPUTSELECT_CCIxB
187  //! - \b TIMER_B_CAPTURE_INPUTSELECT_GND
188  //! - \b TIMER_B_CAPTURE_INPUTSELECT_Vcc
190  //! Decides if capture source should be synchronized with Timer_B clock
191  //! \n Valid values are:
192  //! - \b TIMER_B_CAPTURE_ASYNCHRONOUS [Default]
193  //! - \b TIMER_B_CAPTURE_SYNCHRONOUS
195  //! Is to enable or disable Timer_B capture compare interrupt.
196  //! \n Valid values are:
197  //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_DISABLE [Default]
198  //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE
200  //! Specifies the output mode.
201  //! \n Valid values are:
202  //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE [Default]
203  //! - \b TIMER_B_OUTPUTMODE_SET
204  //! - \b TIMER_B_OUTPUTMODE_TOGGLE_RESET
205  //! - \b TIMER_B_OUTPUTMODE_SET_RESET
206  //! - \b TIMER_B_OUTPUTMODE_TOGGLE
207  //! - \b TIMER_B_OUTPUTMODE_RESET
208  //! - \b TIMER_B_OUTPUTMODE_TOGGLE_SET
209  //! - \b TIMER_B_OUTPUTMODE_RESET_SET
212 
213 //*****************************************************************************
214 //
215 //! \brief Used in the Timer_B_initContinuousMode() function as the param
216 //! parameter.
217 //
218 //*****************************************************************************
220  //! Selects the clock source
221  //! \n Valid values are:
222  //! - \b TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
223  //! - \b TIMER_B_CLOCKSOURCE_ACLK
224  //! - \b TIMER_B_CLOCKSOURCE_SMCLK
225  //! - \b TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
226  uint16_t clockSource;
227  //! Is the divider for Clock source.
228  //! \n Valid values are:
229  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_1 [Default]
230  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_2
231  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_3
232  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_4
233  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_5
234  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_6
235  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_7
236  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_8
237  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_10
238  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_12
239  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_14
240  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_16
241  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_20
242  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_24
243  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_28
244  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_32
245  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_40
246  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_48
247  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_56
248  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_64
250  //! Is to enable or disable Timer_B interrupt
251  //! \n Valid values are:
252  //! - \b TIMER_B_TBIE_INTERRUPT_ENABLE
253  //! - \b TIMER_B_TBIE_INTERRUPT_DISABLE [Default]
255  //! Decides if Timer_B clock divider, count direction, count need to be
256  //! reset.
257  //! \n Valid values are:
258  //! - \b TIMER_B_DO_CLEAR
259  //! - \b TIMER_B_SKIP_CLEAR [Default]
260  uint16_t timerClear;
261  //! Whether to start the timer immediately
264 
265 //*****************************************************************************
266 //
267 //! \brief Used in the Timer_B_initUpDownMode() function as the param
268 //! parameter.
269 //
270 //*****************************************************************************
272  //! Selects the clock source
273  //! \n Valid values are:
274  //! - \b TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK [Default]
275  //! - \b TIMER_B_CLOCKSOURCE_ACLK
276  //! - \b TIMER_B_CLOCKSOURCE_SMCLK
277  //! - \b TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
278  uint16_t clockSource;
279  //! Is the divider for Clock source.
280  //! \n Valid values are:
281  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_1 [Default]
282  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_2
283  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_3
284  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_4
285  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_5
286  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_6
287  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_7
288  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_8
289  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_10
290  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_12
291  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_14
292  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_16
293  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_20
294  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_24
295  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_28
296  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_32
297  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_40
298  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_48
299  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_56
300  //! - \b TIMER_B_CLOCKSOURCE_DIVIDER_64
302  //! Is the specified Timer_B period
303  uint16_t timerPeriod;
304  //! Is to enable or disable Timer_B interrupt
305  //! \n Valid values are:
306  //! - \b TIMER_B_TBIE_INTERRUPT_ENABLE
307  //! - \b TIMER_B_TBIE_INTERRUPT_DISABLE [Default]
309  //! Is to enable or disable Timer_B CCR0 capture compare interrupt.
310  //! \n Valid values are:
311  //! - \b TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE
312  //! - \b TIMER_B_CCIE_CCR0_INTERRUPT_DISABLE [Default]
314  //! Decides if Timer_B clock divider, count direction, count need to be
315  //! reset.
316  //! \n Valid values are:
317  //! - \b TIMER_B_DO_CLEAR
318  //! - \b TIMER_B_SKIP_CLEAR [Default]
319  uint16_t timerClear;
320  //! Whether to start the timer immediately
323 
324 //*****************************************************************************
325 //
326 //! \brief Used in the Timer_B_initCompareMode() function as the param
327 //! parameter.
328 //
329 //*****************************************************************************
331  //! Selects the compare register being used. Refer to datasheet to ensure
332  //! the device has the compare register being used.
333  //! \n Valid values are:
334  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
335  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
336  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
337  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
338  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
339  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
340  //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
341  uint16_t compareRegister;
342  //! Is to enable or disable Timer_B capture compare interrupt.
343  //! \n Valid values are:
344  //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_DISABLE [Default]
345  //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE
347  //! Specifies the output mode.
348  //! \n Valid values are:
349  //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE [Default]
350  //! - \b TIMER_B_OUTPUTMODE_SET
351  //! - \b TIMER_B_OUTPUTMODE_TOGGLE_RESET
352  //! - \b TIMER_B_OUTPUTMODE_SET_RESET
353  //! - \b TIMER_B_OUTPUTMODE_TOGGLE
354  //! - \b TIMER_B_OUTPUTMODE_RESET
355  //! - \b TIMER_B_OUTPUTMODE_TOGGLE_SET
356  //! - \b TIMER_B_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_B_initContinuousMode(), Timer_B_initUpMode(),
367 // Timer_B_initUpDownMode(), and Timer_B_outputPWM().
368 //
369 //*****************************************************************************
370 #define TIMER_B_CLOCKSOURCE_DIVIDER_1 0x00
371 #define TIMER_B_CLOCKSOURCE_DIVIDER_2 0x08
372 #define TIMER_B_CLOCKSOURCE_DIVIDER_3 0x02
373 #define TIMER_B_CLOCKSOURCE_DIVIDER_4 0x10
374 #define TIMER_B_CLOCKSOURCE_DIVIDER_5 0x04
375 #define TIMER_B_CLOCKSOURCE_DIVIDER_6 0x05
376 #define TIMER_B_CLOCKSOURCE_DIVIDER_7 0x06
377 #define TIMER_B_CLOCKSOURCE_DIVIDER_8 0x18
378 #define TIMER_B_CLOCKSOURCE_DIVIDER_10 0x0C
379 #define TIMER_B_CLOCKSOURCE_DIVIDER_12 0x0D
380 #define TIMER_B_CLOCKSOURCE_DIVIDER_14 0x0E
381 #define TIMER_B_CLOCKSOURCE_DIVIDER_16 0x0F
382 #define TIMER_B_CLOCKSOURCE_DIVIDER_20 0x14
383 #define TIMER_B_CLOCKSOURCE_DIVIDER_24 0x15
384 #define TIMER_B_CLOCKSOURCE_DIVIDER_28 0x16
385 #define TIMER_B_CLOCKSOURCE_DIVIDER_32 0x17
386 #define TIMER_B_CLOCKSOURCE_DIVIDER_40 0x1C
387 #define TIMER_B_CLOCKSOURCE_DIVIDER_48 0x1D
388 #define TIMER_B_CLOCKSOURCE_DIVIDER_56 0x1E
389 #define TIMER_B_CLOCKSOURCE_DIVIDER_64 0x1F
390 
391 //*****************************************************************************
392 //
393 // The following are values that can be passed to the timerMode parameter for
394 // functions: Timer_B_startCounter().
395 //
396 //*****************************************************************************
397 #define TIMER_B_STOP_MODE MC_0
398 #define TIMER_B_UP_MODE MC_1
399 #define TIMER_B_CONTINUOUS_MODE MC_2
400 #define TIMER_B_UPDOWN_MODE MC_3
401 
402 //*****************************************************************************
403 //
404 // The following are values that can be passed to the param parameter for
405 // functions: Timer_B_initContinuousMode(), Timer_B_initUpMode(), and
406 // Timer_B_initUpDownMode().
407 //
408 //*****************************************************************************
409 #define TIMER_B_DO_CLEAR TBCLR
410 #define TIMER_B_SKIP_CLEAR 0x00
411 
412 //*****************************************************************************
413 //
414 // The following are values that can be passed to the param parameter for
415 // functions: Timer_B_initContinuousMode(), Timer_B_initUpMode(),
416 // Timer_B_initUpDownMode(), and Timer_B_outputPWM().
417 //
418 //*****************************************************************************
419 #define TIMER_B_CLOCKSOURCE_EXTERNAL_TXCLK TBSSEL__TACLK
420 #define TIMER_B_CLOCKSOURCE_ACLK TBSSEL__ACLK
421 #define TIMER_B_CLOCKSOURCE_SMCLK TBSSEL__SMCLK
422 #define TIMER_B_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK TBSSEL__INCLK
423 
424 //*****************************************************************************
425 //
426 // The following are values that can be passed to the param parameter for
427 // functions: Timer_B_initContinuousMode(), Timer_B_initUpMode(), and
428 // Timer_B_initUpDownMode().
429 //
430 //*****************************************************************************
431 #define TIMER_B_TBIE_INTERRUPT_ENABLE TBIE
432 #define TIMER_B_TBIE_INTERRUPT_DISABLE 0x00
433 
434 //*****************************************************************************
435 //
436 // The following are values that can be passed to the param parameter for
437 // functions: Timer_B_initUpMode(), and Timer_B_initUpDownMode().
438 //
439 //*****************************************************************************
440 #define TIMER_B_CCIE_CCR0_INTERRUPT_ENABLE CCIE
441 #define TIMER_B_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_B_initCaptureMode(), and Timer_B_initCompareMode().
447 //
448 //*****************************************************************************
449 #define TIMER_B_CAPTURECOMPARE_INTERRUPT_DISABLE 0x00
450 #define TIMER_B_CAPTURECOMPARE_INTERRUPT_ENABLE CCIE
451 
452 //*****************************************************************************
453 //
454 // The following are values that can be passed to the param parameter for
455 // functions: Timer_B_initCaptureMode().
456 //
457 //*****************************************************************************
458 #define TIMER_B_CAPTURE_INPUTSELECT_CCIxA CCIS_0
459 #define TIMER_B_CAPTURE_INPUTSELECT_CCIxB CCIS_1
460 #define TIMER_B_CAPTURE_INPUTSELECT_GND CCIS_2
461 #define TIMER_B_CAPTURE_INPUTSELECT_Vcc CCIS_3
462 
463 //*****************************************************************************
464 //
465 // The following are values that can be passed to the param parameter for
466 // functions: Timer_B_initCaptureMode(), Timer_B_initCompareMode(), and
467 // Timer_B_outputPWM().
468 //
469 //*****************************************************************************
470 #define TIMER_B_OUTPUTMODE_OUTBITVALUE OUTMOD_0
471 #define TIMER_B_OUTPUTMODE_SET OUTMOD_1
472 #define TIMER_B_OUTPUTMODE_TOGGLE_RESET OUTMOD_2
473 #define TIMER_B_OUTPUTMODE_SET_RESET OUTMOD_3
474 #define TIMER_B_OUTPUTMODE_TOGGLE OUTMOD_4
475 #define TIMER_B_OUTPUTMODE_RESET OUTMOD_5
476 #define TIMER_B_OUTPUTMODE_TOGGLE_SET OUTMOD_6
477 #define TIMER_B_OUTPUTMODE_RESET_SET OUTMOD_7
478 
479 //*****************************************************************************
480 //
481 // The following are values that can be passed to the compareRegister parameter
482 // for functions: Timer_B_setCompareValue(), and
483 // Timer_B_initCompareLatchLoadEvent(); the captureCompareRegister parameter
484 // for functions: Timer_B_enableCaptureCompareInterrupt(),
485 // Timer_B_disableCaptureCompareInterrupt(),
486 // Timer_B_getCaptureCompareInterruptStatus(),
487 // Timer_B_getSynchronizedCaptureCompareInput(),
488 // Timer_B_getOutputForOutputModeOutBitValue(),
489 // Timer_B_getCaptureCompareCount(),
490 // Timer_B_setOutputForOutputModeOutBitValue(), and
491 // Timer_B_clearCaptureCompareInterrupt(); the param parameter for functions:
492 // Timer_B_initCaptureMode(), Timer_B_initCompareMode(), and
493 // Timer_B_outputPWM().
494 //
495 //*****************************************************************************
496 #define TIMER_B_CAPTURECOMPARE_REGISTER_0 0x02
497 #define TIMER_B_CAPTURECOMPARE_REGISTER_1 0x04
498 #define TIMER_B_CAPTURECOMPARE_REGISTER_2 0x06
499 #define TIMER_B_CAPTURECOMPARE_REGISTER_3 0x08
500 #define TIMER_B_CAPTURECOMPARE_REGISTER_4 0x0A
501 #define TIMER_B_CAPTURECOMPARE_REGISTER_5 0x0C
502 #define TIMER_B_CAPTURECOMPARE_REGISTER_6 0x0E
503 
504 //*****************************************************************************
505 //
506 // The following are values that can be passed to the param parameter for
507 // functions: Timer_B_initCaptureMode().
508 //
509 //*****************************************************************************
510 #define TIMER_B_CAPTUREMODE_NO_CAPTURE CM_0
511 #define TIMER_B_CAPTUREMODE_RISING_EDGE CM_1
512 #define TIMER_B_CAPTUREMODE_FALLING_EDGE CM_2
513 #define TIMER_B_CAPTUREMODE_RISING_AND_FALLING_EDGE CM_3
514 
515 //*****************************************************************************
516 //
517 // The following are values that can be passed to the param parameter for
518 // functions: Timer_B_initCaptureMode().
519 //
520 //*****************************************************************************
521 #define TIMER_B_CAPTURE_ASYNCHRONOUS 0x00
522 #define TIMER_B_CAPTURE_SYNCHRONOUS SCS
523 
524 //*****************************************************************************
525 //
526 // The following are values that can be passed to the mask parameter for
527 // functions: Timer_B_getCaptureCompareInterruptStatus() as well as returned by
528 // the Timer_B_getCaptureCompareInterruptStatus() function.
529 //
530 //*****************************************************************************
531 #define TIMER_B_CAPTURE_OVERFLOW COV
532 #define TIMER_B_CAPTURECOMPARE_INTERRUPT_FLAG CCIFG
533 
534 //*****************************************************************************
535 //
536 // The following are values that can be passed to the synchronized parameter
537 // for functions: Timer_B_getSynchronizedCaptureCompareInput().
538 //
539 //*****************************************************************************
540 #define TIMER_B_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT SCCI
541 #define TIMER_B_READ_CAPTURE_COMPARE_INPUT CCI
542 
543 //*****************************************************************************
544 //
545 // The following are values that can be passed toThe following are values that
546 // can be returned by the Timer_B_getSynchronizedCaptureCompareInput()
547 // function.
548 //
549 //*****************************************************************************
550 #define TIMER_B_CAPTURECOMPARE_INPUT_HIGH 0x01
551 #define TIMER_B_CAPTURECOMPARE_INPUT_LOW 0x00
552 
553 //*****************************************************************************
554 //
555 // The following are values that can be passed to the outputModeOutBitValue
556 // parameter for functions: Timer_B_setOutputForOutputModeOutBitValue() as well
557 // as returned by the Timer_B_getOutputForOutputModeOutBitValue() function.
558 //
559 //*****************************************************************************
560 #define TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH OUT
561 #define TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW 0x00
562 
563 //*****************************************************************************
564 //
565 // The following are values that can be passed to the counterLength parameter
566 // for functions: Timer_B_selectCounterLength().
567 //
568 //*****************************************************************************
569 #define TIMER_B_COUNTER_16BIT CNTL_3
570 #define TIMER_B_COUNTER_12BIT CNTL_2
571 #define TIMER_B_COUNTER_10BIT CNTL_1
572 #define TIMER_B_COUNTER_8BIT CNTL_0
573 
574 //*****************************************************************************
575 //
576 // The following are values that can be passed to the groupLatch parameter for
577 // functions: Timer_B_selectLatchingGroup().
578 //
579 //*****************************************************************************
580 #define TIMER_B_GROUP_NONE TBCLGRP_0
581 #define TIMER_B_GROUP_CL12_CL23_CL56 TBCLGRP_1
582 #define TIMER_B_GROUP_CL123_CL456 TBCLGRP_2
583 #define TIMER_B_GROUP_ALL TBCLGRP_3
584 
585 //*****************************************************************************
586 //
587 // The following are values that can be passed to the compareLatchLoadEvent
588 // parameter for functions: Timer_B_initCompareLatchLoadEvent().
589 //
590 //*****************************************************************************
591 #define TIMER_B_LATCH_ON_WRITE_TO_TBxCCRn_COMPARE_REGISTER CLLD_0
592 #define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UP_OR_CONT_MODE CLLD_1
593 #define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UPDOWN_MODE CLLD_2
594 #define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_CURRENT_COMPARE_LATCH_VALUE CLLD_3
595 
596 //*****************************************************************************
597 //
598 // The following are values that can be passed toThe following are values that
599 // can be returned by the Timer_B_getInterruptStatus() function.
600 //
601 //*****************************************************************************
602 #define TIMER_B_INTERRUPT_NOT_PENDING 0x00
603 #define TIMER_B_INTERRUPT_PENDING 0x01
604 
605 //*****************************************************************************
606 //
607 // Prototypes for the APIs.
608 //
609 //*****************************************************************************
610 
611 //*****************************************************************************
612 //
613 //! \brief Starts Timer_B counter
614 //!
615 //! This function assumes that the timer has been previously configured using
616 //! Timer_B_initContinuousMode, Timer_B_initUpMode or Timer_B_initUpDownMode.
617 //!
618 //! \param baseAddress is the base address of the TIMER_B module.
619 //! \param timerMode selects the mode of the timer
620 //! Valid values are:
621 //! - \b TIMER_B_STOP_MODE
622 //! - \b TIMER_B_UP_MODE
623 //! - \b TIMER_B_CONTINUOUS_MODE [Default]
624 //! - \b TIMER_B_UPDOWN_MODE
625 //!
626 //! Modified bits of \b TBxCTL register.
627 //!
628 //! \return None
629 //
630 //*****************************************************************************
631 extern void Timer_B_startCounter(uint16_t baseAddress,
632  uint16_t timerMode);
633 
634 //*****************************************************************************
635 //
636 //! \brief Configures Timer_B in continuous mode.
637 //!
638 //! This API does not start the timer. Timer needs to be started when required
639 //! using the Timer_B_startCounter API.
640 //!
641 //! \param baseAddress is the base address of the TIMER_B module.
642 //! \param param is the pointer to struct for continuous mode initialization.
643 //!
644 //! Modified bits of \b TBxCTL register.
645 //!
646 //! \return None
647 //
648 //*****************************************************************************
649 extern void Timer_B_initContinuousMode(uint16_t baseAddress,
651 
652 //*****************************************************************************
653 //
654 //! \brief Configures Timer_B in up mode.
655 //!
656 //! This API does not start the timer. Timer needs to be started when required
657 //! using the Timer_B_startCounter API.
658 //!
659 //! \param baseAddress is the base address of the TIMER_B module.
660 //! \param param is the pointer to struct for up mode initialization.
661 //!
662 //! Modified bits of \b TBxCTL register, bits of \b TBxCCTL0 register and bits
663 //! of \b TBxCCR0 register.
664 //!
665 //! \return None
666 //
667 //*****************************************************************************
668 extern void Timer_B_initUpMode(uint16_t baseAddress,
669  Timer_B_initUpModeParam *param);
670 
671 //*****************************************************************************
672 //
673 //! \brief Configures Timer_B in up down mode.
674 //!
675 //! This API does not start the timer. Timer needs to be started when required
676 //! using the Timer_B_startCounter API.
677 //!
678 //! \param baseAddress is the base address of the TIMER_B module.
679 //! \param param is the pointer to struct for up-down mode initialization.
680 //!
681 //! Modified bits of \b TBxCTL register, bits of \b TBxCCTL0 register and bits
682 //! of \b TBxCCR0 register.
683 //!
684 //! \return None
685 //
686 //*****************************************************************************
687 extern void Timer_B_initUpDownMode(uint16_t baseAddress,
689 
690 //*****************************************************************************
691 //
692 //! \brief Initializes Capture Mode
693 //!
694 //! \param baseAddress is the base address of the TIMER_B module.
695 //! \param param is the pointer to struct for capture mode initialization.
696 //!
697 //! Modified bits of \b TBxCCTLn register.
698 //!
699 //! \return None
700 //
701 //*****************************************************************************
702 extern void Timer_B_initCaptureMode(uint16_t baseAddress,
704 
705 //*****************************************************************************
706 //
707 //! \brief Initializes Compare Mode
708 //!
709 //! \param baseAddress is the base address of the TIMER_B module.
710 //! \param param is the pointer to struct for compare mode initialization.
711 //!
712 //! Modified bits of \b TBxCCTLn register and bits of \b TBxCCRn register.
713 //!
714 //! \return None
715 //
716 //*****************************************************************************
717 extern void Timer_B_initCompareMode(uint16_t baseAddress,
719 
720 //*****************************************************************************
721 //
722 //! \brief Enable Timer_B interrupt
723 //!
724 //! Enables Timer_B interrupt. Does not clear interrupt flags.
725 //!
726 //! \param baseAddress is the base address of the TIMER_B module.
727 //!
728 //! Modified bits of \b TBxCTL register.
729 //!
730 //! \return None
731 //
732 //*****************************************************************************
733 extern void Timer_B_enableInterrupt(uint16_t baseAddress);
734 
735 //*****************************************************************************
736 //
737 //! \brief Disable Timer_B interrupt
738 //!
739 //! \param baseAddress is the base address of the TIMER_B module.
740 //!
741 //! Modified bits of \b TBxCTL register.
742 //!
743 //! \return None
744 //
745 //*****************************************************************************
746 extern void Timer_B_disableInterrupt(uint16_t baseAddress);
747 
748 //*****************************************************************************
749 //
750 //! \brief Get Timer_B interrupt status
751 //!
752 //! \param baseAddress is the base address of the TIMER_B module.
753 //!
754 //! \return One of the following:
755 //! - \b Timer_B_INTERRUPT_NOT_PENDING
756 //! - \b Timer_B_INTERRUPT_PENDING
757 //! \n indicating the status of the Timer_B interrupt
758 //
759 //*****************************************************************************
760 extern uint32_t Timer_B_getInterruptStatus(uint16_t baseAddress);
761 
762 //*****************************************************************************
763 //
764 //! \brief Enable capture compare interrupt
765 //!
766 //! \param baseAddress is the base address of the TIMER_B module.
767 //! \param captureCompareRegister selects the capture compare register being
768 //! used. Refer to datasheet to ensure the device has the capture
769 //! compare register being used.
770 //! Valid values are:
771 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
772 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
773 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
774 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
775 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
776 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
777 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
778 //!
779 //! Modified bits of \b TBxCCTLn register.
780 //!
781 //! \return None
782 //
783 //*****************************************************************************
784 extern void Timer_B_enableCaptureCompareInterrupt(uint16_t baseAddress,
785  uint16_t captureCompareRegister);
786 
787 //*****************************************************************************
788 //
789 //! \brief Disable capture compare interrupt
790 //!
791 //! \param baseAddress is the base address of the TIMER_B module.
792 //! \param captureCompareRegister selects the capture compare register being
793 //! used. Refer to datasheet to ensure the device has the capture
794 //! compare register being used.
795 //! Valid values are:
796 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
797 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
798 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
799 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
800 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
801 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
802 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
803 //!
804 //! Modified bits of \b TBxCCTLn register.
805 //!
806 //! \return None
807 //
808 //*****************************************************************************
809 extern void Timer_B_disableCaptureCompareInterrupt(uint16_t baseAddress,
810  uint16_t captureCompareRegister);
811 
812 //*****************************************************************************
813 //
814 //! \brief Return capture compare interrupt status
815 //!
816 //! \param baseAddress is the base address of the TIMER_B module.
817 //! \param captureCompareRegister selects the capture compare register being
818 //! used. Refer to datasheet to ensure the device has the capture
819 //! compare register being used.
820 //! Valid values are:
821 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
822 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
823 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
824 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
825 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
826 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
827 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
828 //! \param mask is the mask for the interrupt status
829 //! Mask value is the logical OR of any of the following:
830 //! - \b TIMER_B_CAPTURE_OVERFLOW
831 //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_FLAG
832 //!
833 //! \return Logical OR of any of the following:
834 //! - \b Timer_B_CAPTURE_OVERFLOW
835 //! - \b Timer_B_CAPTURECOMPARE_INTERRUPT_FLAG
836 //! \n indicating the status of the masked interrupts
837 //
838 //*****************************************************************************
839 extern uint32_t Timer_B_getCaptureCompareInterruptStatus(uint16_t baseAddress,
840  uint16_t captureCompareRegister,
841  uint16_t mask);
842 
843 //*****************************************************************************
844 //
845 //! \brief Reset/Clear the Timer_B clock divider, count direction, count
846 //!
847 //! \param baseAddress is the base address of the TIMER_B module.
848 //!
849 //! Modified bits of \b TBxCTL register.
850 //!
851 //! \return None
852 //
853 //*****************************************************************************
854 extern void Timer_B_clear(uint16_t baseAddress);
855 
856 //*****************************************************************************
857 //
858 //! \brief Get synchronized capturecompare input
859 //!
860 //! \param baseAddress is the base address of the TIMER_B module.
861 //! \param captureCompareRegister selects the capture compare register being
862 //! used. Refer to datasheet to ensure the device has the capture
863 //! compare register being used.
864 //! Valid values are:
865 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
866 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
867 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
868 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
869 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
870 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
871 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
872 //! \param synchronized selects the type of capture compare input
873 //! Valid values are:
874 //! - \b TIMER_B_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT
875 //! - \b TIMER_B_READ_CAPTURE_COMPARE_INPUT
876 //!
877 //! \return One of the following:
878 //! - \b Timer_B_CAPTURECOMPARE_INPUT_HIGH
879 //! - \b Timer_B_CAPTURECOMPARE_INPUT_LOW
880 //
881 //*****************************************************************************
882 extern uint8_t Timer_B_getSynchronizedCaptureCompareInput(uint16_t baseAddress,
883  uint16_t captureCompareRegister,
884  uint16_t synchronized);
885 
886 //*****************************************************************************
887 //
888 //! \brief Get output bit for output mode
889 //!
890 //! \param baseAddress is the base address of the TIMER_B module.
891 //! \param captureCompareRegister selects the capture compare register being
892 //! used. Refer to datasheet to ensure the device has the capture
893 //! compare register being used.
894 //! Valid values are:
895 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
896 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
897 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
898 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
899 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
900 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
901 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
902 //!
903 //! \return One of the following:
904 //! - \b Timer_B_OUTPUTMODE_OUTBITVALUE_HIGH
905 //! - \b Timer_B_OUTPUTMODE_OUTBITVALUE_LOW
906 //
907 //*****************************************************************************
908 extern uint8_t Timer_B_getOutputForOutputModeOutBitValue(uint16_t baseAddress,
909  uint16_t captureCompareRegister);
910 
911 //*****************************************************************************
912 //
913 //! \brief Get current capturecompare count
914 //!
915 //! \param baseAddress is the base address of the TIMER_B module.
916 //! \param captureCompareRegister selects the capture compare register being
917 //! used. Refer to datasheet to ensure the device has the capture
918 //! compare register being used.
919 //! Valid values are:
920 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
921 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
922 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
923 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
924 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
925 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
926 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
927 //!
928 //! \return Current count as uint16_t
929 //
930 //*****************************************************************************
931 extern uint16_t Timer_B_getCaptureCompareCount(uint16_t baseAddress,
932  uint16_t captureCompareRegister);
933 
934 //*****************************************************************************
935 //
936 //! \brief Set output bit for output mode
937 //!
938 //! \param baseAddress is the base address of the TIMER_B module.
939 //! \param captureCompareRegister selects the capture compare register being
940 //! used. Refer to datasheet to ensure the device has the capture
941 //! compare register being used.
942 //! Valid values are:
943 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
944 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
945 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
946 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
947 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
948 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
949 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
950 //! \param outputModeOutBitValue the value to be set for out bit
951 //! Valid values are:
952 //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH
953 //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW
954 //!
955 //! Modified bits of \b TBxCCTLn register.
956 //!
957 //! \return None
958 //
959 //*****************************************************************************
960 extern void Timer_B_setOutputForOutputModeOutBitValue(uint16_t baseAddress,
961  uint16_t captureCompareRegister,
962  uint8_t outputModeOutBitValue);
963 
964 //*****************************************************************************
965 //
966 //! \brief Generate a PWM with Timer_B running in up mode
967 //!
968 //! \param baseAddress is the base address of the TIMER_B module.
969 //! \param param is the pointer to struct for PWM configuration.
970 //!
971 //! Modified bits of \b TBxCCTLn register, bits of \b TBxCTL register, bits of
972 //! \b TBxCCTL0 register and bits of \b TBxCCR0 register.
973 //!
974 //! \return None
975 //
976 //*****************************************************************************
977 extern void Timer_B_outputPWM(uint16_t baseAddress,
978  Timer_B_outputPWMParam *param);
979 
980 //*****************************************************************************
981 //
982 //! \brief Stops the Timer_B
983 //!
984 //! \param baseAddress is the base address of the TIMER_B module.
985 //!
986 //! Modified bits of \b TBxCTL register.
987 //!
988 //! \return None
989 //
990 //*****************************************************************************
991 extern void Timer_B_stop(uint16_t baseAddress);
992 
993 //*****************************************************************************
994 //
995 //! \brief Sets the value of the capture-compare register
996 //!
997 //! \param baseAddress is the base address of the TIMER_B module.
998 //! \param compareRegister selects the compare register being used. Refer to
999 //! datasheet to ensure the device has the compare register being used.
1000 //! Valid values are:
1001 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
1002 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
1003 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
1004 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
1005 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
1006 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
1007 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
1008 //! \param compareValue is the count to be compared with in compare mode
1009 //!
1010 //! Modified bits of \b TBxCCRn register.
1011 //!
1012 //! \return None
1013 //
1014 //*****************************************************************************
1015 extern void Timer_B_setCompareValue(uint16_t baseAddress,
1016  uint16_t compareRegister,
1017  uint16_t compareValue);
1018 
1019 //*****************************************************************************
1020 //
1021 //! \brief Clears the Timer_B TBIFG interrupt flag
1022 //!
1023 //! \param baseAddress is the base address of the TIMER_B module.
1024 //!
1025 //! Modified bits are \b TBIFG of \b TBxCTL register.
1026 //!
1027 //! \return None
1028 //
1029 //*****************************************************************************
1030 extern void Timer_B_clearTimerInterrupt(uint16_t baseAddress);
1031 
1032 //*****************************************************************************
1033 //
1034 //! \brief Clears the capture-compare interrupt flag
1035 //!
1036 //! \param baseAddress is the base address of the TIMER_B module.
1037 //! \param captureCompareRegister selects the capture compare register being
1038 //! used. Refer to datasheet to ensure the device has the capture
1039 //! compare register being used.
1040 //! Valid values are:
1041 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
1042 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
1043 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
1044 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
1045 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
1046 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
1047 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
1048 //!
1049 //! Modified bits are \b CCIFG of \b TBxCCTLn register.
1050 //!
1051 //! \return None
1052 //
1053 //*****************************************************************************
1054 extern void Timer_B_clearCaptureCompareInterrupt(uint16_t baseAddress,
1055  uint16_t captureCompareRegister);
1056 
1057 //*****************************************************************************
1058 //
1059 //! \brief Selects Timer_B counter length
1060 //!
1061 //! \param baseAddress is the base address of the TIMER_B module.
1062 //! \param counterLength selects the value of counter length.
1063 //! Valid values are:
1064 //! - \b TIMER_B_COUNTER_16BIT [Default]
1065 //! - \b TIMER_B_COUNTER_12BIT
1066 //! - \b TIMER_B_COUNTER_10BIT
1067 //! - \b TIMER_B_COUNTER_8BIT
1068 //!
1069 //! Modified bits are \b CNTL of \b TBxCTL register.
1070 //!
1071 //! \return None
1072 //
1073 //*****************************************************************************
1074 extern void Timer_B_selectCounterLength(uint16_t baseAddress,
1075  uint16_t counterLength);
1076 
1077 //*****************************************************************************
1078 //
1079 //! \brief Selects Timer_B Latching Group
1080 //!
1081 //! \param baseAddress is the base address of the TIMER_B module.
1082 //! \param groupLatch selects the latching group.
1083 //! Valid values are:
1084 //! - \b TIMER_B_GROUP_NONE [Default]
1085 //! - \b TIMER_B_GROUP_CL12_CL23_CL56
1086 //! - \b TIMER_B_GROUP_CL123_CL456
1087 //! - \b TIMER_B_GROUP_ALL
1088 //!
1089 //! Modified bits are \b TBCLGRP of \b TBxCTL register.
1090 //!
1091 //! \return None
1092 //
1093 //*****************************************************************************
1094 extern void Timer_B_selectLatchingGroup(uint16_t baseAddress,
1095  uint16_t groupLatch);
1096 
1097 //*****************************************************************************
1098 //
1099 //! \brief Selects Compare Latch Load Event
1100 //!
1101 //! \param baseAddress is the base address of the TIMER_B module.
1102 //! \param compareRegister selects the compare register being used. Refer to
1103 //! datasheet to ensure the device has the compare register being used.
1104 //! Valid values are:
1105 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
1106 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
1107 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
1108 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
1109 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
1110 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
1111 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
1112 //! \param compareLatchLoadEvent selects the latch load event
1113 //! Valid values are:
1114 //! - \b TIMER_B_LATCH_ON_WRITE_TO_TBxCCRn_COMPARE_REGISTER [Default]
1115 //! - \b TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UP_OR_CONT_MODE
1116 //! - \b TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UPDOWN_MODE
1117 //! - \b
1118 //! TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_CURRENT_COMPARE_LATCH_VALUE
1119 //!
1120 //! Modified bits are \b CLLD of \b TBxCCTLn register.
1121 //!
1122 //! \return None
1123 //
1124 //*****************************************************************************
1125 extern void Timer_B_initCompareLatchLoadEvent(uint16_t baseAddress,
1126  uint16_t compareRegister,
1127  uint16_t compareLatchLoadEvent);
1128 
1129 //*****************************************************************************
1130 //
1131 //! \brief Reads the current timer count value
1132 //!
1133 //! Reads the current count value of the timer. There is a majority vote system
1134 //! in place to confirm an accurate value is returned. The Timer_B_THRESHOLD
1135 //! #define in the associated header file can be modified so that the votes
1136 //! must be closer together for a consensus to occur.
1137 //!
1138 //! \param baseAddress is the base address of the Timer module.
1139 //!
1140 //! \return Majority vote of timer count value
1141 //
1142 //*****************************************************************************
1143 extern uint16_t Timer_B_getCounterValue(uint16_t baseAddress);
1144 
1145 //*****************************************************************************
1146 //
1147 // Mark the end of the C bindings section for C++ compilers.
1148 //
1149 //*****************************************************************************
1150 #ifdef __cplusplus
1151 }
1152 #endif
1153 
1154 #endif
1155 #endif // __MSP430WARE_TIMER_B_H__
bool startTimer
Whether to start the timer immediately.
Definition: timer_b.h:155
void Timer_B_selectCounterLength(uint16_t baseAddress, uint16_t counterLength)
Selects Timer_B counter length.
Definition: timer_b.c:302
Used in the Timer_B_initContinuousMode() function as the param parameter.
Definition: timer_b.h:219
uint16_t clockSourceDivider
Definition: timer_b.h:134
void Timer_B_initContinuousMode(uint16_t baseAddress, Timer_B_initContinuousModeParam *param)
Configures Timer_B in continuous mode.
Definition: timer_b.c:28
void Timer_B_initUpDownMode(uint16_t baseAddress, Timer_B_initUpDownModeParam *param)
Configures Timer_B in up down mode.
Definition: timer_b.c:88
uint16_t timerInterruptEnable_TBIE
Definition: timer_b.h:142
uint16_t clockSource
Definition: timer_b.h:111
void Timer_B_initCompareLatchLoadEvent(uint16_t baseAddress, uint16_t compareRegister, uint16_t compareLatchLoadEvent)
Selects Compare Latch Load Event.
Definition: timer_b.c:317
uint8_t Timer_B_getOutputForOutputModeOutBitValue(uint16_t baseAddress, uint16_t captureCompareRegister)
Get output bit for output mode.
Definition: timer_b.c:219
uint16_t Timer_B_getCaptureCompareCount(uint16_t baseAddress, uint16_t captureCompareRegister)
Get current capturecompare count.
Definition: timer_b.c:232
void Timer_B_initCaptureMode(uint16_t baseAddress, Timer_B_initCaptureModeParam *param)
Initializes Capture Mode.
Definition: timer_b.c:122
void Timer_B_initCompareMode(uint16_t baseAddress, Timer_B_initCompareModeParam *param)
Initializes Compare Mode.
Definition: timer_b.c:145
void Timer_B_setOutputForOutputModeOutBitValue(uint16_t baseAddress, uint16_t captureCompareRegister, uint8_t outputModeOutBitValue)
Set output bit for output mode.
Definition: timer_b.c:240
uint16_t timerInterruptEnable_TBIE
Definition: timer_b.h:254
uint32_t Timer_B_getCaptureCompareInterruptStatus(uint16_t baseAddress, uint16_t captureCompareRegister, uint16_t mask)
Return capture compare interrupt status.
Definition: timer_b.c:192
Used in the Timer_B_initCaptureMode() function as the param parameter.
Definition: timer_b.h:164
uint16_t clockSource
Definition: timer_b.h:226
uint16_t timerPeriod
Selects the desired Timer_B period.
Definition: timer_b.h:72
void Timer_B_clearCaptureCompareInterrupt(uint16_t baseAddress, uint16_t captureCompareRegister)
Clears the capture-compare interrupt flag.
Definition: timer_b.c:295
Used in the Timer_B_initUpDownMode() function as the param parameter.
Definition: timer_b.h:271
uint16_t compareOutputMode
Definition: timer_b.h:357
uint16_t captureMode
Definition: timer_b.h:182
uint16_t timerClear
Definition: timer_b.h:319
uint16_t timerPeriod
Is the specified Timer_B period.
Definition: timer_b.h:303
void Timer_B_stop(uint16_t baseAddress)
Stops the Timer_B.
Definition: timer_b.c:277
void Timer_B_enableCaptureCompareInterrupt(uint16_t baseAddress, uint16_t captureCompareRegister)
Enable capture compare interrupt.
Definition: timer_b.c:178
uint16_t compareRegister
Definition: timer_b.h:83
uint16_t synchronizeCaptureSource
Definition: timer_b.h:194
uint16_t dutyCycle
Specifies the dutycycle for the generated waveform.
Definition: timer_b.h:96
void Timer_B_outputPWM(uint16_t baseAddress, Timer_B_outputPWMParam *param)
Generate a PWM with Timer_B running in up mode.
Definition: timer_b.c:249
uint16_t clockSourceDivider
Definition: timer_b.h:249
void Timer_B_setCompareValue(uint16_t baseAddress, uint16_t compareRegister, uint16_t compareValue)
Sets the value of the capture-compare register.
Definition: timer_b.c:282
uint16_t captureInterruptEnable
Definition: timer_b.h:199
uint16_t captureCompareInterruptEnable_CCR0_CCIE
Definition: timer_b.h:313
uint16_t captureCompareInterruptEnable_CCR0_CCIE
Definition: timer_b.h:147
bool startTimer
Whether to start the timer immediately.
Definition: timer_b.h:321
uint16_t compareValue
Is the count to be compared with in compare mode.
Definition: timer_b.h:359
void Timer_B_clear(uint16_t baseAddress)
Reset/Clear the Timer_B clock divider, count direction, count.
Definition: timer_b.c:200
uint16_t captureRegister
Definition: timer_b.h:175
uint16_t compareInterruptEnable
Definition: timer_b.h:346
Used in the Timer_B_initUpMode() function as the param parameter.
Definition: timer_b.h:104
uint32_t Timer_B_getInterruptStatus(uint16_t baseAddress)
Get Timer_B interrupt status.
Definition: timer_b.c:173
uint16_t timerPeriod
Definition: timer_b.h:137
uint16_t clockSource
Definition: timer_b.h:278
void Timer_B_selectLatchingGroup(uint16_t baseAddress, uint16_t groupLatch)
Selects Timer_B Latching Group.
Definition: timer_b.c:310
uint16_t Timer_B_getCounterValue(uint16_t baseAddress)
Reads the current timer count value.
Definition: timer_b.c:326
void Timer_B_disableCaptureCompareInterrupt(uint16_t baseAddress, uint16_t captureCompareRegister)
Disable capture compare interrupt.
Definition: timer_b.c:185
uint16_t compareOutputMode
Definition: timer_b.h:94
void Timer_B_startCounter(uint16_t baseAddress, uint16_t timerMode)
Starts Timer_B counter.
Definition: timer_b.c:21
Used in the Timer_B_outputPWM() function as the param parameter.
Definition: timer_b.h:40
uint16_t clockSource
Definition: timer_b.h:47
uint16_t captureInputSelect
Definition: timer_b.h:189
uint16_t compareRegister
Definition: timer_b.h:341
uint16_t timerClear
Definition: timer_b.h:153
void Timer_B_initUpMode(uint16_t baseAddress, Timer_B_initUpModeParam *param)
Configures Timer_B in up mode.
Definition: timer_b.c:54
uint16_t captureOutputMode
Definition: timer_b.h:210
uint16_t timerClear
Definition: timer_b.h:260
bool startTimer
Whether to start the timer immediately.
Definition: timer_b.h:262
void Timer_B_disableInterrupt(uint16_t baseAddress)
Disable Timer_B interrupt.
Definition: timer_b.c:168
Used in the Timer_B_initCompareMode() function as the param parameter.
Definition: timer_b.h:330
uint16_t clockSourceDivider
Definition: timer_b.h:301
uint16_t clockSourceDivider
Definition: timer_b.h:70
uint16_t timerInterruptEnable_TBIE
Definition: timer_b.h:308
void Timer_B_clearTimerInterrupt(uint16_t baseAddress)
Clears the Timer_B TBIFG interrupt flag.
Definition: timer_b.c:290
uint8_t Timer_B_getSynchronizedCaptureCompareInput(uint16_t baseAddress, uint16_t captureCompareRegister, uint16_t synchronized)
Get synchronized capturecompare input.
Definition: timer_b.c:206
void Timer_B_enableInterrupt(uint16_t baseAddress)
Enable Timer_B interrupt.
Definition: timer_b.c:163

Copyright 2015, Texas Instruments Incorporated