22 lines
604 B
C++
22 lines
604 B
C++
#pragma once
|
|||
|
|
#include <Arduino.h>
|
||
|
|
|
||
|
|
// Will alert after a set time has passed
|
||
|
|
class OperationTimeout
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
OperationTimeout(const unsigned long maxMs) noexcept;
|
||
|
|
OperationTimeout(const long maxMs) noexcept;
|
||
|
|
OperationTimeout(const unsigned int maxMs) noexcept;
|
||
|
|
OperationTimeout(const int maxMs) noexcept;
|
||
|
|
OperationTimeout(const OperationTimeout&) = delete;
|
||
|
|
OperationTimeout(OperationTimeout&&) noexcept = default;
|
||
|
|
|
||
|
|
bool isTimeout() const noexcept;
|
||
|
|
void restart() noexcept;
|
||
|
|
|
||
|
|
private:
|
||
|
|
unsigned long start;
|
||
|
|
const unsigned long maxMs;
|
||
|
|
};
|