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_OutputType_GECE)
23
24#include "OutputGECEFrame.hpp"
25#include "OutputPixel.hpp"
26
27class c_OutputGECE: public c_OutputPixel
28{
29public:
30 c_OutputGECE (c_OutputMgr::e_OutputChannelIds OutputChannelId,
31 gpio_num_t outputGpio,
32 uart_port_t uart,
33 c_OutputMgr::e_OutputType outputType);
34 virtual ~c_OutputGECE ();
35
36 // functions to be provided by the derived class
37 virtual void Begin ();
38 virtual bool SetConfig(ArduinoJson::JsonObject &jsonConfig);
39 virtual void GetConfig(ArduinoJson::JsonObject &jsonConfig);
40 virtual void GetStatus(ArduinoJson::JsonObject &jsonStatus);
41 virtual uint32_t Poll();
42 virtual void GetDriverName(String &sDriverName) { sDriverName = CN_GECE; }
43 void SetOutputBufferSize(uint32_t NumChannelsAvailable);
44 bool validate ();
45
46private:
47/*
48 output looks like this
49
50 Start bit = High for 8us
51 26 data bits.
52 Each bit is 31us
53 0 = 6 us low, 25 us high
54 1 = 25 us low, 6 us high
55 stop bit = low for at least 45us
56*/
57#define GECE_PIXEL_LIMIT 63
58#define GECE_DEFAULT_BRIGHTNESS 0xCC
59
60#define GECE_PIXEL_NS_BIT_0_HIGH (25 * NanoSecondsInAMicroSecond)
61#define GECE_PIXEL_NS_BIT_0_LOW (6 * NanoSecondsInAMicroSecond)
62#define GECE_PIXEL_NS_BIT_1_HIGH (6 * NanoSecondsInAMicroSecond)
63#define GECE_PIXEL_NS_BIT_1_LOW (25 * NanoSecondsInAMicroSecond)
64#define GECE_PIXEL_START_TIME_NS (8 * NanoSecondsInAMicroSecond)
65#define GECE_PIXEL_STOP_TIME_NS (45 * NanoSecondsInAMicroSecond)
66#define GECE_USEC_PER_GECE_BIT ((GECE_PIXEL_NS_BIT_0_HIGH + GECE_PIXEL_NS_BIT_0_LOW)/NanoSecondsInAMicroSecond)
67
68#define GECE_NUM_INTENSITY_BYTES_PER_PIXEL 3
69#define GECE_BITS_PER_INTENSITY 4
70#define GECE_BITS_BRIGHTNESS 8
71#define GECE_BITS_ADDRESS 6
72#define GECE_OVERHEAD_BITS (GECE_BITS_BRIGHTNESS + GECE_BITS_ADDRESS)
73#define GECE_PACKET_SIZE ((GECE_NUM_INTENSITY_BYTES_PER_PIXEL * GECE_BITS_PER_INTENSITY) + GECE_OVERHEAD_BITS) // 26
74
75#define GECE_FRAME_TIME_USEC ((GECE_PACKET_SIZE * GECE_USEC_PER_GECE_BIT) + 90)
76#define GECE_FRAME_TIME_NSEC (GECE_FRAME_TIME_USEC * NanoSecondsInAMicroSecond)
77
78};
79
80
81#endif // defined(SUPPORT_OutputType_GECE)
const CN_PROGMEM char CN_GECE[]
Definition ConstNames.cpp:104
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:43
virtual uint32_t Poll()=0
Call from loop(), renders output data.
e_OutputChannelIds
Definition OutputMgr.hpp:67
e_OutputType
Definition OutputMgr.hpp:126
Definition OutputPixel.hpp:28
virtual void SetOutputBufferSize(uint32_t NumChannelsAvailable)
Definition OutputPixel.cpp:106
virtual void GetStatus(ArduinoJson::JsonObject &jsonStatus)
Definition OutputPixel.cpp:70
bool validate()
confirm that the current configuration is valid
Definition OutputPixel.cpp:272
virtual bool SetConfig(ArduinoJson::JsonObject &jsonConfig)
Set a new config in the driver.
Definition OutputPixel.cpp:171
virtual void GetConfig(ArduinoJson::JsonObject &jsonConfig)
Get the current config used by the driver.
Definition OutputPixel.cpp:50