Data Structures | Macros | Typedefs | Functions
Timer_A

Advanced 16-bit timer with precision PWM support and capture/compare capabilities. More...

Data Structures

struct  _Timer_A_ContinuousModeConfig
 Type definition for _Timer_A_ContinuousModeConfig structure. More...
 
struct  _Timer_A_UpModeConfig
 Type definition for _Timer_A_UpModeConfig structure. More...
 
struct  _Timer_A_UpDownModeConfig
 Type definition for _Timer_A_UpDownModeConfig structure. More...
 
struct  _Timer_A_CaptureModeConfig
 Type definition for _Timer_A_CaptureModeConfig structure. More...
 
struct  _Timer_A_CompareModeConfig
 Type definition for _Timer_A_CompareModeConfig structure. More...
 
struct  _Timer_A_PWMConfig
 Type definition for _Timer_A_PWMConfig structure. More...
 

Macros

#define TIMER_A_CMSIS(x)   ((Timer_A_Type *) x)
 
#define TIMER_A_CCR0_INTERRUPT   0x00
 
#define TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT   0x01
 
#define TIMER_A_THRESHOLD   50
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_1   0x01
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_2   0x02
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_4   0x04
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_8   0x08
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_3   0x03
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_5   0x05
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_6   0x06
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_7   0x07
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_10   0x0A
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_12   0x0C
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_14   0x0E
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_16   0x10
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_20   0x14
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_24   0x18
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_28   0x1C
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_32   0x20
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_40   0x28
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_48   0x30
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_56   0x38
 
#define TIMER_A_CLOCKSOURCE_DIVIDER_64   0x40
 
#define TIMER_A_STOP_MODE   TIMER_A_CTL_MC_0
 
#define TIMER_A_UP_MODE   TIMER_A_CTL_MC_1
 
#define TIMER_A_CONTINUOUS_MODE   TIMER_A_CTL_MC_2
 
#define TIMER_A_UPDOWN_MODE   TIMER_A_CTL_MC_3
 
#define TIMER_A_DO_CLEAR   TIMER_A_CTL_CLR
 
#define TIMER_A_SKIP_CLEAR   0x00
 
#define TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK   TIMER_A_CTL_SSEL__TACLK
 
#define TIMER_A_CLOCKSOURCE_ACLK   TIMER_A_CTL_SSEL__ACLK
 
#define TIMER_A_CLOCKSOURCE_SMCLK   TIMER_A_CTL_SSEL__SMCLK
 
#define TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK   TIMER_A_CTL_SSEL__INCLK
 
#define TIMER_A_TAIE_INTERRUPT_ENABLE   TIMER_A_CTL_IE
 
#define TIMER_A_TAIE_INTERRUPT_DISABLE   0x00
 
#define TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE   TIMER_A_CCTLN_CCIE
 
#define TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE   0x00
 
#define TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE   0x00
 
#define TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE   TIMER_A_CCTLN_CCIE
 
#define TIMER_A_CAPTURE_INPUTSELECT_CCIxA   TIMER_A_CCTLN_CCIS_0
 
#define TIMER_A_CAPTURE_INPUTSELECT_CCIxB   TIMER_A_CCTLN_CCIS_1
 
#define TIMER_A_CAPTURE_INPUTSELECT_GND   TIMER_A_CCTLN_CCIS_2
 
#define TIMER_A_CAPTURE_INPUTSELECT_Vcc   TIMER_A_CCTLN_CCIS_3
 
#define TIMER_A_OUTPUTMODE_OUTBITVALUE   TIMER_A_CCTLN_OUTMOD_0
 
#define TIMER_A_OUTPUTMODE_SET   TIMER_A_CCTLN_OUTMOD_1
 
#define TIMER_A_OUTPUTMODE_TOGGLE_RESET   TIMER_A_CCTLN_OUTMOD_2
 
#define TIMER_A_OUTPUTMODE_SET_RESET   TIMER_A_CCTLN_OUTMOD_3
 
#define TIMER_A_OUTPUTMODE_TOGGLE   TIMER_A_CCTLN_OUTMOD_4
 
#define TIMER_A_OUTPUTMODE_RESET   TIMER_A_CCTLN_OUTMOD_5
 
#define TIMER_A_OUTPUTMODE_TOGGLE_SET   TIMER_A_CCTLN_OUTMOD_6
 
#define TIMER_A_OUTPUTMODE_RESET_SET   TIMER_A_CCTLN_OUTMOD_7
 
#define TIMER_A_CAPTURECOMPARE_REGISTER_0   0x02
 
#define TIMER_A_CAPTURECOMPARE_REGISTER_1   0x04
 
#define TIMER_A_CAPTURECOMPARE_REGISTER_2   0x06
 
#define TIMER_A_CAPTURECOMPARE_REGISTER_3   0x08
 
#define TIMER_A_CAPTURECOMPARE_REGISTER_4   0x0A
 
#define TIMER_A_CAPTURECOMPARE_REGISTER_5   0x0C
 
#define TIMER_A_CAPTURECOMPARE_REGISTER_6   0x0E
 
#define TIMER_A_CAPTUREMODE_NO_CAPTURE   TIMER_A_CCTLN_CM_0
 
#define TIMER_A_CAPTUREMODE_RISING_EDGE   TIMER_A_CCTLN_CM_1
 
#define TIMER_A_CAPTUREMODE_FALLING_EDGE   TIMER_A_CCTLN_CM_2
 
#define TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE   TIMER_A_CCTLN_CM_3
 
#define TIMER_A_CAPTURE_ASYNCHRONOUS   0x00
 
#define TIMER_A_CAPTURE_SYNCHRONOUS   TIMER_A_CCTLN_SCS
 
#define TIMER_A_CAPTURE_OVERFLOW   TIMER_A_CCTLN_COV
 
#define TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG   TIMER_A_CCTLN_CCIFG
 
#define TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT   TIMER_A_CCTLN_SCCI
 
#define TIMER_A_READ_CAPTURE_COMPARE_INPUT   TIMER_A_CCTLN_CCI
 
#define TIMER_A_CAPTURECOMPARE_INPUT_HIGH   0x01
 
#define TIMER_A_CAPTURECOMPARE_INPUT_LOW   0x00
 
#define TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH   TIMER_A_CCTLN_OUT
 
#define TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW   0x00
 
#define TIMER_A_INTERRUPT_NOT_PENDING   0x00
 
#define TIMER_A_INTERRUPT_PENDING   0x01
 
#define Timer_A_setDutyCycle(timer, dutyCycle)   Timer_A_setCompareValue(timer,dutyCycle)
 
