ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputGECE.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* OutputGECE.h - GECE driver code for ESPixelStick
4*
5* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6* Copyright (c) 2015, 2022 Shelby Merrick
7* http://www.forkineye.com
8*
9* This program is provided free for you to use in any way that you wish,
10* subject to the laws and regulations where you are using it. Due diligence
11* is strongly suggested before using this code. Please give credit where due.
12*
13* The Author makes no warranty of any kind, express or implied, with regard
14* to this program or the documentation contained in this document. The
15* Author shall not be liable in any event for incidental or consequential
16* damages in connection with, or arising out of, the furnishing, performance
17* or use of these programs.
18*
19*/
20
21#include "ESPixelStick.h"
22#if defined(SUPPORT_OutputProtocol_GECE)
23
24#include "OutputGECEFrame.hpp"
25#include "OutputPixel.hpp"
26
27class c_OutputGECE: public c_OutputPixel
28{
29public:
30 c_OutputGECE (OM_OutputPortDefinition_t & OutputPortDefinition,
32 virtual ~c_OutputGECE ();
33
34 // functions to be provided by the derived class
35 virtual void Begin ();
36 virtual bool SetConfig(ArduinoJson::JsonObject &jsonConfig);
37 virtual void GetConfig(ArduinoJson::JsonObject &jsonConfig);
38 virtual void GetStatus(ArduinoJson::JsonObject &jsonStatus);
39 virtual uint32_t Poll();
40 virtual void GetDriverName(String &sDriverName) { sDriverName = CN_GECE; }
41 void SetOutputBufferSize(uint32_t NumChannelsAvailable);
42 bool validate ();
43
44private:
45/*
46 output looks like this
47
48 Start bit = High for 8us
49 26 data bits.
50 Each bit is 31us
51 0 = 6 us low, 25 us high
52 1 = 25 us low, 6 us high
53 stop bit = low for at least 45us
54*/
55#define GECE_PIXEL_LIMIT 63
56#define GECE_DEFAULT_BRIGHTNESS 0xCC
57
58#define GECE_PIXEL_NS_BIT_0_HIGH (25 * NanoSecondsInAMicroSecond)
59#define GECE_PIXEL_NS_BIT_0_LOW (6 * NanoSecondsInAMicroSecond)
60#define GECE_PIXEL_NS_BIT_1_HIGH (6 * NanoSecondsInAMicroSecond)
61#define GECE_PIXEL_NS_BIT_1_LOW (25 * NanoSecondsInAMicroSecond)
62#define GECE_PIXEL_START_TIME_NS (8 * NanoSecondsInAMicroSecond)
63#define GECE_PIXEL_STOP_TIME_NS (45 * NanoSecondsInAMicroSecond)
64#define GECE_USEC_PER_GECE_BIT ((GECE_PIXEL_NS_BIT_0_HIGH + GECE_PIXEL_NS_BIT_0_LOW)/NanoSecondsInAMicroSecond)
65
66#define GECE_NUM_INTENSITY_BYTES_PER_PIXEL 3
67#define GECE_BITS_PER_INTENSITY 4
68#define GECE_BITS_BRIGHTNESS 8
69#define GECE_BITS_ADDRESS 6
70#define GECE_OVERHEAD_BITS (GECE_BITS_BRIGHTNESS + GECE_BITS_ADDRESS)
71#define GECE_PACKET_SIZE ((GECE_NUM_INTENSITY_BYTES_PER_PIXEL * GECE_BITS_PER_INTENSITY) + GECE_OVERHEAD_BITS) // 26
72
73#define GECE_FRAME_TIME_USEC ((GECE_PACKET_SIZE * GECE_USEC_PER_GECE_BIT) + 90)
74#define GECE_FRAME_TIME_NSEC (GECE_FRAME_TIME_USEC * NanoSecondsInAMicroSecond)
75
76};
77
78
79#endif // defined(SUPPORT_OutputProtocol_GECE)
const CN_PROGMEM char CN_GECE[]
Definition ConstNames.cpp:116
virtual void GetDriverName(String &sDriverName)=0
get the name for the instantiated driver
virtual void Begin()
set up the operating environment based on the current config (or defaults)
Definition OutputCommon.hpp:41
virtual uint32_t Poll()=0
Call from loop(), renders output data.
e_OutputProtocolType
Definition OutputMgr.hpp:78
Definition OutputPixel.hpp:28
virtual void SetOutputBufferSize(uint32_t NumChannelsAvailable)
Definition OutputPixel.cpp:112
virtual void GetStatus(ArduinoJson::JsonObject &jsonStatus)
Definition OutputPixel.cpp:76
bool validate()
confirm that the current configuration is valid
Definition OutputPixel.cpp:290
virtual bool SetConfig(ArduinoJson::JsonObject &jsonConfig)
Set a new config in the driver.
Definition OutputPixel.cpp:177
virtual void GetConfig(ArduinoJson::JsonObject &jsonConfig)
Get the current config used by the driver.
Definition OutputPixel.cpp:50
Definition OutputMgrPortDefs.hpp:90