AceSegment  0.8.2
A framework for rendering seven segment LED displays using the TM1637, MAX7219, HT16K33, or 74HC595 controller chips
HybridModule.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_HYBRID_MODULE_H
26 #define ACE_SEGMENT_HYBRID_MODULE_H
27 
28 #include "../scanning/ScanningModule.h"
29 #include "../scanning/LedMatrixSingleHc595.h"
30 
31 namespace ace_segment {
32 
50 template <
51  typename T_SPII,
52  uint8_t T_DIGITS,
53  uint8_t T_SUBFIELDS = 1,
54  typename T_CI = ClockInterface,
55  typename T_GPIOI = GpioInterface
56 >
58  LedMatrixSingleHc595<T_SPII, T_GPIOI>,
59  T_DIGITS,
60  T_SUBFIELDS,
61  T_CI
62 > {
63  private:
64  using Super = ScanningModule<
66  T_DIGITS,
67  T_SUBFIELDS,
68  T_CI
69  >;
70 
71  public:
73  const T_SPII& spiInterface,
74  uint8_t segmentOnPattern,
75  uint8_t digitOnPattern,
76  uint8_t framesPerSecond,
77  const uint8_t* digitPins
78  ) :
79  Super(mLedMatrix, framesPerSecond),
80  mLedMatrix(
81  spiInterface,
82  segmentOnPattern /*elementOnPattern*/,
83  digitOnPattern /*groupOnPattern*/,
84  T_DIGITS /*numGroups*/,
85  digitPins /*groupPins*/
86  )
87  {}
88 
89  void begin() {
90  mLedMatrix.begin();
91  Super::begin();
92  }
93 
94  void end() {
95  mLedMatrix.end();
96  Super::end();
97  }
98 
99  private:
101 };
102 
103 } // ace_segment
104 
105 #endif
ace_segment::ScanningModule::end
void end()
A no-op end() function for consistency with other classes.
Definition: ScanningModule.h:132
ace_segment::ScanningModule
An implementation of LedModule for display modules which do not have hardware controller chips,...
Definition: ScanningModule.h:81
ace_segment::HybridModule
An implementation of LedModule class that supports an LED module using a single 74HC595 Shift Registe...
Definition: HybridModule.h:57
ace_segment::ScanningModule::begin
void begin()
Configure the driver with the parameters given by in the constructor.
Definition: ScanningModule.h:109
ace_segment::LedMatrixSingleHc595
An implementation of LedMatrixBase with an 74HC595 Shift Register chip on the segment pins,...
Definition: LedMatrixSingleHc595.h:53