#define Timer_A_clearTimerInterrupt   Timer_A_clearInterruptFlag
 
#define Timer_A_clear   Timer_A_clearTimer
 
#define Timer_A_initCaptureMode   Timer_A_initCapture
 
#define Timer_A_initCompareMode   Timer_A_initCompare
 
#define Timer_A_initContinuousMode   Timer_A_configureContinuousMode
 
#define Timer_A_initUpDownMode   Timer_A_configureUpDownMode
 
#define Timer_A_initUpMode   Timer_A_configureUpMode
 
#define Timer_A_outputPWM   Timer_A_generatePWM
 
#define Timer_A_stop   Timer_A_stopTimer
 

Typedefs

typedef struct
_Timer_A_ContinuousModeConfig 
Timer_A_ContinuousModeConfig
 
typedef struct
_Timer_A_UpModeConfig 
Timer_A_UpModeConfig
 
typedef struct
_Timer_A_UpDownModeConfig 
Timer_A_UpDownModeConfig
 
typedef struct
_Timer_A_CaptureModeConfig 
Timer_A_CaptureModeConfig
 
typedef struct
_Timer_A_CompareModeConfig 
Timer_A_CompareModeConfig
 
typedef struct _Timer_A_PWMConfig Timer_A_PWMConfig
 

Functions

void Timer_A_startCounter (uint32_t timer, uint_fast16_t timerMode)
 
void Timer_A_configureContinuousMode (uint32_t timer, const Timer_A_ContinuousModeConfig *config)
 
void Timer_A_configureUpMode (uint32_t timer, const Timer_A_UpModeConfig *config)
 
void Timer_A_configureUpDownMode (uint32_t timer, const Timer_A_UpDownModeConfig *config)
 
void Timer_A_initCapture (uint32_t timer, const Timer_A_CaptureModeConfig *config)
 
void Timer_A_initCompare (uint32_t timer, const Timer_A_CompareModeConfig *config)
 
void Timer_A_clearTimer (uint32_t timer)
 
uint_fast8_t Timer_A_getSynchronizedCaptureCompareInput (uint32_t timer, uint_fast16_t captureCompareRegister, uint_fast16_t synchronizedSetting)
 
uint_fast8_t Timer_A_getOutputForOutputModeOutBitValue (uint32_t timer, uint_fast16_t captureCompareRegister)
 
uint_fast16_t Timer_A_getCaptureCompareCount (uint32_t timer, uint_fast16_t captureCompareRegister)
 
void Timer_A_setOutputForOutputModeOutBitValue (uint32_t timer, uint_fast16_t captureCompareRegister, uint_fast8_t outputModeOutBitValue)
 
void Timer_A_generatePWM (uint32_t timer, const Timer_A_PWMConfig *config)
 
void Timer_A_stopTimer (uint32_t timer)
 
void Timer_A_setCompareValue (uint32_t timer, uint_fast16_t compareRegister, uint_fast16_t compareValue)
 
uint16_t Timer_A_getCounterValue (uint32_t timer)
 
void Timer_A_clearInterruptFlag (uint32_t timer)
 
void Timer_A_clearCaptureCompareInterrupt (uint32_t timer, uint_fast16_t captureCompareRegister)
 
void Timer_A_enableInterrupt (uint32_t timer)
 
void Timer_A_disableInterrupt (uint32_t timer)
 
uint32_t Timer_A_getInterruptStatus (uint32_t timer)
 
uint32_t Timer_A_getEnabledInterruptStatus (uint32_t timer)
 
void Timer_A_enableCaptureCompareInterrupt (uint32_t timer, uint_fast16_t captureCompareRegister)
 
void Timer_A_disableCaptureCompareInterrupt (uint32_t timer, uint_fast16_t captureCompareRegister)
 
uint32_t Timer_A_getCaptureCompareInterruptStatus (uint32_t timer, uint_fast16_t captureCompareRegister, uint_fast16_t mask)
 
uint32_t Timer_A_getCaptureCompareEnabledInterruptStatus (uint32_t timer, uint_fast16_t captureCompareRegister)
 
void Timer_A_registerInterrupt (uint32_t timer, uint_fast8_t interruptSelect, void(*intHandler)(void))
 
void Timer_A_unregisterInterrupt (uint32_t timer, uint_fast8_t interruptSelect)
 

Detailed Description

Advanced 16-bit timer with precision PWM support and capture/compare capabilities.


Module Operation


TimerA is a 16-bit timer/counter with multiple capture/compare registers. TimerA can support multiple capture/compares, PWM outputs, and interval timing. TimerA also has extensive interrupt capabilities. Interrupts may be generated from the counter on overflow conditions and from each of the capture/compare registers.

This peripheral API handles Timer A hardware peripheral.

TimerA features include:


Basic Operation Modes


TimerA can operate in 3 modes:

TimerA Interrupts may be generated on counter overflow conditions and during capture compare events.

The TimerA may also be used to generate PWM outputs. PWM outputs can be generated by initializing the compare mode with TimerA_initCompare() and the necessary parameters. The PWM may be customized by selecting a desired timer mode (continuous/up/upDown), duty cycle, output mode, timer period etc. The library also provides a simpler way to generate PWM using TimerA_generatePWM() API. However the level of customization and the kinds of PWM generated are limited in this API. Depending on how complex the PWM is and what level of customization is required, the user can use TimerA_generatePWM() or a combination of TimerA_initCompare and timer start APIs.

The TimerA API provides a set of functions for dealing with the TimerA module. Functions are provided to configure and control the timer, along with functions to modify timer/counter values, and to manage interrupt handling for the timer.

Control is also provided over interrupt sources and events. Interrupts can be generated to indicate that an event has been captured.


Programming Example


The DriverLib package contains a variety of different code examples that demonstrate the usage of the TimerA module. These code examples are accessible under the examples/ folder of the SDK release as well as through TI Resource Explorer if using Code Composer Studio. These code examples provide a comprehensive list of use cases as well as practical applications involving each module.

Below is a very brief code example showing how to generate a PWM signal using the TimerA DriverLib module.

Below is the configuration parameter for the TimerA PWM config API:

The next snippet of code is used to actually configure the PWM signal:

Macro Definition Documentation

#define TIMER_A_CMSIS (   x)    ((Timer_A_Type *) x)
#define TIMER_A_CCR0_INTERRUPT   0x00
#define TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT   0x01
#define TIMER_A_THRESHOLD   50

Referenced by Timer_A_getCounterValue().

