2 * -------------------------------------------
3 * MSP432 DriverLib - v3_10_00_09
4 * -------------------------------------------
6 * --COPYRIGHT--,BSD,BSD
7 * Copyright (c) 2014, Texas Instruments Incorporated
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * * Neither the name of Texas Instruments Incorporated nor the names of
22 * its contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 //*****************************************************************************
42 //! \addtogroup timera_api
45 //*****************************************************************************
47 //*****************************************************************************
49 // If building with a C++ compiler, make all of the definitions in this header
52 //*****************************************************************************
61 //*****************************************************************************
63 // Timer_A Specific Parameters
65 //*****************************************************************************
66 #define TIMER_A_CMSIS(x) ((Timer_A_Type *) x)
68 #define TIMER_A_CCR0_INTERRUPT 0x00
69 #define TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT 0x01
71 //*****************************************************************************
73 //! ypedef Timer_A_ContinuousModeConfig
74 //! \brief Type definition for \link _Timer_A_ContinuousModeConfig \endlink
77 //! \struct _Timer_A_ContinuousModeConfig
78 //! \brief Configuration structure for continuous mode in the \b Timer_A module.
79 //! See \link Timer_A_configureContinuousMode \endlink for parameter
82 //*****************************************************************************
83 typedef struct _Timer_A_ContinuousModeConfig
85 uint_fast16_t clockSource;
86 uint_fast16_t clockSourceDivider;
87 uint_fast16_t timerInterruptEnable_TAIE;
88 uint_fast16_t timerClear;
89 } Timer_A_ContinuousModeConfig;
91 //*****************************************************************************
93 //! ypedef Timer_A_UpModeConfig
94 //! \brief Type definition for \link _Timer_A_UpModeConfig \endlink
97 //! \struct _Timer_A_UpModeConfig
98 //! \brief Configuration structure for Up mode in the \b Timer_A module. See
99 //! \link Timer_A_configureUpMode \endlink for parameter
102 //*****************************************************************************
103 typedef struct _Timer_A_UpModeConfig
105 uint_fast16_t clockSource;
106 uint_fast16_t clockSourceDivider;
107 uint_fast16_t timerPeriod;
108 uint_fast16_t timerInterruptEnable_TAIE;
109 uint_fast16_t captureCompareInterruptEnable_CCR0_CCIE;
110 uint_fast16_t timerClear;
111 } Timer_A_UpModeConfig;
113 //*****************************************************************************
115 //! ypedef Timer_A_UpDownModeConfig
116 //! \brief Type definition for \link _Timer_A_UpDownModeConfig \endlink
119 //! \struct _Timer_A_UpDownModeConfig
120 //! \brief Configuration structure for UpDown mode in the \b Timer_A module. See
121 //! \link Timer_A_configureUpDownMode \endlink for parameter
124 //*****************************************************************************
125 typedef struct _Timer_A_UpDownModeConfig
127 uint_fast16_t clockSource;
128 uint_fast16_t clockSourceDivider;
129 uint_fast16_t timerPeriod;
130 uint_fast16_t timerInterruptEnable_TAIE;
131 uint_fast16_t captureCompareInterruptEnable_CCR0_CCIE;
132 uint_fast16_t timerClear;
133 } Timer_A_UpDownModeConfig;
135 //*****************************************************************************
137 //! ypedef Timer_A_CaptureModeConfig
138 //! \brief Type definition for \link _Timer_A_CaptureModeConfig \endlink
141 //! \struct _Timer_A_CaptureModeConfig
142 //! \brief Configuration structure for capture mode in the \b Timer_A module.
143 //! See \link Timer_A_initCapture \endlink for parameter
146 //*****************************************************************************
147 typedef struct _Timer_A_CaptureModeConfig
149 uint_fast16_t captureRegister;
150 uint_fast16_t captureMode;
151 uint_fast16_t captureInputSelect;
152 uint_fast16_t synchronizeCaptureSource;
153 uint_fast8_t captureInterruptEnable;
154 uint_fast16_t captureOutputMode;
155 } Timer_A_CaptureModeConfig;
157 //*****************************************************************************
159 //! ypedef Timer_A_CompareModeConfig
160 //! \brief Type definition for \link _Timer_A_CompareModeConfig \endlink
163 //! \struct _Timer_A_CompareModeConfig
164 //! \brief Configuration structure for compare mode in the \b Timer_A module.
165 //! See \link Timer_A_initCompare \endlink for parameter
168 //*****************************************************************************
169 typedef struct _Timer_A_CompareModeConfig
171 uint_fast16_t compareRegister;
172 uint_fast16_t compareInterruptEnable;
173 uint_fast16_t compareOutputMode;
174 uint_fast16_t compareValue;
175 } Timer_A_CompareModeConfig;
177 //*****************************************************************************
179 //! ypedef Timer_A_PWMConfig
180 //! \brief Type definition for \link _Timer_A_PWMConfig \endlink
183 //! \struct _Timer_A_PWMConfig
184 //! \brief Configuration structure for PWM mode in the \b Timer_A module. See
185 //! \link Timer_A_generatePWM \endlink for parameter
188 //*****************************************************************************
189 typedef struct _Timer_A_PWMConfig
191 uint_fast16_t clockSource;
192 uint_fast16_t clockSourceDivider;
193 uint_fast16_t timerPeriod;
194 uint_fast16_t compareRegister;
195 uint_fast16_t compareOutputMode;
196 uint_fast16_t dutyCycle;
200 //*****************************************************************************
202 // The following is a parameter determines the maximum difference in counts of
203 // the TAxR register for a majority vote
205 //*****************************************************************************
206 #define TIMER_A_THRESHOLD 50
208 //*****************************************************************************
210 // The following are values that can be passed to the clockSourceDivider
213 //*****************************************************************************
214 #define TIMER_A_CLOCKSOURCE_DIVIDER_1 0x01
215 #define TIMER_A_CLOCKSOURCE_DIVIDER_2 0x02
216 #define TIMER_A_CLOCKSOURCE_DIVIDER_4 0x04
217 #define TIMER_A_CLOCKSOURCE_DIVIDER_8 0x08
218 #define TIMER_A_CLOCKSOURCE_DIVIDER_3 0x03
219 #define TIMER_A_CLOCKSOURCE_DIVIDER_5 0x05
220 #define TIMER_A_CLOCKSOURCE_DIVIDER_6 0x06
221 #define TIMER_A_CLOCKSOURCE_DIVIDER_7 0x07
222 #define TIMER_A_CLOCKSOURCE_DIVIDER_10 0x0A
223 #define TIMER_A_CLOCKSOURCE_DIVIDER_12 0x0C
224 #define TIMER_A_CLOCKSOURCE_DIVIDER_14 0x0E
225 #define TIMER_A_CLOCKSOURCE_DIVIDER_16 0x10
226 #define TIMER_A_CLOCKSOURCE_DIVIDER_20 0x14
227 #define TIMER_A_CLOCKSOURCE_DIVIDER_24 0x18
228 #define TIMER_A_CLOCKSOURCE_DIVIDER_28 0x1C
229 #define TIMER_A_CLOCKSOURCE_DIVIDER_32 0x20
230 #define TIMER_A_CLOCKSOURCE_DIVIDER_40 0x28
231 #define TIMER_A_CLOCKSOURCE_DIVIDER_48 0x30
232 #define TIMER_A_CLOCKSOURCE_DIVIDER_56 0x38
233 #define TIMER_A_CLOCKSOURCE_DIVIDER_64 0x40
235 //*****************************************************************************
237 // The following are values that can be passed to the timerMode parameter
239 //*****************************************************************************
240 #define TIMER_A_STOP_MODE TIMER_A_CTL_MC_0
241 #define TIMER_A_UP_MODE TIMER_A_CTL_MC_1
242 #define TIMER_A_CONTINUOUS_MODE TIMER_A_CTL_MC_2
243 #define TIMER_A_UPDOWN_MODE TIMER_A_CTL_MC_3
245 //*****************************************************************************
247 // The following are values that can be passed to the timerClear parameter
249 //*****************************************************************************
250 #define TIMER_A_DO_CLEAR TIMER_A_CTL_CLR
251 #define TIMER_A_SKIP_CLEAR 0x00
253 //*****************************************************************************
255 // The following are values that can be passed to the clockSource parameter
257 //*****************************************************************************
258 #define TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK TIMER_A_CTL_SSEL__TACLK
259 #define TIMER_A_CLOCKSOURCE_ACLK TIMER_A_CTL_SSEL__ACLK
260 #define TIMER_A_CLOCKSOURCE_SMCLK TIMER_A_CTL_SSEL__SMCLK
261 #define TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK TIMER_A_CTL_SSEL__INCLK
263 //*****************************************************************************
265 // The following are values that can be passed to the timerInterruptEnable_TAIE
268 //*****************************************************************************
269 #define TIMER_A_TAIE_INTERRUPT_ENABLE TIMER_A_CTL_IE
270 #define TIMER_A_TAIE_INTERRUPT_DISABLE 0x00
272 //*****************************************************************************
274 // The following are values that can be passed to the
275 // captureCompareInterruptEnable_CCR0_CCIE parameter
277 //*****************************************************************************
278 #define TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE TIMER_A_CCTLN_CCIE
279 #define TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE 0x00
281 //*****************************************************************************
283 // The following are values that can be passed to the captureInterruptEnable
286 //*****************************************************************************
287 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE 0x00
288 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE TIMER_A_CCTLN_CCIE
290 //*****************************************************************************
292 // The following are values that can be passed to the captureInputSelect
295 //*****************************************************************************
296 #define TIMER_A_CAPTURE_INPUTSELECT_CCIxA TIMER_A_CCTLN_CCIS_0
297 #define TIMER_A_CAPTURE_INPUTSELECT_CCIxB TIMER_A_CCTLN_CCIS_1
298 #define TIMER_A_CAPTURE_INPUTSELECT_GND TIMER_A_CCTLN_CCIS_2
299 #define TIMER_A_CAPTURE_INPUTSELECT_Vcc TIMER_A_CCTLN_CCIS_3
301 //*****************************************************************************
303 // The following are values that can be passed to the compareOutputMode
306 //*****************************************************************************
307 #define TIMER_A_OUTPUTMODE_OUTBITVALUE TIMER_A_CCTLN_OUTMOD_0
308 #define TIMER_A_OUTPUTMODE_SET TIMER_A_CCTLN_OUTMOD_1
309 #define TIMER_A_OUTPUTMODE_TOGGLE_RESET TIMER_A_CCTLN_OUTMOD_2
310 #define TIMER_A_OUTPUTMODE_SET_RESET TIMER_A_CCTLN_OUTMOD_3
311 #define TIMER_A_OUTPUTMODE_TOGGLE TIMER_A_CCTLN_OUTMOD_4
312 #define TIMER_A_OUTPUTMODE_RESET TIMER_A_CCTLN_OUTMOD_5
313 #define TIMER_A_OUTPUTMODE_TOGGLE_SET TIMER_A_CCTLN_OUTMOD_6
314 #define TIMER_A_OUTPUTMODE_RESET_SET TIMER_A_CCTLN_OUTMOD_7
316 //*****************************************************************************
318 // The following are values that can be passed to the compareRegister parameter
320 //*****************************************************************************
321 #define TIMER_A_CAPTURECOMPARE_REGISTER_0 0x02
322 #define TIMER_A_CAPTURECOMPARE_REGISTER_1 0x04
323 #define TIMER_A_CAPTURECOMPARE_REGISTER_2 0x06
324 #define TIMER_A_CAPTURECOMPARE_REGISTER_3 0x08
325 #define TIMER_A_CAPTURECOMPARE_REGISTER_4 0x0A
326 #define TIMER_A_CAPTURECOMPARE_REGISTER_5 0x0C
327 #define TIMER_A_CAPTURECOMPARE_REGISTER_6 0x0E
329 //*****************************************************************************
331 // The following are values that can be passed to the captureMode parameter
333 //*****************************************************************************
334 #define TIMER_A_CAPTUREMODE_NO_CAPTURE TIMER_A_CCTLN_CM_0
335 #define TIMER_A_CAPTUREMODE_RISING_EDGE TIMER_A_CCTLN_CM_1
336 #define TIMER_A_CAPTUREMODE_FALLING_EDGE TIMER_A_CCTLN_CM_2
337 #define TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE TIMER_A_CCTLN_CM_3
339 //*****************************************************************************
341 // The following are values that can be passed to the synchronizeCaptureSource
344 //*****************************************************************************
345 #define TIMER_A_CAPTURE_ASYNCHRONOUS 0x00
346 #define TIMER_A_CAPTURE_SYNCHRONOUS TIMER_A_CCTLN_SCS
348 //*****************************************************************************
350 // The following are values that can be passed to the mask parameter
352 //*****************************************************************************
353 #define TIMER_A_CAPTURE_OVERFLOW TIMER_A_CCTLN_COV
354 #define TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG TIMER_A_CCTLN_CCIFG
356 //*****************************************************************************
358 // The following are values that can be passed to the synchronized parameter
360 //*****************************************************************************
361 #define TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT TIMER_A_CCTLN_SCCI
362 #define TIMER_A_READ_CAPTURE_COMPARE_INPUT TIMER_A_CCTLN_CCI
365 #define TIMER_A_CAPTURECOMPARE_INPUT_HIGH 0x01
366 #define TIMER_A_CAPTURECOMPARE_INPUT_LOW 0x00
368 //*****************************************************************************
370 // The following are values that can be passed to the outputModeOutBitValue
373 //*****************************************************************************
374 #define TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH TIMER_A_CCTLN_OUT
375 #define TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW 0x00
377 //*****************************************************************************
379 // The following are values that can be passed toThe following are values that
380 // can be returned by the interrupt functions
382 //*****************************************************************************
383 #define TIMER_A_INTERRUPT_NOT_PENDING 0x00
384 #define TIMER_A_INTERRUPT_PENDING 0x01
387 /* Convenience function for setting the PWM Duty Cycle */
388 #define Timer_A_setDutyCycle(timer,dutyCycle) \
389 Timer_A_setCompareValue(timer,dutyCycle)
391 //*****************************************************************************
393 //Prototypes for the APIs.
395 //*****************************************************************************
397 //*****************************************************************************
399 //! Starts Timer_A counter
401 //! \param timer is the instance of the Timer_A module. Valid parameters
402 //! vary from part to part, but can include:
403 //! - \b TIMER_A0_BASE
404 //! - \b TIMER_A1_BASE
405 //! - \b TIMER_A2_BASE
406 //! - \b TIMER_A3_BASE
407 //! \param timerMode selects Clock source. Valid values are
408 //! - \b TIMER_A_CONTINUOUS_MODE [Default value]
409 //! - \b TIMER_A_UPDOWN_MODE
410 //! - \b TIMER_A_UP_MODE
412 //! \note This function assumes that the timer has been previously configured
413 //! using Timer_A_configureContinuousMode, Timer_A_configureUpMode or
414 //! Timer_A_configureUpDownMode.
418 //*****************************************************************************
419 extern void Timer_A_startCounter(uint32_t timer, uint_fast16_t timerMode);
421 //*****************************************************************************
423 //! Configures Timer_A in continuous mode.
425 //! \param timer is the instance of the Timer_A module. Valid parameters
426 //! vary from part to part, but can include:
427 //! - \b TIMER_A0_BASE
428 //! - \b TIMER_A1_BASE
429 //! - \b TIMER_A2_BASE
430 //! - \b TIMER_A3_BASE
431 //! \param config Configuration structure for Timer_A continuous mode
434 //! <b>Configuration options for \link Timer_A_ContinuousModeConfig \endlink
438 //! \param clockSource selects Clock source. Valid values are
439 //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default value]
440 //! - \b TIMER_A_CLOCKSOURCE_ACLK
441 //! - \b TIMER_A_CLOCKSOURCE_SMCLK
442 //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
443 //! \param timerInterruptEnable_TAIE is the divider for Clock source.
444 //! Valid values are:
445 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default value]
446 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
447 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
448 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
449 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
450 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
451 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
452 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
453 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
454 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
455 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
456 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
457 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
458 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
459 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
460 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
461 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
462 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
463 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
464 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
465 //! \param timerInterruptEnable_TAIE is to enable or disable Timer_A
466 //! interrupt. Valid values are
467 //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE
468 //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default value]
469 //! \param timerClear decides if Timer_A clock divider, count direction,
470 //! count need to be reset. Valid values are
471 //! - \b TIMER_A_DO_CLEAR
472 //! - \b TIMER_A_SKIP_CLEAR [Default value]
474 //! \note This API does not start the timer. Timer needs to be started when
475 //! required using the Timer_A_startCounter API.
479 //*****************************************************************************
480 extern void Timer_A_configureContinuousMode(uint32_t timer,
481 const Timer_A_ContinuousModeConfig *config);
483 //*****************************************************************************
485 //! Configures Timer_A in up mode.
487 //! \param timer is the instance of the Timer_A module. Valid parameters
488 //! vary from part to part, but can include:
489 //! - \b TIMER_A0_BASE
490 //! - \b TIMER_A1_BASE
491 //! - \b TIMER_A2_BASE
492 //! - \b TIMER_A3_BASE
493 //! \param config Configuration structure for Timer_A Up mode
496 //! <b>Configuration options for \link Timer_A_UpModeConfig \endlink
499 //! \param clockSource selects Clock source. Valid values are
500 //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default value]
501 //! - \b TIMER_A_CLOCKSOURCE_ACLK
502 //! - \b TIMER_A_CLOCKSOURCE_SMCLK
503 //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
504 //! \param clockSourceDivider is the divider for Clock source. Valid values
506 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default value]
507 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
508 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
509 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
510 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
511 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
512 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
513 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
514 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
515 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
516 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
517 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
518 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
519 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
520 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
521 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
522 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
523 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
524 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
525 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
526 //! \param timerPeriod is the specified Timer_A period. This is the value
527 //! that gets written into the CCR0. Limited to 16 bits[uint16_t]
528 //! \param timerInterruptEnable_TAIE is to enable or disable Timer_A
529 //! interrupt. Valid values are:
530 //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE and
531 //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default value]
532 //! \param captureCompareInterruptEnable_CCR0_CCIE is to enable or disable
533 //! Timer_A CCR0 captureComapre interrupt. Valid values are
534 //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE and
535 //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default value]
536 //! \param timerClear decides if Timer_A clock divider, count direction,
537 //! count need to be reset. Valid values are
538 //! - \b TIMER_A_DO_CLEAR
539 //! - \b TIMER_A_SKIP_CLEAR [Default value]
541 //!\note This API does not start the timer. Timer needs to be started when
542 //!required using the Timer_A_startCounter API.
546 //*****************************************************************************
547 extern void Timer_A_configureUpMode(uint32_t timer,
548 const Timer_A_UpModeConfig *config);
550 //*****************************************************************************
552 //! Configures Timer_A in up down mode.
554 //! \param timer is the instance of the Timer_A module. Valid parameters
555 //! vary from part to part, but can include:
556 //! - \b TIMER_A0_BASE
557 //! - \b TIMER_A1_BASE
558 //! - \b TIMER_A2_BASE
559 //! - \b TIMER_A3_BASE
560 //! \param config Configuration structure for Timer_A UpDown mode
563 //! <b>Configuration options for \link Timer_A_UpDownModeConfig \endlink
566 //! \param clockSource selects Clock source. Valid values are
567 //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default value]
568 //! - \b TIMER_A_CLOCKSOURCE_ACLK
569 //! - \b TIMER_A_CLOCKSOURCE_SMCLK
570 //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
571 //! \param clockSourceDivider is the divider for Clock source. Valid values
573 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default value]
574 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
575 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
576 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
577 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
578 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
579 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
580 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
581 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
582 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
583 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
584 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
585 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
586 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
587 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
588 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
589 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
590 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
591 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
592 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
593 //! \param timerPeriod is the specified Timer_A period
594 //! \param timerInterruptEnable_TAIE is to enable or disable Timer_A
597 //! - \b TIMER_A_TAIE_INTERRUPT_ENABLE
598 //! - \b TIMER_A_TAIE_INTERRUPT_DISABLE [Default value]
599 //! \param captureCompareInterruptEnable_CCR0_CCIE is to enable or disable
600 //! Timer_A CCR0 captureComapre interrupt. Valid values are
601 //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE and
602 //! - \b TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default value]
603 //! \param timerClear decides if Timer_A clock divider, count direction, count
604 //! need to be reset. Valid values are
605 //! - \b TIMER_A_DO_CLEAR
606 //! - \b TIMER_A_SKIP_CLEAR [Default value]
608 //!This API does not start the timer. Timer needs to be started when required
609 //!using the Timer_A_startCounter API.
613 //*****************************************************************************
614 extern void Timer_A_configureUpDownMode(uint32_t timer,
615 const Timer_A_UpDownModeConfig *config);
617 //*****************************************************************************
619 //! Initializes Capture Mode
621 //! \param timer is the instance of the Timer_A module. Valid parameters
622 //! vary from part to part, but can include:
623 //! - \b TIMER_A0_BASE
624 //! - \b TIMER_A1_BASE
625 //! - \b TIMER_A2_BASE
626 //! - \b TIMER_A3_BASE
627 //! \param config Configuration structure for Timer_A capture mode
630 //! <b>Configuration options for \link Timer_A_CaptureModeConfig \endlink
633 //! \param captureRegister selects the Capture register being used. Valid
635 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
636 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
637 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
638 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
639 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
640 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
641 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
642 //! \n Refer to datasheet to ensure the device has the capture compare
643 //! register being used
644 //! \param captureMode is the capture mode selected. Valid values are
645 //! - \b TIMER_A_CAPTUREMODE_NO_CAPTURE [Default value]
646 //! - \b TIMER_A_CAPTUREMODE_RISING_EDGE
647 //! - \b TIMER_A_CAPTUREMODE_FALLING_EDGE
648 //! - \b TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE
649 //! \param captureInputSelect decides the Input Select
650 //! - \b TIMER_A_CAPTURE_INPUTSELECT_CCIxA [Default value]
651 //! - \b TIMER_A_CAPTURE_INPUTSELECT_CCIxB
652 //! - \b TIMER_A_CAPTURE_INPUTSELECT_GND
653 //! - \b TIMER_A_CAPTURE_INPUTSELECT_Vcc
654 //! \param synchronizeCaptureSource decides if capture source should be
655 //! synchronized with timer clock
657 //! - \b TIMER_A_CAPTURE_ASYNCHRONOUS [Default value]
658 //! - \b TIMER_A_CAPTURE_SYNCHRONOUS
659 //! \param captureInterruptEnable is to enable or disable
660 //! timer captureComapre interrupt. Valid values are
661 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default value]
662 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE
663 //! \param captureOutputMode specifies the ouput mode. Valid values are
664 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default value],
665 //! - \b TIMER_A_OUTPUTMODE_SET,
666 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET,
667 //! - \b TIMER_A_OUTPUTMODE_SET_RESET
668 //! - \b TIMER_A_OUTPUTMODE_TOGGLE,
669 //! - \b TIMER_A_OUTPUTMODE_RESET,
670 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET,
671 //! - \b TIMER_A_OUTPUTMODE_RESET_SET
675 //*****************************************************************************
676 extern void Timer_A_initCapture(uint32_t timer,
677 const Timer_A_CaptureModeConfig *config);
679 //*****************************************************************************
681 //! Initializes Compare Mode
683 //! \param timer is the instance of the Timer_A module. Valid parameters
684 //! vary from part to part, but can include:
685 //! - \b TIMER_A0_BASE
686 //! - \b TIMER_A1_BASE
687 //! - \b TIMER_A2_BASE
688 //! - \b TIMER_A3_BASE
689 //! \param config Configuration structure for Timer_A compare mode
692 //! <b>Configuration options for \link Timer_A_CompareModeConfig \endlink
695 //! \param compareRegister selects the Capture register being used. Valid
697 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
698 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
699 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
700 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
701 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
702 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
703 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
704 //! \n Refer to datasheet to ensure the device has the capture compare
705 //! register being used
706 //! \param compareInterruptEnable is to enable or disable
707 //! timer captureComapre interrupt. Valid values are
708 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE and
709 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default value]
710 //! \param compareOutputMode specifies the output mode. Valid values are
711 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE [Default value],
712 //! - \b TIMER_A_OUTPUTMODE_SET,
713 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET,
714 //! - \b TIMER_A_OUTPUTMODE_SET_RESET
715 //! - \b TIMER_A_OUTPUTMODE_TOGGLE,
716 //! - \b TIMER_A_OUTPUTMODE_RESET,
717 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET,
718 //! - \b TIMER_A_OUTPUTMODE_RESET_SET
719 //! \param compareValue is the count to be compared with in compare mode
723 //*****************************************************************************
724 extern void Timer_A_initCompare(uint32_t timer,
725 const Timer_A_CompareModeConfig *config);
727 //*****************************************************************************
729 //! Reset/Clear the timer clock divider, count direction, count
731 //! \param timer is the instance of the Timer_A module. Valid parameters
732 //! vary from part to part, but can include:
733 //! - \b TIMER_A0_BASE
734 //! - \b TIMER_A1_BASE
735 //! - \b TIMER_A2_BASE
736 //! - \b TIMER_A3_BASE
740 //*****************************************************************************
741 extern void Timer_A_clearTimer(uint32_t timer);
743 //*****************************************************************************
745 //! Get synchronized capture compare input
747 //! \param timer is the instance of the Timer_A module. Valid parameters
748 //! vary from part to part, but can include:
749 //! - \b TIMER_A0_BASE
750 //! - \b TIMER_A1_BASE
751 //! - \b TIMER_A2_BASE
752 //! - \b TIMER_A3_BASE
753 //! \param captureCompareRegister selects the Capture register being used.
755 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
756 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
757 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
758 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
759 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
760 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
761 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
762 //! \n Refer to datasheet to ensure the device has the capture compare
763 //! register being used
764 //! \param synchronizedSetting is to select type of capture compare input.
766 //! - \b TIMER_A_READ_CAPTURE_COMPARE_INPUT
767 //! - \b TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT
769 //! \return \b TIMER_A_CAPTURECOMPARE_INPUT_HIGH or
770 //! - \b TIMER_A_CAPTURECOMPARE_INPUT_LOW
772 //*****************************************************************************
773 extern uint_fast8_t Timer_A_getSynchronizedCaptureCompareInput(uint32_t timer,
774 uint_fast16_t captureCompareRegister,
775 uint_fast16_t synchronizedSetting);
777 //*****************************************************************************
779 //! Get ouput bit for output mode
781 //! \param timer is the instance of the Timer_A module. Valid parameters
782 //! vary from part to part, but can include:
783 //! - \b TIMER_A0_BASE
784 //! - \b TIMER_A1_BASE
785 //! - \b TIMER_A2_BASE
786 //! - \b TIMER_A3_BASE
787 //! \param captureCompareRegister selects the Capture register being used.
789 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
790 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
791 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
792 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
793 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
794 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
795 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
796 //! \n Refer to datasheet to ensure the device has the capture compare
797 //! register being used
799 //! \return \b TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH or
800 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW
802 //*****************************************************************************
803 extern uint_fast8_t Timer_A_getOutputForOutputModeOutBitValue(uint32_t timer,
804 uint_fast16_t captureCompareRegister);
806 //*****************************************************************************
808 //! Get current capture compare count
810 //! \param timer is the instance of the Timer_A module. Valid parameters
811 //! vary from part to part, but can include:
812 //! - \b TIMER_A0_BASE
813 //! - \b TIMER_A1_BASE
814 //! - \b TIMER_A2_BASE
815 //! - \b TIMER_A3_BASE
816 //! \param captureCompareRegister selects the Capture register being used.
818 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
819 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
820 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
821 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
822 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
823 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
824 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
825 //! \n Refer to datasheet to ensure the device has the capture compare
826 //! register being used
828 //! \return current count as uint16_t
830 //*****************************************************************************
831 extern uint_fast16_t Timer_A_getCaptureCompareCount(uint32_t timer,
832 uint_fast16_t captureCompareRegister);
834 //*****************************************************************************
836 //! Set ouput bit for output mode
838 //! \param timer is the instance of the Timer_A module. Valid parameters
839 //! vary from part to part, but can include:
840 //! - \b TIMER_A0_BASE
841 //! - \b TIMER_A1_BASE
842 //! - \b TIMER_A2_BASE
843 //! - \b TIMER_A3_BASE
844 //! \param captureCompareRegister selects the Capture register being used.
846 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
847 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
848 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
849 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
850 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
851 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
852 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
853 //! \n Refer to datasheet to ensure the device has the capture compare
854 //! register being used
855 //! \param outputModeOutBitValue the value to be set for out bit.
856 //! Valid values are:
857 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH
858 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW
862 //*****************************************************************************
863 extern void Timer_A_setOutputForOutputModeOutBitValue(uint32_t timer,
864 uint_fast16_t captureCompareRegister,
865 uint_fast8_t outputModeOutBitValue);
867 //*****************************************************************************
869 //! Generate a PWM with timer running in up mode
871 //! \param timer is the instance of the Timer_A module. Valid parameters
872 //! vary from part to part, but can include:
873 //! - \b TIMER_A0_BASE
874 //! - \b TIMER_A1_BASE
875 //! - \b TIMER_A2_BASE
876 //! - \b TIMER_A3_BASE
877 //! \param config Configuration structure for Timer_A PWM mode
880 //! <b>Configuration options for \link Timer_A_PWMConfig \endlink
883 //! \param clockSource selects Clock source. Valid values are
884 //! - \b TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK
885 //! - \b TIMER_A_CLOCKSOURCE_ACLK
886 //! - \b TIMER_A_CLOCKSOURCE_SMCLK
887 //! - \b TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
888 //! \param clockSourceDivider is the divider for Clock source. Valid values
890 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_1
891 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_2
892 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_4
893 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_8
894 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_3
895 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_5
896 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_6
897 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_7
898 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_10
899 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_12
900 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_14
901 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_16
902 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_20
903 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_24
904 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_28
905 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_32
906 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_40
907 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_48
908 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_56
909 //! - \b TIMER_A_CLOCKSOURCE_DIVIDER_64
910 //! \param timerPeriod selects the desired timer period
911 //! \param compareRegister selects the compare register being used.
913 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
914 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
915 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
916 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
917 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
918 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
919 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
920 //! <br>\n Refer to datasheet to ensure the device has the capture compare
921 //! register being used
922 //! \param compareOutputMode specifies the ouput mode. Valid values are:
923 //! - \b TIMER_A_OUTPUTMODE_OUTBITVALUE,
924 //! - \b TIMER_A_OUTPUTMODE_SET,
925 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_RESET,
926 //! - \b TIMER_A_OUTPUTMODE_SET_RESET
927 //! - \b TIMER_A_OUTPUTMODE_TOGGLE,
928 //! - \b TIMER_A_OUTPUTMODE_RESET,
929 //! - \b TIMER_A_OUTPUTMODE_TOGGLE_SET,
930 //! - \b TIMER_A_OUTPUTMODE_RESET_SET
931 //! \param dutyCycle specifies the dutycycle for the generated waveform
935 //*****************************************************************************
936 extern void Timer_A_generatePWM(uint32_t timer,
937 const Timer_A_PWMConfig *config);
939 //*****************************************************************************
943 //! \param timer is the instance of the Timer_A module. Valid parameters
944 //! vary from part to part, but can include:
945 //! - \b TIMER_A0_BASE
946 //! - \b TIMER_A1_BASE
947 //! - \b TIMER_A2_BASE
948 //! - \b TIMER_A3_BASE
952 //*****************************************************************************
953 extern void Timer_A_stopTimer(uint32_t timer);
955 //*****************************************************************************
957 //! Sets the value of the capture-compare register
959 //! \param timer is the instance of the Timer_A module. Valid parameters
960 //! vary from part to part, but can include:
961 //! - \b TIMER_A0_BASE
962 //! - \b TIMER_A1_BASE
963 //! - \b TIMER_A2_BASE
964 //! - \b TIMER_A3_BASE
965 //! \param compareRegister selects the Capture register being used. Valid
967 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
968 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
969 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
970 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
971 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
972 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
973 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
974 //! <br>\n Refer to datasheet to ensure the device has the capture compare
975 //! register being used
976 //! \param compareValue is the count to be compared with in compare mode
980 //*****************************************************************************
981 extern void Timer_A_setCompareValue(uint32_t timer,
982 uint_fast16_t compareRegister, uint_fast16_t compareValue);
984 //*****************************************************************************
986 //! Returns the current value of the specified timer. Note that according to
987 //! the Timer A user guide, reading the value of the counter is unreliable
988 //! if the system clock is asynchronous from the timer clock. The API addresses
989 //! this concern by reading the timer count register twice and then determining
990 //! the integrity of the value. If the two values are within 10 timer counts
991 //! of each other, the value is deemed safe and returned. If not, the process
992 //! is repeated until a reliable timer value is determined.
994 //! \param timer is the instance of the Timer_A module. Valid parameters
995 //! vary from part to part, but can include:
996 //! - \b TIMER_A0_BASE
997 //! - \b TIMER_A1_BASE
998 //! - \b TIMER_A2_BASE
999 //! - \b TIMER_A3_BASE
1001 //! \returns The value of the specified timer
1003 //*****************************************************************************
1004 extern uint16_t Timer_A_getCounterValue(uint32_t timer);
1006 //*****************************************************************************
1008 //! Clears the Timer TAIFG interrupt flag
1010 //! \param timer is the instance of the Timer_A module. Valid parameters
1011 //! vary from part to part, but can include:
1012 //! - \b TIMER_A0_BASE
1013 //! - \b TIMER_A1_BASE
1014 //! - \b TIMER_A2_BASE
1015 //! - \b TIMER_A3_BASE
1019 //*****************************************************************************
1020 extern void Timer_A_clearInterruptFlag(uint32_t timer);
1022 //*****************************************************************************
1024 //! Clears the capture-compare interrupt flag
1026 //! \param timer is the instance of the Timer_A module. Valid parameters
1027 //! vary from part to part, but can include:
1028 //! - \b TIMER_A0_BASE
1029 //! - \b TIMER_A1_BASE
1030 //! - \b TIMER_A2_BASE
1031 //! - \b TIMER_A3_BASE
1032 //! \param captureCompareRegister selects the Capture-compare register being
1033 //! used. Valid values are
1034 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_0
1035 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_1
1036 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_2
1037 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_3
1038 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_4
1039 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_5
1040 //! - \b TIMER_A_CAPTURECOMPARE_REGISTER_6
1041 //! <br>Refer to the datasheet to ensure the device has the capture compare
1042 //! register being used
1046 //*****************************************************************************
1047 extern void Timer_A_clearCaptureCompareInterrupt(uint32_t timer,
1048 uint_fast16_t captureCompareRegister);
1050 //*****************************************************************************
1052 //! Enable timer interrupt
1054 //! \param timer is the instance of the Timer_A module. Valid parameters
1055 //! vary from part to part, but can include:
1056 //! - \b TIMER_A0_BASE
1057 //! - \b TIMER_A1_BASE
1058 //! - \b TIMER_A2_BASE
1059 //! - \b TIMER_A3_BASE
1063 //*****************************************************************************
1064 extern void Timer_A_enableInterrupt(uint32_t timer);
1066 //*****************************************************************************
1068 //! Disable timer interrupt
1070 //! \param timer is the instance of the Timer_A module. Valid parameters
1071 //! vary from part to part, but can include:
1072 //! - \b TIMER_A0_BASE
1073 //! - \b TIMER_A1_BASE
1074 //! - \b TIMER_A2_BASE
1075 //! - \b TIMER_A3_BASE
1079 //*****************************************************************************
1080 extern void Timer_A_disableInterrupt(uint32_t timer);
1082 //*****************************************************************************
1084 //! Get timer interrupt status
1086 //! \param timer is the instance of the Timer_A module. Valid parameters
1087 //! vary from part to part, but can include:
1088 //! - \b TIMER_A0_BASE
1089 //! - \b TIMER_A1_BASE
1090 //! - \b TIMER_A2_BASE
1091 //! - \b TIMER_A3_BASE
1093 //! \return uint32_t. Return interrupt status. Valid values are
1094 //! - \b TIMER_A_INTERRUPT_PENDING
1095 //! - \b TIMER_A_INTERRUPT_NOT_PENDING
1097 //*****************************************************************************
1098 extern uint32_t Timer_A_getInterruptStatus(uint32_t timer);
1100 //*****************************************************************************
1102 //! Get timer interrupt status masked with the enabled interrupts.
1103 //! This function is useful to call in ISRs to get a list of pending
1104 //! interrupts that are actually enabled and could have caused
1107 //! \param timer is the instance of the Timer_A module. Valid parameters
1108 //! vary from part to part, but can include:
1109 //! - \b TIMER_A0_BASE
1110 //! - \b TIMER_A1_BASE
1111 //! - \b TIMER_A2_BASE
1112 //! - \b TIMER_A3_BASE
1114 //! \return uint32_t. Return interrupt status. Valid values are
1115 //! - \b TIMER_A_INTERRUPT_PENDING
1116 //! - \b TIMER_A_INTERRUPT_NOT_PENDING
1118 //*****************************************************************************
1119 extern uint32_t Timer_A_getEnabledInterruptStatus(uint32_t timer);
1121 //*****************************************************************************
1123 //! Enable capture compare interrupt
1125 //! \param timer is the instance of the Timer_A module. Valid parameters
1126 //! vary from part to part, but can include:
1127 //! - \b TIMER_A0_BASE
1128 //! - \b TIMER_A1_BASE
1129 //! - \b TIMER_A2_BASE
1130 //! - \b TIMER_A3_BASE
1131 //! \param captureCompareRegister is the selected capture compare register
1135 //*****************************************************************************
1136 extern void Timer_A_enableCaptureCompareInterrupt(uint32_t timer,
1137 uint_fast16_t captureCompareRegister);
1139 //*****************************************************************************
1141 //! Disable capture compare interrupt
1143 //! \param timer is the instance of the Timer_A module. Valid parameters
1144 //! vary from part to part, but can include:
1145 //! - \b TIMER_A0_BASE
1146 //! - \b TIMER_A1_BASE
1147 //! - \b TIMER_A2_BASE
1148 //! - \b TIMER_A3_BASE
1149 //! \param captureCompareRegister is the selected capture compare register
1153 //*****************************************************************************
1154 extern void Timer_A_disableCaptureCompareInterrupt(uint32_t timer,
1155 uint_fast16_t captureCompareRegister);
1157 //*****************************************************************************
1159 //! Return capture compare interrupt status
1161 //! \param timer is the instance of the Timer_A module. Valid parameters
1162 //! vary from part to part, but can include:
1163 //! - \b TIMER_A0_BASE
1164 //! - \b TIMER_A1_BASE
1165 //! - \b TIMER_A2_BASE
1166 //! - \b TIMER_A3_BASE
1167 //! \param captureCompareRegister is the selected capture compare register
1169 //! \param mask is the mask for the interrupt status
1170 //! Mask value is the logical OR of any of the following:
1171 //! - \b TIMER_A_CAPTURE_OVERFLOW
1172 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG
1174 //! \returns uint32_t. The mask of the set flags.
1175 //! Valid values is an OR of
1176 //! - \b TIMER_A_CAPTURE_OVERFLOW,
1177 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG
1179 //*****************************************************************************
1180 extern uint32_t Timer_A_getCaptureCompareInterruptStatus(uint32_t timer,
1181 uint_fast16_t captureCompareRegister, uint_fast16_t mask);
1183 //*****************************************************************************
1185 //! Return capture compare interrupt status masked with the enabled interrupts.
1186 //! This function is useful to call in ISRs to get a list of pending
1187 //! interrupts that are actually enabled and could have caused
1190 //! \param timer is the instance of the Timer_A module. Valid parameters
1191 //! vary from part to part, but can include:
1192 //! - \b TIMER_A0_BASE
1193 //! - \b TIMER_A1_BASE
1194 //! - \b TIMER_A2_BASE
1195 //! - \b TIMER_A3_BASE
1196 //! \param captureCompareRegister is the selected capture compare register
1198 //! \returns uint32_t. The mask of the set flags.
1199 //! Valid values is an OR of
1200 //! - \b TIMER_A_CAPTURE_OVERFLOW,
1201 //! - \b TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG
1203 //*****************************************************************************
1204 extern uint32_t Timer_A_getCaptureCompareEnabledInterruptStatus(uint32_t timer,
1205 uint_fast16_t captureCompareRegister);
1207 //*****************************************************************************
1209 //! Registers an interrupt handler for the timer capture compare interrupt.
1211 //! \param timer is the instance of the Timer_A module. Valid parameters
1212 //! vary from part to part, but can include:
1213 //! - \b TIMER_A0_BASE
1214 //! - \b TIMER_A1_BASE
1215 //! - \b TIMER_A2_BASE
1216 //! - \b TIMER_A3_BASE
1218 //! \param interruptSelect Selects which timer interrupt handler to
1219 //! register. For the timer module, there are two separate interrupt handlers
1220 //! that can be registered:
1221 //! - \b TIMER_A_CCR0_INTERRUPT Corresponds to the interrupt for CCR0
1222 //! - \b TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT Corresponds to the
1223 //! interrupt for CCR1-6, as well as the overflow interrupt.
1225 //! \param intHandler is a pointer to the function to be called when the
1226 //! timer capture compare interrupt occurs.
1228 //! This function registers the handler to be called when a timer
1229 //! interrupt occurs. This function enables the global interrupt in the
1230 //! interrupt controller; specific Timer_Ainterrupts must be enabled
1231 //! via Timer_A_enableInterrupt(). It is the interrupt handler's
1232 //! responsibility to clear the interrupt source
1233 //! via Timer_A_clearCaptureCompareInterrupt().
1237 //*****************************************************************************
1238 extern void Timer_A_registerInterrupt(uint32_t timer,
1239 uint_fast8_t interruptSelect, void (*intHandler)(void));
1241 //*****************************************************************************
1243 //! Unregisters the interrupt handler for the timer
1245 //! \param timer is the instance of the Timer_A module. Valid parameters
1246 //! vary from part to part, but can include:
1247 //! - \b TIMER_A0_BASE
1248 //! - \b TIMER_A1_BASE
1249 //! - \b TIMER_A2_BASE
1250 //! - \b TIMER_A3_BASE
1252 //! \param interruptSelect Selects which timer interrupt handler to
1253 //! register. For the timer module, there are two separate interrupt handlers
1254 //! that can be registered:
1255 //! - \b TIMER_A_CCR0_INTERRUPT Corresponds to the interrupt for CCR0
1256 //! - \b TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT Corresponds to the
1257 //! interrupt for CCR1-6, as well as the overflow interrupt.
1259 //! This function unregisters the handler to be called when timer
1260 //! interrupt occurs. This function also masks off the interrupt in the
1261 //! interrupt controller so that the interrupt handler no longer is called.
1263 //! \sa Interrupt_registerInterrupt() for important information about
1264 //! registering interrupt handlers.
1268 //*****************************************************************************
1269 extern void Timer_A_unregisterInterrupt(uint32_t timer,
1270 uint_fast8_t interruptSelect);
1272 /* Backwards Compatibility Layer */
1273 #define Timer_A_clearTimerInterrupt Timer_A_clearInterruptFlag
1274 #define Timer_A_clear Timer_A_clearTimer
1275 #define Timer_A_initCaptureMode Timer_A_initCapture
1276 #define Timer_A_initCompareMode Timer_A_initCompare
1277 #define Timer_A_initContinuousMode Timer_A_configureContinuousMode
1278 #define Timer_A_initUpDownMode Timer_A_configureUpDownMode
1279 #define Timer_A_initUpMode Timer_A_configureUpMode
1280 #define Timer_A_outputPWM Timer_A_generatePWM
1281 #define Timer_A_stop Timer_A_stopTimer
1283 //*****************************************************************************
1285 // Mark the end of the C bindings section for C++ compilers.
1287 //*****************************************************************************
1292 //*****************************************************************************
1294 // Close the Doxygen group.
1297 //*****************************************************************************
1299 #endif /* TIMERA_H_ */