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

Add host target platform (#4783)

Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
Jesse Hills
2023-05-10 11:38:18 +12:00
committed by GitHub
parent 8c32941428
commit c835b67bac
24 changed files with 448 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ namespace esphome {
namespace logger {
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040)
/** Enum for logging UART selection
*
* Advanced configuration (pin selection, etc) is not supported.
@@ -52,6 +53,7 @@ enum UARTSelection {
UART_SELECTION_USB_CDC,
#endif // USE_RP2040
};
#endif // USE_ESP32 || USE_ESP8266
class Logger : public Component {
public:
@@ -66,10 +68,11 @@ 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)
void set_uart_selection(UARTSelection uart_selection) { uart_ = uart_selection; }
/// Get the UART used by the logger.
UARTSelection get_uart() const;
#endif
/// Set the log level of the specified tag.
void set_log_level(const std::string &tag, int log_level);
@@ -139,7 +142,9 @@ class Logger : public Component {
char *tx_buffer_{nullptr};
int tx_buffer_at_{0};
int tx_buffer_size_{0};
#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040)
UARTSelection uart_{UART_SELECTION_UART0};
#endif
#ifdef USE_ARDUINO
Stream *hw_serial_{nullptr};
#endif