Fix some bugs from merging and add second dmx interface

This commit is contained in:
Patrick Schwarz 2024-11-24 14:42:59 +01:00
parent 50c37dc80a
commit e53f897aac
5 changed files with 150 additions and 121 deletions

View file

@ -1,4 +1,5 @@
#include <inttypes.h>
#include <HardwareSerial.h>
#ifndef ESPDMX_h
#define ESPDMX_h
@ -7,7 +8,9 @@
#define DMXFORMAT SERIAL_8N2
#define BREAKSPEED 83333
#define BREAKFORMAT SERIAL_8N1
#define SERIALPORT Serial0
#define DMX_DEFAULT_PORT Serial0
#define DMX_DEFAULT_TX 21
#define DMX_DEFAULT_RX 33
#define DMXCHANNELS 512
class DMXESPSerial
@ -15,14 +18,20 @@ class DMXESPSerial
public:
int sendPin;
int recvPin;
HardwareSerial *port;
bool dmxStarted;
uint8_t dmxDataStore[DMXCHANNELS + 1];
void init(int pinSend, int pinRecv);
uint8_t read(int Channel);
void init(int pinSend, int pinRecv, HardwareSerial& port);
uint8_t read(int channel);
uint8_t* readAll();
void write(int channel, uint8_t value);
void update();
void end();
private:
// Member variables
HardwareSerial* _Serial;
};
#endif