33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
|
#ifndef __SWM320_TIMR_H__
|
|||
|
#define __SWM320_TIMR_H__
|
|||
|
|
|||
|
#define TIMR_MODE_TIMER 0
|
|||
|
#define TIMR_MODE_COUNTER 1
|
|||
|
|
|||
|
void TIMR_Init(TIMR_TypeDef * TIMRx, uint32_t mode, uint32_t period, uint32_t int_en); //<2F><>ʱ<EFBFBD><CAB1>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
void TIMR_Start(TIMR_TypeDef * TIMRx); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>ʼֵ<CABC><D6B5>ʼ<EFBFBD><CABC>ʱ/<2F><><EFBFBD><EFBFBD>
|
|||
|
void TIMR_Stop(TIMR_TypeDef * TIMRx); //ֹͣ<CDA3><D6B9>ʱ<EFBFBD><CAB1>
|
|||
|
void TIMR_Halt(TIMR_TypeDef * TIMRx); //<2F><>ͣ<EFBFBD><CDA3>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>
|
|||
|
void TIMR_Resume(TIMR_TypeDef * TIMRx); //<2F>ָ<EFBFBD><D6B8><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
void TIMR_SetPeriod(TIMR_TypeDef * TIMRx, uint32_t period); //<2F><><EFBFBD>ö<EFBFBD>ʱ/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint32_t TIMR_GetPeriod(TIMR_TypeDef * TIMRx); //<2F><>ȡ<EFBFBD><C8A1>ʱ/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uint32_t TIMR_GetCurValue(TIMR_TypeDef * TIMRx); //<2F><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ֵ
|
|||
|
|
|||
|
void TIMR_INTEn(TIMR_TypeDef * TIMRx); //ʹ<><CAB9><EFBFBD>ж<EFBFBD>
|
|||
|
void TIMR_INTDis(TIMR_TypeDef * TIMRx); //<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
void TIMR_INTClr(TIMR_TypeDef * TIMRx); //<2F><><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6>־
|
|||
|
uint32_t TIMR_INTStat(TIMR_TypeDef * TIMRx); //<2F><>ȡ<EFBFBD>ж<EFBFBD>״̬
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#define PULSE_LOW 0
|
|||
|
#define PULSE_HIGH 1
|
|||
|
|
|||
|
void Pulse_Init(uint32_t pulse, uint32_t int_en);
|
|||
|
void Pulse_Start(void);
|
|||
|
uint32_t Pulse_Done(void);
|
|||
|
|
|||
|
|
|||
|
#endif //__SWM320_TIMR_H__
|