44 uint32_t u32Cmpr = 0, u32Prescale = 0;
47 if(u32Freq > (u32Clk / 2))
58 u32Cmpr = u32Clk / u32Freq;
60 timer->
CMPR = u32Cmpr;
61 timer->
PRECNT = u32Prescale;
65 return(u32Clk / (u32Cmpr * (u32Prescale + 1)));
98 u32Usec = ((u32Usec + 99) / 100) * 100;
102 u32Usec = ((u32Usec + 9) / 10) * 10;
105 if(u32Clk > 0xFFFFFF)
112 fCmpr = ((float)u32Usec * (
float)u32Clk) / 1000000.0;
114 timer->
CMPR = (uint32_t)fCmpr;
115 timer->
PRECNT = u32Prescale;
120 for(; delay > 0; delay--)
210 return au32Clk[u32Src];
230 uint32_t u32DropCount,
232 uint32_t u32EnableInt)
void TIMER_DisableEventCounter(TIMER_T *timer)
This function is used to disable the Timer event counter function.
#define TIMER_CTL_PDMA_TEEN_Msk
#define CLK_CLKSEL2_TMR2_S_Msk
#define CLK_CLKSEL1_TMR0_S_Pos
#define CLK
Pointer to CLK register structure.
#define TIMER_CTL_TCAP_EN_Msk
#define TIMER_CTL_TMR_EN_Msk
#define TIMER2
Pointer to TIMER2 register structure.
Nano100 series peripheral access layer header file. This file contains all the peripheral register's ...
#define CLK_CLKSEL1_TMR0_S_Msk
#define TIMER_CTL_EVENT_EDGE_Msk
#define CLK_CLKSEL2_TMR3_S_Msk
void TIMER_EnableCapture(TIMER_T *timer, uint32_t u32CapMode, uint32_t u32Edge)
This function is used to enable timer capture function with specified mode and capture edge.
#define CLK_CLKSEL1_TMR1_S_Pos
#define CLK_CLKSEL1_TMR1_S_Msk
#define TIMER_CTL_EVENT_EN_Msk
#define TIMER_CTL_CAP_TRG_EN_Msk
#define TIMER_CTL_TMR_ACT_Msk
#define TIMER_CTL_TCAP_CNT_MODE_Msk
void TIMER_DisableCapture(TIMER_T *timer)
This function is used to disable the Timer capture function.
#define TIMER_IER_TCAP_IE_Msk
uint32_t TIMER_GetModuleClock(TIMER_T *timer)
This function is used to get the clock frequency of Timer.
#define TIMER3
Pointer to TIMER3 register structure.
#define TIMER1
Pointer to TIMER1 register structure.
#define TIMER0
Pointer to TIMER0 register structure.
#define TIMER_CTL_TCAP_EDGE_Msk
void TIMER_Close(TIMER_T *timer)
This function stops Timer counting and disable the Timer interrupt function.
void TIMER_Delay(TIMER_T *timer, uint32_t u32Usec)
This function is used to create a delay loop for u32usec micro seconds.
#define CLK_CLKSEL2_TMR2_S_Pos
#define CLK_CLKSEL2_TMR3_S_Pos
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.
#define TIMER_CTL_ADC_TEEN_Msk
void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask)
This function is used to set modules trigger by timer interrupt.
#define TIMER_CTL_TCAP_MODE_Msk
void TIMER_DisableFreqCounter(TIMER_T *timer)
This function is used to disable the Timer frequency counter function.
void TIMER_SetTriggerSource(TIMER_T *timer, uint32_t u32Src)
This function is used to select the interrupt source used to trigger other modules.
void TIMER_EnableEventCounter(TIMER_T *timer, uint32_t u32Edge)
This function is used to enable the Timer counter function with specify detection edge.
uint32_t TIMER_Open(TIMER_T *timer, uint32_t u32Mode, uint32_t u32Freq)
This function is used to configure timer to operate in specified mode and frequency....
#define TIMER_CTL_INTR_TRG_EN_Msk