AceSegment  0.8.0
A framework for rendering seven segment LED displays using the TM1637, MAX7219, HT16K33, or 74HC595 controller chips
Public Member Functions | List of all members
ace_segment::PatternWriter Class Reference

Write LED segment patterns to the underlying LedModule. More...

#include <PatternWriter.h>

Public Member Functions

 PatternWriter (LedModule &ledModule)
 Constructor. More...
 
LedModuleledModule () const
 Return the underlying LedModule.
 
uint8_t getNumDigits () const
 Return the number of digits supported by this display instance.
 
void writePatternAt (uint8_t pos, uint8_t pattern)
 Write the pattern for a given pos. More...
 
void writePatternsAt (uint8_t pos, const uint8_t patterns[], uint8_t len)
 Write the array of patterns of length len, starting at pos. More...
 
void writePatternsAt_P (uint8_t pos, const uint8_t patterns[], uint8_t len)
 Write the array of patterns of length len, which are stored in flash memory through PROGMEM, starting at pos. More...
 
void writeDecimalPointAt (uint8_t pos, bool state=true)
 Write the decimal point for the pos. More...
 
void clear ()
 Clear the entire display.
 
void clearToEnd (uint8_t pos)
 Clear the display from pos to the end.
 

Detailed Description

Write LED segment patterns to the underlying LedModule.

Other 'Writer' classes provide additional functionality on top of this class (e.g. NumberWriter, ClockWriter, TemperatureWriter, CharWriter, StringWriter).

This class is stateless and does not contain any virtual functions. If the method calls are made on the PatternWriter object directly, the compiler can optimize away the indirection and call LedModule methods directly.

Definition at line 43 of file PatternWriter.h.

Constructor & Destructor Documentation

◆ PatternWriter()

ace_segment::PatternWriter::PatternWriter ( LedModule ledModule)
inlineexplicit

Constructor.

Parameters
ledModulean instance of LedModule or one of its subclasses

Definition at line 49 of file PatternWriter.h.

Member Function Documentation

◆ writeDecimalPointAt()

void ace_segment::PatternWriter::writeDecimalPointAt ( uint8_t  pos,
bool  state = true 
)
inline

Write the decimal point for the pos.

Clock LED modules will attach the colon segment to one of the decimal points.

Definition at line 102 of file PatternWriter.h.

◆ writePatternAt()

void ace_segment::PatternWriter::writePatternAt ( uint8_t  pos,
uint8_t  pattern 
)
inline

Write the pattern for a given pos.

If the pos is out of bounds, the method does nothing.

Definition at line 61 of file PatternWriter.h.

◆ writePatternsAt()

void ace_segment::PatternWriter::writePatternsAt ( uint8_t  pos,
const uint8_t  patterns[],
uint8_t  len 
)
inline

Write the array of patterns of length len, starting at pos.

If an element of patterns attempts to write to a digit beyond the last digit of the LED module, nothing happens.

The default implementation calls writePatternAt(), which should be sufficient in most cases. Subclasses can override if needed.

Definition at line 74 of file PatternWriter.h.

◆ writePatternsAt_P()

void ace_segment::PatternWriter::writePatternsAt_P ( uint8_t  pos,
const uint8_t  patterns[],
uint8_t  len 
)
inline

Write the array of patterns of length len, which are stored in flash memory through PROGMEM, starting at pos.

If an element of patterns attempts to write to a digit beyond the last digit of the LED module, nothing happens.

The default implementation calls writePatternAt(), which should be sufficient in most cases. Subclasses can override if needed.

Definition at line 90 of file PatternWriter.h.


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