mirror of
https://github.com/esphome/esphome.git
synced 2024-12-28 16:31:44 +01:00
fix s2 implementation
This commit is contained in:
parent
e2f23fd799
commit
df37248308
2 changed files with 8 additions and 17 deletions
|
@ -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")
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue