📄 test_timer.c
字号:
#include <std.h>
#include <csl.h>
#include <csl_dat.h>
#include <csl_timer.h>
TIMER_Handle hTimer;
///////////////////////////////////
void SetTimer(void)
{
TIMER_Config MyConfig = { 0x00000200, /* ctl */
0xffffffff, /* prd */
0x00000000 /* cnt */ };
// IRQ_enable(IRQ_EVT_TINT0);
hTimer = TIMER_open(TIMER_DEV1,TIMER_OPEN_RESET);
TIMER_config(hTimer,&MyConfig);
TIMER_setCount(hTimer,0x00000000);
TIMER_setPeriod(hTimer,0xffffffff); //unit 1ms ->75000
}
/////////////////////////////////////////
Uint32 timer_start(void)
{
TIMER_setCount(hTimer,0x00000000);
TIMER_start(hTimer);
return TIMER_getCount(hTimer);
}
Uint32 timer_stop(void)
{
TIMER_pause(hTimer);
return TIMER_getCount(hTimer);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -