AceSegment  0.4.0
An adjustable, configurable, and extensible framework for rendering seven segment LED displays.
LedDisplay.h
1 /*
2 MIT License
3 
4 Copyright (c) 2021 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef ACE_SEGMENT_LED_DISPLAY_H
26 #define ACE_SEGMENT_LED_DISPLAY_H
27 
28 #include <stdint.h>
29 
30 namespace ace_segment {
31 
42 class LedDisplay {
43  public:
44  LedDisplay(uint8_t numDigits) : mNumDigits(numDigits) {}
45 
50  virtual void writePatternAt(uint8_t pos, uint8_t pattern) = 0;
51 
57  virtual void writePatternsAt(uint8_t pos, const uint8_t patterns[],
58  uint8_t len) = 0;
59 
66  virtual void writePatternsAt_P(uint8_t pos, const uint8_t patterns[],
67  uint8_t len) = 0;
68 
79  virtual void setBrightnessAt(uint8_t pos, uint8_t brightness) = 0;
80 
85  virtual void writeDecimalPointAt(uint8_t pos, bool state = true) = 0;
86 
93  virtual void setGlobalBrightness(uint8_t brightness) = 0;
94 
96  virtual void clear() = 0;
97 
99  uint8_t getNumDigits() const { return mNumDigits; }
100 
101  private:
102  uint8_t const mNumDigits;
103 };
104 
105 } // ace_segment
106 
107 #endif
ace_segment::LedDisplay::clear
virtual void clear()=0
Clear all digits to blank pattern.
ace_segment::LedDisplay
General interface for writing LED segment patterns to the LED display module.
Definition: LedDisplay.h:42
ace_segment::LedDisplay::setGlobalBrightness
virtual void setGlobalBrightness(uint8_t brightness)=0
Set global brightness of all digits, with the brightness value expressed as a fraction of 256.
ace_segment::LedDisplay::writeDecimalPointAt
virtual void writeDecimalPointAt(uint8_t pos, bool state=true)=0
Write the decimal point for the pos.
ace_segment::LedDisplay::writePatternsAt_P
virtual void writePatternsAt_P(uint8_t pos, const uint8_t patterns[], uint8_t len)=0
Write the array of patterns of length len, which are stored in flash memory through PROGMEM,...
ace_segment::LedDisplay::writePatternsAt
virtual void writePatternsAt(uint8_t pos, const uint8_t patterns[], uint8_t len)=0
Write the array of patterns of length len, starting at pos.
ace_segment::LedDisplay::setBrightnessAt
virtual void setBrightnessAt(uint8_t pos, uint8_t brightness)=0
Write the brightness for a given pos, leaving pattern unchanged.
ace_segment::LedDisplay::getNumDigits
uint8_t getNumDigits() const
Return the number of digits supported by this display instance.
Definition: LedDisplay.h:99
ace_segment::LedDisplay::writePatternAt
virtual void writePatternAt(uint8_t pos, uint8_t pattern)=0
Write the pattern for a given pos.