ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputUCS1903.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* OutputUCS1903.h - UCS1903 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
25#include "ESPixelStick.h"
26#ifdef SUPPORT_OutputProtocol_UCS1903
27
28#include "OutputPixel.hpp"
29
30class c_OutputUCS1903 : public c_OutputPixel
31{
32public:
33 // These functions are inherited from c_OutputCommon
34 c_OutputUCS1903 (OM_OutputPortDefinition_t & OutputPortDefinition,
36 virtual ~c_OutputUCS1903 ();
37
38 // functions to be provided by the derived class
39 virtual void Begin ();
40 virtual bool SetConfig (ArduinoJson::JsonObject & jsonConfig);
41 virtual void GetConfig (ArduinoJson::JsonObject & jsonConfig);
42 void GetDriverName (String & sDriverName) { sDriverName = CN_UCS1903; }
43 virtual void GetStatus (ArduinoJson::JsonObject & jsonStatus);
44 virtual void SetOutputBufferSize (uint32_t NumChannelsAvailable);
45
46protected:
47
48#define UCS1903_PIXEL_DATA_RATE 800000.0
49#define UCS1903_PIXEL_NS_BIT_TOTAL ( (1.0 / UCS1903_PIXEL_DATA_RATE) * NanoSecondsInASecond)
50
51#define UCS1903_PIXEL_NS_BIT_0_HIGH 250.0 // 250ns +/- 150ns per datasheet
52#define UCS1903_PIXEL_NS_BIT_0_LOW (UCS1903_PIXEL_NS_BIT_TOTAL - UCS1903_PIXEL_NS_BIT_0_HIGH)
53
54#define UCS1903_PIXEL_NS_BIT_1_HIGH 1000.0 // 1000ns +/- 150ns per datasheet
55#define UCS1903_PIXEL_NS_BIT_1_LOW (UCS1903_PIXEL_NS_BIT_TOTAL - UCS1903_PIXEL_NS_BIT_1_HIGH)
56
57#define UCS1903_PIXEL_IDLE_TIME_NS 25000.0 // 24us per datasheet
58#define UCS1903_PIXEL_IDLE_TIME_US (UCS1903_PIXEL_IDLE_TIME_NS / float(NanoSecondsInAMicroSecond))
59
60#define UCS1903_PIXEL_BITS_PER_INTENSITY 8
61
62}; // c_OutputUCS1903
63
64#endif // def SUPPORT_OutputProtocol_UCS1903
const CN_PROGMEM char CN_UCS1903[]
Definition ConstNames.cpp:237
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