ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputTM1814Rmt.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
* OutputTM1814Rmt.h - TM1814 driver code for ESPixelStick RMT Channel
4
*
5
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6
* Copyright (c) 2015, 2024 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_TM1814) && defined (ARDUINO_ARCH_ESP32)
26
27
#include "
OutputTM1814.hpp
"
28
#include "
OutputRmt.hpp
"
29
30
class
c_OutputTM1814Rmt :
public
c_OutputTM1814
31
{
32
public
:
33
// These functions are inherited from c_OutputCommon
34
c_OutputTM1814Rmt (
OM_OutputPortDefinition_t
& OutputPortDefinition,
35
c_OutputMgr::e_OutputProtocolType
outputType);
36
virtual
~c_OutputTM1814Rmt ();
37
38
// functions to be provided by the derived class
39
void
Begin ();
40
bool
SetConfig
(ArduinoJson::JsonObject& jsonConfig);
41
uint32_t Poll ();
42
bool
RmtPoll ();
43
void
GetStatus (ArduinoJson::JsonObject& jsonStatus);
44
void
SetOutputBufferSize (uint32_t NumChannelsAvailable);
45
void
PauseOutput(
bool
State);
46
bool
ISR_GetNextBitToSend (rmt_item32_t &DataToSend);
47
void
StartNewDataFrame();
48
49
private
:
50
51
// The adjustments compensate for rounding errors in the calculations
52
#define TM1814_PIXEL_RMT_TICKS_BIT_0_HIGH uint16_t ( (TM1814_PIXEL_NS_BIT_0_HIGH / RMT_TickLengthNS) + 0.0)
53
#define TM1814_PIXEL_RMT_TICKS_BIT_0_LOW uint16_t ( (TM1814_PIXEL_NS_BIT_0_LOW / RMT_TickLengthNS) + 0.0)
54
#define TM1814_PIXEL_RMT_TICKS_BIT_1_HIGH uint16_t ( (TM1814_PIXEL_NS_BIT_1_HIGH / RMT_TickLengthNS) + 0.0)
55
#define TM1814_PIXEL_RMT_TICKS_BIT_1_LOW uint16_t ( (TM1814_PIXEL_NS_BIT_1_LOW / RMT_TickLengthNS) + 1.0)
56
#define TM1814_PIXEL_RMT_TICKS_IDLE uint16_t ( (TM1814_PIXEL_NS_IDLE / RMT_TickLengthNS) + 1.0)
57
58
rmt_item32_t ZeroBit;
59
rmt_item32_t OneBit;
60
rmt_item32_t IfgBit;
61
uint32_t IfgBitCount;
62
uint32_t IfgBitCurrentCount;
63
uint32_t DataPattern;
64
uint32_t DataPatternMask;
65
66
// #define TM1814_RMT_DEBUG_COUNTERS
67
#ifdef TM1814_RMT_DEBUG_COUNTERS
68
#define INC_TM1814_RMT_DEBUG_COUNTERS(c) (++RmtDebugCounters.c)
69
struct
70
{
71
uint32_t GetNextBit = 0;
72
uint32_t FrameStarts = 0;
73
uint32_t FrameEnds = 0;
74
uint32_t BreakBits = 0;
75
uint32_t MabBits = 0;
76
uint32_t StartBits = 0;
77
uint32_t DataBits = 0;
78
uint32_t StopBits = 0;
79
uint32_t Underrun = 0;
80
} RmtDebugCounters;
81
#else
82
#define INC_TM1814_RMT_DEBUG_COUNTERS(c)
83
#endif
// def TM1814_RMT_DEBUG_COUNTERS
84
85
c_OutputRmt Rmt;
86
87
};
// c_OutputTM1814Rmt
88
89
#endif
// defined (SUPPORT_OutputProtocol_TM1814) && defined (ARDUINO_ARCH_ESP32)
ESPixelStick.h
OutputRmt.hpp
OutputTM1814.hpp
c_OutputMgr::e_OutputProtocolType
e_OutputProtocolType
Definition
OutputMgr.hpp:78
SetConfig
void SetConfig(const char *DataString)
Definition
main.cpp:329
OM_OutputPortDefinition_t
Definition
OutputMgrPortDefs.hpp:90
include
output
OutputTM1814Rmt.hpp
Generated by
1.12.0