RSeries astromech firmware
NeoPSI.h
Go to the documentation of this file.
1 
2 #ifndef NeoPSI_h
3 #define NeoPSI_h
4 
5 #include "ReelTwo.h"
6 #include "dome/LogicEngine.h"
7 
8 #ifndef FRONT_PSI_PIN
9  #if defined(REELTWO_TEENSY)
10  #define FRONT_PSI_PIN 21 /* TODO figure out correct default pin */
11  #elif defined(REELTWO_ZERO)
12  #define FRONT_PSI_PIN 5 /* TODO figure out correct default pin */
13  #elif defined(REELTWO_AVR_MEGA)
14  #define FRONT_PSI_PIN 5
15  #elif defined(REELTWO_AVR)
16  #define FRONT_PSI_PIN 6
17  #elif defined(ESP32)
18  #define FRONT_PSI_PIN 32
19  #else
20  #error Unsupported platform
21  #endif
22 #endif
23 
24 #ifndef REAR_PSI_PIN
25  #if defined(REELTWO_TEENSY)
26  #define REAR_PSI_PIN 22 /* TODO figure out correct default pin */
27  #elif defined(REELTWO_ZERO)
28  #define REAR_PSI_PIN 3 /* TODO figure out correct default pin */
29  #elif defined(REELTWO_AVR_MEGA)
30  #define REAR_PSI_PIN 6
31  #elif defined(REELTWO_AVR)
32  #define REAR_PSI_PIN 6
33  #elif defined(ESP32)
34  #define REAR_PSI_PIN 23
35  #else
36  #error Unsupported platform
37  #endif
38 #endif
39 
41 template <uint8_t DATA_PIN>
42 class NeoPSIPCB : public FastLEDPCB<WS2812B, DATA_PIN, 35, 0, 35, 5, 7>
43 {
44 public:
45  static inline const byte* getLEDMap()
46  {
47  // Use dummy pixel 31 for no pixel
48  static const byte sLEDmap[] PROGMEM =
49  {
50  31, 11, 12, 25, 31,
51  0, 10, 13, 24, 26,
52  1, 9, 14, 23, 27,
53  2, 8, 15, 22, 28,
54  3, 7, 16, 21, 29,
55  4, 6, 17, 20, 30,
56  31, 5, 18, 19, 31,
57  };
58  return sLEDmap;
59  }
60 };
61 
62 template <uint8_t DATA_PIN>
63 class AstroPixelPSIPCB : public FastLEDPCB<WS2812B, DATA_PIN, 25, 0, 25, 5, 5>
64 {
65 public:
66  static inline const byte* getLEDMap()
67  {
68  // Use dummy pixel 31 for no pixel
69  static const byte sLEDmap[] PROGMEM =
70  {
71  31, 0, 1, 2, 31,
72  3, 4, 5, 6, 7,
73  8, 9, 10, 11, 12,
74  13, 14, 15, 16, 17,
75  31, 18, 19, 20, 31,
76  };
77  return sLEDmap;
78  }
79 };
80 
81 template <uint8_t DATA_PIN>
82 class AstroPixelPSI8PCB : public FastLEDPCB<WS2812B, DATA_PIN, 64, 0, 64, 8, 8>
83 {
84 public:
85  static inline const byte* getLEDMap()
86  {
87  // Use dummy pixel 31 for no pixel
88  static const byte sLEDmap[] PROGMEM =
89  {
90  99,99,3,2,1,0,99,99,
91  99,9,8,7,6,5,4,99,
92  17,16,15,14,13,12,11,10,
93  25,24,23,22,21,20,19,18,
94  33,32,31,30,29,28,27,26,
95  41,40,39,38,37,36,35,34,
96  99,47,46,45,44,43,42,99,
97  99,99,51,50,49,48,99,99
98  };
99  return sLEDmap;
100  }
101 };
102 
114 template <uint8_t DATA_PIN = FRONT_PSI_PIN>
115 using NeoFrontPSI = LogicEngineDisplay<NeoPSIPCB<DATA_PIN>, LogicRenderGlyph5Pt>;
116 
128 template <uint8_t DATA_PIN = REAR_PSI_PIN>
129 using NeoRearPSI = LogicEngineDisplay<NeoPSIPCB<DATA_PIN>, LogicRenderGlyph5Pt>;
130 
131 
143 template <uint8_t DATA_PIN = FRONT_PSI_PIN>
144 using AstroPixelFrontPSI = LogicEngineDisplay<AstroPixelPSIPCB<DATA_PIN>, LogicRenderGlyph5Pt, LogicEngineDefaults::PSICOLORWIPE>;
145 
157 template <uint8_t DATA_PIN = REAR_PSI_PIN>
158 using AstroPixelRearPSI = LogicEngineDisplay<AstroPixelPSIPCB<DATA_PIN>, LogicRenderGlyph5Pt, LogicEngineDefaults::PSICOLORWIPE>;
159 
171 template <uint8_t DATA_PIN = FRONT_PSI_PIN>
172 using AstroPixelFrontPSI8 = LogicEngineDisplay<AstroPixelPSI8PCB<DATA_PIN>, LogicRenderGlyph5Pt, LogicEngineDefaults::PSICOLORWIPE>;
173 
185 template <uint8_t DATA_PIN = REAR_PSI_PIN>
186 using AstroPixelRearPSI8 = LogicEngineDisplay<AstroPixelPSI8PCB<DATA_PIN>, LogicRenderGlyph5Pt, LogicEngineDefaults::PSICOLORWIPE>;
187 
188 static LogicEngineSettings LogicEngineFrontPSIDefault(
195 
196 static LogicEngineSettings LogicEngineRearPSIDefault(
203 
204 #endif
NeoRearPSI
LogicEngineDisplay< NeoPSIPCB< DATA_PIN >, LogicRenderGlyph5Pt > NeoRearPSI
Definition: NeoPSI.h:129
LogicEngineSettings
Current settings for LogicEngine hardware.
Definition: LogicEngine.h:176
AstroPixelFrontPSI
Neopixel based Front PSI PCB.
ReelTwo.h
LogicEngineDefaults::REAR_HUE
static constexpr byte REAR_HUE
Definition: LogicEngine.h:96
LogicEngineDefaults::sequence
static long sequence(byte seq, ColorVal colorVal=kDefault, uint8_t speedScale=0, uint8_t numSeconds=0)
Calculate sequence value given four parameters.
Definition: LogicEngine.h:160
LogicEngineDefaults::REAR_PSI_PAL
static constexpr byte REAR_PSI_PAL
Definition: LogicEngine.h:102
AstroPixelPSI8PCB::getLEDMap
static const byte * getLEDMap()
Definition: NeoPSI.h:85
LogicEngineDefaults::kYellow
@ kYellow
Definition: LogicEngine.h:147
AstroPixelRearPSI8
LogicEngineDisplay< AstroPixelPSI8PCB< DATA_PIN >, LogicRenderGlyph5Pt, LogicEngineDefaults::PSICOLORWIPE > AstroPixelRearPSI8
Definition: NeoPSI.h:186
LogicEngineDefaults::FRONT_FADE
static constexpr byte FRONT_FADE
Definition: LogicEngine.h:90
AstroPixelPSIPCB
Definition: NeoPSI.h:63
AstroPixelRearPSI
Neopixel based Rear PSI PCB.
LogicEngineDefaults::FRONT_HUE
static constexpr byte FRONT_HUE
Definition: LogicEngine.h:92
LogicEngineDefaults::kRed
@ kRed
Definition: LogicEngine.h:145
AstroPixelPSIPCB::getLEDMap
static const byte * getLEDMap()
Definition: NeoPSI.h:66
AstroPixelPSI8PCB
Definition: NeoPSI.h:82
LogicEngineDefaults::REAR_BRI
static constexpr byte REAR_BRI
Definition: LogicEngine.h:105
AstroPixelFrontPSI8
Neopixel based Front PSI PCB for denser displays.
LogicEngine.h
LogicEngineDefaults::REAR_DELAY
static constexpr byte REAR_DELAY
Definition: LogicEngine.h:95
LogicEngineDefaults::REAR_FADE
static constexpr byte REAR_FADE
Definition: LogicEngine.h:94
LogicEngineDefaults::PSICOLORWIPE
static constexpr byte PSICOLORWIPE
Definition: LogicEngine.h:137
LogicEngineDefaults::FRONT_PSI_PAL
static constexpr byte FRONT_PSI_PAL
Definition: LogicEngine.h:101
LogicEngineDefaults::FRONT_DELAY
static constexpr byte FRONT_DELAY
Definition: LogicEngine.h:91
NeoFrontPSI
Neopixel based Front PSI PCB.
LogicEngineDefaults::FRONT_BRI
static constexpr byte FRONT_BRI
Definition: LogicEngine.h:104