初级会员
- 积分
- 189
- 金钱
- 189
- 注册时间
- 2019-6-28
- 在线时间
- 27 小时
|
1金钱
如题:
本人将正点原子战舰ZET6的BSP按照官网方式改成VET6,当启用毁掉函数时。程序好像就不执行了(没有打印信息)。去掉毁掉函数时,打印信息就ok
tim2_dev = rt_device_find("timer2");
if(tim2_dev != NULL)
{
rt_kprintf("find tim2_dev ok\r\n");
}
ret = rt_device_open(tim2_dev, RT_DEVICE_OFLAG_RDWR);
if (ret == RT_EOK)
{
rt_kprintf("open timer2 device successd\r\n");
}
rt_device_set_rx_indicate(tim2_dev, timeout_cb);
rt_device_control(tim2_dev, HWTIMER_CTRL_FREQ_SET, &freq);
mode = HWTIMER_MODE_PERIOD;
ret = rt_device_control(tim2_dev, HWTIMER_CTRL_MODE_SET, &mode);
if (ret == RT_EOK)
{
rt_kprintf("set mode ok \r\n");
}
timeout_s.sec = 5;
timeout_s.usec = 0;
rt_device_write(tim2_dev, 0, &timeout_s, sizeof(timeout_s));
return 0;
}
|
|