static void stop_timer(aos_timer_t *timer) { LOG("%s", __func__); if (!timer) {LOG("Timer is not set"); return;} if (aos_timer_stop(timer) != 0) { LOG("Error: aos_timer_stop failed in "); return; } }
void k_timer_stop(k_timer_t *timer) { int ret; ASSERT(timer, "timer is NULL"); BT_DBG("timer %p", timer); ret = aos_timer_stop(&timer->timer); if (ret) { BT_DBG("fail to stop timer"); } }
void k_timer_start(k_timer_t *timer, uint32_t timeout) { int ret; ASSERT(timer, "timer is NULL"); BT_DBG("timer %p,timeout %u", timer, timeout); timer->timeout = timeout; timer->start_ms = aos_now_ms(); ret = aos_timer_stop(&timer->timer); if (ret) { BT_DBG("fail to stop timer"); } ret = aos_timer_change(&timer->timer, timeout); if (ret) { BT_DBG("fail to change timeout"); } ret = aos_timer_start(&timer->timer); if (ret) { BT_DBG("fail to start timer"); } }