openlifu.io.LIFUDFU.STM32I2CDFUviaMaster¶
- class openlifu.io.LIFUDFU.STM32I2CDFUviaMaster(uart: LIFUUart, i2c_addr: int = 114, write_read_delay_s: float = 0.005)[source]¶
Bases:
objectI2C DFU client that routes all I2C transactions through the USB-master module via the
OW_I2C_PASSTHRUUART packet type.The master firmware receives the passthrough request and executes the raw I2C write (and optional read) on the global I2C bus toward the slave DFU bootloader at i2c_addr (default 0x72).
Packet wire format used:
packetType = OW_I2C_PASSTHRU (0xE9) addr = 7-bit I2C slave address command = 0x00 write-only = 0x01 write, 5 ms delay, read back <reserved> bytes reserved = number of bytes to read back (command 0x01 only, max 255) data = raw bytes to write
- _exchange(payload: bytes, read_len: int, pre_read_delay_s: float | None = None) bytes[source]¶
Write payload to the I2C slave and read read_len bytes back.
The firmware executes a combined write+read transaction and inserts a fixed 5 ms gap between the write and read phases internally. The optional pre_read_delay_s parameter adds an extra host-side delay before issuing the passthrough transaction (i.e. before the firmware performs the write+read). This does not change the internal 5 ms gap handled by the firmware and is rarely needed.