ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
TimeStep Class Reference

Provides a mechanism to trigger actions at a specified frequency. More...

#include <TimeStep.h>

Public Member Functions

 TimeStep (float frequency)
 Constructor to initialize TimeStep with a frequency.
 
void SetFrequency (float frequency)
 Sets the frequency for the TimeStep.
 
bool IsReady ()
 Checks if the specified time interval has elapsed.
 

Private Attributes

unsigned long previousMillis
 Stores the last recorded time in milliseconds.
 
uint16_t updateInterval
 Interval in milliseconds between updates.
 

Detailed Description

Provides a mechanism to trigger actions at a specified frequency.

Definition at line 18 of file TimeStep.h.

Constructor & Destructor Documentation

◆ TimeStep()

TimeStep ( float  frequency)

Constructor to initialize TimeStep with a frequency.

Parameters
frequencyThe frequency in Hz.

Definition at line 3 of file TimeStep.cpp.

References SetFrequency().

Member Function Documentation

◆ IsReady()

bool IsReady ( )

Checks if the specified time interval has elapsed.

Returns
True if the interval has elapsed, otherwise false.

Definition at line 11 of file TimeStep.cpp.

References previousMillis, and updateInterval.

Referenced by APDS9960::isBooped(), HeadsUpDisplay::Update(), MicrophoneFourier::Update(), MMC56X3::Update(), and ProtogenProject::UpdateFace().

◆ SetFrequency()

void SetFrequency ( float  frequency)

Sets the frequency for the TimeStep.

Parameters
frequencyThe new frequency in Hz.

Definition at line 7 of file TimeStep.cpp.

References updateInterval.

Referenced by MicrophoneFourier::Initialize(), and TimeStep().

Member Data Documentation

◆ previousMillis

unsigned long previousMillis
private

Stores the last recorded time in milliseconds.

Definition at line 20 of file TimeStep.h.

Referenced by IsReady().

◆ updateInterval

uint16_t updateInterval
private

Interval in milliseconds between updates.

Definition at line 21 of file TimeStep.h.

Referenced by IsReady(), and SetFrequency().


The documentation for this class was generated from the following files: