完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
RT_TIMER_CTRL_GET_STATE
应该是新版本增加的命令字 看代码正确的返回值是0或1,不清楚为何你的返回0x20a7,自己单步调试看看,哪里有问题吧 /** * @Brief This function will get or set some options of the timer * * @param timer the timer to be get or set * @param cmd the control command * @param arg the argument * * @Return the statu of control */ rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg) { rt_base_t level; /* parameter check */ RT_ASSERT(timer != RT_NULL); RT_ASSERT(rt_object_get_type(&timer->parent) == RT_Object_Class_Timer); level = rt_hw_interrupt_disable(); switch (cmd) { case RT_TIMER_CTRL_GET_TIME: *(rt_tick_t *)arg = timer->init_tick; break; case RT_TIMER_CTRL_SET_TIME: RT_ASSERT((*(rt_tick_t *)arg) < RT_TICK_MAX / 2); timer->init_tick = *(rt_tick_t *)arg; break; case RT_TIMER_CTRL_SET_ONESHOT: timer->parent.flag &= ~RT_TIMER_FLAG_PERIODIC; break; case RT_TIMER_CTRL_SET_PERIODIC: timer->parent.flag |= RT_TIMER_FLAG_PERIODIC; break; case RT_TIMER_CTRL_GET_STATE: if(timer->parent.flag & RT_TIMER_FLAG_ACTIVATED) { /*timer is start and run*/ *(rt_uint32_t *)arg = RT_TIMER_FLAG_ACTIVATED; } else { /*timer is stop*/ *(rt_uint32_t *)arg = RT_TIMER_FLAG_DEACTIVATED; } break; case RT_TIMER_CTRL_GET_REMAIN_TIME: *(rt_tick_t *)arg = timer->timeout_tick; break; default: break; } rt_hw_interrupt_enable(level); return RT_EOK; } |
|
|
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1035 浏览 0 评论
AI模型部署边缘设备的奇妙之旅:如何在边缘端部署OpenCV
3400 浏览 0 评论
tms320280021 adc采样波形,为什么adc采样频率上来波形就不好了?
1462 浏览 0 评论
2140 浏览 0 评论
1637 浏览 0 评论
75307 浏览 21 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 08:02 , Processed in 0.400376 second(s), Total 42, Slave 35 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号