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

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

#include <fastarduino/time.h>

Public Member Functions

 auto_delay (const auto_delay &)=delete
 
auto_delayoperator= (const auto_delay &)=delete
 
 auto_delay (DELAY_PTR new_delay) INLINE
 Set new time::delay to new_delay after storing current function for later restore. More...
 

Detailed Description

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

Usage example:

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

Definition at line 432 of file time.h.

Constructor & Destructor Documentation

◆ auto_delay()

time::auto_delay::auto_delay ( DELAY_PTR  new_delay)
inlineexplicit

Set new time::delay to new_delay after storing current function for later restore.

Parameters
new_delaynew function pointer to replace time::delay

Definition at line 443 of file time.h.


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