69 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Floating point operators should normally be avoided for code size. If really needed, you can use `duration<float>{elapsed_time()}.count()`")
96 MBED_DEPRECATED_SINCE("mbed-os-6.0.0", "Floating point operators should normally be avoided for code size. If really needed, you can use `duration<
float>{
elapsed_time()}.count()`
")
97 operator float() const;
104 MBED_DEPRECATED_SINCE("mbed-os-6.0.0
", "Use the Chrono-based
elapsed_time method. If integer microseconds are needed, you can use `
elapsed_time().count()`
")
105 us_timestamp_t read_high_resolution_us() const;
112 std::chrono::microseconds elapsed_time() const;
114#if !defined(DOXYGEN_ONLY)
116 TimerBase(const ticker_data_t *data);
117 TimerBase(const ticker_data_t *data, bool lock_deepsleep);
118 TimerBase(const TimerBase &t);
119 TimerBase(TimerBase &&t);
122 const TimerBase &operator=(const TimerBase &) = delete;
124 std::chrono::microseconds slicetime() const;
125 TickerDataClock::time_point _start{}; // the start time of the latest slice
126 std::chrono::microseconds _time{}; // any accumulated time from previous slices
127 TickerDataClock _ticker_data;
128 bool _lock_deepsleep; // flag that indicates if deep sleep should be disabled
129 bool _running = false; // whether the timer is running
132 // Copy storage while a lock is held
133 TimerBase(const TimerBase &t, const CriticalSectionLock &) : TimerBase(t, false) {}
134 // Copy storage only - used by delegating constructors
135 TimerBase(const TimerBase &t, bool) : _start(t._start), _time(t._time), _ticker_data(t._ticker_data), _lock_deepsleep(t._lock_deepsleep), _running(t._running) {}