Improv Serial support via USB CDC and JTAG (#5559)

This commit is contained in:
Keith Burzinski
2023-10-19 01:53:09 -05:00
committed by Jesse Hills
parent 8c2d9101d5
commit 11dba3147d
5 changed files with 189 additions and 54 deletions
@@ -14,6 +14,13 @@
#endif
#ifdef USE_ESP_IDF
#include <driver/uart.h>
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6) || defined(USE_ESP32_VARIANT_ESP32S3) || \
defined(USE_ESP32_VARIANT_ESP32H2)
#include <driver/usb_serial_jtag.h>
#endif
#if defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
#include <esp_private/usb_console.h>
#endif
#endif
namespace esphome {
@@ -26,6 +33,7 @@ enum ImprovSerialType : uint8_t {
TYPE_RPC_RESPONSE = 0x04
};
static const uint16_t IMPROV_SERIAL_TIMEOUT = 100;
static const uint8_t IMPROV_SERIAL_VERSION = 1;
class ImprovSerialComponent : public Component, public improv_base::ImprovBase {
@@ -48,8 +56,7 @@ class ImprovSerialComponent : public Component, public improv_base::ImprovBase {
std::vector<uint8_t> build_rpc_settings_response_(improv::Command command);
std::vector<uint8_t> build_version_info_();
int available_();
uint8_t read_byte_();
optional<uint8_t> read_byte_();
void write_data_(std::vector<uint8_t> &data);
#ifdef USE_ARDUINO