Seven Segments Displays Agnostic Library for ESP32 (Arduino) v3.3.0
A library that provides a class that models a Seven Segment Display and provides an unified API through it's members independently of the display technology.
|
Default constructor. More...
#include <SevenSegDisplays.h>
Public Member Functions | |
SevenSegDisplays (SevenSegDispHw *dspUndrlHwPtr) | |
Class constructor. | |
~SevenSegDisplays () | |
Class destructor. | |
virtual bool | begin (uint32_t updtLps=0) |
Sets up the hardware display to work, and starts the display activities. | |
bool | blink () |
Makes the display blink the contents it is showing. | |
bool | blink (const uint32_t &onRate, const uint32_t &offRate=0) |
Makes the display blink the contents it is showing. | |
void | clear () |
Clears the display, turning off all the segments and dots. | |
bool | doubleGauge (const int &levelLeft, const int &levelRight, char labelLeft=' ', char labelRight=' ') |
Displays a basic graphical representation of the level of fulfillment or completeness of two segmented values or tasks. | |
bool | end () |
Ends the activity of the display. | |
bool | gauge (const int &level, char label=' ') |
Displays a basic graphical representation of the level of fulfillment or completeness of a segmented value or task. | |
bool | gauge (const double &level, char label=' ') |
Displays a basic graphical representation of the level of fulfillment or completeness of a segmented value or task. | |
uint8_t | getCurBrghtnssLvl () |
Returns the current brightness level of the display. | |
uint8_t | getDigitsQty () |
Return the number of digits of the display hardware. | |
uint8_t | getDspCount () |
Returns the quantity of instantiated SevenSegDisplays class objects at invocation moment. | |
bool | getDspIsDmmbl () |
Returns the logic value indicating if the display is dimmable. | |
SevenSegDispHw * | getDspUndrlHwPtr () |
Returns a pointer to the underlying hardware display object. | |
int32_t | getDspValMax () |
Returns a value equivalent to the greatest displayable number for the display. | |
int32_t | getDspValMin () |
Returns a value equivalent to the smallest displayable number for the display. | |
bool | getIsOn () |
Returns a logic value indicating if the display is in On state. | |
uint32_t | getMaxBlinkRate () |
Returns the maximum rate the display can be configured to blink at. | |
uint8_t | getMaxBrghtnssLvl () |
Returns the maximum brightness value setting for the display. | |
uint32_t | getMinBlinkRate () |
Returns the minimum rate the display can be configured to blink at. | |
uint8_t | getMinBrghtnssLvl () |
Returns the minimum brightness value setting for the display. | |
uint16_t | getSerialNbr () |
Returns a unique numeric identification of the object. | |
bool | isBlank () |
Returns a value indicating if the display is blank. | |
bool | isBlinking () |
Returns a boolean value indicating if the display is set to blink or not. | |
bool | isWaiting () |
Returns a boolean value indicating if the display is set to "waiting mode" or not. | |
bool | noBlink () |
Stops the display blinking, if it was doing so, leaving the display turned on. | |
bool | noWait () |
Stops the Waiting mode, if it was doing so, leaving the display turned on. | |
bool | print (String text) |
Displays a text string. | |
bool | print (const int32_t &value, bool rgtAlgn=false, bool zeroPad=false) |
Displays an integer value as long as the length representation fits the available space of the display. | |
bool | print (const double &value, const unsigned int &decPlaces, bool rgtAlgn=false, bool zeroPad=false) |
Displays a floating point value. | |
void | resetBlinkMask () |
Resets the blinking mask. | |
void | setBlinkMask (const bool *newBlnkMsk) |
Sets a new blinking mask for the display. | |
bool | setBlinkRate (const uint32_t &newOnRate, const uint32_t &newOffRate=0) |
Changes the time parameters to use for the display blinking of the contents it shows. | |
bool | setBrghtnssLvl (const uint8_t &newBrghtnssLvl) |
Set the brightness level for the display. | |
bool | setWaitChar (const char &newChar) |
Sets the "Waiting" character. | |
bool | setWaitRate (const uint32_t &newWaitRate) |
Changes the timing parameter used to show the "progress ongoing bar advancement" speed. | |
void | turnOff () |
Turns the display module off. | |
void | turnOn () |
Turns the display module on. | |
void | turnOn (const uint8_t &newBrghtnssLvl) |
Turns the display module on. | |
bool | wait () |
Makes the display enter the "Waiting mode". | |
bool | wait (const uint32_t &newWaitRate) |
Makes the display enter the "Waiting mode" with a specific wait rate. | |
bool | write (const uint8_t &segments, const uint8_t &port) |
Prints one character to the display, at a designated position (digit or port), without affecting the rest of the characters displayed. | |
bool | write (const String &character, const uint8_t &port) |
Prints one character to the display, at a designated position (digit or port), without affecting the rest of the characters displayed. |
Default constructor.
SevenSegDisplays::SevenSegDisplays | ( | SevenSegDispHw * | dspUndrlHwPtr | ) |
Class constructor.
Instantiates a SevenSegDisplays class object
dspUndrlHw | A pointer to an instantiated SevenSegDispHw subclass object that models the hardware display that composes the SevenSegDisplays object |
A three lines step by step code example:
A two lines example using the & operand to pass the pointer to the constructor
A two lines example using a sub-class pointer to a dynamic instantiated object
A two lines example using a base class pointer to a dynamic instantiated object
A one liner example using as argument the pointer returned from dynamic instantiated object
|
virtual |
Sets up the hardware display to work, and starts the display activities.
Depending on the display controller characteristics the setup procedure may include different defined steps, each class will execute the needed steps for each display controller.
updtLps | Optional parameter, sets the rate needed by the dynamic type displays, will be ignored by othe types of displays. Is no value is passed to the dynamic displays they will used a preset stantard parameter. |
true | The display was initialized without errors. |
false | The display couldn't be initialized due to an error. |
bool SevenSegDisplays::blink | ( | ) |
Makes the display blink the contents it is showing.
The display will blink the contents it is showing until a noBlink() method is invoked. The display will continue blinking even if the contents are changed.
By default all the digits will be set to blink, but each digit might be configured individually to blink or not by using the setBlinkMask(const bool*) method.
When invoking the blink() method with no parameters the blinking pace (timings) previously set will be used. If no setBlinkRate(const unsigned long, const unsigned long) and no blink(const unsigned long, const unsigned long) with parameters was used before this call, the blinking will be symmetrical, meaning that the time the display shows the contents and the time the display is blank are equal. The on time and the off time of the blinking starts at a preset rate this first time the method is invoked.
The blinking rate can be changed by using the setBlinkRate(const unsigned long, const unsigned long) method. After changing the blinking rate, the new blinking rate will be kept after a noBlink() call is done, until it is modified with a new setBlinkRate(const unsigned long, const unsigned long) call, or it is restarted by a blink(const unsigned long, const unsigned long) with parameters.
true | If the display blinking process started ok, or was already set to blink |
false | The display blinking failed to start. |
Use example:
bool SevenSegDisplays::blink | ( | const uint32_t & | onRate, |
const uint32_t & | offRate = 0 ) |
Makes the display blink the contents it is showing.
Makes the display blink the contents it shows until a noBlink() method is invoked. The blinking is symmetrical if only one parameter is passed, asymmetrical if two different parameters are passed, meaning that the time the display shows the contents and the time the display is blank will be equal (symmetrical) or not (asymmetrical), depending of those two parameters. The blinking starts at a passed rate when the method is invoked. The blinking rate can be changed by using the .setBlinkRate(const unsigned long, const unsigned long) method. The blink rate set will be kept after a .noBlink(), until it is modified with a new .setBlinkRate(const unsigned long, const unsigned long) call, or it is restarted by a .blink(const unsigned long, const unsigned long) with parameters.
onRate | Value indicating the time (in milliseconds) the display must stay on, the value must be in the range _minBlinkRate <= onRate <= _maxBlinkRate. Those preset values can be known by the use of the getMinBlinkRate() and the getMaxBlinkRate() methods. |
offRate | Optional value indicating the time (in milliseconds) the display must stay off, the value must be in the range _minBlinkRate <= offRate <= _maxBlinkRate. Those preset values might be known by the use of the getMinBlinkRate() and the getMaxBlinkRate() methods. If no offRate value is provided the method will assume it's a symmetric blink call and use a value for offRate equal to the value passed for onRate. |
true | If the display was already set to blink, or was not blinking and the blinking started with the provided parameters. If the display was already blinking no change will be made to the blinking rate. |
false | One or more of the parameters passed were out of range. |
Use examples:
void SevenSegDisplays::clear | ( | ) |
Clears the display, turning off all the segments and dots.
To ensure success the method must also clean auxiliary buffers used to save the main buffer contents while blinking, as the backup buffer will be restored, so the display clear() would be reverted
Use example:
bool SevenSegDisplays::doubleGauge | ( | const int & | levelLeft, |
const int & | levelRight, | ||
char | labelLeft = ' ', | ||
char | labelRight = ' ' ) |
Displays a basic graphical representation of the level of fulfillment or completeness of two segmented values or tasks.
The data displayed gives a general fast notion on the matter, as a battery charge level, liquids deposit level, time remaining, tasks completeness and so on. The levels are represented by the horizontal segments (0, 1, 2 or 3 from bottom to top), and a character might be added before each of the graphical representations to give an indication of what the display is showing, passed through the labelLeft and labelRight parameters. As four 7 segments digit ports will be used, this method only applies to displays with 4 to 8 LED digits, the display is splitted in two sectors, the left side and the right side, and each one of them must have a valid value (0 <= value <= 3) to enable them to be displayed, and might have (or not) a single displayable character to give a visual hint to what the value is showing. For more information check the gauge(const int, char) method.
levelLeft | The integer value to display must be in the range 0 <= level <= 3 for the two leftside 7 segments displays. |
levelRight | The integer value to display must be in the range 0 <= level <= 3 for the two rightside 7 segments displays. |
labelLeft | A char, optional parameter (if not specified the default value, a Space, will be assumed), that will be displayed in the leftmost digit of the display. The character must be one of the "displayable" characters, as listed in the print() method description. |
labelRight | A char, optional parameter (if not specified the default value, a Space, will be assumed), that will be displayed in the position left to the levelRight display, just before the levelRight value. The character must be one of the "displayable" characters, as listed in the .print(String) method description. |
true | If the values could be represented. |
false | Otherwise, being that the levelLeft and/or levelRight parameter was out of range and/or the labelLeft and/or labelRight parameter was not in the list of displayable characters. The display will be blanked. |
Use example:
bool SevenSegDisplays::end | ( | ) |
Ends the activity of the display.
After the end() is invoked, the display will stop accepting new data, stop it's refreshing and all activities involved in keeping it's contents updated. To keep the expected level of accuracy and security the display will be cleaned before stopping it's activity.
bool SevenSegDisplays::gauge | ( | const double & | level, |
char | label = ' ' ) |
Displays a basic graphical representation of the level of fulfillment or completeness of a segmented value or task.
The data displayed gives a general fast notion on the matter, as a battery charge level, liquids deposit level, time remaining, tasks completeness and so on. The levels are represented by the horizontal segments (0, 1, 2 or 3 from bottom to top, and from left to right), and a character might be added before the graphical representation to give an indication of what the display is showing, passed through the label parameter.
level | The double value to display must be in the range 0.0 <= level <= 1.0, being the range the representation of the percentage of the 'full' level, so that the ranges are: 0.0 <= level < 0.25 for the first level, 0.25 <= level < 0.50 for the second level, 0.50 <= level < 0.75 for the third level, and 0.75 <= level <= 1.00 for the fourth and upper level. |
label | char, optional parameter (if not specified the default value, a Space, will be assumed), that will be displayed in the leftmost digit of the display. The character must be one of the "displayable" characters, as listed in the print(String) method description. |
Use example:
bool SevenSegDisplays::gauge | ( | const int & | level, |
char | label = ' ' ) |
Displays a basic graphical representation of the level of fulfillment or completeness of a segmented value or task.
The displayed data gives a general fast notion on the matter, as a battery charge level, liquids deposit level, time remaining, tasks completeness and so on. The levels are represented by the horizontal segments (0, 1, 2 or 3 from bottom to top, and from left to right), and a character might be added before the graphical representation to give an indication of what the display is showing, passed through the label parameter. This method is usable in displays which have from 4 and up to 8 digits, and the representation always makes use of exactly 4 digits.
level | The integer value to display must be in the range 0 <= level <= 3. |
label | char, optional parameter (if not specified the default value, a Space, will be assumed), that will be displayed in the leftmost digit of the display. The character must be one of the "displayable" characters, as listed in the print(String) method description. |
Use example:
uint8_t SevenSegDisplays::getCurBrghtnssLvl | ( | ) |
Returns the current brightness level of the display.
uint8_t SevenSegDisplays::getDigitsQty | ( | ) |
Return the number of digits of the display hardware.
Returns an unsigned short integer value indicating the the quantity of digits (ports), the display have as declared at the object instantiation. Each time the class is instantiated the object is created with the needed resources and the range of values it's capable of displaying are calculated based on the dspDigits parameter, and that value is the one returned by this method.
Use example:
uint8_t SevenSegDisplays::getDspCount | ( | ) |
Returns the quantity of instantiated SevenSegDisplays class objects at invocation moment.
bool SevenSegDisplays::getDspIsDmmbl | ( | ) |
Returns the logic value indicating if the display is dimmable.
true | The display is dimmable (variable brightness configuration) |
false | The display is not dimmable (only constant brightness) |
SevenSegDispHw * SevenSegDisplays::getDspUndrlHwPtr | ( | ) |
Returns a pointer to the underlying hardware display object.
The pointer returned is of the type SevenSegDispHw*, i.e. a base class pointer. One of the most important and practical use for this method is to give direct access to exclusive attributes, properties and characteristics some of the hardware display models have, and functions they may execute that have no way of being used through the SevenDisplays class methods. Some of those attributes known to exist are:
int32_t SevenSegDisplays::getDspValMax | ( | ) |
Returns a value equivalent to the greatest displayable number for the display.
The value indicates the greatest displayable number according to the quantity of digits (ports) the display have as indicated at the object instantiation.
Use example:
int32_t SevenSegDisplays::getDspValMin | ( | ) |
Returns a value equivalent to the smallest displayable number for the display.
The value indicates the smallest displayable number according to the quantity of digits (ports) the display have as indicated at the object instantiation.
Use example:
bool SevenSegDisplays::getIsOn | ( | ) |
Returns a logic value indicating if the display is in On state.
true | The display is on |
false | The display is off |
uint32_t SevenSegDisplays::getMaxBlinkRate | ( | ) |
Returns the maximum rate the display can be configured to blink at.
The maximum rate the display can be configured to blink at helps keeping the blinkRate setters inside the accepted range. At least two aspects of the blinking process are involved in the determination if this value.
Use example:
uint8_t SevenSegDisplays::getMaxBrghtnssLvl | ( | ) |
Returns the maximum brightness value setting for the display.
uint32_t SevenSegDisplays::getMinBlinkRate | ( | ) |
Returns the minimum rate the display can be configured to blink at.
The minimum rate the display can be configured to blink at helps keeping the blinkRate setters inside the accepted range. At least two aspects of the blinking process are involved in the determination if this value.
Use example:
uint8_t SevenSegDisplays::getMinBrghtnssLvl | ( | ) |
Returns the minimum brightness value setting for the display.
uint16_t SevenSegDisplays::getSerialNbr | ( | ) |
Returns a unique numeric identification of the object.
The Returned unsigned integer value identifies the object. Each time the class is instantiated the created object receives a serial instantiation number that can be used in order to identify each object in case of need.
Use example:
bool SevenSegDisplays::isBlank | ( | ) |
Returns a value indicating if the display is blank.
The condition of blank is the one in which "All the display ports/digits of the display show spaces, and no decimal points or semicolons are active". This definition is important as it not refers to the display buffer holding any specific arbitrary value (0x00 or 0xFF) but the value designated as _space.
true | The display buffer is filled with _space values |
false | At least one memory element of the buffer is filled with a value that is not a _space |
Use example:
bool SevenSegDisplays::isBlinking | ( | ) |
Returns a boolean value indicating if the display is set to blink or not.
true | The display is set to blink. |
false | The display is set not to blink. |
Use example:
bool SevenSegDisplays::isWaiting | ( | ) |
Returns a boolean value indicating if the display is set to "waiting mode" or not.
Knowing if the display is set to "waiting mode" might be useful as the display will force the mode disabling if a print(), write(), gauge(), etc. methods is invoked.
Use example:
bool SevenSegDisplays::noBlink | ( | ) |
Stops the display blinking, if it was doing so, leaving the display turned on.
Stoping the blinking process includes retrieving the original contents from the _dspAuxPtr pointed memory (the Auxiliary Buffer), freeing the Auxiliary Buffer memory, stoping the timer attached to the process and cleaning the blinking state related flags
true | The display was set to not blinking, either because the display was set to blink and was stopped, either the display was not set to blink. |
false | The display was set to blink, and the blink stopping failed. |
Code example:
bool SevenSegDisplays::noWait | ( | ) |
Stops the Waiting mode, if it was doing so, leaving the display turned on.
Stoping the "Waiting mode" process includes retrieving the original contents from the _dspAuxPtr pointed memory (the Auxiliary Buffer), freeing the Auxiliary Buffer memory, stoping the timer attached to the process and cleaning the waiting state related flags
true | If the display was set to wait, the Waiting mode is stopped. |
false | If the display was not set to wait, no changes will be done. |
Code example:
bool SevenSegDisplays::print | ( | const double & | value, |
const unsigned int & | decPlaces, | ||
bool | rgtAlgn = false, | ||
bool | zeroPad = false ) |
Displays a floating point value.
The floating point value will be displayed as long as the length representation fits the available space of the display. If the integer part of value is not in the displayable range or if the sum of the spaces needed by the integer part plus the indicated decimal places to display is greater than the available digits space, the print() will fail, returning a false value and clearing the display.
value | The floating point value which must be in the range ((-1)*(pow(10, ((dspDigits - decPlaces) - 1)) - 1)) <= value <= (pow(10, (dspDigits - decPlaces)) - 1), or _dspValMin <= value <= _dspValMax. |
decPlaces | Decimal places to be displayed after the decimal point, ranging 0 <= decPlaces < dspDigits, selecting 0 value will display the number as an integer, with no '.' displayed. In any case the only modification that will be applied if value has a decimal part longer than the decPlaces number of digits is truncation, if any other rounding criteria is desired the developer must apply it to value before calling this method. |
rgtAlgn | Boolean, optional parameter (if not specified the default value, false, will be assumed), indicates if the represented value must be displayed right aligned, with the missing heading characters being completed with spaces or zeros, depending in the zeroPad optional parameter. When a negative value is displayed and it's less than (dspDigits - 1) digits long, a right aligned display will keep the '-' sign in the leftmost position, and the free space to the leftmost digit will be filled with spaces or zeros, depending in the zeroPad optional parameter. |
zeroPad | Boolean, optional parameter (if not specified the default value, false, will be assumed), indicates if the heading free spaces of the value right aligned displayed must be filled with zeros (true) or spaces (false). In the case of a negative value the spaces or zeros will fill the gap between the '-' sign kept in the leftmost position, and the first digit. |
true | The value could be represented. |
false | The value couldn't be represented. The display is blanked. |
Code example (on a 4-bits display):
bool SevenSegDisplays::print | ( | const int32_t & | value, |
bool | rgtAlgn = false, | ||
bool | zeroPad = false ) |
Displays an integer value as long as the length representation fits the available space of the display.
value | The integer value to display which must be in the range (-1)*(pow(10, (dspDigits - 1)) - 1) <= value <= (pow(10, dspDigits) - 1), or _dspValMin <= value <= _dspValMax. |
rgtAlgn | Boolean, optional parameter (if not specified the default value, false, will be assumed), indicates if the represented value must be displayed right aligned, with the missing heading characters being completed with spaces or zeros, depending in the zeroPad optional parameter. When a negative value is displayed and it's less than (dspDigits - 1) digits long, a right aligned display will keep the '-' sign in the leftmost position, and the free space to the leftmost digit will be filled with spaces or zeros, depending in the zeroPad optional parameter. |
zeroPad | Boolean, optional parameter (if not specified the default value, false, will be assumed), indicates if the heading free spaces of the integer right aligned displayed must be filled with zeros (true) or spaces (false). In the case of a negative integer the spaces or zeros will fill the gap between the '-' sign kept in the leftmost position, and the first digit. |
Code example
bool SevenSegDisplays::print | ( | String | text | ) |
Displays a text string.
The text string must contains all "displayable" characters, which are the ones included in the following list: 0123456789AabCcdEeFGHhIiJLlnOoPqrStUuY-_. and the space. There are other special characters displayable, details in the notes.
text | String, up to dspDigits displayable characters long PLUS usable dots, all characters included in the representable characters list. Each valid character might be followed by a "." if needed, without being counted as a character, even spaces and special chars. If two or more consecutive dots are passed, an intermediate space is considered to be included between each pair of them, and that space counts as one of the available characters to display. |
true | If the text complies with the requirements to be represented. The text string will be displayed. |
false | Otherwise. The display will be blanked. |
Code example:
void SevenSegDisplays::resetBlinkMask | ( | ) |
Resets the blinking mask.
The blinking mask configures which digits of the display will be affected by the .blink() method. This method resets the mask so that all the digits will be affected when blinking is active.
Code example
void SevenSegDisplays::setBlinkMask | ( | const bool * | newBlnkMsk | ) |
Sets a new blinking mask for the display.
The blinking mask indicates which digits will be involved when a blink() method is invoked. Indicating true for a digit makes it blink when the method is called, indicating false makes it display steady independently of the other digits. The parameter is positional referenced to the display, and for ease of use the index numbers of the array indicate their position relative to the rightmost digit (blnkPort0). The mask might be reset to its original value (all digits set to blink) by using this method with all parameters set to true or by using the resetBlinkMask() method.
newBlnkMsk | Array of booleans of length dspDigits, indexes are positional referenced to the display, indicating each one which digits must blink after a blink() method is invoked (true) or stay steady (false). The indexes valid range is 0 <= index <= (dspDigits-1), corresponding the [0] position withe the rightmost display port, the [1] position the second from the right and so on. |
Code example
bool SevenSegDisplays::setBlinkRate | ( | const uint32_t & | newOnRate, |
const uint32_t & | newOffRate = 0 ) |
Changes the time parameters to use for the display blinking of the contents it shows.
The parameters change will take immediate effect, either if the display is already blinking or not, in the latter case the parameters will be the ones used when a blink() method is called without parameters. The blinking will be symmetrical if only one parameter is passed, asymmetrical if two different parameters are passed, meaning that the time the display shows the contents and the time the display is blank will be equal (symmetrical) or not equal (asymmetrical), depending of those two parameters. The blink rate set will be kept after a noBlink() or new blink() without parameters call is done, until it is modified with a new setBlinkRate() call, or it is restarted by a blink() with parameters. Note that to restart the blinking with a blink() the service must first be stopped, as the method makes no changes if the blinking service was already running.
newOnRate | unsigned long integer containing the time (in milliseconds) the display must stay on, the value must be in the range _minBlinkRate <= onRate <= _maxBlinkRate. Those built-in values can be known by the use of the getMinBlinkRate() and the getMaxBlinkRate() methods. |
newOffRate | optional unsigned long integer containing the time (in milliseconds) the display must stay off, the value must be in the range _minBlinkRate <= offRate <= _maxBlinkRate. Those built-in values can be known by the use of the getMinBlinkRate() and the getMaxBlinkRate() methods. If no offRate value is provided the method will assume it's a symmetric blink call and use a value of offRate equal to the value passed by onRate. |
Code example
bool SevenSegDisplays::setBrghtnssLvl | ( | const uint8_t & | newBrghtnssLvl | ) |
Set the brightness level for the display.
For the brightness level settin to succeed two conditions must be met:
1) The display must be dimmable (see setBrghtnssLvl() ) 2) The new brightness level must be in the valid range for the display: getMinBrghtnssLvl() <= newBrghtnssLvl <= getMaxBrghtnssLvl()
newBrghtnssLvl | The new value setting for the brightness level |
bool SevenSegDisplays::setWaitChar | ( | const char & | newChar | ) |
Sets the "Waiting" character.
The character used by the display to show the "process ongoing" a.k.a. "Waiting mode" can be changed. The default character set is the "-" (minus sign). The parameters change will take immediate effect, either if the display is already in wait mode or not. The new character will be changed for further calls of the method until a new setWaitChar is invoked with a valid argument, that means a "displayable character".
newChar | A character the display must use for symbolizing the progress, the value must be in the displayable characters group as explained in the print() method. |
Code example
bool SevenSegDisplays::setWaitRate | ( | const uint32_t & | newWaitRate | ) |
Changes the timing parameter used to show the "progress ongoing bar advancement" speed.
The parameter change will take immediate effect, either if the display is already in wait mode or not, in the latter case the parameter will be the one used when a wait() method is called without parameters. The wait rate set will be kept after a noWait() or new wait() without parameters call is done, until it is modified with a new setWaitRate() call, or it is restarted by a wait() with parameters. Note that to restart the waiting with a wait() the service must first be stopped, as the method makes no changes if the waiting service was already running.
newWaitRate | unsigned long integer containing the time (in milliseconds) the display must take to advance the next character symbolizing the progress, the value must be in the range _minBlinkRate <= newWaitRate <= _maxBlinkRate. Those values can be known by the use of the getMinBlinkRate() and the getMaxBlinkRate() methods. |
true | The parameter passed is within the valid range, the change takes effect. |
false | The parameter passed was out of range, the rate change will not be made. |
Code example
void SevenSegDisplays::turnOff | ( | ) |
Turns the display module off.
The display module will be cleared and will keep that status until a turnOn(), or turnOn(const uint8_t &) is invoked.
void SevenSegDisplays::turnOn | ( | ) |
Turns the display module on.
The display module will be turned on and it's content displayed, and will keep that status until a turnOff() is invoked.
void SevenSegDisplays::turnOn | ( | const uint8_t & | newBrghtnssLvl | ) |
Turns the display module on.
The display module will be turned on, it's brightness level set to the requested level, it's content displayed, and will keep that status until a turnOff() is invoked.
newBrghtnssLvl | The new brightness level for the display. See setBrghtnssLvl(const uint8_t &) for details |
bool SevenSegDisplays::wait | ( | ) |
Makes the display enter the "Waiting mode".
While in "Waiting mode" the display shows a simple animated progress bar or "process ongoing bar" until a noWait() method is invoked. The speed rate for the progress animation starts at a parameter passed rate when the method is invoked, or the last speed set will be used, having a preset value for the first time it's invoked if no parameter is passed. The animation rate can be changed by using the setWaitRate() method. The speed rate set will be kept after a noWait() or new wait() without parameters call is done, until it is modified with a new setWaitRate() call, or it is restarted by a wait() with a parameter. Note that to restart the waiting with a wait() the service must first be stopped, as the method makes no changes if the waiting service was already running.
Code example
bool SevenSegDisplays::wait | ( | const uint32_t & | newWaitRate | ) |
Makes the display enter the "Waiting mode" with a specific wait rate.
The method is similar to the wait() method, the only difference is that before entering the "Waiting state" a setWaitRate() is executed, using the provided argument to set the new wait rate.
newWaitRate | A new rate for the animated progress bar or "process ongoing bar". |
bool SevenSegDisplays::write | ( | const String & | character, |
const uint8_t & | port ) |
Prints one character to the display, at a designated position (digit or port), without affecting the rest of the characters displayed.
character | A single character string that must be displayable, as defined in the print() method. |
port | unsigned short integer value representing the position or digit where the character will be sent, being the range of valid values 0 <= port <= (dspDigits - 1), the 0 value is the rightmost digit, the 1 value the second from the right and so on. |
true | character is a displayable one char string, and port value is in the range 0 <= value <= (dspDigits - 1). |
false | character was not "displayable" or the port value was out of range. |
Use example
bool SevenSegDisplays::write | ( | const uint8_t & | segments, |
const uint8_t & | port ) |
Prints one character to the display, at a designated position (digit or port), without affecting the rest of the characters displayed.
segments | An unsigned short integer value representing which segments to turn on and which off to get the graphic representation of a character in the seven segment display, the corresponding value can be looked up in the _charLeds[] array definition in the header file of the library. In the case of a common cathode display the values there listed must be complemented. Any other uint8_t (char or unsigned short int is the same here) value is admissible, but the displayed result might not be easily recognized as a known ASCII character. |
port | unsigned short integer value representing the position or digit where the character will be sent, being the range of valid values 0 <= port <= (dspDigits - 1), the 0 value is the rightmost digit, the 1 value the second from the right and so on. |
true | The parameters are within the acceptable range, in this case 0 <= port <= (dspDigits - 1). |
false | The port value was outside the acceptable range. |
Code example