Lumitronix_Iflex_Pro_Workshop
Library to interact with the iFlexPro
NeoAbcdefgpsSegmentFeature.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2 NeoAbcdefgpsSegmentFeature provides feature classes to describe color order and
3 color depth for LumitronixIFlexBus template class when used with seven segment display
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 
29 // Abcdefgps byte order
31  public NeoByteElements<9, SevenSegDigit, uint8_t>,
33 {
34 public:
35  static void applyPixelColor(uint8_t* pPixels, uint16_t indexPixel, ColorObject color)
36  {
37  uint8_t* p = getPixelAddress(pPixels, indexPixel);
38  uint8_t commonSize = (PixelSize < color.Count) ? PixelSize : color.Count;
39  for (uint8_t iSegment = 0; iSegment < commonSize; iSegment++)
40  {
41  *p++ = color.Segment[iSegment];
42  }
43  }
44 
45  static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
46  {
47  ColorObject color;
48  const uint8_t* p = getPixelAddress(pPixels, indexPixel);
49  uint8_t commonSize = (PixelSize < color.Count) ? PixelSize : color.Count;
50 
51  for (uint8_t iSegment = 0; iSegment < commonSize; iSegment++)
52  {
53  color.Segment[iSegment] = *p++;
54  }
55  return color;
56  }
57 
58  static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
59  {
60  ColorObject color;
61  const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
62  uint8_t commonSize = (PixelSize < color.Count) ? PixelSize : color.Count;
63 
64  for (uint8_t iSegment = 0; iSegment < commonSize; iSegment++)
65  {
66  color.Segment[iSegment] = pgm_read_byte(p++);
67  }
68 
69  return color;
70  }
71 
72 };
#define PGM_VOID_P
Definition: NeoUtil.h:42
Definition: NeoAbcdefgpsSegmentFeature.h:33
static void applyPixelColor(uint8_t *pPixels, uint16_t indexPixel, ColorObject color)
Definition: NeoAbcdefgpsSegmentFeature.h:35
static ColorObject retrievePixelColor(const uint8_t *pPixels, uint16_t indexPixel)
Definition: NeoAbcdefgpsSegmentFeature.h:45
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
Definition: NeoAbcdefgpsSegmentFeature.h:58
Definition: NeoByteElements.h:101
static uint8_t * getPixelAddress(uint8_t *pPixels, uint16_t indexPixel)
Definition: NeoByteElements.h:43
T_COLOR_OBJECT ColorObject
Definition: NeoByteElements.h:41
static const size_t PixelSize
Definition: NeoByteElements.h:40
Definition: NeoElementsNoSettings.h:30