From c00efd485c0d422188badddde13613ea50668080 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Mon, 1 Sep 2025 18:07:31 +0200 Subject: embassy-dfu-usb: Allow `application` and `dfu` feature at the same time Since there is no technical reason to disallow the use of both features at the same time, remove the artifical contraint to give developers more freedom with their implementations. --- embassy-usb-dfu/src/application.rs | 1 + embassy-usb-dfu/src/dfu.rs | 1 + embassy-usb-dfu/src/lib.rs | 14 ++++---------- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'embassy-usb-dfu/src') diff --git a/embassy-usb-dfu/src/application.rs b/embassy-usb-dfu/src/application.rs index 4b7b72073..78eb2c083 100644 --- a/embassy-usb-dfu/src/application.rs +++ b/embassy-usb-dfu/src/application.rs @@ -1,3 +1,4 @@ +//! Application part of DFU logic use embassy_boot::BlockingFirmwareState; use embassy_time::{Duration, Instant}; use embassy_usb::control::{InResponse, OutResponse, Recipient, RequestType}; diff --git a/embassy-usb-dfu/src/dfu.rs b/embassy-usb-dfu/src/dfu.rs index 9a2f125fb..be28890bb 100644 --- a/embassy-usb-dfu/src/dfu.rs +++ b/embassy-usb-dfu/src/dfu.rs @@ -1,3 +1,4 @@ +//! DFU bootloader part of DFU logic use embassy_boot::{AlignedBuffer, BlockingFirmwareUpdater, FirmwareUpdaterError}; use embassy_usb::control::{InResponse, OutResponse, Recipient, RequestType}; use embassy_usb::driver::Driver; diff --git a/embassy-usb-dfu/src/lib.rs b/embassy-usb-dfu/src/lib.rs index 54ffa7276..e9f4278b6 100644 --- a/embassy-usb-dfu/src/lib.rs +++ b/embassy-usb-dfu/src/lib.rs @@ -6,21 +6,15 @@ mod fmt; pub mod consts; #[cfg(feature = "dfu")] -mod dfu; -#[cfg(feature = "dfu")] +pub mod dfu; +#[cfg(all(feature = "dfu", not(feature = "application")))] pub use self::dfu::*; #[cfg(feature = "application")] -mod application; -#[cfg(feature = "application")] +pub mod application; +#[cfg(all(feature = "application", not(feature = "dfu")))] pub use self::application::*; -#[cfg(any( - all(feature = "dfu", feature = "application"), - not(any(feature = "dfu", feature = "application")) -))] -compile_error!("usb-dfu must be compiled with exactly one of `dfu`, or `application` features"); - /// Provides a platform-agnostic interface for initiating a system reset. /// /// This crate exposes `ResetImmediate` when compiled with cortex-m or esp32c3 support, which immediately issues a -- cgit