ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputTM1814.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* OutputTM1814.h - TM1814 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* 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#include "ESPixelStick.h"
25#ifdef SUPPORT_OutputProtocol_TM1814
26
27#include "OutputPixel.hpp"
28
29class c_OutputTM1814 : public c_OutputPixel
30{
31public:
32 // These functions are inherited from c_OutputCommon
33 c_OutputTM1814 (OM_OutputPortDefinition_t & OutputPortDefinition,
35 virtual ~c_OutputTM1814 ();
36
37 // functions to be provided by the derived class
38 virtual void Begin ();
39 virtual bool SetConfig (ArduinoJson::JsonObject & jsonConfig);
40 virtual void GetConfig (ArduinoJson::JsonObject & jsonConfig);
41 void GetDriverName (String & sDriverName) { sDriverName = CN_TM1814; }
42 virtual void GetStatus (ArduinoJson::JsonObject & jsonStatus);
43 virtual void SetOutputBufferSize (uint32_t NumChannelsAvailable);
44
45protected:
46
47#define TM1814_PIXEL_DATA_RATE 800000.0
48#define TM1814_PIXEL_NS_BIT_TOTAL ((1.0 / TM1814_PIXEL_DATA_RATE) * NanoSecondsInASecond)
49
50#define TM1814_PIXEL_NS_BIT_0_LOW 375.0 // 360ns +/- 50ns per datasheet
51#define TM1814_PIXEL_NS_BIT_0_HIGH (TM1814_PIXEL_NS_BIT_TOTAL - TM1814_PIXEL_NS_BIT_0_LOW)
52
53#define TM1814_PIXEL_NS_BIT_1_LOW 800.0 // 720ns -70ns / +280ns per datasheet
54#define TM1814_PIXEL_NS_BIT_1_HIGH (TM1814_PIXEL_NS_BIT_TOTAL - TM1814_PIXEL_NS_BIT_1_LOW)
55
56#define TM1814_PIXEL_NS_IDLE 500000.0 // 500us per datasheet
57#define TM1814_MIN_IDLE_TIME_US (TM1814_PIXEL_NS_IDLE / float(NanoSecondsInAMicroSecond))
58
59#define TM1814_DEFAULT_INTENSITY_PER_PIXEL 3
60
61private:
62
63 uint8_t CurrentLimit = 50;
64 struct PreambleData_t
65 {
66 uint8_t normal[4];
67 uint8_t inverted[4];
68 };
69 PreambleData_t PreambleData;
70
71}; // c_OutputTM1814
72
73#endif // def SUPPORT_OutputProtocol_TM1814
const CN_PROGMEM char CN_TM1814[]
Definition ConstNames.cpp:227
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
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
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