From 33fec015265a0f47b7d1084fe11bfea75e807388 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 4 Sep 2019 11:21:38 +0800 Subject: [PATCH] add GetRunningTimer --- a8/xtimer.cc | 8 ++++++++ a8/xtimer.h | 1 + 2 files changed, 9 insertions(+) diff --git a/a8/xtimer.cc b/a8/xtimer.cc index 3e01eec..f668d64 100644 --- a/a8/xtimer.cc +++ b/a8/xtimer.cc @@ -228,6 +228,9 @@ namespace a8 void XTimer::DeleteTimer(xtimer_list* timer) { + if (!timer) { + abort(); + } if (base_->running_timer == timer) { base_->running_timer = nullptr; } @@ -256,6 +259,11 @@ namespace a8 return timer->param; } + xtimer_list* XTimer::GetRunningTimer() + { + return base_->running_timer; + } + void XTimer::UpdateTimer() { struct xtvec_base *base = base_; diff --git a/a8/xtimer.h b/a8/xtimer.h index 0c92737..e63d710 100644 --- a/a8/xtimer.h +++ b/a8/xtimer.h @@ -41,6 +41,7 @@ namespace a8 //通过关联的list_head获取定时器对象 xtimer_list* GetTimerByAttach(list_head* attach_entry); a8::XParams& GetTimerXParams(xtimer_list* timer); + xtimer_list* GetRunningTimer(); private: void UpdateTimer();