Mistake on this page?
Report an issue in GitHub or email us
Public Types | Public Member Functions
Timeout Class Reference
Inheritance diagram for Timeout:
TimeoutBase TickerBase TimerEvent NonCopyable< TickerBase > NonCopyable< TimerEvent >

Public Types

using clock = HighResClock
 Clock to use with attach_absolute, guaranteeing running only while attached or manually locked. More...
 

Public Member Functions

HighResClock::time_point scheduled_time () const
 
template<class F >
void attach_absolute (F &&func, HighResClock::time_point abs_time)
 Attach a function to be called by the Timeout, specifying the absolute time. More...
 
std::chrono::microseconds remaining_time () const
 Return time remaining until callback. More...
 
template<typename F >
MBED_FORCEINLINE void attach (F &&func, float t)
 Attach a function to be called by the Ticker, specifying the interval in seconds. More...
 
void attach (Callback< void()> func, std::chrono::microseconds t)
 Attach a function to be called by the Ticker, specifying the interval in microseconds. More...
 
void attach_us (Callback< void()> func, us_timestamp_t t)
 Attach a function to be called by the Ticker, specifying the interval in microseconds. More...
 
void detach ()
 Detach the function. More...
 

Detailed Description

Definition at line 93 of file Timeout.h.

Member Typedef Documentation

Clock to use with attach_absolute, guaranteeing running only while attached or manually locked.

Definition at line 98 of file Timeout.h.

Member Function Documentation

MBED_FORCEINLINE void attach ( F &&  func,
float  t 
)
inherited

Attach a function to be called by the Ticker, specifying the interval in seconds.

The method forwards its arguments to attach_us() rather than copying them which may not be trivial depending on the callback copied. The function is forcibly inlined to not use floating-point operations. This is possible given attach_us() expects an integer value for the callback interval.

Parameters
funcpointer to the function to be called
tthe time between calls in seconds
Deprecated:
Pass a chrono duration, not a float second count. For example use 10ms rather than 0.01f.

Definition at line 92 of file Ticker.h.

void attach ( Callback< void()>  func,
std::chrono::microseconds  t 
)
inherited

Attach a function to be called by the Ticker, specifying the interval in microseconds.

Parameters
funcpointer to the function to be called
tthe time between calls in micro-seconds
Note
setting t to a value shorter than it takes to process the ticker callback causes the system to hang. Ticker callback is called constantly with no time for threads scheduling.
void attach_absolute ( F &&  func,
HighResClock::time_point  abs_time 
)

Attach a function to be called by the Timeout, specifying the absolute time.

Parameters
funcpointer to the function to be called
abs_timethe absolute time for the call, referenced to HighResClock
Note
setting abs_time to a time in the past means the event will be scheduled immediately resulting in an instant call to the function.

Definition at line 116 of file Timeout.h.

void attach_us ( Callback< void()>  func,
us_timestamp_t  t 
)
inherited

Attach a function to be called by the Ticker, specifying the interval in microseconds.

Parameters
funcpointer to the function to be called
tthe time between calls in micro-seconds
Note
setting t to a value shorter than it takes to process the ticker callback causes the system to hang. Ticker callback is called constantly with no time for threads scheduling.
Deprecated:
Pass a chrono duration, not an integer microsecond count. For example use 10ms rather than 10000.
void detach ( )
inherited

Detach the function.

std::chrono::microseconds remaining_time ( ) const
inherited

Return time remaining until callback.

Returns
time remaining until callback is due
Note
if the callback is overdue, or has already run, the returned value will be negative

Definition at line 68 of file Timeout.h.

HighResClock::time_point scheduled_time ( ) const

Definition at line 101 of file Timeout.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.