openlifu.io.LIFUDFU.STM32USBDFU

class openlifu.io.LIFUDFU.STM32USBDFU(vid: int = 1155, pid: int = 57105, transfer_size: int = 1024, timeout_ms: int = 4000, libusb_dll: str | None = None)[source]

Bases: object

Minimal STM32 DfuSe USB client using PyUSB.

Supports Set-Address-Pointer, page erase, memory write and DFU UPLOAD (used to read the bootloader version string).

Requires: pip install pyusb plus a libusb-1.0 backend.

get_backend()[source]

Public accessor for the libusb backend (avoids protected-member access).

get_version() str[source]

Read bootloader version string via DFU UPLOAD from the virtual address.

manifest() None[source]

Send zero-length DNLOAD to trigger DFU manifestation (launches firmware).

write_memory(address: int, data: bytes, page_erase: bool = True, progress_callback: Callable | None = None) None[source]

Write data to target flash, optionally erasing each 2 KB page first.