Keisuke Sehara
/
STM32_Whisking
fast-feedback virtual target task code on STM Nucleo
Diff: core/scheduler.cpp
- Revision:
- 27:b31ea8d74f9e
- Child:
- 28:797536a42b9f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/scheduler.cpp Sat Jul 21 00:36:38 2018 +0000 @@ -0,0 +1,20 @@ +#include "scheduler.h" + +namespace scheduler +{ + Timeout timeout_; + + void set(const us_timestamp_t& timeout_us, Callback<void ()> func) + { + if (timeout_us == 0) { + func(); + } else { + timeout_.attach(func, timeout_us); + } + } + + void reset() + { + timeout_.detach(); + } +} \ No newline at end of file