ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputTLS3001.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* OutputTLS3001.h - TLS3001 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_OutputType_TLS3001
26
27#include "OutputPixel.hpp"
28
29class c_OutputTLS3001 : public c_OutputPixel
30{
31public:
32 // These functions are inherited from c_OutputCommon
33 c_OutputTLS3001 (c_OutputMgr::e_OutputChannelIds OutputChannelId,
34 gpio_num_t outputGpio,
35 uart_port_t uart,
36 c_OutputMgr::e_OutputType outputType);
37 virtual ~c_OutputTLS3001 ();
38
39 // functions to be provided by the derived class
40 virtual void Begin () { c_OutputPixel::Begin (); }
41 virtual bool SetConfig (ArduinoJson::JsonObject& jsonConfig);
42 virtual void GetConfig (ArduinoJson::JsonObject& jsonConfig);
43 void GetDriverName (String& sDriverName) { sDriverName = CN_TLS3001; }
44 virtual void GetStatus (ArduinoJson::JsonObject & jsonStatus);
45 virtual void SetOutputBufferSize (uint32_t NumChannelsAvailable);
46
47protected:
48
49#define TLS3001_PIXEL_DATA_RATE 500000.0
50#define TLS3001_PIXEL_NS_BIT ((1.0 / TLS3001_PIXEL_DATA_RATE) * NanoSecondsInASecond)
51
52#define TLS3001_PIXEL_NS_IDLE 50000.0 // 50us
53#define TLS3001_MIN_IDLE_TIME_US (TLS3001_PIXEL_NS_IDLE / float(NanoSecondsInAMicroSecond))
54
55#define TLS3001_DEFAULT_INTENSITY_PER_PIXEL 3
56/*
57 Frame Start = 15 1s Always followed by four bit Frame Type
58
59 Frame Types
60 Sync 0b0001 Followed by 15 0s followed by an idle period
61 Reset 0b0100 Followed by long idle time (calculation needed)
62 Data 0b0010 Followed by 39 bit data times num pixels
63
64 39 bit data
65 1 zero
66 12 R
67 1 zero
68 12 g
69 1 zero
70 12 b
71*/
72#define TLS3001_MAX_CONSECUTIVE_DATA_FRAMES 50
73
74private:
75
76 uint8_t CurrentLimit = 50;
77 struct PreambleData_t
78 {
79 uint8_t normal[4];
80 uint8_t inverted[4];
81 };
82 PreambleData_t PreambleData;
83
84}; // c_OutputTLS3001
85
86#endif // def SUPPORT_OutputType_TLS3001
const CN_PROGMEM char CN_TLS3001[]
Definition ConstNames.cpp:209
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
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
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