#define TIMER_A_CLOCKSOURCE_DIVIDER_1   0x01
#define TIMER_A_CLOCKSOURCE_DIVIDER_2   0x02
#define TIMER_A_CLOCKSOURCE_DIVIDER_4   0x04
#define TIMER_A_CLOCKSOURCE_DIVIDER_8   0x08
#define TIMER_A_CLOCKSOURCE_DIVIDER_3   0x03
#define TIMER_A_CLOCKSOURCE_DIVIDER_5   0x05
#define TIMER_A_CLOCKSOURCE_DIVIDER_6   0x06
#define TIMER_A_CLOCKSOURCE_DIVIDER_7   0x07
#define TIMER_A_CLOCKSOURCE_DIVIDER_10   0x0A
#define TIMER_A_CLOCKSOURCE_DIVIDER_12   0x0C
#define TIMER_A_CLOCKSOURCE_DIVIDER_14   0x0E
#define TIMER_A_CLOCKSOURCE_DIVIDER_16   0x10
#define TIMER_A_CLOCKSOURCE_DIVIDER_20   0x14
#define TIMER_A_CLOCKSOURCE_DIVIDER_24   0x18
#define TIMER_A_CLOCKSOURCE_DIVIDER_28   0x1C
#define TIMER_A_CLOCKSOURCE_DIVIDER_32   0x20
#define TIMER_A_CLOCKSOURCE_DIVIDER_40   0x28
#define TIMER_A_CLOCKSOURCE_DIVIDER_48   0x30
#define TIMER_A_CLOCKSOURCE_DIVIDER_56   0x38
#define TIMER_A_CLOCKSOURCE_DIVIDER_64   0x40
#define TIMER_A_STOP_MODE   TIMER_A_CTL_MC_0
#define TIMER_A_UP_MODE   TIMER_A_CTL_MC_1
#define TIMER_A_CONTINUOUS_MODE   TIMER_A_CTL_MC_2

Referenced by Timer_A_startCounter().

#define TIMER_A_UPDOWN_MODE   TIMER_A_CTL_MC_3
#define TIMER_A_DO_CLEAR   TIMER_A_CTL_CLR
#define TIMER_A_SKIP_CLEAR   0x00
#define TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK   TIMER_A_CTL_SSEL__TACLK
#define TIMER_A_CLOCKSOURCE_ACLK   TIMER_A_CTL_SSEL__ACLK
#define TIMER_A_CLOCKSOURCE_SMCLK   TIMER_A_CTL_SSEL__SMCLK
#define TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK   TIMER_A_CTL_SSEL__INCLK
#define TIMER_A_TAIE_INTERRUPT_ENABLE   TIMER_A_CTL_IE
#define TIMER_A_TAIE_INTERRUPT_DISABLE   0x00
#define TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE   TIMER_A_CCTLN_CCIE
#define TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE   0x00
#define TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE   0x00
#define TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE   TIMER_A_CCTLN_CCIE
#define TIMER_A_CAPTURE_INPUTSELECT_CCIxA   TIMER_A_CCTLN_CCIS_0

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTURE_INPUTSELECT_CCIxB   TIMER_A_CCTLN_CCIS_1

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTURE_INPUTSELECT_GND   TIMER_A_CCTLN_CCIS_2

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTURE_INPUTSELECT_Vcc   TIMER_A_CCTLN_CCIS_3

Referenced by Timer_A_initCapture().

#define TIMER_A_OUTPUTMODE_OUTBITVALUE   TIMER_A_CCTLN_OUTMOD_0
#define TIMER_A_OUTPUTMODE_SET   TIMER_A_CCTLN_OUTMOD_1
#define TIMER_A_OUTPUTMODE_TOGGLE_RESET   TIMER_A_CCTLN_OUTMOD_2
#define TIMER_A_OUTPUTMODE_SET_RESET   TIMER_A_CCTLN_OUTMOD_3
#define TIMER_A_OUTPUTMODE_TOGGLE   TIMER_A_CCTLN_OUTMOD_4
#define TIMER_A_OUTPUTMODE_RESET   TIMER_A_CCTLN_OUTMOD_5
#define TIMER_A_OUTPUTMODE_TOGGLE_SET   TIMER_A_CCTLN_OUTMOD_6
#define TIMER_A_OUTPUTMODE_RESET_SET   TIMER_A_CCTLN_OUTMOD_7
#define TIMER_A_CAPTURECOMPARE_REGISTER_0   0x02
#define TIMER_A_CAPTURECOMPARE_REGISTER_1   0x04
#define TIMER_A_CAPTURECOMPARE_REGISTER_2   0x06
#define TIMER_A_CAPTURECOMPARE_REGISTER_3   0x08
#define TIMER_A_CAPTURECOMPARE_REGISTER_4   0x0A
#define TIMER_A_CAPTURECOMPARE_REGISTER_5   0x0C
#define TIMER_A_CAPTURECOMPARE_REGISTER_6   0x0E
#define TIMER_A_CAPTUREMODE_NO_CAPTURE   TIMER_A_CCTLN_CM_0

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTUREMODE_RISING_EDGE   TIMER_A_CCTLN_CM_1

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTUREMODE_FALLING_EDGE   TIMER_A_CCTLN_CM_2

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE   TIMER_A_CCTLN_CM_3

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTURE_ASYNCHRONOUS   0x00

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTURE_SYNCHRONOUS   TIMER_A_CCTLN_SCS

Referenced by Timer_A_initCapture().

#define TIMER_A_CAPTURE_OVERFLOW   TIMER_A_CCTLN_COV
#define TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG   TIMER_A_CCTLN_CCIFG
#define TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT   TIMER_A_CCTLN_SCCI
#define TIMER_A_READ_CAPTURE_COMPARE_INPUT   TIMER_A_CCTLN_CCI
#define TIMER_A_CAPTURECOMPARE_INPUT_HIGH   0x01
#define TIMER_A_CAPTURECOMPARE_INPUT_LOW   0x00
#define TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH   TIMER_A_CCTLN_OUT
#define TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW   0x00
#define TIMER_A_INTERRUPT_NOT_PENDING   0x00
#define TIMER_A_INTERRUPT_PENDING   0x01
#define Timer_A_setDutyCycle (   timer,
  dutyCycle 
)    Timer_A_setCompareValue(timer,dutyCycle)
#define Timer_A_clearTimerInterrupt   Timer_A_clearInterruptFlag
#define Timer_A_clear   Timer_A_clearTimer
#define Timer_A_initCaptureMode   Timer_A_initCapture
#define Timer_A_initCompareMode   Timer_A_initCompare
#define Timer_A_initContinuousMode   Timer_A_configureContinuousMode
#define Timer_A_initUpDownMode   Timer_A_configureUpDownMode
#define Timer_A_initUpMode   Timer_A_configureUpMode
#define Timer_A_outputPWM   Timer_A_generatePWM
#define Timer_A_stop   Timer_A_stopTimer

