fix s2 implementation

This commit is contained in:
Tomasz Duda 2024-10-01 17:50:54 +02:00
parent e2f23fd799
commit df37248308
2 changed files with 8 additions and 17 deletions

View file

@ -42,5 +42,3 @@ CONFIG_SCHEMA = cv.All(
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
cg.add_build_flag("-Wl,--wrap=tud_mount_cb")
cg.add_build_flag("-Wl,--wrap=tud_umount_cb")

View file

@ -9,19 +9,6 @@
#endif
#endif
extern "C" {
bool configured;
void __wrap_tud_mount_cb(void){
configured = true;
}
void __wrap_tud_umount_cb(void){
configured = false;
}
}
namespace esphome {
namespace usb_device {
@ -30,14 +17,12 @@ static const char *const TAG = "usb_device";
void UsbDevice::update() {
#ifdef USE_BINARY_SENSOR
if (configured_ != nullptr) {
// bool configured = USB;
configured_->publish_state(get_configured_());
}
#endif
}
void UsbDevice::dump_config() {
// bool configured = USB;
ESP_LOGCONFIG(TAG, "USB device - configured: %s", YESNO(get_configured_()));
}
@ -54,7 +39,15 @@ bool UsbDevice::get_configured_() {
#else
return USBSerial;
#endif
#else
// this is subject of change by other components so make sure that we won't fail to report silently
#error Not implemented
#endif
#elif USE_ESP32_VARIANT_ESP32S2
return USB;
#else
// this is subject of change by other components so make sure that we won't fail to report silently
#error Not implemented
#endif
return false;
}