Some useful stuff

Dependents:   FtEncoder FtControlSet

Embed: (wiki syntax)

« Back to documentation index

TimeoutTweaked Class Reference

TimeoutTweaked Class Reference

Tweaked Timeout class, that publishes the protected TimerEvent methods remove() and insert(unsigned int), which are a bit faster than detach() and attach(...). More...

#include <TimeoutTweaked.h>

Public Member Functions

void remove ()
 calls protected TimerEvent::remove()that just removes the timer event from the schedule but keeps the handler that has been attached before
void insert (unsigned int timestamp)
 calls proteccted TimerEvent::insert() that inserts a new timeout event to the schedule at the given timestamp.
void attach (void(*fptr)(void))
 Attach a function to be called by the tweaked Timeout.
template<typename T >
void attach (T *tptr, void(T::*mptr)(void))
 Attach a member function to be called by the tweaked Timeout.

Detailed Description

Tweaked Timeout class, that publishes the protected TimerEvent methods remove() and insert(unsigned int), which are a bit faster than detach() and attach(...).

Useful when you just want to restart a timeout in a short ISR, without hooking in a "new" callback function. Saves ~1.5µs.

Definition at line 12 of file TimeoutTweaked.h.


Member Function Documentation

void attach ( void(*)(void)  fptr )

Attach a function to be called by the tweaked Timeout.

Definition at line 25 of file TimeoutTweaked.h.

void attach ( T *  tptr,
void(T::*)(void)  mptr 
)

Attach a member function to be called by the tweaked Timeout.

Definition at line 31 of file TimeoutTweaked.h.

void insert ( unsigned int  timestamp )

calls proteccted TimerEvent::insert() that inserts a new timeout event to the schedule at the given timestamp.

e.g. insert(us_ticker_read()+timeout_us)

Definition at line 21 of file TimeoutTweaked.h.

void remove (  )

calls protected TimerEvent::remove()that just removes the timer event from the schedule but keeps the handler that has been attached before

Definition at line 16 of file TimeoutTweaked.h.