AceSegment  0.4.0
An adjustable, configurable, and extensible framework for rendering seven segment LED displays.
LedMatrixBase.h
1 /*
2 MIT License
3 
4 Copyright (c) 2018 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_MATRIX_BASE_H
26 #define ACE_SEGMENT_LED_MATRIX_BASE_H
27 
28 namespace ace_segment {
29 
73  public:
74 
76  static constexpr uint8_t kActiveHighPattern = 0xFF;
77 
79  static constexpr uint8_t kActiveLowPattern = 0x00;
80 
86  uint8_t groupOnPattern,
87  uint8_t elementOnPattern
88  ) :
89  mGroupXorMask(~groupOnPattern),
90  mElementXorMask(~elementOnPattern)
91  {}
92 
94  void begin() const {}
95 
97  void end() const {}
98 
100  void draw(uint8_t /*group*/, uint8_t /*elementPattern*/) const {}
101 
103  void disableGroup(uint8_t /*group*/) const {}
104 
106  void enableGroup(uint8_t /*group*/) const {}
107 
109  void clear() const {}
110 
111  protected:
112  uint8_t const mGroupXorMask;
113  uint8_t const mElementXorMask;
114 };
115 
116 }
117 
118 #endif
ace_segment::LedMatrixBase
Class that represents the abstraction of a particular LED display wiring, and knows how to turn off a...
Definition: LedMatrixBase.h:72
ace_segment::LedMatrixBase::kActiveLowPattern
static constexpr uint8_t kActiveLowPattern
Bit pattern to indicate that logical 0 activates group or element.
Definition: LedMatrixBase.h:79
ace_segment::LedMatrixBase::end
void end() const
Turn off the pins by doing the opposite of begin().
Definition: LedMatrixBase.h:97
ace_segment::LedMatrixBase::draw
void draw(uint8_t, uint8_t) const
Write element patterns for the given group.
Definition: LedMatrixBase.h:100
ace_segment::LedMatrixBase::LedMatrixBase
LedMatrixBase(uint8_t groupOnPattern, uint8_t elementOnPattern)
Definition: LedMatrixBase.h:85
ace_segment::LedMatrixBase::kActiveHighPattern
static constexpr uint8_t kActiveHighPattern
Bit pattern to indicate that logical 1 activates group or element.
Definition: LedMatrixBase.h:76
ace_segment::LedMatrixBase::disableGroup
void disableGroup(uint8_t) const
Disable the elements of given group.
Definition: LedMatrixBase.h:103
ace_segment::LedMatrixBase::clear
void clear() const
Clear everything.
Definition: LedMatrixBase.h:109
ace_segment::LedMatrixBase::begin
void begin() const
Configure the pins for the given LED wiring.
Definition: LedMatrixBase.h:94
ace_segment::LedMatrixBase::enableGroup
void enableGroup(uint8_t) const
Enable the elements of given group.
Definition: LedMatrixBase.h:106