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