// // Created by illyum on 8/15/2024. // #ifndef DMX_H #define DMX_H #include #include #include #include #include "serial_port.h" const int DMX_BAUD_RATE = 250000; struct DMXFixture { unsigned char r, g, b; int channel; }; class DMXEngine { public: DMXEngine(const char* portName); ~DMXEngine(); void start(); void stop(); void setChannelValue(int channel, unsigned char value); private: void configurePort(); void sendDMXData(); void dumpZeros(); static void dmxThreadFunc(DMXEngine* engine); SerialPort* serialPort; std::vector buffer; std::thread dmxThread; bool running; static const int DMX_CHANNELS = 512; }; #endif // DMX_H