Typedef Documentation

Function Documentation

void Timer_A_startCounter ( uint32_t  timer,
uint_fast16_t  timerMode 
)

Starts Timer_A counter

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
timerModeselects Clock source. Valid values are
  • TIMER_A_CONTINUOUS_MODE [Default value]
  • TIMER_A_UPDOWN_MODE
  • TIMER_A_UP_MODE
Note
This function assumes that the timer has been previously configured using Timer_A_configureContinuousMode, Timer_A_configureUpMode or Timer_A_configureUpDownMode.
Returns
None

References ASSERT, TIMER_A_CMSIS, TIMER_A_CONTINUOUS_MODE, TIMER_A_UP_MODE, and TIMER_A_UPDOWN_MODE.

void Timer_A_configureContinuousMode ( uint32_t  timer,
const Timer_A_ContinuousModeConfig config 
)

Configures Timer_A in continuous mode.

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
configConfiguration structure for Timer_A continuous mode

Configuration options for Timer_A_ContinuousModeConfig structure.


Parameters
clockSourceselects Clock source. Valid values are
  • TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default value]
  • TIMER_A_CLOCKSOURCE_ACLK
  • TIMER_A_CLOCKSOURCE_SMCLK
  • TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
timerInterruptEnable_TAIEis the divider for Clock source. Valid values are:
  • TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default value]
  • TIMER_A_CLOCKSOURCE_DIVIDER_2
  • TIMER_A_CLOCKSOURCE_DIVIDER_4
  • TIMER_A_CLOCKSOURCE_DIVIDER_8
  • TIMER_A_CLOCKSOURCE_DIVIDER_3
  • TIMER_A_CLOCKSOURCE_DIVIDER_5
  • TIMER_A_CLOCKSOURCE_DIVIDER_6
  • TIMER_A_CLOCKSOURCE_DIVIDER_7
  • TIMER_A_CLOCKSOURCE_DIVIDER_10
  • TIMER_A_CLOCKSOURCE_DIVIDER_12
  • TIMER_A_CLOCKSOURCE_DIVIDER_14
  • TIMER_A_CLOCKSOURCE_DIVIDER_16
  • TIMER_A_CLOCKSOURCE_DIVIDER_20
  • TIMER_A_CLOCKSOURCE_DIVIDER_24
  • TIMER_A_CLOCKSOURCE_DIVIDER_28
  • TIMER_A_CLOCKSOURCE_DIVIDER_32
  • TIMER_A_CLOCKSOURCE_DIVIDER_40
  • TIMER_A_CLOCKSOURCE_DIVIDER_48
  • TIMER_A_CLOCKSOURCE_DIVIDER_56
  • TIMER_A_CLOCKSOURCE_DIVIDER_64
timerInterruptEnable_TAIEis to enable or disable Timer_A interrupt. Valid values are
  • TIMER_A_TAIE_INTERRUPT_ENABLE
  • TIMER_A_TAIE_INTERRUPT_DISABLE [Default value]
timerCleardecides if Timer_A clock divider, count direction, count need to be reset. Valid values are
  • TIMER_A_DO_CLEAR
  • TIMER_A_SKIP_CLEAR [Default value]
Note
This API does not start the timer. Timer needs to be started when required using the Timer_A_startCounter API.
Returns
None

References ASSERT, _Timer_A_ContinuousModeConfig::clockSource, _Timer_A_ContinuousModeConfig::clockSourceDivider, TIMER_A_CLOCKSOURCE_ACLK, TIMER_A_CLOCKSOURCE_DIVIDER_1, TIMER_A_CLOCKSOURCE_DIVIDER_10, TIMER_A_CLOCKSOURCE_DIVIDER_12, TIMER_A_CLOCKSOURCE_DIVIDER_14, TIMER_A_CLOCKSOURCE_DIVIDER_16, TIMER_A_CLOCKSOURCE_DIVIDER_2, TIMER_A_CLOCKSOURCE_DIVIDER_20, TIMER_A_CLOCKSOURCE_DIVIDER_24, TIMER_A_CLOCKSOURCE_DIVIDER_28, TIMER_A_CLOCKSOURCE_DIVIDER_3, TIMER_A_CLOCKSOURCE_DIVIDER_32, TIMER_A_CLOCKSOURCE_DIVIDER_4, TIMER_A_CLOCKSOURCE_DIVIDER_40, TIMER_A_CLOCKSOURCE_DIVIDER_48, TIMER_A_CLOCKSOURCE_DIVIDER_5, TIMER_A_CLOCKSOURCE_DIVIDER_56, TIMER_A_CLOCKSOURCE_DIVIDER_6, TIMER_A_CLOCKSOURCE_DIVIDER_64, TIMER_A_CLOCKSOURCE_DIVIDER_7, TIMER_A_CLOCKSOURCE_DIVIDER_8, TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK, TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK, TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CMSIS, TIMER_A_DO_CLEAR, TIMER_A_SKIP_CLEAR, TIMER_A_TAIE_INTERRUPT_DISABLE, TIMER_A_TAIE_INTERRUPT_ENABLE, TIMER_A_UPDOWN_MODE, _Timer_A_ContinuousModeConfig::timerClear, and _Timer_A_ContinuousModeConfig::timerInterruptEnable_TAIE.

void Timer_A_configureUpMode ( uint32_t  timer,
const Timer_A_UpModeConfig config 
)

Configures Timer_A in up mode.

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
configConfiguration structure for Timer_A Up mode

Configuration options for Timer_A_UpModeConfig structure.


Parameters
clockSourceselects Clock source. Valid values are
  • TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default value]
  • TIMER_A_CLOCKSOURCE_ACLK
  • TIMER_A_CLOCKSOURCE_SMCLK
  • TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
