1
This commit is contained in:
parent
9dcbd24fd4
commit
380074e2f7
17
a8/xtimer.cc
17
a8/xtimer.cc
@ -342,6 +342,18 @@ namespace a8
|
||||
InternalDelete(base_->running_timer, false, true);
|
||||
}
|
||||
|
||||
long long GetIdleTime()
|
||||
{
|
||||
int idle_time = 1;
|
||||
for (int lv1_idx = base_->timer_tick & TVR_MASK; lv1_idx < TVR_SIZE; ++lv1_idx) {
|
||||
if (!list_empty(base_->tv1.vec + lv1_idx)) {
|
||||
return idle_time <= 1 ? 1 : idle_time - 1;
|
||||
}
|
||||
++idle_time;
|
||||
}
|
||||
return idle_time <= 1 ? 1 : idle_time - 1;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void AddToFreeList(xtimer_list* timer)
|
||||
@ -574,4 +586,9 @@ namespace a8
|
||||
impl_->DeleteCurrentTimer();
|
||||
}
|
||||
|
||||
long long XTimer::GetIdleTime()
|
||||
{
|
||||
return impl_->GetIdleTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ namespace a8
|
||||
long long GetRemainTime(XTimerWp& timer_wp);
|
||||
void DeleteCurrentTimer();
|
||||
bool IsRunning();
|
||||
long long GetIdleTime();
|
||||
|
||||
private:
|
||||
void ClearAttacher(Attacher* attacher);
|
||||
|
Loading…
x
Reference in New Issue
Block a user