Files
esphome-dmx512/components/dmx512/dmx512esp32.h
sillyfrog 234b55ff8b Support for ESP32 with only 2 UART (#33)
Don't require U2TXD_OUT_IDX to be set (for ESP32-S2 chips), Update README regardin UART count

---------

Co-authored-by: Sillyfrog <sillyfrog@users.noreply.github.com>
2024-12-02 18:32:55 +01:00

34 lines
608 B
C++

#pragma once
#ifdef USE_ESP32_FRAMEWORK_ARDUINO
#include "dmx512.h"
#include "esp32-hal-matrix.h"
namespace esphome {
namespace dmx512 {
class DMX512ESP32 : public DMX512 {
public:
DMX512ESP32() = default;
void send_break() override;
void set_uart_num(int num) override {
if(num == 0) {
this->uart_idx_ = U0TXD_OUT_IDX;
} else if(num == 1) {
this->uart_idx_ = U1TXD_OUT_IDX;
#ifdef U2TXD_OUT_IDX
} else if(num == 2) {
this->uart_idx_ = U2TXD_OUT_IDX;
#endif
}
}
};
} // namespace dmx512
} // namespace esphome
#endif // USE_ESP32_FRAMEWORK_ARDUINO