clockSourceDivideris the divider for Clock source. Valid values are:
  • TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default value]
  • TIMER_A_CLOCKSOURCE_DIVIDER_2
  • TIMER_A_CLOCKSOURCE_DIVIDER_4
  • TIMER_A_CLOCKSOURCE_DIVIDER_8
  • TIMER_A_CLOCKSOURCE_DIVIDER_3
  • TIMER_A_CLOCKSOURCE_DIVIDER_5
  • TIMER_A_CLOCKSOURCE_DIVIDER_6
  • TIMER_A_CLOCKSOURCE_DIVIDER_7
  • TIMER_A_CLOCKSOURCE_DIVIDER_10
  • TIMER_A_CLOCKSOURCE_DIVIDER_12
  • TIMER_A_CLOCKSOURCE_DIVIDER_14
  • TIMER_A_CLOCKSOURCE_DIVIDER_16
  • TIMER_A_CLOCKSOURCE_DIVIDER_20
  • TIMER_A_CLOCKSOURCE_DIVIDER_24
  • TIMER_A_CLOCKSOURCE_DIVIDER_28
  • TIMER_A_CLOCKSOURCE_DIVIDER_32
  • TIMER_A_CLOCKSOURCE_DIVIDER_40
  • TIMER_A_CLOCKSOURCE_DIVIDER_48
  • TIMER_A_CLOCKSOURCE_DIVIDER_56
  • TIMER_A_CLOCKSOURCE_DIVIDER_64
timerPeriodis the specified Timer_A period. This is the value that gets written into the CCR0. Limited to 16 bits[uint16_t]
timerInterruptEnable_TAIEis to enable or disable Timer_A interrupt. Valid values are:
  • TIMER_A_TAIE_INTERRUPT_ENABLE and
  • TIMER_A_TAIE_INTERRUPT_DISABLE [Default value]
captureCompareInterruptEnable_CCR0_CCIEis to enable or disable Timer_A CCR0 captureComapre interrupt. Valid values are
  • TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE and
  • TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default value]
timerCleardecides if Timer_A clock divider, count direction, count need to be reset. Valid values are
  • TIMER_A_DO_CLEAR
  • TIMER_A_SKIP_CLEAR [Default value]
Note
This API does not start the timer. Timer needs to be started when required using the Timer_A_startCounter API.
Returns
None

References ASSERT, _Timer_A_UpModeConfig::captureCompareInterruptEnable_CCR0_CCIE, _Timer_A_UpModeConfig::clockSource, _Timer_A_UpModeConfig::clockSourceDivider, TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE, TIMER_A_CLOCKSOURCE_ACLK, TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK, TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK, TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CMSIS, TIMER_A_DO_CLEAR, TIMER_A_SKIP_CLEAR, TIMER_A_TAIE_INTERRUPT_ENABLE, TIMER_A_UPDOWN_MODE, _Timer_A_UpModeConfig::timerClear, _Timer_A_UpModeConfig::timerInterruptEnable_TAIE, and _Timer_A_UpModeConfig::timerPeriod.

void Timer_A_configureUpDownMode ( uint32_t  timer,
const Timer_A_UpDownModeConfig config 
)

Configures Timer_A in up down mode.

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
configConfiguration structure for Timer_A UpDown mode

Configuration options for Timer_A_UpDownModeConfig structure.


Parameters
clockSourceselects Clock source. Valid values are
  • TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK [Default value]
  • TIMER_A_CLOCKSOURCE_ACLK
  • TIMER_A_CLOCKSOURCE_SMCLK
  • TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
clockSourceDivideris the divider for Clock source. Valid values are:
  • TIMER_A_CLOCKSOURCE_DIVIDER_1 [Default value]
  • TIMER_A_CLOCKSOURCE_DIVIDER_2
  • TIMER_A_CLOCKSOURCE_DIVIDER_4
  • TIMER_A_CLOCKSOURCE_DIVIDER_8
  • TIMER_A_CLOCKSOURCE_DIVIDER_3
  • TIMER_A_CLOCKSOURCE_DIVIDER_5
  • TIMER_A_CLOCKSOURCE_DIVIDER_6
  • TIMER_A_CLOCKSOURCE_DIVIDER_7
  • TIMER_A_CLOCKSOURCE_DIVIDER_10
  • TIMER_A_CLOCKSOURCE_DIVIDER_12
  • TIMER_A_CLOCKSOURCE_DIVIDER_14
  • TIMER_A_CLOCKSOURCE_DIVIDER_16
  • TIMER_A_CLOCKSOURCE_DIVIDER_20
  • TIMER_A_CLOCKSOURCE_DIVIDER_24
  • TIMER_A_CLOCKSOURCE_DIVIDER_28
  • TIMER_A_CLOCKSOURCE_DIVIDER_32
  • TIMER_A_CLOCKSOURCE_DIVIDER_40
  • TIMER_A_CLOCKSOURCE_DIVIDER_48
  • TIMER_A_CLOCKSOURCE_DIVIDER_56
  • TIMER_A_CLOCKSOURCE_DIVIDER_64
timerPeriodis the specified Timer_A period
timerInterruptEnable_TAIEis to enable or disable Timer_A interrupt. Valid values are
  • TIMER_A_TAIE_INTERRUPT_ENABLE
  • TIMER_A_TAIE_INTERRUPT_DISABLE [Default value]
captureCompareInterruptEnable_CCR0_CCIEis to enable or disable Timer_A CCR0 captureComapre interrupt. Valid values are
  • TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE and
  • TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE [Default value]
timerCleardecides if Timer_A clock divider, count direction, count need to be reset. Valid values are
  • TIMER_A_DO_CLEAR
  • TIMER_A_SKIP_CLEAR [Default value]

This API does not start the timer. Timer needs to be started when required using the Timer_A_startCounter API.

Returns
None

References ASSERT, _Timer_A_UpDownModeConfig::captureCompareInterruptEnable_CCR0_CCIE, _Timer_A_UpDownModeConfig::clockSource, _Timer_A_UpDownModeConfig::clockSourceDivider, TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE, TIMER_A_CLOCKSOURCE_ACLK, TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK, TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK, TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CMSIS, TIMER_A_DO_CLEAR, TIMER_A_SKIP_CLEAR, TIMER_A_STOP_MODE, TIMER_A_TAIE_INTERRUPT_ENABLE, TIMER_A_UPDOWN_MODE, _Timer_A_UpDownModeConfig::timerClear, _Timer_A_UpDownModeConfig::timerInterruptEnable_TAIE, and _Timer_A_UpDownModeConfig::timerPeriod.

void Timer_A_initCapture ( uint32_t  timer,
const Timer_A_CaptureModeConfig config 
)

Initializes Capture Mode

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
configConfiguration structure for Timer_A capture mode

Configuration options for Timer_A_CaptureModeConfig structure.


Parameters
captureRegisterselects the Capture register being used. Valid values are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6
    Refer to datasheet to ensure the device has the capture compare register being used
captureModeis the capture mode selected. Valid values are
  • TIMER_A_CAPTUREMODE_NO_CAPTURE [Default value]
  • TIMER_A_CAPTUREMODE_RISING_EDGE
  • TIMER_A_CAPTUREMODE_FALLING_EDGE
  • TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE
