diff options
| author | bernard.xiong <[email protected]> | 2010-03-25 15:16:34 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2010-03-25 15:16:34 +0000 |
| commit | 474d3b805660b260739702089be2e99a26f6d12b (patch) | |
| tree | a760a0609fa552735807fe56a50a5940aa5ef9d3 /examples/kernel/timer_static.c | |
| parent | a08d9637b608c2f94925e2d304080026b771e7fb (diff) | |
add timer_control example.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@543 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'examples/kernel/timer_static.c')
| -rw-r--r-- | examples/kernel/timer_static.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/kernel/timer_static.c b/examples/kernel/timer_static.c index 7ffaac35c6..9009bf62d9 100644 --- a/examples/kernel/timer_static.c +++ b/examples/kernel/timer_static.c @@ -25,8 +25,16 @@ static void timeout2(void* parameter) void timer_static_init() { /* 初始化定时器 */ - rt_timer_init(&timer1, "timer1", timeout1, RT_NULL, 10, RT_TIMER_FLAG_PERIODIC); - rt_timer_init(&timer2, "timer2", timeout2, RT_NULL, 30, RT_TIMER_FLAG_ONE_SHOT); + rt_timer_init(&timer1, "timer1", /* 定时器名字是 timer1 */ + timeout1, /* 超时时回调的处理函数 */ + RT_NULL, /* 超时函数的入口参数 */ + 10, /* 定时长度,以OS Tick为单位,即10个OS Tick */ + RT_TIMER_FLAG_PERIODIC); /* 周期性定时器 */ + rt_timer_init(&timer2, "timer2", /* 定时器名字是 timer2 */ + timeout2, /* 超时时回调的处理函数 */ + RT_NULL, /* 超时函数的入口参数 */ + 30, /* 定时长度为30个OS Tick */ + RT_TIMER_FLAG_ONE_SHOT); /* 单次定时器 */ /* 启动定时器 */ rt_timer_start(&timer1); |
