ESPHome  2024.12.2
uart_component_libretiny.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_LIBRETINY
4 
5 #include <vector>
7 #include "esphome/core/hal.h"
8 #include "esphome/core/log.h"
9 #include "uart_component.h"
10 
11 namespace esphome {
12 namespace uart {
13 
15  public:
16  void setup() override;
17  void dump_config() override;
18  float get_setup_priority() const override { return setup_priority::BUS; }
19 
20  void write_array(const uint8_t *data, size_t len) override;
21 
22  bool peek_byte(uint8_t *data) override;
23  bool read_array(uint8_t *data, size_t len) override;
24 
25  int available() override;
26  void flush() override;
27 
28  uint16_t get_config();
29 
30  HardwareSerial *get_hw_serial() { return this->serial_; }
31  int8_t get_hw_serial_number() { return this->hardware_idx_; }
32 
33  protected:
34  void check_logger_conflict() override;
35 
36  HardwareSerial *serial_{nullptr};
37  int8_t hardware_idx_{-1};
38 };
39 
40 } // namespace uart
41 } // namespace esphome
42 
43 #endif // USE_LIBRETINY
void write_array(const uint8_t *data, size_t len) override
const float BUS
For communication buses like i2c/spi.
Definition: component.cpp:16
bool read_array(uint8_t *data, size_t len) override
std::string size_t len
Definition: helpers.h:293
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7