captureInputSelectdecides the Input Select
  • TIMER_A_CAPTURE_INPUTSELECT_CCIxA [Default value]
  • TIMER_A_CAPTURE_INPUTSELECT_CCIxB
  • TIMER_A_CAPTURE_INPUTSELECT_GND
  • TIMER_A_CAPTURE_INPUTSELECT_Vcc
synchronizeCaptureSourcedecides if capture source should be synchronized with timer clock Valid values are
  • TIMER_A_CAPTURE_ASYNCHRONOUS [Default value]
  • TIMER_A_CAPTURE_SYNCHRONOUS
captureInterruptEnableis to enable or disable timer captureComapre interrupt. Valid values are
  • TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default value]
  • TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE
captureOutputModespecifies the ouput mode. Valid values are
  • TIMER_A_OUTPUTMODE_OUTBITVALUE [Default value],
  • TIMER_A_OUTPUTMODE_SET,
  • TIMER_A_OUTPUTMODE_TOGGLE_RESET,
  • TIMER_A_OUTPUTMODE_SET_RESET
  • TIMER_A_OUTPUTMODE_TOGGLE,
  • TIMER_A_OUTPUTMODE_RESET,
  • TIMER_A_OUTPUTMODE_TOGGLE_SET,
  • TIMER_A_OUTPUTMODE_RESET_SET
Returns
None

References ASSERT, _Timer_A_CaptureModeConfig::captureInputSelect, _Timer_A_CaptureModeConfig::captureInterruptEnable, _Timer_A_CaptureModeConfig::captureMode, _Timer_A_CaptureModeConfig::captureOutputMode, _Timer_A_CaptureModeConfig::captureRegister, _Timer_A_CaptureModeConfig::synchronizeCaptureSource, TIMER_A_CAPTURE_ASYNCHRONOUS, TIMER_A_CAPTURE_INPUTSELECT_CCIxA, TIMER_A_CAPTURE_INPUTSELECT_CCIxB, TIMER_A_CAPTURE_INPUTSELECT_GND, TIMER_A_CAPTURE_INPUTSELECT_Vcc, TIMER_A_CAPTURE_SYNCHRONOUS, TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE, TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, TIMER_A_CAPTUREMODE_FALLING_EDGE, TIMER_A_CAPTUREMODE_NO_CAPTURE, TIMER_A_CAPTUREMODE_RISING_AND_FALLING_EDGE, TIMER_A_CAPTUREMODE_RISING_EDGE, TIMER_A_CMSIS, TIMER_A_DO_CLEAR, TIMER_A_OUTPUTMODE_OUTBITVALUE, TIMER_A_OUTPUTMODE_RESET, TIMER_A_OUTPUTMODE_RESET_SET, TIMER_A_OUTPUTMODE_SET, TIMER_A_OUTPUTMODE_SET_RESET, TIMER_A_OUTPUTMODE_TOGGLE, TIMER_A_OUTPUTMODE_TOGGLE_RESET, TIMER_A_OUTPUTMODE_TOGGLE_SET, and TIMER_A_TAIE_INTERRUPT_ENABLE.

void Timer_A_initCompare ( uint32_t  timer,
const Timer_A_CompareModeConfig config 
)

Initializes Compare Mode

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
configConfiguration structure for Timer_A compare mode

Configuration options for Timer_A_CompareModeConfig structure.


Parameters
compareRegisterselects the Capture register being used. Valid values are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6
    Refer to datasheet to ensure the device has the capture compare register being used
compareInterruptEnableis to enable or disable timer captureComapre interrupt. Valid values are
  • TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE and
  • TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default value]
compareOutputModespecifies the output mode. Valid values are
  • TIMER_A_OUTPUTMODE_OUTBITVALUE [Default value],
  • TIMER_A_OUTPUTMODE_SET,
  • TIMER_A_OUTPUTMODE_TOGGLE_RESET,
  • TIMER_A_OUTPUTMODE_SET_RESET
  • TIMER_A_OUTPUTMODE_TOGGLE,
  • TIMER_A_OUTPUTMODE_RESET,
  • TIMER_A_OUTPUTMODE_TOGGLE_SET,
  • TIMER_A_OUTPUTMODE_RESET_SET
compareValueis the count to be compared with in compare mode
Returns
None

References ASSERT, _Timer_A_CompareModeConfig::compareInterruptEnable, _Timer_A_CompareModeConfig::compareOutputMode, _Timer_A_CompareModeConfig::compareRegister, _Timer_A_CompareModeConfig::compareValue, TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE, TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, TIMER_A_CMSIS, TIMER_A_OUTPUTMODE_OUTBITVALUE, TIMER_A_OUTPUTMODE_RESET, TIMER_A_OUTPUTMODE_RESET_SET, TIMER_A_OUTPUTMODE_SET, TIMER_A_OUTPUTMODE_SET_RESET, TIMER_A_OUTPUTMODE_TOGGLE, TIMER_A_OUTPUTMODE_TOGGLE_RESET, and TIMER_A_OUTPUTMODE_TOGGLE_SET.

void Timer_A_clearTimer ( uint32_t  timer)

Reset/Clear the timer clock divider, count direction, count

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
Returns
None

References TIMER_A_CMSIS.

uint_fast8_t Timer_A_getSynchronizedCaptureCompareInput ( uint32_t  timer,
uint_fast16_t  captureCompareRegister,
uint_fast16_t  synchronizedSetting 
)

Get synchronized capture compare input

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisterselects the Capture register being used. Valid values are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6
    Refer to datasheet to ensure the device has the capture compare register being used
synchronizedSettingis to select type of capture compare input. Valid values are
  • TIMER_A_READ_CAPTURE_COMPARE_INPUT
  • TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT
Returns
TIMER_A_CAPTURECOMPARE_INPUT_HIGH or
  • TIMER_A_CAPTURECOMPARE_INPUT_LOW

References ASSERT, TIMER_A_CAPTURECOMPARE_INPUT_HIGH, TIMER_A_CAPTURECOMPARE_INPUT_LOW, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, TIMER_A_CMSIS, TIMER_A_READ_CAPTURE_COMPARE_INPUT, and TIMER_A_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT.

uint_fast8_t Timer_A_getOutputForOutputModeOutBitValue ( uint32_t  timer,
uint_fast16_t  captureCompareRegister 
)

Get ouput bit for output mode

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisterselects the Capture register being used. Valid values are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6
    Refer to datasheet to ensure the device has the capture compare register being used
Returns
TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH or
  • TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW

References ASSERT, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, TIMER_A_CMSIS, TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH, and TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW.

uint_fast16_t Timer_A_getCaptureCompareCount ( uint32_t  timer,
uint_fast16_t  captureCompareRegister 
)

