mirror of
https://github.com/esphome/esphome.git
synced 2025-02-24 20:12:30 +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):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
await cg.register_component(var, config)
|
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
|
||||||
#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 esphome {
|
||||||
namespace usb_device {
|
namespace usb_device {
|
||||||
|
|
||||||
|
@ -30,14 +17,12 @@ static const char *const TAG = "usb_device";
|
||||||
void UsbDevice::update() {
|
void UsbDevice::update() {
|
||||||
#ifdef USE_BINARY_SENSOR
|
#ifdef USE_BINARY_SENSOR
|
||||||
if (configured_ != nullptr) {
|
if (configured_ != nullptr) {
|
||||||
// bool configured = USB;
|
|
||||||
configured_->publish_state(get_configured_());
|
configured_->publish_state(get_configured_());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsbDevice::dump_config() {
|
void UsbDevice::dump_config() {
|
||||||
// bool configured = USB;
|
|
||||||
ESP_LOGCONFIG(TAG, "USB device - configured: %s", YESNO(get_configured_()));
|
ESP_LOGCONFIG(TAG, "USB device - configured: %s", YESNO(get_configured_()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +39,15 @@ bool UsbDevice::get_configured_() {
|
||||||
#else
|
#else
|
||||||
return USBSerial;
|
return USBSerial;
|
||||||
#endif
|
#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
|
#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
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue