From fdce7c90252715cce8d4e9c72f45b129506d3c68 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 12 Dec 2022 13:57:38 +0800 Subject: [PATCH] 1 --- a8/xtimer.cc | 8 ++++++++ a8/xtimer.h | 1 + 2 files changed, 9 insertions(+) diff --git a/a8/xtimer.cc b/a8/xtimer.cc index aedecb6..775caac 100644 --- a/a8/xtimer.cc +++ b/a8/xtimer.cc @@ -292,6 +292,14 @@ namespace a8 return &timer->param; } + a8::XParams* XTimer::MutableParams(std::weak_ptr& ptr) + { + if (ptr.expired()) { + abort(); + } + return MutableParams(ptr.lock()->timer); + } + long long XTimer::GetRemainTime(xtimer_list* timer) { if (!timer) { diff --git a/a8/xtimer.h b/a8/xtimer.h index 00f0bd6..5d17adb 100644 --- a/a8/xtimer.h +++ b/a8/xtimer.h @@ -46,6 +46,7 @@ namespace a8 xtimer_list* GetTimerByAttach(list_head* attach_entry); //获取定时器关联参数 a8::XParams* MutableParams(xtimer_list* timer); + a8::XParams* MutableParams(std::weak_ptr& ptr); //获取定时器剩余时间 long long GetRemainTime(xtimer_list* timer); //获取当前正在运行的定时器