![]() |
M480 BSP V3.05.006
The Board Support Package for M480 Series
|
Macros | |
#define | TIMER_SET_CMP_VALUE(timer, u32Value) |
Set Timer Compared Value. More... | |
#define | TIMER_SET_PRESCALE_VALUE(timer, u32Value) |
Set Timer Prescale Value. More... | |
#define | TIMER_IS_ACTIVE(timer) |
Check specify Timer Status. More... | |
#define | TIMER_SELECT_TOUT_PIN(timer, u32ToutSel) |
Select Toggle-output Pin. More... | |
#define | TIMER_SET_OPMODE(timer, u32OpMode) |
Select Timer operating mode. More... | |
Functions | |
__STATIC_INLINE void | TIMER_Start (TIMER_T *timer) |
Start Timer Counting. More... | |
__STATIC_INLINE void | TIMER_Stop (TIMER_T *timer) |
Stop Timer Counting. More... | |
__STATIC_INLINE void | TIMER_EnableWakeup (TIMER_T *timer) |
Enable Timer Interrupt Wake-up Function. More... | |
__STATIC_INLINE void | TIMER_DisableWakeup (TIMER_T *timer) |
Disable Timer Wake-up Function. More... | |
__STATIC_INLINE void | TIMER_StartCapture (TIMER_T *timer) |
Start Timer Capture Function. More... | |
__STATIC_INLINE void | TIMER_StopCapture (TIMER_T *timer) |
Stop Timer Capture Function. More... | |
__STATIC_INLINE void | TIMER_EnableCaptureDebounce (TIMER_T *timer) |
Enable Capture Pin De-bounce. More... | |
__STATIC_INLINE void | TIMER_DisableCaptureDebounce (TIMER_T *timer) |
Disable Capture Pin De-bounce. More... | |
__STATIC_INLINE void | TIMER_EnableEventCounterDebounce (TIMER_T *timer) |
Enable Counter Pin De-bounce. More... | |
__STATIC_INLINE void | TIMER_DisableEventCounterDebounce (TIMER_T *timer) |
Disable Counter Pin De-bounce. More... | |
__STATIC_INLINE void | TIMER_EnableInt (TIMER_T *timer) |
Enable Timer Time-out Interrupt. More... | |
__STATIC_INLINE void | TIMER_DisableInt (TIMER_T *timer) |
Disable Timer Time-out Interrupt. More... | |
__STATIC_INLINE void | TIMER_EnableCaptureInt (TIMER_T *timer) |
Enable Capture Trigger Interrupt. More... | |
__STATIC_INLINE void | TIMER_DisableCaptureInt (TIMER_T *timer) |
Disable Capture Trigger Interrupt. More... | |
__STATIC_INLINE uint32_t | TIMER_GetIntFlag (TIMER_T *timer) |
Get Timer Time-out Interrupt Flag. More... | |
__STATIC_INLINE void | TIMER_ClearIntFlag (TIMER_T *timer) |
Clear Timer Time-out Interrupt Flag. More... | |
__STATIC_INLINE uint32_t | TIMER_GetCaptureIntFlag (TIMER_T *timer) |
Get Timer Capture Interrupt Flag. More... | |
__STATIC_INLINE void | TIMER_ClearCaptureIntFlag (TIMER_T *timer) |
Clear Timer Capture Interrupt Flag. More... | |
__STATIC_INLINE uint32_t | TIMER_GetWakeupFlag (TIMER_T *timer) |
Get Timer Wake-up Flag. More... | |
__STATIC_INLINE void | TIMER_ClearWakeupFlag (TIMER_T *timer) |
Clear Timer Wake-up Flag. More... | |
__STATIC_INLINE uint32_t | TIMER_GetCaptureData (TIMER_T *timer) |
Get Capture value. More... | |
__STATIC_INLINE uint32_t | TIMER_GetCounter (TIMER_T *timer) |
Get Counter value. More... | |
uint32_t | TIMER_Open (TIMER_T *timer, uint32_t u32Mode, uint32_t u32Freq) |
Open Timer with Operate Mode and Frequency. More... | |
void | TIMER_Close (TIMER_T *timer) |
Stop Timer Counting. More... | |
int32_t | TIMER_Delay (TIMER_T *timer, uint32_t u32Usec) |
Create a specify Delay Time. More... | |
void | TIMER_EnableCapture (TIMER_T *timer, uint32_t u32CapMode, uint32_t u32Edge) |
Enable Timer Capture Function. More... | |
void | TIMER_DisableCapture (TIMER_T *timer) |
Disable Timer Capture Function. More... | |
void | TIMER_EnableEventCounter (TIMER_T *timer, uint32_t u32Edge) |
Enable Timer Counter Function. More... | |
void | TIMER_DisableEventCounter (TIMER_T *timer) |
Disable Timer Counter Function. More... | |
uint32_t | TIMER_GetModuleClock (TIMER_T *timer) |
Get Timer Clock Frequency. More... | |
void | TIMER_EnableFreqCounter (TIMER_T *timer, uint32_t u32DropCount, uint32_t u32Timeout, uint32_t u32EnableInt) |
This function is used to enable the Timer frequency counter function. More... | |
void | TIMER_DisableFreqCounter (TIMER_T *timer) |
This function is used to disable the Timer frequency counter function. More... | |
void | TIMER_SetTriggerSource (TIMER_T *timer, uint32_t u32Src) |
This function is used to select the interrupt source used to trigger other modules. More... | |
void | TIMER_SetTriggerTarget (TIMER_T *timer, uint32_t u32Mask) |
This function is used to set modules trigger by timer interrupt. More... | |
int32_t | TIMER_ResetCounter (TIMER_T *timer) |
Reset Counter. More... | |
#define TIMER_IS_ACTIVE | ( | timer | ) |
Check specify Timer Status.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
0 | Timer 24-bit up counter is inactive |
1 | Timer 24-bit up counter is active |
This macro is used to check if specify Timer counter is inactive or active.
#define TIMER_SELECT_TOUT_PIN | ( | timer, | |
u32ToutSel | |||
) |
Select Toggle-output Pin.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
[in] | u32ToutSel | Toggle-output pin selection, valid values are: |
This macro is used to select timer toggle-output pin is output on TMx or TMx_EXT pin.
#define TIMER_SET_CMP_VALUE | ( | timer, | |
u32Value | |||
) |
Set Timer Compared Value.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
[in] | u32Value | Timer compare value. Valid values are between 2 to 0xFFFFFF. |
This macro is used to set timer compared value to adjust timer time-out interval.
#define TIMER_SET_OPMODE | ( | timer, | |
u32OpMode | |||
) |
Select Timer operating mode.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
[in] | u32OpMode | Operation mode. Possible options are |
#define TIMER_SET_PRESCALE_VALUE | ( | timer, | |
u32Value | |||
) |
Set Timer Prescale Value.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
[in] | u32Value | Timer prescale value. Valid values are between 0 to 0xFF. |
This macro is used to set timer prescale value and timer source clock will be divided by (prescale + 1)
before it is fed into timer.
__STATIC_INLINE void TIMER_ClearCaptureIntFlag | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_ClearIntFlag | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_ClearWakeupFlag | ( | TIMER_T * | timer | ) |
void TIMER_Close | ( | TIMER_T * | timer | ) |
int32_t TIMER_Delay | ( | TIMER_T * | timer, |
uint32_t | u32Usec | ||
) |
Create a specify Delay Time.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
[in] | u32Usec | Delay period in micro seconds. Valid values are between 100~1000000 (100 micro second ~ 1 second). |
0 | Success, target delay time reached |
TIMER_TIMEOUT_ERR | Delay function execute failed due to timer stop working |
This API is used to create a delay loop for u32usec micro seconds by using timer one-shot mode.
void TIMER_DisableCapture | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_DisableCaptureDebounce | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_DisableCaptureInt | ( | TIMER_T * | timer | ) |
void TIMER_DisableEventCounter | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_DisableEventCounterDebounce | ( | TIMER_T * | timer | ) |
void TIMER_DisableFreqCounter | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_DisableInt | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_DisableWakeup | ( | TIMER_T * | timer | ) |
void TIMER_EnableCapture | ( | TIMER_T * | timer, |
uint32_t | u32CapMode, | ||
uint32_t | u32Edge | ||
) |
Enable Timer Capture Function.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
[in] | u32CapMode | Timer capture mode. Could be |
[in] | u32Edge | Timer capture trigger edge. Possible values are |
This API is used to enable timer capture function with specify capture trigger edge
to get current counter value or reset counter value to 0.
__STATIC_INLINE void TIMER_EnableCaptureDebounce | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_EnableCaptureInt | ( | TIMER_T * | timer | ) |
void TIMER_EnableEventCounter | ( | TIMER_T * | timer, |
uint32_t | u32Edge | ||
) |
Enable Timer Counter Function.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
[in] | u32Edge | Detection edge of counter pin. Could be ether |
This function is used to enable the timer counter function with specify detection edge.
__STATIC_INLINE void TIMER_EnableEventCounterDebounce | ( | TIMER_T * | timer | ) |
void TIMER_EnableFreqCounter | ( | TIMER_T * | timer, |
uint32_t | u32DropCount, | ||
uint32_t | u32Timeout, | ||
uint32_t | u32EnableInt | ||
) |
This function is used to enable the Timer frequency counter function.
[in] | timer | The base address of Timer module. Can be TIMER0 or TIMER2 |
[in] | u32DropCount | This parameter has no effect in M480 series BSP |
[in] | u32Timeout | This parameter has no effect in M480 series BSP |
[in] | u32EnableInt | Enable interrupt assertion after capture complete or not. Valid values are TRUE and FALSE |
This function is used to calculate input event frequency. After enable this function, a pair of timers, TIMER0 and TIMER1, or TIMER2 and TIMER3 will be configured for this function. The mode used to calculate input event frequency is mentioned as "Inter Timer Trigger Mode" in Technical Reference Manual
__STATIC_INLINE void TIMER_EnableInt | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_EnableWakeup | ( | TIMER_T * | timer | ) |
Enable Timer Interrupt Wake-up Function.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
This function is used to enable the timer interrupt wake-up function and interrupt source could be time-out interrupt,
counter event interrupt or capture trigger interrupt.
__STATIC_INLINE uint32_t TIMER_GetCaptureData | ( | TIMER_T * | timer | ) |
__STATIC_INLINE uint32_t TIMER_GetCaptureIntFlag | ( | TIMER_T * | timer | ) |
Get Timer Capture Interrupt Flag.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
0 | Timer capture interrupt did not occur |
1 | Timer capture interrupt occurred |
This function indicates timer capture trigger interrupt occurred or not.
__STATIC_INLINE uint32_t TIMER_GetCounter | ( | TIMER_T * | timer | ) |
__STATIC_INLINE uint32_t TIMER_GetIntFlag | ( | TIMER_T * | timer | ) |
Get Timer Time-out Interrupt Flag.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
0 | Timer time-out interrupt did not occur |
1 | Timer time-out interrupt occurred |
This function indicates timer time-out interrupt occurred or not.
uint32_t TIMER_GetModuleClock | ( | TIMER_T * | timer | ) |
Get Timer Clock Frequency.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
This API is used to get the timer clock frequency.
__STATIC_INLINE uint32_t TIMER_GetWakeupFlag | ( | TIMER_T * | timer | ) |
Get Timer Wake-up Flag.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
0 | Timer does not cause CPU wake-up |
1 | Timer interrupt event cause CPU wake-up |
This function indicates timer interrupt event has waked up system or not.
uint32_t TIMER_Open | ( | TIMER_T * | timer, |
uint32_t | u32Mode, | ||
uint32_t | u32Freq | ||
) |
Open Timer with Operate Mode and Frequency.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
[in] | u32Mode | Operation mode. Possible options are |
[in] | u32Freq | Target working frequency |
This API is used to configure timer to operate in specified mode and frequency. If timer cannot work in target frequency, a closest frequency will be chose and returned.
int32_t TIMER_ResetCounter | ( | TIMER_T * | timer | ) |
Reset Counter.
[in] | timer | The pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3. |
0 | Timer reset success |
TIMER_TIMEOUT_ERR | Timer reset failed |
This function is used to reset current counter value and internal prescale counter value.
void TIMER_SetTriggerSource | ( | TIMER_T * | timer, |
uint32_t | u32Src | ||
) |
This function is used to select the interrupt source used to trigger other modules.
[in] | timer | The base address of Timer module |
[in] | u32Src | Selects the interrupt source to trigger other modules. Could be: |
void TIMER_SetTriggerTarget | ( | TIMER_T * | timer, |
uint32_t | u32Mask | ||
) |
This function is used to set modules trigger by timer interrupt.
[in] | timer | The base address of Timer module |
[in] | u32Mask | The mask of modules (EPWM, EADC, DAC and PDMA) trigger by timer. Is the combination of |
__STATIC_INLINE void TIMER_Start | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_StartCapture | ( | TIMER_T * | timer | ) |
__STATIC_INLINE void TIMER_Stop | ( | TIMER_T * | timer | ) |