LumaShow/src/dmx.h

40 lines
709 B
C
Raw Normal View History

2024-08-15 20:44:16 -06:00
//
// Created by illyum on 8/15/2024.
//
2024-08-16 02:17:43 -06:00
#ifndef DMX_H
#define DMX_H
2024-08-15 20:44:16 -06:00
2024-08-16 02:17:43 -06:00
#include <vector>
#include <tuple>
#include <atomic>
#include <thread>
struct DMXFixture {
unsigned char r, g, b;
int channel;
};
class DMXEngine {
public:
explicit DMXEngine(const char* portName, int baudRate = 250000, int dataSize = 512);
~DMXEngine();
void start();
void stop();
void setChannelValue(int channel, unsigned char value);
private:
void sendDMXData();
void dumpZeros();
void configurePort();
static void dmxThreadFunc(DMXEngine* engine);
void* hSerial;
std::atomic<bool> running;
std::vector<unsigned char> buffer;
std::thread dmxThread;
};
#endif // DMX_H