AceSegment  0.3.0
An adjustable, configurable, and extensible framework for rendering seven segment LED displays.
Public Member Functions | Protected Attributes | List of all members
ace_segment::DigitDriver Class Reference

A Driver that assumes that the resistors are on the segments so the multiplexing occurs by scanning through the digits. More...

#include <DigitDriver.h>

Inheritance diagram for ace_segment::DigitDriver:
Inheritance graph
[legend]
Collaboration diagram for ace_segment::DigitDriver:
Collaboration graph
[legend]

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.
 
- Public Member Functions inherited from ace_segment::Driver
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
 
- Protected Attributes inherited from ace_segment::Driver
LedMatrix *const mLedMatrix
 
DimmablePattern *const mDimmablePatterns
 
const uint8_t mNumDigits
 
const bool mOwnsLedMatrix
 
volatile bool mPreparedToSleep
 

Additional Inherited Members

- Public Types inherited from ace_segment::Driver
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...
 
- Protected Member Functions inherited from ace_segment::Driver
 Driver (const Driver &)=delete
 
Driveroperator= (const Driver &)=delete
 
 Driver (LedMatrix *ledMatrix, DimmablePattern *dimmablePatterns, uint8_t numDigits, bool ownsLedMatrix=false)
 Constructor. More...
 
- Static Protected Attributes inherited from ace_segment::Driver
static const uint8_t kNumSegments = 8
 Number of segments on a single digit. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DigitDriver()

ace_segment::DigitDriver::DigitDriver ( LedMatrix ledMatrix,
DimmablePattern dimmablePatterns,
uint8_t  numDigits,
bool  ownsLedMatrix = false 
)
inlineexplicit

Constructor.

Definition at line 42 of file DigitDriver.h.

Member Function Documentation

◆ configure()

virtual void ace_segment::DigitDriver::configure ( )
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.

◆ displayCurrentField()

void ace_segment::DigitDriver::displayCurrentField ( )
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.

◆ getFieldsPerFrame()

virtual uint16_t ace_segment::DigitDriver::getFieldsPerFrame ( )
inlineoverridevirtual

Return number of fields per frame.

Implements ace_segment::Driver.

Reimplemented in ace_segment::ModulatingDigitDriver.

Definition at line 55 of file DigitDriver.h.

◆ isBrightnessSupported()

virtual bool ace_segment::DigitDriver::isBrightnessSupported ( )
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.

Member Data Documentation

◆ mCurrentDigit

uint8_t ace_segment::DigitDriver::mCurrentDigit
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.

◆ mPrevDigit

uint8_t ace_segment::DigitDriver::mPrevDigit
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.


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