REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
durations.h
Go to the documentation of this file.
1// Copyright (c) 2024 anabrid GmbH
2// Contact: https://www.anabrid.com/licensing/
3//
4// SPDX-License-Identifier: MIT OR GPL-2.0-or-later
5
6#pragma once
7
8#include <Arduino.h>
9
10namespace utils {
11
13
15struct duration {
17
18 void reset() { last_time = millis(); }
19
20 duration() { reset(); }
21
23 bool expired(time_ms period) const { return (millis() - last_time >= period); }
24};
25
26} // namespace utils
uint32_t
Definition flasher.cpp:195
uint32_t time_ms
Definition durations.h:12
Simple time tracking (up to 50 days)
Definition durations.h:15
time_ms last_time
Definition durations.h:16
bool expired(time_ms period) const
Returns true if period expired, false otherwise.
Definition durations.h:23