25 #ifndef ACE_SEGMENT_RENDERER_H 26 #define ACE_SEGMENT_RENDERER_H 30 #include "TimingStats.h" 60 uint8_t framesPerSecond, uint16_t statsResetInterval,
64 mStyledPatterns(styledPatterns),
65 mNumDigits(numDigits),
66 mFramesPerSecond(framesPerSecond),
67 mStatsResetInterval(statsResetInterval)
70 mStylers[i] = (stylers !=
nullptr) ? stylers[i] :
nullptr;
104 mBrightness = brightness;
112 void writePatternAt(uint8_t digit, uint8_t pattern, uint8_t style);
158 return mStyledPatterns[i];
179 void updateStylers();
182 void renderStyledPatterns();
187 const uint8_t mNumDigits;
188 const uint8_t mFramesPerSecond;
191 const uint16_t mStatsResetInterval;
205 uint8_t mBrightness = 255;
208 bool mIsBrightnessEnabled =
false;
211 uint16_t mMicrosPerField;
212 uint16_t mLastRenderFieldMicros;
216 uint16_t mFieldsPerFrame;
217 uint16_t mCurrentField;
uint16_t getFramesPerSecond()
Return the frames per second.
StyledPattern & getStyledPattern(uint8_t i)
Return a reference the styled digit.
bool renderFieldWhenReady()
Display one field of a frame when the time is right.
TimingStats getTimingStats()
Return stats.
static const uint8_t kNumStyles
Maximum number of styles.
bool isStylerSupported(Styler *styler)
Return true if the given Styler is supported by the current Driver.
void writePatternAt(uint8_t digit, uint8_t pattern, uint8_t style)
Write the pattern and style for a given digit.
void renderField()
Render the current field immediately.
void writeStyleAt(uint8_t digit, uint8_t style)
Write the style for a given digit, leaving pattern unchanged.
virtual void configure()
Configure the driver with the parameters given by in the constructor.
void writeBrightness(uint8_t brightness)
Set brightness expressed as a fraction of 256.
A class that knows how to translate an array of led segement bit patterns with style attributes to a ...
void clear()
Clear all digits, preserving the styles at each digit.
uint16_t getFieldsPerSecond()
Return the fields per second.
void writeDecimalPointAt(uint8_t digit, bool state=true)
Write the decimal point for the digit.
Base class of drivers which knows how to transfer the bit patterns stored in the array of DimmablePat...
Renderer(Hardware *hardware, Driver *driver, StyledPattern *styledPatterns, uint8_t numDigits, uint8_t framesPerSecond, uint16_t statsResetInterval, Styler **stylers)
Constructor.
virtual ~Renderer()
Destructor.
uint8_t getNumDigits()
Get the number of digits.
Data structure that keeps track of the state of each digit (its segment bit pattern and its style)...
Interface for classes which apply a style to the given bit pattern and brightness.
virtual uint16_t getFieldsPerFrame()=0
Return number of fields per frame.
uint8_t * getActiveStyles()
Retrieve the array of active styles.