ESPHome 2025.5.0
Loading...
Searching...
No Matches
uart_component_host.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef USE_HOST
4
6#include "esphome/core/log.h"
7#include "uart_component.h"
8
9namespace esphome {
10namespace uart {
11
13 public:
14 virtual ~HostUartComponent();
15 void setup() override;
16 void dump_config() override;
17 float get_setup_priority() const override { return setup_priority::BUS; }
18 void write_array(const uint8_t *data, size_t len) override;
19 bool peek_byte(uint8_t *data) override;
20 bool read_array(uint8_t *data, size_t len) override;
21 int available() override;
22 void flush() override;
23 void set_name(std::string port_name) { port_name_ = port_name; };
24
25 protected:
26 void update_error_(const std::string &error);
27 void check_logger_conflict() override {}
28 std::string port_name_;
29 std::string first_error_{""};
31 bool has_peek_{false};
32 uint8_t peek_byte_;
33};
34
35} // namespace uart
36} // namespace esphome
37
38#endif // USE_HOST
bool read_array(uint8_t *data, size_t len) override
float get_setup_priority() const override
void write_array(const uint8_t *data, size_t len) override
void update_error_(const std::string &error)
void set_name(std::string port_name)
bool peek_byte(uint8_t *data) override
const float BUS
For communication buses like i2c/spi.
Definition component.cpp:16
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:301