FastLED 3.9.15
Loading...
Searching...
No Matches
frame_tracker.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4
5#include "fl/namespace.h"
6
7// #include <iostream>
8
9// using namespace std;
10
11namespace fl {
12
13// Tracks the current frame number based on the time elapsed since the start of
14// the animation.
16 public:
17 FrameTracker(float fps);
18
19 // Gets the current frame and the next frame number based on the current
20 // time.
21 void get_interval_frames(uint32_t now, uint32_t *frameNumber,
22 uint32_t *nextFrameNumber,
23 uint8_t *amountOfNextFrame = nullptr) const;
24
25 // Given a frame number, returns the exact timestamp in milliseconds that
26 // the frame should be displayed.
27 uint32_t get_exact_timestamp_ms(uint32_t frameNumber) const;
28
30
31 private:
33 uint32_t mStartTime = 0;
34};
35
36} // namespace fl
uint32_t get_exact_timestamp_ms(uint32_t frameNumber) const
void get_interval_frames(uint32_t now, uint32_t *frameNumber, uint32_t *nextFrameNumber, uint8_t *amountOfNextFrame=nullptr) const
uint32_t mMicrosSecondsPerInterval
FrameTracker(float fps)
uint32_t microsecondsPerFrame() const
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16