Skip to content

Commit ba1f633

Browse files
committed
[更新]移除定时器设置频率代码
1 parent b604e39 commit ba1f633

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

hwtimer_sample.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
/* 定时器超时回调函数 */
2323
static rt_err_t timeout_cb(rt_device_t dev, rt_size_t size)
2424
{
25-
rt_kprintf("this is hwtimer timeout callback fucntion!\n");
2625
rt_kprintf("tick is :%d !\n", rt_tick_get());
2726

2827
return 0;
@@ -34,7 +33,6 @@ static int hwtimer_sample(int argc, char *argv[])
3433
rt_hwtimerval_t timeout_s; /* 定时器超时值 */
3534
rt_device_t hw_dev = RT_NULL; /* 定时器设备句柄 */
3635
rt_hwtimer_mode_t mode; /* 定时器模式 */
37-
rt_uint32_t freq = 10000; /* 计数频率 */
3836

3937
/* 查找定时器设备 */
4038
hw_dev = rt_device_find(HWTIMER_DEV_NAME);
@@ -55,14 +53,6 @@ static int hwtimer_sample(int argc, char *argv[])
5553
/* 设置超时回调函数 */
5654
rt_device_set_rx_indicate(hw_dev, timeout_cb);
5755

58-
/* 设置计数频率(默认1Mhz或支持的最小计数频率) */
59-
ret = rt_device_control(hw_dev, HWTIMER_CTRL_FREQ_SET, &freq);
60-
if (ret != RT_EOK)
61-
{
62-
rt_kprintf("set frequency failed! ret is :%d\n", ret);
63-
return ret;
64-
}
65-
6656
/* 设置模式为周期性定时器 */
6757
mode = HWTIMER_MODE_PERIOD;
6858
ret = rt_device_control(hw_dev, HWTIMER_CTRL_MODE_SET, &mode);

0 commit comments

Comments
 (0)