ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputUCS8903.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* OutputUCS8903.h - UCS8903 driver code for ESPixelStick
4*
5* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6* Copyright (c) 2015 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 "OutputPixel.hpp"
26
27#ifdef SUPPORT_OutputType_UCS8903
28#ifdef ARDUINO_ARCH_ESP32
29# include <driver/uart.h>
30#endif
31
32class c_OutputUCS8903 : public c_OutputPixel
33{
34public:
35 // These functions are inherited from c_OutputCommon
36 c_OutputUCS8903 (c_OutputMgr::e_OutputChannelIds OutputChannelId,
37 gpio_num_t outputGpio,
38 uart_port_t uart,
39 c_OutputMgr::e_OutputType outputType);
40 virtual ~c_OutputUCS8903 ();
41
42 // functions to be provided by the derived class
43 virtual void Begin ();
44 virtual bool SetConfig (ArduinoJson::JsonObject & jsonConfig);
45 virtual void GetConfig (ArduinoJson::JsonObject & jsonConfig);
46 void GetDriverName (String & sDriverName) { sDriverName = CN_UCS8903; }
47 virtual void GetStatus (ArduinoJson::JsonObject& jsonStatus);
48 virtual void SetOutputBufferSize (uint32_t NumChannelsAvailable);
49
50protected:
51
52// #define UCS8903_PIXEL_DATA_RATE 800000.0
53#define UCS8903_PIXEL_DATA_RATE (1 / ((UCS8903_PIXEL_NS_BIT_TOTAL) / NanoSecondsInASecond ))
54// #define UCS8903_PIXEL_NS_BIT_TOTAL ((1.0 / UCS8903_PIXEL_DATA_RATE) * NanoSecondsInASecond)
55#define UCS8903_PIXEL_NS_BIT_TOTAL (UCS8903_PIXEL_NS_BIT_0_HIGH + UCS8903_PIXEL_NS_BIT_0_LOW)
56
57#define UCS8903_PIXEL_NS_BIT_0_HIGH 400.0 // 400ns +/- 40ns per datasheet
58#define UCS8903_PIXEL_NS_BIT_0_LOW 800.0 // 800ns -0 per data sheet
59
60#define UCS8903_PIXEL_NS_BIT_1_HIGH 800.0 // 800ns +/- 150ns per datasheet
61#define UCS8903_PIXEL_NS_BIT_1_LOW 400.0 // 400ns -0 per data sheet
62
63#define UCS8903_PIXEL_IDLE_TIME_NS 30000.0 // >24us per datasheet
64#define UCS8903_PIXEL_IDLE_TIME_US (UCS8903_PIXEL_IDLE_TIME_NS / float(NanoSecondsInAMicroSecond))
65#define UCS8903_INTENSITY_DATA_WIDTH 16
66
67}; // c_OutputUCS8903
68#endif // def SUPPORT_OutputType_UCS8903
const CN_PROGMEM char CN_UCS8903[]
Definition ConstNames.cpp:219
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