Lumitronix_Iflex_Pro_Workshop
Library to interact with the iFlexPro
NeoTm1914Features.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2 NeoTm1914Features provides feature classes to describe color order and
3 color depth for LumitronixIFlexBus template class specific to the TM1914 chip
4 
5 Written by Michael C. Miller.
6 
7 I invest time and resources providing this open source code,
8 please support me by dontating (see https://github.com/Makuna)
9 
10 -------------------------------------------------------------------------
11 This file is part of the LUMITRONIX_iFlex_Workshop library.
12 
13 LumitronixIFlexBus is free software: you can redistribute it and/or modify
14 it under the terms of the GNU Lesser General Public License as
15 published by the Free Software Foundation, either version 3 of
16 the License, or (at your option) any later version.
17 
18 LumitronixIFlexBus is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 
23 You should have received a copy of the GNU Lesser General Public
24 License along with LumitronixIFlex. If not, see
25 <http://www.gnu.org/licenses/>.
26 -------------------------------------------------------------------------*/
27 #pragma once
28 
30 {
31  NeoTm1914_Mode_DinFdinAutoSwitch, // Switches between DIN and FDIN on any signal pause > 300ms
32  NeoTm1914_Mode_DinOnly, // DIN input pin used exclusively
33  NeoTm1914_Mode_FdinOnly // FDIN input pin used exclusively
34 };
35 
37 {
38 public:
40  Mode(mode)
41  {
42  }
43 
45 };
46 
48 {
49 public:
51  static const size_t SettingsSize = 6;
52 
53  static void applySettings([[maybe_unused]] uint8_t* pData, [[maybe_unused]] size_t sizeData, [[maybe_unused]] const SettingsObject& settings)
54  {
55  // settings are at the front of the data stream
56  uint8_t* pSet = pData;
57  uint8_t mode = 0xff;
58 
59  // C1 - the mode
60  *pSet++ = 0xff;
61  *pSet++ = 0xff;
62 
63  switch (settings.Mode)
64  {
66  mode = 0xff;
67  break;
68 
70  mode = 0xfa;
71  break;
72 
74  default:
75  mode = 0xf5;
76  break;
77  }
78  *pSet++ = mode;
79 
80  // C2 - ones compliment of the above
81  uint8_t* pC1 = pData;
82  for (uint8_t elem = 0; elem < 3; elem++)
83  {
84  *pSet++ = ~(*pC1++);
85  }
86  }
87 
88  static uint8_t* pixels([[maybe_unused]] uint8_t* pData, [[maybe_unused]] size_t sizeData)
89  {
90  // settings are at the front of the data stream
91  return pData + SettingsSize;
92  }
93 
94  static const uint8_t* pixels([[maybe_unused]] const uint8_t* pData, [[maybe_unused]] size_t sizeData)
95  {
96  // settings are at the front of the data stream
97  return pData + SettingsSize;
98  }
99 };
100 
101 
103  public Neo3ByteFeature<ColorIndexR, ColorIndexG, ColorIndexB>,
105 {
106 };
107 
108 
110  public Neo3ByteFeature<ColorIndexG, ColorIndexR, ColorIndexB>,
112 {
113 };
NeoTm1914_Mode
Definition: NeoTm1914Features.h:30
@ NeoTm1914_Mode_DinFdinAutoSwitch
Definition: NeoTm1914Features.h:31
@ NeoTm1914_Mode_DinOnly
Definition: NeoTm1914Features.h:32
@ NeoTm1914_Mode_FdinOnly
Definition: NeoTm1914Features.h:33
Definition: NeoTm1914Features.h:48
static uint8_t * pixels([[maybe_unused]] uint8_t *pData, [[maybe_unused]] size_t sizeData)
Definition: NeoTm1914Features.h:88
NeoTm1914Settings SettingsObject
Definition: NeoTm1914Features.h:50
static void applySettings([[maybe_unused]] uint8_t *pData, [[maybe_unused]] size_t sizeData, [[maybe_unused]] const SettingsObject &settings)
Definition: NeoTm1914Features.h:53
static const size_t SettingsSize
Definition: NeoTm1914Features.h:51
static const uint8_t * pixels([[maybe_unused]] const uint8_t *pData, [[maybe_unused]] size_t sizeData)
Definition: NeoTm1914Features.h:94
Definition: Neo3ByteFeature.h:32
Definition: NeoTm1914Features.h:112
Definition: NeoTm1914Features.h:105
Definition: NeoTm1914Features.h:37
NeoTm1914Settings(NeoTm1914_Mode mode=NeoTm1914_Mode_DinOnly)
Definition: NeoTm1914Features.h:39
NeoTm1914_Mode Mode
Definition: NeoTm1914Features.h:44