Lumitronix_Iflex_Pro_Workshop
Library to interact with the iFlexPro
NeoBacedfpgsSegmentFeature.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2 NeoBacedfpgsSegmentFeature 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 // BACEDF.G+ 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 
39  // Segment Digit is Abcdefgps order
40  *p++ = color.Segment[LedSegment_B];
41  *p++ = color.Segment[LedSegment_A];
42  *p++ = color.Segment[LedSegment_C];
43 
44  *p++ = color.Segment[LedSegment_E];
45  *p++ = color.Segment[LedSegment_D];
46  *p++ = color.Segment[LedSegment_F];
47 
48  *p++ = color.Segment[LedSegment_Decimal];
49  *p++ = color.Segment[LedSegment_G];
50  *p++ = color.Segment[LedSegment_Custom];
51  }
52 
53  static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
54  {
55  ColorObject color;
56  const uint8_t* p = getPixelAddress(pPixels, indexPixel);
57 
58  color.Segment[LedSegment_B] = *p++;
59  color.Segment[LedSegment_A] = *p++;
60  color.Segment[LedSegment_C] = *p++;
61 
62  color.Segment[LedSegment_E] = *p++;
63  color.Segment[LedSegment_D] = *p++;
64  color.Segment[LedSegment_F] = *p++;
65 
66  color.Segment[LedSegment_Decimal] = *p++;
67  color.Segment[LedSegment_G] = *p++;
68  color.Segment[LedSegment_Custom] = *p++;
69 
70  return color;
71  }
72 
73  static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
74  {
75  ColorObject color;
76  const uint8_t* p = getPixelAddress((const uint8_t*)pPixels, indexPixel);
77 
78  color.Segment[LedSegment_B] = pgm_read_byte(p++);
79  color.Segment[LedSegment_A] = pgm_read_byte(p++);
80  color.Segment[LedSegment_C] = pgm_read_byte(p++);
81 
82  color.Segment[LedSegment_E] = pgm_read_byte(p++);
83  color.Segment[LedSegment_D] = pgm_read_byte(p++);
84  color.Segment[LedSegment_F] = pgm_read_byte(p++);
85 
86  color.Segment[LedSegment_Decimal] = pgm_read_byte(p++);
87  color.Segment[LedSegment_G] = pgm_read_byte(p++);
88  color.Segment[LedSegment_Custom] = pgm_read_byte(p++);
89 
90  return color;
91  }
92 
93 };
#define PGM_VOID_P
Definition: NeoUtil.h:42
@ LedSegment_E
Definition: SegmentDigit.h:34
@ LedSegment_G
Definition: SegmentDigit.h:36
@ LedSegment_D
Definition: SegmentDigit.h:33
@ LedSegment_F
Definition: SegmentDigit.h:35
@ LedSegment_Custom
Definition: SegmentDigit.h:38
@ LedSegment_B
Definition: SegmentDigit.h:31
@ LedSegment_C
Definition: SegmentDigit.h:32
@ LedSegment_Decimal
Definition: SegmentDigit.h:37
@ LedSegment_A
Definition: SegmentDigit.h:30
Definition: NeoBacedfpgsSegmentFeature.h:33
static ColorObject retrievePixelColor_P(PGM_VOID_P pPixels, uint16_t indexPixel)
Definition: NeoBacedfpgsSegmentFeature.h:73
static void applyPixelColor(uint8_t *pPixels, uint16_t indexPixel, ColorObject color)
Definition: NeoBacedfpgsSegmentFeature.h:35
static ColorObject retrievePixelColor(const uint8_t *pPixels, uint16_t indexPixel)
Definition: NeoBacedfpgsSegmentFeature.h:53
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
Definition: NeoElementsNoSettings.h:30