17 #ifndef MBED_TICKERDATACLOCK_H 18 #define MBED_TICKERDATACLOCK_H 21 #include "hal/ticker_api.h" 60 using duration = std::chrono::microseconds;
61 using rep = duration::rep;
62 using period = duration::period;
63 using time_point = std::chrono::time_point<TickerDataClock>;
64 static const bool is_steady =
false;
122 *timestamp = time_point(duration(t));
162 inline TickerDataClock::time_point get_time_point(
const ticker_event_t &event)
164 return TickerDataClock::time_point{TickerDataClock::duration{
event.timestamp}};
void ticker_insert_event_us(const ticker_data_t *const ticker, ticker_event_t *obj, us_timestamp_t timestamp, uint32_t id)
Insert an event to the queue.
void ticker_resume(const ticker_data_t *const ticker)
Resume this ticker.
int ticker_get_next_timestamp_us(const ticker_data_t *const ticker, us_timestamp_t *timestamp)
Read the next event's timestamp.
uint64_t us_timestamp_t
A us timestamp stored in a 64 bit integer.
Ticker's data structure.
constexpr TickerDataClock(const ticker_data_t *ticker)
Construct a TickerDataClock referring to a ticker_data_t.
A partial implementation of a C++11 Clock representing a HAL ticker.
time_point now() const
Read the current (absolute) ticker's timestamp.
void remove_event(ticker_event_t *obj)
Remove an event from the queue.
Ticker's event structure.
void set_handler(ticker_event_handler handler)
Initialize a ticker and set the event handler.
us_timestamp_t ticker_read_us(const ticker_data_t *const ticker)
Read the current (absolute) ticker's timestamp.
void insert_event(ticker_event_t *obj, time_point timestamp, uint32_t id)
Insert an event to the queue.
void ticker_remove_event(const ticker_data_t *const ticker, ticker_event_t *obj)
Remove an event from the queue.
void ticker_suspend(const ticker_data_t *const ticker)
Suspend this ticker.
void resume()
Resume this ticker.
void suspend()
Suspend this ticker.
int get_next_timestamp(time_point *timestamp) const
Read the next event's timestamp.
void ticker_set_handler(const ticker_data_t *const ticker, ticker_event_handler handler)
Initialize a ticker and set the event handler.