AceSegment
0.2.0
An adjustable, configurable, and extensible framework for rendering seven segment LED displays.
|
Base class of drivers which knows how to transfer the bit patterns stored in the array of DimmingDigit objects to the actual LED display. More...
#include <Driver.h>
Public Types | |
typedef uint8_t | SegmentPatternType |
Integer type used to store the segment bit patterns of a single digit. More... | |
typedef uint8_t | DigitPatternType |
Integer type used to store the digit bit patterns of a single segment. More... | |
Public Member Functions | |
virtual | ~Driver () |
Virtual destructor needed to clean up LedMatrix that was created on the heap by DriverBuilder. More... | |
virtual void | configure () |
virtual void | displayCurrentField ()=0 |
Display the current field of the frame. More... | |
virtual uint16_t | getFieldsPerFrame ()=0 |
Return number of fields per frame. More... | |
virtual bool | isBrightnessSupported ()=0 |
Returns true if the driver supports brightness. More... | |
void | setPattern (uint8_t digit, SegmentPatternType pattern, uint8_t brightness=DimmingDigit::kOn) |
Set the pattern for a given digit. More... | |
void | setBrightness (uint8_t digit, uint8_t brightness) |
Set the brightness of the given digit. More... | |
Protected Member Functions | |
Driver (const Driver &)=delete | |
Driver & | operator= (const Driver &)=delete |
Driver (LedMatrix *ledMatrix, DimmingDigit *dimmingDigits, uint8_t numDigits, bool ownsLedMatrix=false) | |
Constructor. More... | |
Protected Attributes | |
LedMatrix *const | mLedMatrix |
DimmingDigit *const | mDimmingDigits |
const uint8_t | mNumDigits |
const bool | mOwnsLedMatrix |
Static Protected Attributes | |
static const uint8_t | kNumSegments = 8 |
Number of segments on a single digit. More... | |
Base class of drivers which knows how to transfer the bit patterns stored in the array of DimmingDigit objects to the actual LED display.
Different wiring configuration will require different drivers.
Each call to displayCurrentField() displays one field of a frame. The object is expected to keep internal state so that the next call to displayCurrentField() displays the next field.
typedef uint8_t ace_segment::Driver::DigitPatternType |
typedef uint8_t ace_segment::Driver::SegmentPatternType |
|
virtual |
Virtual destructor needed to clean up LedMatrix that was created on the heap by DriverBuilder.
Normally, the Driver will be created once and never deleted, however unit tests will create multiple versions of Driver and will call the destructor to clean up after each test.
Definition at line 31 of file Driver.cpp.
|
inlineexplicitprotected |
Constructor.
The driver takes ownership of the ledMatrix and will delete it in the destructor.
ledMatrix | The ledMatrix can be null for a FakeDriver but normally it is expected to be non-null. |
dimmingDigits | An array of DimmingDigit objects that represents each digit. |
numDigits | |
ownsLedMatrix | If true, the Driver object owns the ledMatrix and will delete it in the destructor. Default is false, but set to true by DriverBuidler. |
|
pure virtual |
Display the current field of the frame.
Automatically advances to the next field for the next call. A frame is one complete rendering of all the digits. A field is a slice of that frame. If the digits are multiplexed, then a field is a rendering of a single digit with all its segments. If the segments are multiplexed, then a field is a rendering of a single segment across multiple digits.
Implemented in ace_segment::ModulatingDigitDriver, ace_segment::DigitDriver, and ace_segment::SegmentDriver.
|
pure virtual |
Return number of fields per frame.
Implemented in ace_segment::ModulatingDigitDriver, ace_segment::DigitDriver, and ace_segment::SegmentDriver.
|
pure virtual |
Returns true if the driver supports brightness.
If not, any brightness greater than 0 will be considered ON, and 0 will be OFF.
Implemented in ace_segment::ModulatingDigitDriver, ace_segment::DigitDriver, and ace_segment::SegmentDriver.
void ace_segment::Driver::setBrightness | ( | uint8_t | digit, |
uint8_t | brightness | ||
) |
Set the brightness of the given digit.
Definition at line 51 of file Driver.cpp.
void ace_segment::Driver::setPattern | ( | uint8_t | digit, |
SegmentPatternType | pattern, | ||
uint8_t | brightness = DimmingDigit::kOn |
||
) |
Set the pattern for a given digit.
digit | the digit index, 0 is the left most digit |
pattern | the segment bit pattern |
brightness | optional brightness fraction of the digit in units of 1/256, set to 255 if not specified |
Definition at line 43 of file Driver.cpp.
|
staticprotected |