mirror of
https://github.com/esphome/esphome.git
synced 2025-09-03 20:02:22 +01:00
remove old code
This commit is contained in:
@@ -44,9 +44,5 @@ async def to_code(config):
|
|||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
reset_output = await cg.get_variable(config[CONF_RESET_OUTPUT])
|
reset_output = await cg.get_variable(config[CONF_RESET_OUTPUT])
|
||||||
cg.add(var.set_reset_output(reset_output))
|
cg.add(var.set_reset_output(reset_output))
|
||||||
if CORE.using_arduino:
|
zephyr_add_prj_conf("CDC_ACM_DTE_RATE_CALLBACK_SUPPORT", True)
|
||||||
# week symbol do not work for some reason so use wrap instaed
|
|
||||||
cg.add_build_flag("-Wl,--wrap=tud_cdc_line_state_cb")
|
|
||||||
elif CORE.using_zephyr:
|
|
||||||
zephyr_add_prj_conf("CDC_ACM_DTE_RATE_CALLBACK_SUPPORT", True)
|
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
@@ -1,13 +1,7 @@
|
|||||||
#include "dfu.h"
|
#include "dfu.h"
|
||||||
#ifdef USE_ZEPHYR
|
|
||||||
#include <zephyr/device.h>
|
#include <zephyr/device.h>
|
||||||
#include <zephyr/drivers/uart.h>
|
#include <zephyr/drivers/uart.h>
|
||||||
#include <zephyr/drivers/uart/cdc_acm.h>
|
#include <zephyr/drivers/uart/cdc_acm.h>
|
||||||
#endif
|
|
||||||
#ifdef USE_ARRUINO
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include <Adafruit_TinyUSB.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace dfu {
|
namespace dfu {
|
||||||
@@ -18,7 +12,6 @@ volatile bool goto_dfu = false;
|
|||||||
#define DFU_DBL_RESET_MAGIC 0x5A1AD5 // SALADS
|
#define DFU_DBL_RESET_MAGIC 0x5A1AD5 // SALADS
|
||||||
uint32_t *dbl_reset_mem = ((uint32_t *) DFU_DBL_RESET_MEM);
|
uint32_t *dbl_reset_mem = ((uint32_t *) DFU_DBL_RESET_MEM);
|
||||||
|
|
||||||
#ifdef USE_ZEPHYR
|
|
||||||
#define DEVICE_AND_COMMA(node_id) DEVICE_DT_GET(node_id),
|
#define DEVICE_AND_COMMA(node_id) DEVICE_DT_GET(node_id),
|
||||||
|
|
||||||
const struct device *cdc_dev[] = {DT_FOREACH_STATUS_OKAY(zephyr_cdc_acm_uart, DEVICE_AND_COMMA)};
|
const struct device *cdc_dev[] = {DT_FOREACH_STATUS_OKAY(zephyr_cdc_acm_uart, DEVICE_AND_COMMA)};
|
||||||
@@ -28,14 +21,11 @@ static void cdc_dte_rate_callback(const struct device *, uint32_t rate) {
|
|||||||
goto_dfu = true;
|
goto_dfu = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void DeviceFirmwareUpdate::setup() {
|
void DeviceFirmwareUpdate::setup() {
|
||||||
#ifdef USE_ZEPHYR
|
|
||||||
for (int idx = 0; idx < ARRAY_SIZE(cdc_dev); idx++) {
|
for (int idx = 0; idx < ARRAY_SIZE(cdc_dev); idx++) {
|
||||||
cdc_acm_dte_rate_callback_set(cdc_dev[idx], cdc_dte_rate_callback);
|
cdc_acm_dte_rate_callback_set(cdc_dev[idx], cdc_dte_rate_callback);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceFirmwareUpdate::loop() {
|
void DeviceFirmwareUpdate::loop() {
|
||||||
@@ -49,24 +39,3 @@ void DeviceFirmwareUpdate::loop() {
|
|||||||
} // namespace dfu
|
} // namespace dfu
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
||||||
#ifdef USE_ARRUINO
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void __wrap_tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
|
|
||||||
(void) rts;
|
|
||||||
|
|
||||||
// DTR = false is counted as disconnected
|
|
||||||
if (!dtr) {
|
|
||||||
// touch1200 only with first CDC instance (Serial)
|
|
||||||
if (itf == 0) {
|
|
||||||
cdc_line_coding_t coding;
|
|
||||||
tud_cdc_get_line_coding(&coding);
|
|
||||||
|
|
||||||
if (coding.bit_rate == 1200) {
|
|
||||||
goto_dfu = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@@ -281,7 +281,7 @@ async def to_code(config):
|
|||||||
if config.get(CONF_ESP8266_STORE_LOG_STRINGS_IN_FLASH):
|
if config.get(CONF_ESP8266_STORE_LOG_STRINGS_IN_FLASH):
|
||||||
cg.add_build_flag("-DUSE_STORE_LOG_STR_IN_FLASH")
|
cg.add_build_flag("-DUSE_STORE_LOG_STR_IN_FLASH")
|
||||||
|
|
||||||
if CORE.using_arduino and not CORE.is_nrf52:
|
if CORE.using_arduino:
|
||||||
if config[CONF_HARDWARE_UART] == USB_CDC:
|
if config[CONF_HARDWARE_UART] == USB_CDC:
|
||||||
cg.add_build_flag("-DARDUINO_USB_CDC_ON_BOOT=1")
|
cg.add_build_flag("-DARDUINO_USB_CDC_ON_BOOT=1")
|
||||||
if CORE.is_esp32 and get_esp32_variant() == VARIANT_ESP32C3:
|
if CORE.is_esp32 and get_esp32_variant() == VARIANT_ESP32C3:
|
||||||
|
@@ -41,3 +41,5 @@ dfu:
|
|||||||
|
|
||||||
zephyr_ble_server:
|
zephyr_ble_server:
|
||||||
|
|
||||||
|
zephyr_ble_nus:
|
||||||
|
log: true
|
||||||
|
Reference in New Issue
Block a user