diff --git a/drivers/Ticker.cpp b/drivers/Ticker.cpp index d7dabf5494..0b4048a37b 100644 --- a/drivers/Ticker.cpp +++ b/drivers/Ticker.cpp @@ -29,16 +29,16 @@ void Ticker::detach() { core_util_critical_section_exit(); } -void Ticker::setup(timestamp_t t) { +void Ticker::setup(us_timestamp_t t) { core_util_critical_section_enter(); remove(); _delay = t; - insert(_delay + ticker_read(_ticker_data)); + insert_absolute(_delay + ticker_read_us(_ticker_data)); core_util_critical_section_exit(); } void Ticker::handler() { - insert(event.timestamp + _delay); + insert_absolute(event.timestamp + _delay); _function(); } diff --git a/drivers/Ticker.h b/drivers/Ticker.h index 5434ef7f8f..57695d16bd 100644 --- a/drivers/Ticker.h +++ b/drivers/Ticker.h @@ -100,7 +100,7 @@ public: * @param func pointer to the function to be called * @param t the time between calls in micro-seconds */ - void attach_us(Callback func, timestamp_t t) { + void attach_us(Callback func, us_timestamp_t t) { _function = func; setup(t); } @@ -118,7 +118,7 @@ public: MBED_DEPRECATED_SINCE("mbed-os-5.1", "The attach_us function does not support cv-qualifiers. Replaced by " "attach_us(callback(obj, method), t).") - void attach_us(T *obj, M method, timestamp_t t) { + void attach_us(T *obj, M method, us_timestamp_t t) { attach_us(Callback(obj, method), t); } @@ -131,12 +131,12 @@ public: void detach(); protected: - void setup(timestamp_t t); + void setup(us_timestamp_t t); virtual void handler(); protected: - timestamp_t _delay; /* Time delay (in microseconds) for re-setting the multi-shot callback. */ - Callback _function; /* Callback. */ + us_timestamp_t _delay; /**< Time delay (in microseconds) for re-setting the multi-shot callback. */ + Callback _function; /**< Callback. */ }; } // namespace mbed