Files
esphome-wake-up-light-ii/components/uart/uart_component_host.h
T
mangavalkandClaude Opus 5.5 1457e25d98 Update the patched UART component to ESPHome 2026.11.0
ESPHome 2026.11's tuya component calls uart.new_uart_component(), which the
2026.10.2 copy didn't have, so the build failed. Copy the UART component from
2026.11.0, reapply the PA13/PA14 patch, regenerate the patch file and point
the refs at v1.0.6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 00:31:45 +01:00

43 lines
1.2 KiB
C++

#pragma once
#ifdef USE_HOST
#include <utility>
#include "esphome/core/component.h"
#include "esphome/core/log.h"
#include "uart_component.h"
namespace esphome::uart {
class HostUartComponent final : public UARTComponent, public Component {
public:
~HostUartComponent();
void setup() override;
void dump_config() override;
float get_setup_priority() const override { return setup_priority::BUS; }
void write_array(const uint8_t *data, size_t len) override;
bool peek_byte(uint8_t *data) override;
bool read_array(uint8_t *data, size_t len) override;
size_t available() override;
UARTFlushResult flush() override;
/// Drive DTR/RTS. Returns false when the port is closed or the ioctl fails.
bool set_modem_control(bool dtr, bool rts);
bool get_dtr() const;
bool get_rts() const;
void set_name(std::string port_name) { this->port_name_ = std::move(port_name); }
protected:
void update_error_(const std::string &error);
int get_modem_bits_() const;
void check_logger_conflict() override {}
std::string port_name_;
std::string first_error_;
int file_descriptor_ = -1;
bool has_peek_{false};
uint8_t peek_byte_;
};
} // namespace esphome::uart
#endif // USE_HOST