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/bootloader/stm32wb-dfu/src | |
| 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/bootloader/stm32wb-dfu/src')
| -rw-r--r-- | examples/boot/bootloader/stm32wb-dfu/src/main.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/boot/bootloader/stm32wb-dfu/src/main.rs b/examples/boot/bootloader/stm32wb-dfu/src/main.rs index 8cfd4daa7..fea6f4a0d 100644 --- a/examples/boot/bootloader/stm32wb-dfu/src/main.rs +++ b/examples/boot/bootloader/stm32wb-dfu/src/main.rs | |||
| @@ -78,11 +78,15 @@ fn main() -> ! { | |||
| 78 | msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), | 78 | msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), |
| 79 | )); | 79 | )); |
| 80 | 80 | ||
| 81 | // For non-composite devices: | 81 | usb_dfu::<_, _, _, _, 4096>(&mut builder, &mut state, |func| { |
| 82 | usb_dfu::<_, _, _, _, 4096>(&mut builder, &mut state, None); | 82 | // You likely don't have to add these function level headers if your USB device is not composite |
| 83 | 83 | // (i.e. if your device does not expose another interface in addition to DFU) | |
| 84 | // Or for composite devices: | 84 | func.msos_feature(msos::CompatibleIdFeatureDescriptor::new("WINUSB", "")); |
| 85 | // usb_dfu::<_, _, _, _, 4096>(&mut builder, &mut state, Some(DEVICE_INTERFACE_GUIDS)); | 85 | func.msos_feature(msos::RegistryPropertyFeatureDescriptor::new( |
| 86 | "DeviceInterfaceGUIDs", | ||
| 87 | msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), | ||
| 88 | )); | ||
| 89 | }); | ||
| 86 | 90 | ||
| 87 | let mut dev = builder.build(); | 91 | let mut dev = builder.build(); |
| 88 | embassy_futures::block_on(dev.run()); | 92 | embassy_futures::block_on(dev.run()); |
