ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
TimeStep.h
Go to the documentation of this file.
1/**
2 * @file TimeStep.h
3 * @brief Utility class for timing operations based on a set frequency.
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 TimeStep
16 * @brief Provides a mechanism to trigger actions at a specified frequency.
17 */
18class TimeStep {
19private:
20 unsigned long previousMillis; ///< Stores the last recorded time in milliseconds.
21 uint16_t updateInterval; ///< Interval in milliseconds between updates.
22
23public:
24 /**
25 * @brief Constructor to initialize TimeStep with a frequency.
26 * @param frequency The frequency in Hz.
27 */
28 TimeStep(float frequency);
29
30 /**
31 * @brief Sets the frequency for the TimeStep.
32 * @param frequency The new frequency in Hz.
33 */
34 void SetFrequency(float frequency);
35
36 /**
37 * @brief Checks if the specified time interval has elapsed.
38 * @return True if the interval has elapsed, otherwise false.
39 */
40 bool IsReady();
41};
Implements a generic Kalman Filter for 1D data.
Provides a mechanism to trigger actions at a specified frequency.
Definition TimeStep.h:18
bool IsReady()
Checks if the specified time interval has elapsed.
Definition TimeStep.cpp:11
unsigned long previousMillis
Stores the last recorded time in milliseconds.
Definition TimeStep.h:20
uint16_t updateInterval
Interval in milliseconds between updates.
Definition TimeStep.h:21
void SetFrequency(float frequency)
Sets the frequency for the TimeStep.
Definition TimeStep.cpp:7