embassy-usb-dfu

Crates

git

Versions

application

Flavors

embassy_usb_dfu

Function usb_dfu

Source
pub fn usb_dfu<'d, D: Driver<'d>, STATE: NorFlash, RST: Reset>(
    builder: &mut Builder<'d, D>,
    handler: &'d mut Control<'d, STATE, RST>,
    timeout: Duration,
)
Expand description

An implementation of the USB DFU 1.1 runtime protocol

This function will add a DFU interface descriptor to the provided Builder, and register the provided Control as a handler for the USB device. The USB builder can be used as normal once this is complete. The handler is responsive to DFU GetStatus and Detach commands.

Once a detach command, followed by a USB reset is received by the host, a magic number will be written into the bootloader state partition to indicate that it should expose a DFU device, and a software reset will be issued.

To apply USB DFU updates, the bootloader must be capable of recognizing the DFU magic and exposing a device to handle the full DFU transaction with the host.