AceSegment  0.11.0
A library for rendering seven segment LED displays using the TM1637, TM1638, MAX7219, HT16K33, or 74HC595 controller chips
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 
31 static const uint8_t kActiveHighPattern = 0xFF;
32 
34 static const uint8_t kActiveLowPattern = 0x00;
35 
80  public:
81 
87  uint8_t elementOnPattern,
88  uint8_t groupOnPattern
89  ) :
90  mElementXorMask(~elementOnPattern),
91  mGroupXorMask(~groupOnPattern)
92  {}
93 
95  void begin() const {}
96 
98  void end() const {}
99 
101  void draw(uint8_t /*group*/, uint8_t /*elementPattern*/) const {}
102 
104  void disableGroup(uint8_t /*group*/) const {}
105 
107  void enableGroup(uint8_t /*group*/) const {}
108 
110  void clear() const {}
111 
112  protected:
113  uint8_t const mElementXorMask;
114  uint8_t const mGroupXorMask;
115 };
116 
117 }
118 
119 #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:79
ace_segment::LedMatrixBase::LedMatrixBase
LedMatrixBase(uint8_t elementOnPattern, uint8_t groupOnPattern)
Definition: LedMatrixBase.h:86
ace_segment::LedMatrixBase::end
void end() const
Turn off the pins by doing the opposite of begin().
Definition: LedMatrixBase.h:98
ace_segment::LedMatrixBase::draw
void draw(uint8_t, uint8_t) const
Write element patterns for the given group.
Definition: LedMatrixBase.h:101
ace_segment::LedMatrixBase::disableGroup
void disableGroup(uint8_t) const
Disable the elements of given group.
Definition: LedMatrixBase.h:104
ace_segment::LedMatrixBase::clear
void clear() const
Clear everything.
Definition: LedMatrixBase.h:110
ace_segment::LedMatrixBase::begin
void begin() const
Configure the pins for the given LED wiring.
Definition: LedMatrixBase.h:95
ace_segment::LedMatrixBase::enableGroup
void enableGroup(uint8_t) const
Enable the elements of given group.
Definition: LedMatrixBase.h:107