![]() |
M4521_BSP V3.02.000
The Board Support Package for M4521
|

Macros | |
| #define | TIMER_SET_CMP_VALUE(timer, u32Value) ((timer)->CMP = (u32Value)) |
| Set Timer Compared Value. More... | |
| #define | TIMER_SET_PRESCALE_VALUE(timer, u32Value) ((timer)->CTL = ((timer)->CTL & ~TIMER_CTL_PSC_Msk) | (u32Value)) |
| Set Timer Prescale Value. More... | |
| #define | TIMER_IS_ACTIVE(timer) (((timer)->CTL & TIMER_CTL_ACTSTS_Msk)? 1 : 0) |
| Check specify Timer Status. More... | |
| #define | TIMER_SELECT_TOUT_PIN(timer, u32ToutSel) ((timer)->CTL = ((timer)->CTL & ~TIMER_CTL_TGLPINSEL_Msk) | (u32ToutSel)) |
| Select Toggle-output Pin. 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_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... | |
| void | 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... | |
Variables | |
| int32_t | g_TIMER_i32ErrCode = 0 |
| #define TIMER_IS_ACTIVE | ( | timer | ) | (((timer)->CTL & TIMER_CTL_ACTSTS_Msk)? 1 : 0) |
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 | |||
| ) | ((timer)->CTL = ((timer)->CTL & ~TIMER_CTL_TGLPINSEL_Msk) | (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 Tx or Tx_EXT pin.
| #define TIMER_SET_CMP_VALUE | ( | timer, | |
| u32Value | |||
| ) | ((timer)->CMP = (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_PRESCALE_VALUE | ( | timer, | |
| u32Value | |||
| ) | ((timer)->CTL = ((timer)->CTL & ~TIMER_CTL_PSC_Msk) | (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 |
|
static |
|
static |
| void TIMER_Close | ( | TIMER_T * | timer | ) |
| void 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). |
This API is used to create a delay loop for u32usec micro seconds by using timer one-shot mode.
Definition at line 100 of file timer.c.

| void TIMER_DisableCapture | ( | TIMER_T * | timer | ) |
|
static |
|
static |
| void TIMER_DisableEventCounter | ( | TIMER_T * | timer | ) |
|
static |
|
static |
|
static |
| 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 |
|
static |
| 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 |
|
static |
|
static |
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 |
|
static |
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 |
|
static |
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.
Definition at line 241 of file timer.c.

|
static |
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.
Definition at line 47 of file timer.c.

|
static |
|
static |