Cypress技术论坛
直播中

朱燕媚

7年用户 186经验值
私信 关注
[问答]

PERIODIC TIMER无法在其定时器处理程序中停止(cyw20719)

你好,
初始化一个周期定时器,并启动它。但是在定时器处理程序中无法停止此定时器。
1。初始化代码
*启动应用程序计时器*/
如果(wiced_init_timer(&;app_timer,mesh_app_timer,0,wiced_seconds_periodic_timer)= = wiced_success)
{
如果(wiced_start_timer(&;app_timer,mesh_app_timeout_in_seconds)!= WICEDDY成功
{
WiDeEdBTyTracle(APP启动计时器失败)!!n“”;
}
2。
空隙MeHyAppApTimeT(UTI32)
{
wiced_bt_trace(“mesh_app_timer:计数:%d参数:%dn”,dev_ctx.app_timer_count,Arg);- & gt;虽然停止计时器返回成功。这个调试打印仍然存在。
DavyCTX.AppthimeSerialC++.
WICEDED STOP计时器(和AppSimTime);
γ- IFDEF
/ *转储WICED BT缓存统计每10秒监控缓冲区的使用* /
如果(!)(DeVCCTX.AppTimeTimeRealStCurnal%)
{
A. DeByPrimtBuffiSUSER();
}
第二节
}

以上来自于百度翻译


     以下为原文
  Hi,
   Init a periodic timer, and start it.  but this timer cannot be stopped in it's timer handler.
1. init code
    /* Starting the app timer  */
    if ( wiced_init_timer(&app_timer, mesh_app_timer, 0, WICED_SECONDS_PERIODIC_TIMER) == WICED_SUCCESS)
    {
        if ( wiced_start_timer(&app_timer, MESH_APP_TIMEOUT_IN_SECONDS) != WICED_SUCCESS)
        {
            WICED_BT_TRACE(" APP START Timer FAILED!! n");
        }
2.
void mesh_app_timer(uint32_t arg)
{
    WICED_BT_TRACE("mesh_app_timer: count:%d arg:%dn", dev_ctx.app_timer_count, arg);   -> although stop timer returned successfully. this debug print still there.
    dev_ctx.app_timer_count++;
wiced_stop_timer(&app_timer);
#ifdef _DEB_PRINT_BUF_USE
    /* dump wiced bt buffer statistics on every 10 seconds to monitor buffer usage */
    if (!(dev_ctx.app_timer_count % _DEB_PRINT_BUF_USE))
    {
        _deb_print_buf_use();
    }
#endif
}

回帖(1)

吴民峰

2018-9-7 11:39:55
作为一种解决方案,使用单次计时器代替定期计时器,并重新启动计时器回调中的计时器。这将作为一个周期定时器,你可以简单地选择不重新启动计时器,如果你想阻止它。

以上来自于百度翻译


     以下为原文
  As a workaround, use a single shot timer instead of a periodic timer and restart the timer in the timer callback. This will act as a periodic timer and you can simply chose not to restart the timer if you want to stop it
举报

更多回帖

发帖
×
20
完善资料,
赚取积分