1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-25 06:32:22 +01:00

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>
This commit is contained in:
Kuba Szczodrzyński
2023-09-05 00:16:08 +02:00
committed by GitHub
parent 22c0b0abaa
commit a9630ac847
78 changed files with 6085 additions and 89 deletions

View File

@@ -25,12 +25,18 @@ namespace esphome {
namespace logger {
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040)
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY)
/** Enum for logging UART selection
*
* Advanced configuration (pin selection, etc) is not supported.
*/
enum UARTSelection {
#ifdef USE_LIBRETINY
UART_SELECTION_DEFAULT = 0,
UART_SELECTION_UART0,
UART_SELECTION_UART1,
UART_SELECTION_UART2,
#else
UART_SELECTION_UART0 = 0,
UART_SELECTION_UART1,
#if defined(USE_ESP32)
@@ -53,8 +59,9 @@ enum UARTSelection {
#ifdef USE_RP2040
UART_SELECTION_USB_CDC,
#endif // USE_RP2040
#endif // USE_LIBRETINY
};
#endif // USE_ESP32 || USE_ESP8266
#endif // USE_ESP32 || USE_ESP8266 || USE_RP2040 || USE_LIBRETINY
class Logger : public Component {
public:
@@ -69,7 +76,7 @@ class Logger : public Component {
#ifdef USE_ESP_IDF
uart_port_t get_uart_num() const { return uart_num_; }
#endif
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040)
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY)
void set_uart_selection(UARTSelection uart_selection) { uart_ = uart_selection; }
/// Get the UART used by the logger.
UARTSelection get_uart() const;
@@ -146,6 +153,9 @@ class Logger : public Component {
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040)
UARTSelection uart_{UART_SELECTION_UART0};
#endif
#ifdef USE_LIBRETINY
UARTSelection uart_{UART_SELECTION_DEFAULT};
#endif
#ifdef USE_ARDUINO
Stream *hw_serial_{nullptr};
#endif