ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Wait.h
Go to the documentation of this file.
1/**
2 * @file Wait.h
3 * @brief Utility class for handling non-blocking wait operations.
4 *
5 * @date 22/12/2024
6 * @version 1.0
7 * @author Coela Can't
8 */
9
10#pragma once
11
12#include <Arduino.h>
13
14/**
15 * @class Wait
16 * @brief Provides a mechanism to wait for a specified duration without blocking.
17 */
18class Wait {
19private:
20 unsigned long previousMillis; ///< Stores the last recorded time in milliseconds.
21 unsigned long millisToWait; ///< Duration to wait in milliseconds.
22
23public:
24 /**
25 * @brief Constructor to initialize Wait with a duration.
26 * @param millisToWait The duration to wait in milliseconds.
27 */
28 Wait(unsigned long millisToWait);
29
30 /**
31 * @brief Resets the wait timer to start counting again.
32 */
33 void Reset();
34
35 /**
36 * @brief Checks if the specified duration has elapsed.
37 * @return True if the duration has elapsed, otherwise false.
38 */
39 bool IsFinished();
40};
Provides a mechanism to wait for a specified duration without blocking.
Definition Wait.h:18
void Reset()
Resets the wait timer to start counting again.
Definition Wait.cpp:8
unsigned long previousMillis
Stores the last recorded time in milliseconds.
Definition Wait.h:20
unsigned long millisToWait
Duration to wait in milliseconds.
Definition Wait.h:21
bool IsFinished()
Checks if the specified duration has elapsed.
Definition Wait.cpp:12