1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-22 03:33:52 +01:00
Files
esphome/esphome/components/uart/uart_component_libretiny.h
Kuba Szczodrzyński a9630ac847 Support for LibreTiny platform (RTL8710, BK7231 & other modules) (#3509)
Co-authored-by: Kuba Szczodrzyński <kuba@szczodrzynski.pl>
Co-authored-by: Sam Neirinck <git@samneirinck.com>
Co-authored-by: David Buezas <dbuezas@users.noreply.github.com>
Co-authored-by: Stroe Andrei Catalin <catalin2402@gmail.com>
Co-authored-by: Sam Neirinck <github@samneirinck.be>
Co-authored-by: Péter Sárközi <xmisterhu@gmail.com>
Co-authored-by: Hajo Noerenberg <hn@users.noreply.github.com>
2023-09-05 10:16:08 +12:00

44 lines
990 B
C++

#pragma once
#ifdef USE_LIBRETINY
#include <vector>
#include "esphome/core/component.h"
#include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "uart_component.h"
namespace esphome {
namespace uart {
class LibreTinyUARTComponent : public UARTComponent, public Component {
public:
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;
int available() override;
void flush() override;
uint16_t get_config();
HardwareSerial *get_hw_serial() { return this->serial_; }
int8_t get_hw_serial_number() { return this->hardware_idx_; }
protected:
void check_logger_conflict() override;
HardwareSerial *serial_{nullptr};
int8_t hardware_idx_{-1};
};
} // namespace uart
} // namespace esphome
#endif // USE_LIBRETINY