ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputGECEUart.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* OutputGECEUart.h - GECE driver code for ESPixelStick UART
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* This is a derived class that converts data in the output buffer into
20* pixel intensities and then transmits them through the configured serial
21* interface.
22*
23*/
24
25#include "ESPixelStick.h"
26#if defined(SUPPORT_OutputProtocol_GECE)
27
28#include "OutputGECE.hpp"
29#include "OutputUart.hpp"
30
31class c_OutputGECEUart : public c_OutputGECE
32{
33public:
34 // These functions are inherited from c_OutputCommon
35 c_OutputGECEUart (OM_OutputPortDefinition_t & OutputPortDefinition,
37 virtual ~c_OutputGECEUart ();
38
39 // functions to be provided by the derived class
40 void Begin ();
41 uint32_t Poll ();
42#if defined(ARDUINO_ARCH_ESP32)
43 bool RmtPoll () {return false;}
44#endif // defined(ARDUINO_ARCH_ESP32)
45 void PauseOutput (bool State);
46 bool SetConfig (ArduinoJson::JsonObject& jsonConfig);
47 void GetConfig (ArduinoJson::JsonObject& jsonConfig);
48 void GetStatus (ArduinoJson::JsonObject& jsonStatus);
49
50private:
51
52#define GECE_UART_BITS_PER_GECE_BIT 5.0
53#define GECE_UART_USEC_PER_BIT (float(GECE_USEC_PER_GECE_BIT) / float(GECE_UART_BITS_PER_GECE_BIT))
54#define GECE_BAUDRATE uint32_t((1.0 / (GECE_UART_USEC_PER_BIT / float(MicroSecondsInASecond))))
55#define GECE_UART_BREAK_BITS uint32_t(((GECE_PIXEL_STOP_TIME_NS / NanoSecondsInAMicroSecond) / GECE_UART_USEC_PER_BIT) + 1)
56
57 c_OutputUart Uart;
58
59// #define GECE_UART_DEBUG_COUNTERS
60#ifdef GECE_UART_DEBUG_COUNTERS
61 uint32_t NewFrameCounter = 0;
62 uint32_t TimeSinceLastFrameMS = 0;
63 uint32_t TimeLastFrameStartedMS = 0;
64#endif // def GECE_UART_DEBUG_COUNTERS
65
66}; // c_OutputGECEUart
67
68#endif // defined(SUPPORT_OutputProtocol_GECE)
e_OutputProtocolType
Definition OutputMgr.hpp:78
Definition OutputUart.hpp:33
void GetConfig(JsonObject &json)
Definition main.cpp:499
void SetConfig(const char *DataString)
Definition main.cpp:321
Definition OutputMgrPortDefs.hpp:90