ESPHome  2024.10.2
uart_component_esp32_arduino.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ESP32_FRAMEWORK_ARDUINO
4 
5 #include <driver/uart.h>
6 #include <HardwareSerial.h>
7 #include <vector>
9 #include "esphome/core/hal.h"
10 #include "esphome/core/log.h"
11 #include "uart_component.h"
12 
13 namespace esphome {
14 namespace uart {
15 
17  public:
18  void setup() override;
19  void dump_config() override;
20  float get_setup_priority() const override { return setup_priority::BUS; }
21 
22  void write_array(const uint8_t *data, size_t len) override;
23 
24  bool peek_byte(uint8_t *data) override;
25  bool read_array(uint8_t *data, size_t len) override;
26 
27  int available() override;
28  void flush() override;
29 
30  uint32_t get_config();
31 
32  HardwareSerial *get_hw_serial() { return this->hw_serial_; }
33  uint8_t get_hw_serial_number() { return this->number_; }
34 
47  void load_settings(bool dump_config) override;
48  void load_settings() override { this->load_settings(true); }
49 
50  protected:
51  void check_logger_conflict() override;
52 
53  HardwareSerial *hw_serial_{nullptr};
54  uint8_t number_{0};
55 };
56 
57 } // namespace uart
58 } // namespace esphome
59 
60 #endif // USE_ESP32_FRAMEWORK_ARDUINO
bool read_array(uint8_t *data, size_t len) override
const float BUS
For communication buses like i2c/spi.
Definition: component.cpp:16
void write_array(const uint8_t *data, size_t len) override
std::string size_t len
Definition: helpers.h:292
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7