Class SevenSegment

Class Documentation

class SevenSegment

Class definition for SevenSegment which groups together all Segment objects which belong to together and provides some wrapper functions to manage all seven segments together.

Public Types

enum SegmentPosition

Segment positions for addressing the internal segment mapping table - Please use SegmentPositions_t for all external uses instead.

Values:

enumerator LeftTopSegment
enumerator MiddleTopSegment
enumerator RightTopSegment
enumerator CenterSegment
enumerator LeftBottomSegment
enumerator MiddleBottomSegment
enumerator RightBottomSegment
enum SevenSegmentMode

The mode of the seven segment display. This also defines which segments ave to be linked and which ones can be left out, also which digits can be displayed by this paricular instance of the seven segment display.

Values:

enumerator FULL_SEGMENT
enumerator HALF_SEGMENT

has 7 segments

enumerator ONLY_ONE

has only the 3 horizontal segments has only the right 2 vertical segments

Public Functions

SevenSegment(SevenSegmentMode mode, Animator *DisplayAnimationHandler)

Construct a new Seven Segment object.

Parameters:
  • mode – defines which digits can be displayed and which segments will not be assigned

  • DisplayAnimationHandler – Animation handler which will be resposible for refreshing this display.

~SevenSegment()

Destroy the Seven Segment object.

void add(Segment *segmentToAdd, SegmentPosition positionInDisplay)

Add a single segment to the Seven segment display.

Parameters:
  • segmentToAddSegment which shall be added

  • positionInDisplay – Position of the added segment withing the seven segment display

void DisplayNumber(uint8_t value)

Display a number on the display. If the display is not able to display the passed number nothing will happen.

Parameters:

value – Number to display 0 - 9

void DisplayChar(char value)

Display a character on a Display. NOTE: Currently not implemented (only supports 0-9 as characters)

Parameters:

value – Number to display ‘0’ - ‘9’

void FlashMiddleDot(uint8_t numDots)

Plays a fading in and out animation on the middle (or two middle, if segment length is even) LEDs of one or multiple segment/s The function will internally display the animation on the right segments depending on the SevenSegment::SevenSegmentMode.

Parameters:

numDots – Number of dots to display 0-2

bool canDisplay(char charToCheck)

checks if a particular character can be displayed on this display.

Parameters:

charToCheck – Char which shall be checked for

Returns:

true if the char can be displayed

Returns:

false if the char cannot be displayed

void setColor(CRGB color)

Sets the animation color which will be displayed on the LEDs the next time an animation ticks.

Parameters:

color – Color to set

void updateColor(CRGB color)

Sets the current and also the animation color which will be displayed on the LEDs the next time the LEDs are updated.

Parameters:

color – Color to set

void off()

Turn all LEDs in this seven segment display off. will be pushed to the LEDs with the next call of FastLED.show()