fast-feedback virtual target task code on STM Nucleo

Dependencies:   mbed

core/scheduler.cpp

Committer:
gwappa
Date:
2018-07-21
Revision:
27:b31ea8d74f9e
Child:
28:797536a42b9f

File content as of revision 27:b31ea8d74f9e:

#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();
    }
}