Advanced 16-bit timer with precision PWM support and capture/compare capabilities.
More...
|
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) |
|
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:
- Asynchronous 16-bit timer/counter with four operating modes
- Selectable and configurable clock source
- Up to seven configurable capture/compare registers
- Configurable outputs with pulse width modulation (PWM) capability
- Asynchronous input and output latching
- Interrupt vector register for fast decoding of all Timer interrupts
Basic Operation Modes
TimerA can operate in 3 modes:
- Continuous Mode
- Up Mode
- Down Mode
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:
#define TIMER_A_CMSIS |
( |
|
x | ) |
((Timer_A_Type *) x) |
Referenced by Timer_A_clearCaptureCompareInterrupt(), Timer_A_clearInterruptFlag(), Timer_A_clearTimer(), Timer_A_configureContinuousMode(), Timer_A_configureUpDownMode(), Timer_A_configureUpMode(), Timer_A_disableCaptureCompareInterrupt(), Timer_A_disableInterrupt(), Timer_A_enableCaptureCompareInterrupt(), Timer_A_enableInterrupt(), Timer_A_generatePWM(), Timer_A_getCaptureCompareCount(), Timer_A_getCaptureCompareEnabledInterruptStatus(), Timer_A_getCaptureCompareInterruptStatus(), Timer_A_getCounterValue(), Timer_A_getEnabledInterruptStatus(), Timer_A_getInterruptStatus(), Timer_A_getOutputForOutputModeOutBitValue(), Timer_A_getSynchronizedCaptureCompareInput(), Timer_A_initCapture(), Timer_A_initCompare(), Timer_A_setCompareValue(), Timer_A_setOutputForOutputModeOutBitValue(), Timer_A_startCounter(), and Timer_A_stopTimer().
#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 |
void Timer_A_startCounter |
( |
uint32_t |
timer, |
|
|
uint_fast16_t |
timerMode |
|
) |
| |
Starts Timer_A counter
- Parameters
-
timer | is 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
|
timerMode | selects 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.
Configures Timer_A in continuous mode.
- Parameters
-
timer | is 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
|
config | Configuration structure for Timer_A continuous mode |
Configuration options for Timer_A_ContinuousModeConfig structure.
- Parameters
-
clockSource | selects 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_TAIE | is 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_TAIE | is to enable or disable Timer_A interrupt. Valid values are
- TIMER_A_TAIE_INTERRUPT_ENABLE
- TIMER_A_TAIE_INTERRUPT_DISABLE [Default value]
|
timerClear | decides 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.
Configures Timer_A in up mode.
- Parameters
-
timer | is 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
|
config | Configuration structure for Timer_A Up mode |
Configuration options for Timer_A_UpModeConfig structure.
- Parameters
-
clockSource | selects 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
|
clockSourceDivider | is 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
|
timerPeriod | is the specified Timer_A period. This is the value that gets written into the CCR0. Limited to 16 bits[uint16_t] |
timerInterruptEnable_TAIE | is 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_CCIE | is 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]
|
timerClear | decides 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.
Configures Timer_A in up down mode.
- Parameters
-
timer | is 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
|
config | Configuration structure for Timer_A UpDown mode |
Configuration options for Timer_A_UpDownModeConfig structure.
- Parameters
-
clockSource | selects 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
|
clockSourceDivider | is 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
|
timerPeriod | is the specified Timer_A period |
timerInterruptEnable_TAIE | is to enable or disable Timer_A interrupt. Valid values are
- TIMER_A_TAIE_INTERRUPT_ENABLE
- TIMER_A_TAIE_INTERRUPT_DISABLE [Default value]
|
captureCompareInterruptEnable_CCR0_CCIE | is 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]
|
timerClear | decides 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.
Initializes Capture Mode
- Parameters
-
timer | is 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
|
config | Configuration structure for Timer_A capture mode |
Configuration options for Timer_A_CaptureModeConfig structure.
- Parameters
-
captureRegister | selects 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
|
captureMode | is 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
|
captureInputSelect | decides 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
|
synchronizeCaptureSource | decides if capture source should be synchronized with timer clock Valid values are
- TIMER_A_CAPTURE_ASYNCHRONOUS [Default value]
- TIMER_A_CAPTURE_SYNCHRONOUS
|
captureInterruptEnable | is to enable or disable timer captureComapre interrupt. Valid values are
- TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default value]
- TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE
|
captureOutputMode | specifies 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.
Initializes Compare Mode
- Parameters
-
timer | is 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
|
config | Configuration structure for Timer_A compare mode |
Configuration options for Timer_A_CompareModeConfig structure.
- Parameters
-
compareRegister | selects 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
|
compareInterruptEnable | is to enable or disable timer captureComapre interrupt. Valid values are
- TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE and
- TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE [Default value]
|
compareOutputMode | specifies 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
|
compareValue | is 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
-
timer | is 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
-
timer | is 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
|
captureCompareRegister | selects 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
|
synchronizedSetting | is 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
-
timer | is 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
|
captureCompareRegister | selects 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 |
|
) |
| |
void Timer_A_setOutputForOutputModeOutBitValue |
( |
uint32_t |
timer, |
|
|
uint_fast16_t |
captureCompareRegister, |
|
|
uint_fast8_t |
outputModeOutBitValue |
|
) |
| |
Set ouput bit for output mode
- Parameters
-
timer | is 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
|
captureCompareRegister | selects 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
|
outputModeOutBitValue | the 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.
Generate a PWM with timer running in up mode
- Parameters
-
timer | is 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
|
config | Configuration structure for Timer_A PWM mode |
Configuration options for Timer_A_PWMConfig structure.
- Parameters
-
clockSource | selects Clock source. Valid values are
- TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK
- TIMER_A_CLOCKSOURCE_ACLK
- TIMER_A_CLOCKSOURCE_SMCLK
- TIMER_A_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK
|
clockSourceDivider | is 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
|
timerPeriod | selects the desired timer period |
compareRegister | selects 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
|
compareOutputMode | specifies 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
|
dutyCycle | specifies 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
-
timer | is 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 |
|
) |
| |
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
-
timer | is 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
-
timer | is 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 |
|
) |
| |
void Timer_A_enableInterrupt |
( |
uint32_t |
timer | ) |
|
Enable timer interrupt
- Parameters
-
timer | is 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
-
timer | is 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
-
timer | is 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
-
timer | is 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 |
|
) |
| |
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 |
|
) |
| |
Return capture compare interrupt status
- Parameters
-
timer | is 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
|
captureCompareRegister | is the selected capture compare register |
mask | is 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
-
timer | is 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
|
captureCompareRegister | is 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
-
timer | is 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
|
interruptSelect | Selects 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.
|
intHandler | is 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
-
timer | is 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
|
interruptSelect | Selects 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.