ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
OutputSerialRmt.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
* OutputSerialRmt.h - WS2811 driver code for ESPixelStick RMT Channel
4
*
5
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6
* Copyright (c) 2015, 2025 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_FireGod) || defined(SUPPORT_OutputProtocol_DMX) || defined(SUPPORT_OutputProtocol_Serial) || defined(SUPPORT_OutputProtocol_Renard)) && defined(ARDUINO_ARCH_ESP32)
26
27
#include "
OutputSerial.hpp
"
28
#include "
OutputRmt.hpp
"
29
30
class
c_OutputSerialRmt :
public
c_OutputSerial
31
{
32
public
:
33
// These functions are inherited from c_OutputCommon
34
c_OutputSerialRmt (
OM_OutputPortDefinition_t
& OutputPortDefinition,
35
c_OutputMgr::e_OutputProtocolType
outputType);
36
virtual
~c_OutputSerialRmt ();
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
void
StartNewDataFrame();
47
bool
ISR_GetNextBitToSend(rmt_item32_t & DataToSend);
48
49
private
:
50
void
SetUpRmtBitTimes();
51
rmt_idle_level_t idle_level = rmt_idle_level_t::RMT_IDLE_LEVEL_HIGH;
52
53
c_OutputRmt Rmt;
54
55
rmt_item32_t BreakBit;
56
uint32_t BreakBitCount = 0;
57
rmt_item32_t MabBit;
58
uint32_t MabBitCount = 0;
59
rmt_item32_t StartBit;
60
uint32_t StartBitCount = 0;
61
rmt_item32_t DataBitArray[4];
// 00 / 01 / 10 / 11
62
uint32_t CurrentDataPairId = 0;
63
rmt_item32_t StopBit;
64
uint32_t StopBitCount = 0;
65
uint32_t DataPattern;
66
67
// #define SERIAL_RMT_DEBUG_COUNTERS
68
#ifdef SERIAL_RMT_DEBUG_COUNTERS
69
#define INC_SERIAL_RMT_DEBUG_COUNTERS(c) (++SerialRmtDebugCounters.c)
70
struct
71
{
72
uint32_t GetNextBit = 0;
73
uint32_t FrameStarts = 0;
74
uint32_t FrameEnds = 0;
75
uint32_t BreakBits = 0;
76
uint32_t MabBits = 0;
77
uint32_t StartBits = 0;
78
uint32_t DataBits = 0;
79
uint32_t StopBits = 0;
80
uint32_t Underrun = 0;
81
} SerialRmtDebugCounters;
82
#else
83
#define INC_SERIAL_RMT_DEBUG_COUNTERS(c)
84
#endif
// def SERIAL_RMT_DEBUG_COUNTERS
85
86
};
// c_OutputSerialRmt
87
88
#endif
// defined(SUPPORT_OutputProtocol_FireGod) || (defined(SUPPORT_OutputProtocol_DMX) || defined(SUPPORT_OutputProtocol_Serial) || defined(SUPPORT_OutputProtocol_Renard)) && defined(ARDUINO_ARCH_ESP32)
ESPixelStick.h
OutputRmt.hpp
OutputSerial.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
OutputSerialRmt.hpp
Generated by
1.12.0