ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputAPA102.hpp
Go to the documentation of this file.
1#pragma once
2/*
3* OutputAPA102.h - APA102 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#if defined(SUPPORT_OutputProtocol_APA102)
26
27#include "OutputPixel.hpp"
28
29class c_OutputAPA102 : public c_OutputPixel
30{
31public:
32 // These functions are inherited from c_OutputCommon
33 c_OutputAPA102 (OM_OutputPortDefinition_t & OutputPortDefinition,
35 virtual ~c_OutputAPA102 ();
36
37 // functions to be provided by the derived class
38 virtual bool SetConfig (ArduinoJson::JsonObject & jsonConfig);
39 virtual void GetConfig (ArduinoJson::JsonObject & jsonConfig);
40 void GetDriverName (String & sDriverName) { sDriverName = "APA102"; }
41 virtual void GetStatus (ArduinoJson::JsonObject & jsonStatus);
42 virtual void SetOutputBufferSize (uint32_t NumChannelsAvailable);
43
44protected:
45
46#define APA102_BIT_RATE (APB_CLK_FREQ/80)
47#define APA102_BITS_PER_INTENSITY 8
48#define APA102_MICRO_SEC_PER_INTENSITY int ( ( (1.0/float (APA102_BIT_RATE)) * APA102_BITS_PER_INTENSITY))
49#define APA102_MIN_IDLE_TIME_US 500
50 uint16_t BlockSize = 1;
51 float BlockDelay = 0;
52 const uint32_t FrameStartData = 0;
53 const uint32_t FrameEndData = 0xFFFFFFFF;
54 const uint8_t PixelStartData = 0xFF; // Max driving current
55
56}; // c_OutputAPA102
57
58#endif // defined(SUPPORT_OutputProtocol_APA102)
virtual void GetDriverName(String &sDriverName)=0
get the name for the instantiated driver
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