定时器的用法

来源:互联网 发布:吉林省网络培训学院 编辑:程序博客网 时间:2024/06/17 13:52

struct timer_list  gs_timer;

setup_timer(&gs->timer, mma7660_timer, (unsigned long) gs);
mod_timer(&gs->timer, jiffies +msecs_to_jiffies( GSENSOR_TIMER_DELAY));

 其中声明一个定时器 gs_timer。然后利用setup_timer()函数初始化该定时器。

最后利用mod_timer()修改定时器时间,其中msecs_to_jiffies()是设定计时为毫秒,红字为数值。

原创粉丝点击