ESPixelStick Firmware
Firmware for the ESPixelStick
Loading...
Searching...
No Matches
InputE131.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
* E131Input.h - Code to wrap ESPAsyncE131 for input
4
*
5
* Project: ESPixelStick - An ESP8266 / ESP32 and E1.31 based pixel driver
6
* Copyright (c) 2021, 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
*/
20
21
#include "
InputCommon.hpp
"
22
#include <ESPAsyncE131.h>
23
24
class
c_InputE131
:
public
c_InputCommon
25
{
26
private
:
27
static
const
uint16_t
UNIVERSE_MAX
= 512;
28
static
const
char
ConfigFileName
[];
29
static
const
uint8_t
MAX_NUM_UNIVERSES
= (
OM_MAX_NUM_CHANNELS
/
UNIVERSE_MAX
) + 1;
30
31
byte
_e131
[
sizeof
(ESPAsyncE131)];
32
#define e131 static_cast<ESPAsyncE131>(*(&_e131[0]))
33
ESPAsyncE131 *
pE131
=
nullptr
;
34
35
// e131_packet_t packet; ///< Packet buffer for parsing
36
38
uint16_t
startUniverse
= 1;
39
uint16_t
LastUniverse
= 1;
40
uint16_t
ChannelsPerUniverse
= 512;
41
uint16_t
FirstUniverseChannelOffset
= 1;
42
ESPAsyncE131PortId
PortId
= E131_DEFAULT_PORT;
43
bool
ESPAsyncE131Initialized
=
false
;
44
46
uint16_t
channel_count
= 0;
47
48
struct
Universe_t
49
{
50
uint32_t
DestinationOffset
;
51
uint32_t
BytesToCopy
;
52
uint32_t
SourceDataOffset
;
53
uint8_t
SequenceNumber
;
54
uint32_t
SequenceErrorCounter
;
55
};
56
Universe_t
UniverseArray
[
MAX_NUM_UNIVERSES
];
57
58
void
validateConfiguration
();
59
void
NetworkStateChanged
(
bool
IsConnected,
bool
RebootAllowed);
// used by poorly designed rx functions
60
void
SetBufferTranslation
();
61
62
public
:
63
64
c_InputE131
(
c_InputMgr::e_InputChannelIds
NewInputChannelId,
65
c_InputMgr::e_InputType
NewChannelType,
66
uint32_t BufferSize);
67
virtual
~c_InputE131
();
68
69
// functions to be provided by the derived class
70
void
Begin
();
71
bool
SetConfig
(JsonObject & jsonConfig);
72
void
GetConfig
(JsonObject & jsonConfig);
73
void
GetStatus
(JsonObject & jsonStatus);
74
void
Process
();
75
void
GetDriverName
(String & sDriverName) { sDriverName =
"E1.31"
; }
76
void
SetBufferInfo
(uint32_t BufferSize);
77
void
NetworkStateChanged
(
bool
IsConnected);
// used by poorly designed rx functions
78
bool
isShutDownRebootNeeded
() {
return
HasBeenInitialized
; }
79
void
ProcessIncomingE131Data
(e131_packet_t *);
80
};
InputCommon.hpp
OM_MAX_NUM_CHANNELS
#define OM_MAX_NUM_CHANNELS
Definition
OutputMgr.hpp:198
c_InputCommon
Definition
InputCommon.hpp:27
c_InputCommon::HasBeenInitialized
bool HasBeenInitialized
Definition
InputCommon.hpp:51
c_InputE131
Definition
InputE131.hpp:25
c_InputE131::LastUniverse
uint16_t LastUniverse
Last Universe to listen for.
Definition
InputE131.hpp:39
c_InputE131::UNIVERSE_MAX
static const uint16_t UNIVERSE_MAX
Definition
InputE131.hpp:27
c_InputE131::validateConfiguration
void validateConfiguration()
Definition
InputE131.cpp:302
c_InputE131::pE131
ESPAsyncE131 * pE131
Definition
InputE131.hpp:33
c_InputE131::ProcessIncomingE131Data
void ProcessIncomingE131Data(e131_packet_t *)
Definition
InputE131.cpp:143
c_InputE131::ConfigFileName
static const char ConfigFileName[]
Definition
InputE131.hpp:28
c_InputE131::startUniverse
uint16_t startUniverse
JSON configuration parameters.
Definition
InputE131.hpp:38
c_InputE131::Process
void Process()
Call from loop(), renders Input data.
Definition
InputE131.cpp:134
c_InputE131::PortId
ESPAsyncE131PortId PortId
Definition
InputE131.hpp:42
c_InputE131::_e131
byte _e131[sizeof(ESPAsyncE131)]
Definition
InputE131.hpp:31
c_InputE131::~c_InputE131
virtual ~c_InputE131()
Definition
InputE131.cpp:39
c_InputE131::c_InputE131
c_InputE131(c_InputMgr::e_InputChannelIds NewInputChannelId, c_InputMgr::e_InputType NewChannelType, uint32_t BufferSize)
Definition
InputE131.cpp:24
c_InputE131::NetworkStateChanged
void NetworkStateChanged(bool IsConnected, bool RebootAllowed)
Definition
InputE131.cpp:367
c_InputE131::ChannelsPerUniverse
uint16_t ChannelsPerUniverse
Universe boundary limit.
Definition
InputE131.hpp:40
c_InputE131::channel_count
uint16_t channel_count
from sketch globals
Definition
InputE131.hpp:46
c_InputE131::GetStatus
void GetStatus(JsonObject &jsonStatus)
Definition
InputE131.cpp:103
c_InputE131::SetBufferTranslation
void SetBufferTranslation()
Definition
InputE131.cpp:227
c_InputE131::ESPAsyncE131Initialized
bool ESPAsyncE131Initialized
Definition
InputE131.hpp:43
c_InputE131::FirstUniverseChannelOffset
uint16_t FirstUniverseChannelOffset
Channel to start listening at - 1 based.
Definition
InputE131.hpp:41
c_InputE131::GetConfig
void GetConfig(JsonObject &jsonConfig)
Get the current config used by the driver.
Definition
InputE131.cpp:89
c_InputE131::GetDriverName
void GetDriverName(String &sDriverName)
get the name for the instantiated driver
Definition
InputE131.hpp:75
c_InputE131::Begin
void Begin()
set up the operating environment based on the current config (or defaults)
Definition
InputE131.cpp:48
c_InputE131::MAX_NUM_UNIVERSES
static const uint8_t MAX_NUM_UNIVERSES
Definition
InputE131.hpp:29
c_InputE131::SetBufferInfo
void SetBufferInfo(uint32_t BufferSize)
Definition
InputE131.cpp:207
c_InputE131::isShutDownRebootNeeded
bool isShutDownRebootNeeded()
Definition
InputE131.hpp:78
c_InputE131::SetConfig
bool SetConfig(JsonObject &jsonConfig)
Set a new config in the driver.
Definition
InputE131.cpp:274
c_InputE131::UniverseArray
Universe_t UniverseArray[MAX_NUM_UNIVERSES]
Definition
InputE131.hpp:56
c_InputMgr::e_InputType
e_InputType
Definition
InputMgr.hpp:72
c_InputMgr::e_InputChannelIds
e_InputChannelIds
Definition
InputMgr.hpp:40
c_InputE131::Universe_t
Definition
InputE131.hpp:49
c_InputE131::Universe_t::SequenceErrorCounter
uint32_t SequenceErrorCounter
Definition
InputE131.hpp:54
c_InputE131::Universe_t::DestinationOffset
uint32_t DestinationOffset
Definition
InputE131.hpp:50
c_InputE131::Universe_t::SequenceNumber
uint8_t SequenceNumber
Definition
InputE131.hpp:53
c_InputE131::Universe_t::SourceDataOffset
uint32_t SourceDataOffset
Definition
InputE131.hpp:52
c_InputE131::Universe_t::BytesToCopy
uint32_t BytesToCopy
Definition
InputE131.hpp:51
include
input
InputE131.hpp
Generated by
1.12.0