AceSegment  0.8.0
A framework for rendering seven segment LED displays using the TM1637, MAX7219, HT16K33, or 74HC595 controller chips
DirectModule.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_DIRECT_MODULE_H
26 #define ACE_SEGMENT_DIRECT_MODULE_H
27 
28 #include "../scanning/ScanningModule.h"
29 #include "../scanning/LedMatrixDirect.h"
30 
31 namespace ace_segment {
32 
49 template <
50  uint8_t T_DIGITS,
51  uint8_t T_SUBFIELDS = 1,
52  typename T_CI = ClockInterface,
53  typename T_GPIOI = GpioInterface
54 >
56  LedMatrixDirect<T_GPIOI>,
57  T_DIGITS,
58  T_SUBFIELDS,
59  T_CI
60 > {
61  private:
62  using Super = ScanningModule<
64  T_DIGITS,
65  T_SUBFIELDS,
66  T_CI
67  >;
68 
69  public:
71  uint8_t segmentOnPattern,
72  uint8_t digitOnPattern,
73  uint8_t framesPerSecond,
74  const uint8_t* segmentPins,
75  const uint8_t* digitPins
76  ) :
77  Super(mLedMatrix, framesPerSecond),
78  mLedMatrix(
79  segmentOnPattern /*elementOnPattern*/,
80  digitOnPattern /*groupOnPattern*/,
81  8 /* numElements */,
82  segmentPins /*elementPins*/,
83  T_DIGITS /*numGroups*/,
84  digitPins /* groupPins */
85  )
86  {}
87 
88  void begin() {
89  mLedMatrix.begin();
90  Super::begin();
91  }
92 
93  void end() {
94  mLedMatrix.end();
95  Super::end();
96  }
97 
98  private:
99  LedMatrixDirect<T_GPIOI> mLedMatrix;
100 };
101 
102 } // ace_segment
103 
104 #endif
ace_segment::ScanningModule::end
void end()
A no-op end() function for consistency with other classes.
Definition: ScanningModule.h:128
ace_segment::ScanningModule
An implementation of LedModule for display modules which do not have hardware controller chips,...
Definition: ScanningModule.h:80
ace_segment::ScanningModule::begin
void begin()
Configure the driver with the parameters given by in the constructor.
Definition: ScanningModule.h:108
ace_segment::LedMatrixDirect
An LedMatrixBase that whose group pins and element pins are wired directly to the MCU.
Definition: LedMatrixDirect.h:44
ace_segment::DirectModule
An implementation of LedModule whose segment and digit pins are directly connected to the GPIO pins o...
Definition: DirectModule.h:55