Get current capture compare count

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisterselects the Capture register being used. Valid values are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6
    Refer to datasheet to ensure the device has the capture compare register being used
Returns
current count as uint16_t

References ASSERT, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, and TIMER_A_CMSIS.

void Timer_A_setOutputForOutputModeOutBitValue ( uint32_t  timer,
uint_fast16_t  captureCompareRegister,
uint_fast8_t  outputModeOutBitValue 
)

Set ouput bit for output mode

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisterselects the Capture register being used. are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6
    Refer to datasheet to ensure the device has the capture compare register being used
outputModeOutBitValuethe value to be set for out bit. Valid values are:
  • TIMER_A_OUTPUTMODE_OUTBITVALUE_HIGH
  • TIMER_A_OUTPUTMODE_OUTBITVALUE_LOW
Returns
None

References TIMER_A_CMSIS, and TIMER_A_OUTPUTMODE_RESET_SET.

void Timer_A_generatePWM ( uint32_t  timer,
const Timer_A_PWMConfig config 
)

Generate a PWM with timer running in up mode

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
configConfiguration structure for Timer_A PWM mode

Configuration options for Timer_A_PWMConfig structure.


Parameters
clockSourceselects Clock source. Valid values are
  • TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK
  • TIMER_A_CLOCKSOURCE_ACLK
  • TIMER_A_CLOCKSOURCE_SMCLK
  • TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
clockSourceDivideris the divider for Clock source. Valid values are
  • TIMER_A_CLOCKSOURCE_DIVIDER_1
  • TIMER_A_CLOCKSOURCE_DIVIDER_2
  • TIMER_A_CLOCKSOURCE_DIVIDER_4
  • TIMER_A_CLOCKSOURCE_DIVIDER_8
  • TIMER_A_CLOCKSOURCE_DIVIDER_3
  • TIMER_A_CLOCKSOURCE_DIVIDER_5
  • TIMER_A_CLOCKSOURCE_DIVIDER_6
  • TIMER_A_CLOCKSOURCE_DIVIDER_7
  • TIMER_A_CLOCKSOURCE_DIVIDER_10
  • TIMER_A_CLOCKSOURCE_DIVIDER_12
  • TIMER_A_CLOCKSOURCE_DIVIDER_14
  • TIMER_A_CLOCKSOURCE_DIVIDER_16
  • TIMER_A_CLOCKSOURCE_DIVIDER_20
  • TIMER_A_CLOCKSOURCE_DIVIDER_24
  • TIMER_A_CLOCKSOURCE_DIVIDER_28
  • TIMER_A_CLOCKSOURCE_DIVIDER_32
  • TIMER_A_CLOCKSOURCE_DIVIDER_40
  • TIMER_A_CLOCKSOURCE_DIVIDER_48
  • TIMER_A_CLOCKSOURCE_DIVIDER_56
  • TIMER_A_CLOCKSOURCE_DIVIDER_64
timerPeriodselects the desired timer period
compareRegisterselects the compare register being used. Valid values are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6

    Refer to datasheet to ensure the device has the capture compare register being used
compareOutputModespecifies the ouput mode. Valid values are:
  • TIMER_A_OUTPUTMODE_OUTBITVALUE,
  • TIMER_A_OUTPUTMODE_SET,
  • TIMER_A_OUTPUTMODE_TOGGLE_RESET,
  • TIMER_A_OUTPUTMODE_SET_RESET
  • TIMER_A_OUTPUTMODE_TOGGLE,
  • TIMER_A_OUTPUTMODE_RESET,
  • TIMER_A_OUTPUTMODE_TOGGLE_SET,
  • TIMER_A_OUTPUTMODE_RESET_SET
dutyCyclespecifies the dutycycle for the generated waveform
Returns
None

References ASSERT, _Timer_A_PWMConfig::clockSource, _Timer_A_PWMConfig::clockSourceDivider, _Timer_A_PWMConfig::compareOutputMode, _Timer_A_PWMConfig::compareRegister, _Timer_A_PWMConfig::dutyCycle, TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, TIMER_A_CLOCKSOURCE_ACLK, TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK, TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK, TIMER_A_CLOCKSOURCE_SMCLK, TIMER_A_CMSIS, TIMER_A_DO_CLEAR, TIMER_A_OUTPUTMODE_OUTBITVALUE, TIMER_A_OUTPUTMODE_RESET, TIMER_A_OUTPUTMODE_RESET_SET, TIMER_A_OUTPUTMODE_SET, TIMER_A_OUTPUTMODE_SET_RESET, TIMER_A_OUTPUTMODE_TOGGLE, TIMER_A_OUTPUTMODE_TOGGLE_RESET, TIMER_A_OUTPUTMODE_TOGGLE_SET, TIMER_A_TAIE_INTERRUPT_ENABLE, TIMER_A_UP_MODE, TIMER_A_UPDOWN_MODE, and _Timer_A_PWMConfig::timerPeriod.

void Timer_A_stopTimer ( uint32_t  timer)

Stops the timer

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
Returns
None

References TIMER_A_CMSIS.

void Timer_A_setCompareValue ( uint32_t  timer,
uint_fast16_t  compareRegister,
uint_fast16_t  compareValue 
)

Sets the value of the capture-compare register

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
compareRegisterselects the Capture register being used. Valid values are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6

    Refer to datasheet to ensure the device has the capture compare register being used
compareValueis the count to be compared with in compare mode
Returns
None

References ASSERT, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, and TIMER_A_CMSIS.

uint16_t Timer_A_getCounterValue ( uint32_t  timer)

Returns the current value of the specified timer. Note that according to the Timer A user guide, reading the value of the counter is unreliable if the system clock is asynchronous from the timer clock. The API addresses this concern by reading the timer count register twice and then determining the integrity of the value. If the two values are within 10 timer counts of each other, the value is deemed safe and returned. If not, the process is repeated until a reliable timer value is determined.

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
Returns
The value of the specified timer

References TIMER_A_CMSIS, and TIMER_A_THRESHOLD.

void Timer_A_clearInterruptFlag ( uint32_t  timer)

Clears the Timer TAIFG interrupt flag

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
Returns
None

References TIMER_A_CMSIS.

void Timer_A_clearCaptureCompareInterrupt ( uint32_t  timer,
uint_fast16_t  captureCompareRegister 
)

