ESP8266_swiss_army_board/src/app/NonBlockingDelay.h

27 lines
625 B
C++

/**
* Author : Anatole SCHRAMM-HENRY
* Created on : 03/04/2022
* Licence : MIT
*
* Dead simple object implementing a non blocking delay using the Arduino framework.
*/
#ifndef NONBLOCKINGDELAY_H
#define NONBLOCKINGDELAY_H
#include <Arduino.h>
class NonBlockingDelay
{
public:
NonBlockingDelay(const unsigned long delay, unsigned long tickReference = millis());
// Manually reset the internal tick reference
void reset();
operator bool();
protected:
private:
const unsigned long _delay;
unsigned long _tickReference;
};
#endif //NONBLOCKINGDELAY_H