FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
time::auto_millis Class Reference

Set a new time::millis function for the duration of the current scope; when the scope is left, the previous time::millis function is restored. More...

#include <fastarduino/time.h>

Public Member Functions

 auto_millis (const auto_millis &)=delete
 
auto_millisoperator= (const auto_millis &)=delete
 
 auto_millis (MILLIS_PTR new_millis) INLINE
 Set new time::millis to new_millis after storing current function for later restore. More...
 

Detailed Description

Set a new time::millis function for the duration of the current scope; when the scope is left, the previous time::millis function is restored.

Usage example:

uint32_t my_millis()
{
...
}
void f()
{
// Set new time::millis function
auto_millis d{my_millis};
// call API that rely on time::millis
...
// Restore previous time::millis function
}
Set a new time::millis function for the duration of the current scope; when the scope is left,...
Definition: time.h:477

Definition at line 476 of file time.h.

Constructor & Destructor Documentation

◆ auto_millis()

time::auto_millis::auto_millis ( MILLIS_PTR  new_millis)
inlineexplicit

Set new time::millis to new_millis after storing current function for later restore.

Parameters
new_millisnew function pointer to replace time::millis

Definition at line 487 of file time.h.


The documentation for this class was generated from the following file: