diff options
| author | Gerhard de Clercq <[email protected]> | 2025-05-14 09:52:46 +0200 |
|---|---|---|
| committer | Gerhard de Clercq <[email protected]> | 2025-05-14 09:52:46 +0200 |
| commit | d4d10bad0bc2f2bbfbad116fb07e27eea4ac5af2 (patch) | |
| tree | 111676a87f0e9b5aeb83733ed87663909fcec952 /examples/boot/application/stm32wb-dfu | |
| parent | 46e25cbc5ff62e24f86574d7ae5d872aa0c2595d (diff) | |
[embassy-usb-dfu] accept closure to customise DFU function
This provides a more generic interface for users to customise the DFU function instead of restricting customisation to DFU headers.
Diffstat (limited to 'examples/boot/application/stm32wb-dfu')
| -rw-r--r-- | examples/boot/application/stm32wb-dfu/src/main.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/boot/application/stm32wb-dfu/src/main.rs b/examples/boot/application/stm32wb-dfu/src/main.rs index 6236dfe52..4d6556597 100644 --- a/examples/boot/application/stm32wb-dfu/src/main.rs +++ b/examples/boot/application/stm32wb-dfu/src/main.rs | |||
| @@ -70,11 +70,15 @@ async fn main(_spawner: Spawner) { | |||
| 70 | msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), | 70 | msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), |
| 71 | )); | 71 | )); |
| 72 | 72 | ||
| 73 | // For non-composite devices: | 73 | usb_dfu(&mut builder, &mut state, Duration::from_millis(2500), |func| { |
| 74 | usb_dfu(&mut builder, &mut state, Duration::from_millis(2500), None); | 74 | // You likely don't have to add these function level headers if your USB device is not composite |
| 75 | 75 | // (i.e. if your device does not expose another interface in addition to DFU) | |
| 76 | // Or for composite devices: | 76 | func.msos_feature(msos::CompatibleIdFeatureDescriptor::new("WINUSB", "")); |
| 77 | // usb_dfu(&mut builder, &mut state, Duration::from_millis(2500), Some(DEVICE_INTERFACE_GUIDS)); | 77 | func.msos_feature(msos::RegistryPropertyFeatureDescriptor::new( |
| 78 | "DeviceInterfaceGUIDs", | ||
| 79 | msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), | ||
| 80 | )); | ||
| 81 | }); | ||
| 78 | 82 | ||
| 79 | let mut dev = builder.build(); | 83 | let mut dev = builder.build(); |
| 80 | dev.run().await | 84 | dev.run().await |
