MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.70.00.08
 All Data Structures Files Functions Variables Enumerations 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 compareOutputMode
466 // parameter for functions: Timer_B_setOutputMode(); the param parameter for
467 // functions: Timer_B_initCaptureMode(), Timer_B_initCompareMode(), and
468 // Timer_B_outputPWM().
469 //
470 //*****************************************************************************
471 #define TIMER_B_OUTPUTMODE_OUTBITVALUE OUTMOD_0
472 #define TIMER_B_OUTPUTMODE_SET OUTMOD_1
473 #define TIMER_B_OUTPUTMODE_TOGGLE_RESET OUTMOD_2
474 #define TIMER_B_OUTPUTMODE_SET_RESET OUTMOD_3
475 #define TIMER_B_OUTPUTMODE_TOGGLE OUTMOD_4
476 #define TIMER_B_OUTPUTMODE_RESET OUTMOD_5
477 #define TIMER_B_OUTPUTMODE_TOGGLE_SET OUTMOD_6
478 #define TIMER_B_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_B_setCompareValue(),
484 // Timer_B_initCompareLatchLoadEvent(), and Timer_B_setOutputMode(); the
485 // captureCompareRegister parameter for functions:
486 // Timer_B_enableCaptureCompareInterrupt(),
487 // Timer_B_disableCaptureCompareInterrupt(),
488 // Timer_B_getCaptureCompareInterruptStatus(),
489 // Timer_B_getSynchronizedCaptureCompareInput(),
490 // Timer_B_getOutputForOutputModeOutBitValue(),
491 // Timer_B_getCaptureCompareCount(),
492 // Timer_B_setOutputForOutputModeOutBitValue(), and
493 // Timer_B_clearCaptureCompareInterrupt(); the param parameter for functions:
494 // Timer_B_initCaptureMode(), Timer_B_initCompareMode(), and
495 // Timer_B_outputPWM().
496 //
497 //*****************************************************************************
498 #define TIMER_B_CAPTURECOMPARE_REGISTER_0 0x02
499 #define TIMER_B_CAPTURECOMPARE_REGISTER_1 0x04
500 #define TIMER_B_CAPTURECOMPARE_REGISTER_2 0x06
501 #define TIMER_B_CAPTURECOMPARE_REGISTER_3 0x08
502 #define TIMER_B_CAPTURECOMPARE_REGISTER_4 0x0A
503 #define TIMER_B_CAPTURECOMPARE_REGISTER_5 0x0C
504 #define TIMER_B_CAPTURECOMPARE_REGISTER_6 0x0E
505 
506 //*****************************************************************************
507 //
508 // The following are values that can be passed to the param parameter for
509 // functions: Timer_B_initCaptureMode().
510 //
511 //*****************************************************************************
512 #define TIMER_B_CAPTUREMODE_NO_CAPTURE CM_0
513 #define TIMER_B_CAPTUREMODE_RISING_EDGE CM_1
514 #define TIMER_B_CAPTUREMODE_FALLING_EDGE CM_2
515 #define TIMER_B_CAPTUREMODE_RISING_AND_FALLING_EDGE CM_3
516 
517 //*****************************************************************************
518 //
519 // The following are values that can be passed to the param parameter for
520 // functions: Timer_B_initCaptureMode().
521 //
522 //*****************************************************************************
523 #define TIMER_B_CAPTURE_ASYNCHRONOUS 0x00
524 #define TIMER_B_CAPTURE_SYNCHRONOUS SCS
525 
526 //*****************************************************************************
527 //
528 // The following are values that can be passed to the mask parameter for
529 // functions: Timer_B_getCaptureCompareInterruptStatus() as well as returned by
530 // the Timer_B_getCaptureCompareInterruptStatus() function.
531 //
532 //*****************************************************************************
533 #define TIMER_B_CAPTURE_OVERFLOW COV
534 #define TIMER_B_CAPTURECOMPARE_INTERRUPT_FLAG CCIFG
535 
536 //*****************************************************************************
537 //
538 // The following are values that can be passed to the synchronized parameter
539 // for functions: Timer_B_getSynchronizedCaptureCompareInput().
540 //
541 //*****************************************************************************
542 #define TIMER_B_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT SCCI
543 #define TIMER_B_READ_CAPTURE_COMPARE_INPUT CCI
544 
545 //*****************************************************************************
546 //
547 // The following are values that can be passed toThe following are values that
548 // can be returned by the Timer_B_getSynchronizedCaptureCompareInput()
549 // function.
550 //
551 //*****************************************************************************
552 #define TIMER_B_CAPTURECOMPARE_INPUT_HIGH 0x01
553 #define TIMER_B_CAPTURECOMPARE_INPUT_LOW 0x00
554 
555 //*****************************************************************************
556 //
557 // The following are values that can be passed to the outputModeOutBitValue
558 // parameter for functions: Timer_B_setOutputForOutputModeOutBitValue() as well
559 // as returned by the Timer_B_getOutputForOutputModeOutBitValue() function.
560 //
561 //*****************************************************************************
562 #define TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH OUT
563 #define TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW 0x00
564 
565 //*****************************************************************************
566 //
567 // The following are values that can be passed to the counterLength parameter
568 // for functions: Timer_B_selectCounterLength().
569 //
570 //*****************************************************************************
571 #define TIMER_B_COUNTER_16BIT CNTL_3
572 #define TIMER_B_COUNTER_12BIT CNTL_2
573 #define TIMER_B_COUNTER_10BIT CNTL_1
574 #define TIMER_B_COUNTER_8BIT CNTL_0
575 
576 //*****************************************************************************
577 //
578 // The following are values that can be passed to the groupLatch parameter for
579 // functions: Timer_B_selectLatchingGroup().
580 //
581 //*****************************************************************************
582 #define TIMER_B_GROUP_NONE TBCLGRP_0
583 #define TIMER_B_GROUP_CL12_CL23_CL56 TBCLGRP_1
584 #define TIMER_B_GROUP_CL123_CL456 TBCLGRP_2
585 #define TIMER_B_GROUP_ALL TBCLGRP_3
586 
587 //*****************************************************************************
588 //
589 // The following are values that can be passed to the compareLatchLoadEvent
590 // parameter for functions: Timer_B_initCompareLatchLoadEvent().
591 //
592 //*****************************************************************************
593 #define TIMER_B_LATCH_ON_WRITE_TO_TBxCCRn_COMPARE_REGISTER CLLD_0
594 #define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UP_OR_CONT_MODE CLLD_1
595 #define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UPDOWN_MODE CLLD_2
596 #define TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_CURRENT_COMPARE_LATCH_VALUE CLLD_3
597 
598 //*****************************************************************************
599 //
600 // The following are values that can be passed toThe following are values that
601 // can be returned by the Timer_B_getInterruptStatus() function.
602 //
603 //*****************************************************************************
604 #define TIMER_B_INTERRUPT_NOT_PENDING 0x00
605 #define TIMER_B_INTERRUPT_PENDING 0x01
606 
607 //*****************************************************************************
608 //
609 // Prototypes for the APIs.
610 //
611 //*****************************************************************************
612 
613 //*****************************************************************************
614 //
615 //! \brief Starts Timer_B counter
616 //!
617 //! This function assumes that the timer has been previously configured using
618 //! Timer_B_initContinuousMode, Timer_B_initUpMode or Timer_B_initUpDownMode.
619 //!
620 //! \param baseAddress is the base address of the TIMER_B module.
621 //! \param timerMode selects the mode of the timer
622 //! Valid values are:
623 //! - \b TIMER_B_STOP_MODE
624 //! - \b TIMER_B_UP_MODE
625 //! - \b TIMER_B_CONTINUOUS_MODE [Default]
626 //! - \b TIMER_B_UPDOWN_MODE
627 //!
628 //! Modified bits of \b TBxCTL register.
629 //!
630 //! \return None
631 //
632 //*****************************************************************************
633 extern void Timer_B_startCounter(uint16_t baseAddress,
634  uint16_t timerMode);
635 
636 //*****************************************************************************
637 //
638 //! \brief Configures Timer_B in continuous mode.
639 //!
640 //! This API does not start the timer. Timer needs to be started when required
641 //! using the Timer_B_startCounter API.
642 //!
643 //! \param baseAddress is the base address of the TIMER_B module.
644 //! \param param is the pointer to struct for continuous mode initialization.
645 //!
646 //! Modified bits of \b TBxCTL register.
647 //!
648 //! \return None
649 //
650 //*****************************************************************************
651 extern void Timer_B_initContinuousMode(uint16_t baseAddress,
653 
654 //*****************************************************************************
655 //
656 //! \brief Configures Timer_B in up mode.
657 //!
658 //! This API does not start the timer. Timer needs to be started when required
659 //! using the Timer_B_startCounter API.
660 //!
661 //! \param baseAddress is the base address of the TIMER_B module.
662 //! \param param is the pointer to struct for up mode initialization.
663 //!
664 //! Modified bits of \b TBxCTL register, bits of \b TBxCCTL0 register and bits
665 //! of \b TBxCCR0 register.
666 //!
667 //! \return None
668 //
669 //*****************************************************************************
670 extern void Timer_B_initUpMode(uint16_t baseAddress,
671  Timer_B_initUpModeParam *param);
672 
673 //*****************************************************************************
674 //
675 //! \brief Configures Timer_B in up down mode.
676 //!
677 //! This API does not start the timer. Timer needs to be started when required
678 //! using the Timer_B_startCounter API.
679 //!
680 //! \param baseAddress is the base address of the TIMER_B module.
681 //! \param param is the pointer to struct for up-down mode initialization.
682 //!
683 //! Modified bits of \b TBxCTL register, bits of \b TBxCCTL0 register and bits
684 //! of \b TBxCCR0 register.
685 //!
686 //! \return None
687 //
688 //*****************************************************************************
689 extern void Timer_B_initUpDownMode(uint16_t baseAddress,
691 
692 //*****************************************************************************
693 //
694 //! \brief Initializes Capture Mode
695 //!
696 //! \param baseAddress is the base address of the TIMER_B module.
697 //! \param param is the pointer to struct for capture mode initialization.
698 //!
699 //! Modified bits of \b TBxCCTLn register.
700 //!
701 //! \return None
702 //
703 //*****************************************************************************
704 extern void Timer_B_initCaptureMode(uint16_t baseAddress,
706 
707 //*****************************************************************************
708 //
709 //! \brief Initializes Compare Mode
710 //!
711 //! \param baseAddress is the base address of the TIMER_B module.
712 //! \param param is the pointer to struct for compare mode initialization.
713 //!
714 //! Modified bits of \b TBxCCTLn register and bits of \b TBxCCRn register.
715 //!
716 //! \return None
717 //
718 //*****************************************************************************
719 extern void Timer_B_initCompareMode(uint16_t baseAddress,
721 
722 //*****************************************************************************
723 //
724 //! \brief Enable Timer_B interrupt
725 //!
726 //! Enables Timer_B interrupt. Does not clear interrupt flags.
727 //!
728 //! \param baseAddress is the base address of the TIMER_B module.
729 //!
730 //! Modified bits of \b TBxCTL register.
731 //!
732 //! \return None
733 //
734 //*****************************************************************************
735 extern void Timer_B_enableInterrupt(uint16_t baseAddress);
736 
737 //*****************************************************************************
738 //
739 //! \brief Disable Timer_B interrupt
740 //!
741 //! \param baseAddress is the base address of the TIMER_B module.
742 //!
743 //! Modified bits of \b TBxCTL register.
744 //!
745 //! \return None
746 //
747 //*****************************************************************************
748 extern void Timer_B_disableInterrupt(uint16_t baseAddress);
749 
750 //*****************************************************************************
751 //
752 //! \brief Get Timer_B interrupt status
753 //!
754 //! \param baseAddress is the base address of the TIMER_B module.
755 //!
756 //! \return One of the following:
757 //! - \b Timer_B_INTERRUPT_NOT_PENDING
758 //! - \b Timer_B_INTERRUPT_PENDING
759 //! \n indicating the status of the Timer_B interrupt
760 //
761 //*****************************************************************************
762 extern uint32_t Timer_B_getInterruptStatus(uint16_t baseAddress);
763 
764 //*****************************************************************************
765 //
766 //! \brief Enable capture compare interrupt
767 //!
768 //! \param baseAddress is the base address of the TIMER_B module.
769 //! \param captureCompareRegister selects the capture compare register being
770 //! used. Refer to datasheet to ensure the device has the capture
771 //! compare register being used.
772 //! Valid values are:
773 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
774 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
775 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
776 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
777 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
778 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
779 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
780 //!
781 //! Modified bits of \b TBxCCTLn register.
782 //!
783 //! \return None
784 //
785 //*****************************************************************************
786 extern void Timer_B_enableCaptureCompareInterrupt(uint16_t baseAddress,
787  uint16_t captureCompareRegister);
788 
789 //*****************************************************************************
790 //
791 //! \brief Disable capture compare interrupt
792 //!
793 //! \param baseAddress is the base address of the TIMER_B module.
794 //! \param captureCompareRegister selects the capture compare register being
795 //! used. Refer to datasheet to ensure the device has the capture
796 //! compare register being used.
797 //! Valid values are:
798 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
799 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
800 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
801 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
802 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
803 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
804 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
805 //!
806 //! Modified bits of \b TBxCCTLn register.
807 //!
808 //! \return None
809 //
810 //*****************************************************************************
811 extern void Timer_B_disableCaptureCompareInterrupt(uint16_t baseAddress,
812  uint16_t captureCompareRegister);
813 
814 //*****************************************************************************
815 //
816 //! \brief Return capture compare interrupt status
817 //!
818 //! \param baseAddress is the base address of the TIMER_B module.
819 //! \param captureCompareRegister selects the capture compare register being
820 //! used. Refer to datasheet to ensure the device has the capture
821 //! compare register being used.
822 //! Valid values are:
823 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
824 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
825 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
826 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
827 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
828 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
829 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
830 //! \param mask is the mask for the interrupt status
831 //! Mask value is the logical OR of any of the following:
832 //! - \b TIMER_B_CAPTURE_OVERFLOW
833 //! - \b TIMER_B_CAPTURECOMPARE_INTERRUPT_FLAG
834 //!
835 //! \return Logical OR of any of the following:
836 //! - \b Timer_B_CAPTURE_OVERFLOW
837 //! - \b Timer_B_CAPTURECOMPARE_INTERRUPT_FLAG
838 //! \n indicating the status of the masked interrupts
839 //
840 //*****************************************************************************
841 extern uint32_t Timer_B_getCaptureCompareInterruptStatus(uint16_t baseAddress,
842  uint16_t captureCompareRegister,
843  uint16_t mask);
844 
845 //*****************************************************************************
846 //
847 //! \brief Reset/Clear the Timer_B clock divider, count direction, count
848 //!
849 //! \param baseAddress is the base address of the TIMER_B module.
850 //!
851 //! Modified bits of \b TBxCTL register.
852 //!
853 //! \return None
854 //
855 //*****************************************************************************
856 extern void Timer_B_clear(uint16_t baseAddress);
857 
858 //*****************************************************************************
859 //
860 //! \brief Get synchronized capturecompare input
861 //!
862 //! \param baseAddress is the base address of the TIMER_B module.
863 //! \param captureCompareRegister selects the capture compare register being
864 //! used. Refer to datasheet to ensure the device has the capture
865 //! compare register being used.
866 //! Valid values are:
867 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
868 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
869 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
870 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
871 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
872 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
873 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
874 //! \param synchronized selects the type of capture compare input
875 //! Valid values are:
876 //! - \b TIMER_B_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT
877 //! - \b TIMER_B_READ_CAPTURE_COMPARE_INPUT
878 //!
879 //! \return One of the following:
880 //! - \b Timer_B_CAPTURECOMPARE_INPUT_HIGH
881 //! - \b Timer_B_CAPTURECOMPARE_INPUT_LOW
882 //
883 //*****************************************************************************
884 extern uint8_t Timer_B_getSynchronizedCaptureCompareInput(uint16_t baseAddress,
885  uint16_t captureCompareRegister,
886  uint16_t synchronized);
887 
888 //*****************************************************************************
889 //
890 //! \brief Get output bit for output mode
891 //!
892 //! \param baseAddress is the base address of the TIMER_B module.
893 //! \param captureCompareRegister selects the capture compare register being
894 //! used. Refer to datasheet to ensure the device has the capture
895 //! compare register being used.
896 //! Valid values are:
897 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
898 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
899 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
900 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
901 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
902 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
903 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
904 //!
905 //! \return One of the following:
906 //! - \b Timer_B_OUTPUTMODE_OUTBITVALUE_HIGH
907 //! - \b Timer_B_OUTPUTMODE_OUTBITVALUE_LOW
908 //
909 //*****************************************************************************
910 extern uint8_t Timer_B_getOutputForOutputModeOutBitValue(uint16_t baseAddress,
911  uint16_t captureCompareRegister);
912 
913 //*****************************************************************************
914 //
915 //! \brief Get current capturecompare count
916 //!
917 //! \param baseAddress is the base address of the TIMER_B module.
918 //! \param captureCompareRegister selects the capture compare register being
919 //! used. Refer to datasheet to ensure the device has the capture
920 //! compare register being used.
921 //! Valid values are:
922 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
923 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
924 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
925 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
926 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
927 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
928 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
929 //!
930 //! \return Current count as uint16_t
931 //
932 //*****************************************************************************
933 extern uint16_t Timer_B_getCaptureCompareCount(uint16_t baseAddress,
934  uint16_t captureCompareRegister);
935 
936 //*****************************************************************************
937 //
938 //! \brief Set output bit for output mode
939 //!
940 //! \param baseAddress is the base address of the TIMER_B module.
941 //! \param captureCompareRegister selects the capture compare register being
942 //! used. Refer to datasheet to ensure the device has the capture
943 //! compare register being used.
944 //! Valid values are:
945 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
946 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
947 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
948 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
949 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
950 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
951 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
952 //! \param outputModeOutBitValue the value to be set for out bit
953 //! Valid values are:
954 //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE_HIGH
955 //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE_LOW
956 //!
957 //! Modified bits of \b TBxCCTLn register.
958 //!
959 //! \return None
960 //
961 //*****************************************************************************
962 extern void Timer_B_setOutputForOutputModeOutBitValue(uint16_t baseAddress,
963  uint16_t captureCompareRegister,
964  uint8_t outputModeOutBitValue);
965 
966 //*****************************************************************************
967 //
968 //! \brief Generate a PWM with Timer_B running in up mode
969 //!
970 //! \param baseAddress is the base address of the TIMER_B module.
971 //! \param param is the pointer to struct for PWM configuration.
972 //!
973 //! Modified bits of \b TBxCCTLn register, bits of \b TBxCTL register, bits of
974 //! \b TBxCCTL0 register and bits of \b TBxCCR0 register.
975 //!
976 //! \return None
977 //
978 //*****************************************************************************
979 extern void Timer_B_outputPWM(uint16_t baseAddress,
980  Timer_B_outputPWMParam *param);
981 
982 //*****************************************************************************
983 //
984 //! \brief Stops the Timer_B
985 //!
986 //! \param baseAddress is the base address of the TIMER_B module.
987 //!
988 //! Modified bits of \b TBxCTL register.
989 //!
990 //! \return None
991 //
992 //*****************************************************************************
993 extern void Timer_B_stop(uint16_t baseAddress);
994 
995 //*****************************************************************************
996 //
997 //! \brief Sets the value of the capture-compare register
998 //!
999 //! \param baseAddress is the base address of the TIMER_B module.
1000 //! \param compareRegister selects the compare register being used. Refer to
1001 //! datasheet to ensure the device has the compare register being used.
1002 //! Valid values are:
1003 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
1004 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
1005 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
1006 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
1007 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
1008 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
1009 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
1010 //! \param compareValue is the count to be compared with in compare mode
1011 //!
1012 //! Modified bits of \b TBxCCRn register.
1013 //!
1014 //! \return None
1015 //
1016 //*****************************************************************************
1017 extern void Timer_B_setCompareValue(uint16_t baseAddress,
1018  uint16_t compareRegister,
1019  uint16_t compareValue);
1020 
1021 //*****************************************************************************
1022 //
1023 //! \brief Clears the Timer_B TBIFG interrupt flag
1024 //!
1025 //! \param baseAddress is the base address of the TIMER_B module.
1026 //!
1027 //! Modified bits are \b TBIFG of \b TBxCTL register.
1028 //!
1029 //! \return None
1030 //
1031 //*****************************************************************************
1032 extern void Timer_B_clearTimerInterrupt(uint16_t baseAddress);
1033 
1034 //*****************************************************************************
1035 //
1036 //! \brief Clears the capture-compare interrupt flag
1037 //!
1038 //! \param baseAddress is the base address of the TIMER_B module.
1039 //! \param captureCompareRegister selects the capture compare register being
1040 //! used. Refer to datasheet to ensure the device has the capture
1041 //! compare register being used.
1042 //! Valid values are:
1043 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
1044 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
1045 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
1046 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
1047 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
1048 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
1049 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
1050 //!
1051 //! Modified bits are \b CCIFG of \b TBxCCTLn register.
1052 //!
1053 //! \return None
1054 //
1055 //*****************************************************************************
1056 extern void Timer_B_clearCaptureCompareInterrupt(uint16_t baseAddress,
1057  uint16_t captureCompareRegister);
1058 
1059 //*****************************************************************************
1060 //
1061 //! \brief Selects Timer_B counter length
1062 //!
1063 //! \param baseAddress is the base address of the TIMER_B module.
1064 //! \param counterLength selects the value of counter length.
1065 //! Valid values are:
1066 //! - \b TIMER_B_COUNTER_16BIT [Default]
1067 //! - \b TIMER_B_COUNTER_12BIT
1068 //! - \b TIMER_B_COUNTER_10BIT
1069 //! - \b TIMER_B_COUNTER_8BIT
1070 //!
1071 //! Modified bits are \b CNTL of \b TBxCTL register.
1072 //!
1073 //! \return None
1074 //
1075 //*****************************************************************************
1076 extern void Timer_B_selectCounterLength(uint16_t baseAddress,
1077  uint16_t counterLength);
1078 
1079 //*****************************************************************************
1080 //
1081 //! \brief Selects Timer_B Latching Group
1082 //!
1083 //! \param baseAddress is the base address of the TIMER_B module.
1084 //! \param groupLatch selects the latching group.
1085 //! Valid values are:
1086 //! - \b TIMER_B_GROUP_NONE [Default]
1087 //! - \b TIMER_B_GROUP_CL12_CL23_CL56
1088 //! - \b TIMER_B_GROUP_CL123_CL456
1089 //! - \b TIMER_B_GROUP_ALL
1090 //!
1091 //! Modified bits are \b TBCLGRP of \b TBxCTL register.
1092 //!
1093 //! \return None
1094 //
1095 //*****************************************************************************
1096 extern void Timer_B_selectLatchingGroup(uint16_t baseAddress,
1097  uint16_t groupLatch);
1098 
1099 //*****************************************************************************
1100 //
1101 //! \brief Selects Compare Latch Load Event
1102 //!
1103 //! \param baseAddress is the base address of the TIMER_B module.
1104 //! \param compareRegister selects the compare register being used. Refer to
1105 //! datasheet to ensure the device has the compare register being used.
1106 //! Valid values are:
1107 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
1108 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
1109 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
1110 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
1111 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
1112 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
1113 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
1114 //! \param compareLatchLoadEvent selects the latch load event
1115 //! Valid values are:
1116 //! - \b TIMER_B_LATCH_ON_WRITE_TO_TBxCCRn_COMPARE_REGISTER [Default]
1117 //! - \b TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UP_OR_CONT_MODE
1118 //! - \b TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_0_IN_UPDOWN_MODE
1119 //! - \b
1120 //! TIMER_B_LATCH_WHEN_COUNTER_COUNTS_TO_CURRENT_COMPARE_LATCH_VALUE
1121 //!
1122 //! Modified bits are \b CLLD of \b TBxCCTLn register.
1123 //!
1124 //! \return None
1125 //
1126 //*****************************************************************************
1127 extern void Timer_B_initCompareLatchLoadEvent(uint16_t baseAddress,
1128  uint16_t compareRegister,
1129  uint16_t compareLatchLoadEvent);
1130 
1131 //*****************************************************************************
1132 //
1133 //! \brief Reads the current timer count value
1134 //!
1135 //! Reads the current count value of the timer. There is a majority vote system
1136 //! in place to confirm an accurate value is returned. The Timer_B_THRESHOLD
1137 //! #define in the associated header file can be modified so that the votes
1138 //! must be closer together for a consensus to occur.
1139 //!
1140 //! \param baseAddress is the base address of the Timer module.
1141 //!
1142 //! \return Majority vote of timer count value
1143 //
1144 //*****************************************************************************
1145 extern uint16_t Timer_B_getCounterValue(uint16_t baseAddress);
1146 
1147 //*****************************************************************************
1148 //
1149 //! \brief Sets the output mode
1150 //!
1151 //! Sets the output mode for the timer even the timer is already running.
1152 //!
1153 //! \param baseAddress is the base address of the TIMER_B module.
1154 //! \param compareRegister selects the compare register being used.
1155 //! Valid values are:
1156 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_0
1157 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_1
1158 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_2
1159 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_3
1160 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_4
1161 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_5
1162 //! - \b TIMER_B_CAPTURECOMPARE_REGISTER_6
1163 //! \param compareOutputMode specifies the output mode.
1164 //! Valid values are:
1165 //! - \b TIMER_B_OUTPUTMODE_OUTBITVALUE [Default]
1166 //! - \b TIMER_B_OUTPUTMODE_SET
1167 //! - \b TIMER_B_OUTPUTMODE_TOGGLE_RESET
1168 //! - \b TIMER_B_OUTPUTMODE_SET_RESET
1169 //! - \b TIMER_B_OUTPUTMODE_TOGGLE
1170 //! - \b TIMER_B_OUTPUTMODE_RESET
1171 //! - \b TIMER_B_OUTPUTMODE_TOGGLE_SET
1172 //! - \b TIMER_B_OUTPUTMODE_RESET_SET
1173 //!
1174 //! Modified bits are \b OUTMOD of \b TBxCCTLn register.
1175 //!
1176 //! \return None
1177 //
1178 //*****************************************************************************
1179 extern void Timer_B_setOutputMode(uint16_t baseAddress,
1180  uint16_t compareRegister,
1181  uint16_t compareOutputMode);
1182 
1183 //*****************************************************************************
1184 //
1185 // Mark the end of the C bindings section for C++ compilers.
1186 //
1187 //*****************************************************************************
1188 #ifdef __cplusplus
1189 }
1190 #endif
1191 
1192 #endif
1193 #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:303
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:318
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:296
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_setOutputMode(uint16_t baseAddress, uint16_t compareRegister, uint16_t compareOutputMode)
Sets the output mode.
Definition: timer_b.c:351
void Timer_B_stop(uint16_t baseAddress)
Stops the Timer_B.
Definition: timer_b.c:278
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:283
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:311
uint16_t Timer_B_getCounterValue(uint16_t baseAddress)
Reads the current timer count value.
Definition: timer_b.c:327
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:291
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 2016, Texas Instruments Incorporated