Clears the capture-compare interrupt flag

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisterselects the Capture-compare register being used. Valid values are
  • TIMER_A_CAPTURECOMPARE_REGISTER_0
  • TIMER_A_CAPTURECOMPARE_REGISTER_1
  • TIMER_A_CAPTURECOMPARE_REGISTER_2
  • TIMER_A_CAPTURECOMPARE_REGISTER_3
  • TIMER_A_CAPTURECOMPARE_REGISTER_4
  • TIMER_A_CAPTURECOMPARE_REGISTER_5
  • TIMER_A_CAPTURECOMPARE_REGISTER_6
    Refer to the datasheet to ensure the device has the capture compare register being used
Returns
None

References ASSERT, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, and TIMER_A_CMSIS.

void Timer_A_enableInterrupt ( uint32_t  timer)

Enable timer interrupt

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
Returns
None

References TIMER_A_CMSIS.

void Timer_A_disableInterrupt ( uint32_t  timer)

Disable timer interrupt

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
Returns
None

References TIMER_A_CMSIS.

uint32_t Timer_A_getInterruptStatus ( uint32_t  timer)

Get timer interrupt status

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
Returns
uint32_t. Return interrupt status. Valid values are
  • TIMER_A_INTERRUPT_PENDING
  • TIMER_A_INTERRUPT_NOT_PENDING

References TIMER_A_CMSIS.

Referenced by Timer_A_getEnabledInterruptStatus().

uint32_t Timer_A_getEnabledInterruptStatus ( uint32_t  timer)

Get timer interrupt status masked with the enabled interrupts. This function is useful to call in ISRs to get a list of pending interrupts that are actually enabled and could have caused the ISR.

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
Returns
uint32_t. Return interrupt status. Valid values are
  • TIMER_A_INTERRUPT_PENDING
  • TIMER_A_INTERRUPT_NOT_PENDING

References TIMER_A_CMSIS, and Timer_A_getInterruptStatus().

void Timer_A_enableCaptureCompareInterrupt ( uint32_t  timer,
uint_fast16_t  captureCompareRegister 
)

Enable capture compare interrupt

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisteris the selected capture compare register
Returns
None

References ASSERT, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, and TIMER_A_CMSIS.

void Timer_A_disableCaptureCompareInterrupt ( uint32_t  timer,
uint_fast16_t  captureCompareRegister 
)

Disable capture compare interrupt

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisteris the selected capture compare register
Returns
None

References ASSERT, TIMER_A_CAPTURECOMPARE_REGISTER_0, TIMER_A_CAPTURECOMPARE_REGISTER_1, TIMER_A_CAPTURECOMPARE_REGISTER_2, TIMER_A_CAPTURECOMPARE_REGISTER_3, TIMER_A_CAPTURECOMPARE_REGISTER_4, TIMER_A_CAPTURECOMPARE_REGISTER_5, TIMER_A_CAPTURECOMPARE_REGISTER_6, and TIMER_A_CMSIS.

uint32_t Timer_A_getCaptureCompareInterruptStatus ( uint32_t  timer,
uint_fast16_t  captureCompareRegister,
uint_fast16_t  mask 
)

Return capture compare interrupt status

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisteris the selected capture compare register
maskis the mask for the interrupt status Mask value is the logical OR of any of the following:
  • TIMER_A_CAPTURE_OVERFLOW
  • TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG
Returns
uint32_t. The mask of the set flags. Valid values is an OR of
  • TIMER_A_CAPTURE_OVERFLOW,
  • TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG

References TIMER_A_CMSIS.

Referenced by Timer_A_getCaptureCompareEnabledInterruptStatus().

uint32_t Timer_A_getCaptureCompareEnabledInterruptStatus ( uint32_t  timer,
uint_fast16_t  captureCompareRegister 
)

Return capture compare interrupt status masked with the enabled interrupts. This function is useful to call in ISRs to get a list of pending interrupts that are actually enabled and could have caused the ISR.

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
captureCompareRegisteris the selected capture compare register
Returns
uint32_t. The mask of the set flags. Valid values is an OR of
  • TIMER_A_CAPTURE_OVERFLOW,
  • TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG

References TIMER_A_CAPTURE_OVERFLOW, TIMER_A_CAPTURECOMPARE_INTERRUPT_FLAG, TIMER_A_CMSIS, and Timer_A_getCaptureCompareInterruptStatus().

void Timer_A_registerInterrupt ( uint32_t  timer,
uint_fast8_t  interruptSelect,
void(*)(void)  intHandler 
)

Registers an interrupt handler for the timer capture compare interrupt.

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
interruptSelectSelects which timer interrupt handler to register. For the timer module, there are two separate interrupt handlers that can be registered:
  • TIMER_A_CCR0_INTERRUPT Corresponds to the interrupt for CCR0
  • TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT Corresponds to the interrupt for CCR1-6, as well as the overflow interrupt.
intHandleris a pointer to the function to be called when the timer capture compare interrupt occurs.

This function registers the handler to be called when a timer interrupt occurs. This function enables the global interrupt in the interrupt controller; specific Timer_Ainterrupts must be enabled via Timer_A_enableInterrupt(). It is the interrupt handler's responsibility to clear the interrupt source via Timer_A_clearCaptureCompareInterrupt().

Returns
None.

References ASSERT, INT_TA0_0, INT_TA0_N, INT_TA1_0, INT_TA1_N, INT_TA2_0, INT_TA2_N, INT_TA3_0, INT_TA3_N, Interrupt_enableInterrupt(), Interrupt_registerInterrupt(), TIMER_A_CCR0_INTERRUPT, and TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT.

void Timer_A_unregisterInterrupt ( uint32_t  timer,
uint_fast8_t  interruptSelect 
)

Unregisters the interrupt handler for the timer

Parameters
timeris the instance of the Timer_A module. Valid parameters vary from part to part, but can include:
  • TIMER_A0_BASE
  • TIMER_A1_BASE
  • TIMER_A2_BASE
  • TIMER_A3_BASE
interruptSelectSelects which timer interrupt handler to register. For the timer module, there are two separate interrupt handlers that can be registered:
  • TIMER_A_CCR0_INTERRUPT Corresponds to the interrupt for CCR0
  • TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT Corresponds to the interrupt for CCR1-6, as well as the overflow interrupt.

This function unregisters the handler to be called when timer interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

See Also
Interrupt_registerInterrupt() for important information about registering interrupt handlers.
Returns
None.

References ASSERT, INT_TA0_0, INT_TA0_N, INT_TA1_0, INT_TA1_N, INT_TA2_0, INT_TA2_N, INT_TA3_0, INT_TA3_N, Interrupt_disableInterrupt(), Interrupt_unregisterInterrupt(), TIMER_A_CCR0_INTERRUPT, and TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT.


Copyright 2019, Texas Instruments Incorporated