AceSegment
0.3.0
An adjustable, configurable, and extensible framework for rendering seven segment LED displays.
|
A Driver that assumes that the resistors are on the segments so the multiplexing occurs by scanning through the digits. More...
#include <DigitDriver.h>
Public Member Functions | |
DigitDriver (LedMatrix *ledMatrix, DimmablePattern *dimmablePatterns, uint8_t numDigits, bool ownsLedMatrix=false) | |
Constructor. More... | |
virtual void | configure () override |
Configure the driver. More... | |
virtual uint16_t | getFieldsPerFrame () override |
Return number of fields per frame. More... | |
virtual bool | isBrightnessSupported () override |
Returns true if the driver supports brightness. More... | |
virtual void | displayCurrentField () override |
Display the current field of the frame. More... | |
virtual void | prepareToSleep () override |
Prepare to go to sleep by clearing the frame, and setting a flag so that it doesn't turn itself back on through an interrupt. | |
![]() | |
virtual | ~Driver () |
Virtual destructor needed to clean up LedMatrix that was created on the heap by DriverBuilder. More... | |
virtual void | finish () |
Turn off the LEDs by doing the opposite of configure(). More... | |
virtual void | wakeFromSleep () |
Wake up from sleep. More... | |
void | setPattern (uint8_t digit, SegmentPatternType pattern, uint8_t brightness=DimmablePattern::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 Attributes | |
uint8_t | mCurrentDigit |
Within the displayCurrentField() method, mCurrentDigit is the current digit that is being drawn. More... | |
uint8_t | mPrevDigit |
Within the displayCurrentField() method, the mPrevDigit is the digit that was displayed on the previous call to displayCurrentField(). More... | |
SegmentPatternType | mSegmentPattern |
![]() | |
LedMatrix *const | mLedMatrix |
DimmablePattern *const | mDimmablePatterns |
const uint8_t | mNumDigits |
const bool | mOwnsLedMatrix |
volatile bool | mPreparedToSleep |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
Driver (const Driver &)=delete | |
Driver & | operator= (const Driver &)=delete |
Driver (LedMatrix *ledMatrix, DimmablePattern *dimmablePatterns, uint8_t numDigits, bool ownsLedMatrix=false) | |
Constructor. More... | |
![]() | |
static const uint8_t | kNumSegments = 8 |
Number of segments on a single digit. More... | |
A Driver that assumes that the resistors are on the segments so the multiplexing occurs by scanning through the digits.
Definition at line 39 of file DigitDriver.h.
|
inlineexplicit |
Constructor.
Definition at line 42 of file DigitDriver.h.
|
inlineoverridevirtual |
Configure the driver.
Usually called only once in a program. Sometimes unit tests may call it twice.
Reimplemented from ace_segment::Driver.
Reimplemented in ace_segment::ModulatingDigitDriver.
Definition at line 48 of file DigitDriver.h.
|
overridevirtual |
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.
Implements ace_segment::Driver.
Reimplemented in ace_segment::ModulatingDigitDriver.
Definition at line 32 of file DigitDriver.cpp.
|
inlineoverridevirtual |
Return number of fields per frame.
Implements ace_segment::Driver.
Reimplemented in ace_segment::ModulatingDigitDriver.
Definition at line 55 of file DigitDriver.h.
|
inlineoverridevirtual |
Returns true if the driver supports brightness.
If not, any brightness greater than 0 will be considered ON, and 0 will be OFF.
Implements ace_segment::Driver.
Reimplemented in ace_segment::ModulatingDigitDriver.
Definition at line 57 of file DigitDriver.h.
|
protected |
Within the displayCurrentField() method, mCurrentDigit is the current digit that is being drawn.
It is incremented to the next digit just before returning from that method.
Definition at line 69 of file DigitDriver.h.
|
protected |
Within the displayCurrentField() method, the mPrevDigit is the digit that was displayed on the previous call to displayCurrentField().
It is set to the digit that was just displayed before returning.
Definition at line 76 of file DigitDriver.h.