Description
The current daplink_flash module mixes low-level bridge communication (I2C, status, error, config zone) with high-level flash file operations (read, write, filename). This makes it harder to extend and creates a tight coupling between flash operations and bridge management.
Proposed architecture
steami_config ─┐
├──→ daplink_bridge ──→ I2C (F103)
daplink_flash ─┘
daplink_bridge (new — low-level bridge communication)
Handles all direct I2C communication with the STM32F103 DAPLink interface:
device_id() — WHO_AM_I register
_status() / _error() / busy() — status and error registers
_wait_busy() — busy polling
_read_reg() / _write_reg() — raw register access
read_config() / write_config() / clear_config() — config zone operations
daplink_flash (refactored — high-level flash file operations)
Uses daplink_bridge for I2C access, focuses on file operations:
set_filename() / get_filename() — 8.3 filename management
clear_flash() — erase file data
write() / write_line() — append data to file
read() / read_sector() — read file data
steami_config (unchanged — uses bridge directly)
Already uses only config zone operations. Will import from daplink_bridge instead of daplink_flash.
Migration
# Before
from daplink_flash import DaplinkFlash
flash = DaplinkFlash(i2c)
flash.device_id()
flash.write_line("data")
flash.write_config(json_data)
# After
from daplink_bridge import DaplinkBridge
from daplink_flash import DaplinkFlash
bridge = DaplinkBridge(i2c)
flash = DaplinkFlash(bridge) # takes bridge, not i2c
config = SteamiConfig(bridge) # takes bridge, not flash
bridge.device_id()
flash.write_line("data")
bridge.write_config(json_data)
Tasks
Impact
- Breaking change for
steami_config constructor (takes bridge instead of flash)
daplink_flash constructor changes (takes bridge instead of i2c)
- All examples need updating
- No firmware change needed (same I2C protocol)
Related
Description
The current
daplink_flashmodule mixes low-level bridge communication (I2C, status, error, config zone) with high-level flash file operations (read, write, filename). This makes it harder to extend and creates a tight coupling between flash operations and bridge management.Proposed architecture
daplink_bridge(new — low-level bridge communication)Handles all direct I2C communication with the STM32F103 DAPLink interface:
device_id()— WHO_AM_I register_status()/_error()/busy()— status and error registers_wait_busy()— busy polling_read_reg()/_write_reg()— raw register accessread_config()/write_config()/clear_config()— config zone operationsdaplink_flash(refactored — high-level flash file operations)Uses
daplink_bridgefor I2C access, focuses on file operations:set_filename()/get_filename()— 8.3 filename managementclear_flash()— erase file datawrite()/write_line()— append data to fileread()/read_sector()— read file datasteami_config(unchanged — uses bridge directly)Already uses only config zone operations. Will import from
daplink_bridgeinstead ofdaplink_flash.Migration
Tasks
lib/daplink_bridge/module with low-level bridge classdaplink_flashto useDaplinkBridgeinternallysteami_configto take aDaplinkBridgeinstead ofDaplinkFlashdaplink_bridgeto firmware manifest.pyImpact
steami_configconstructor (takes bridge instead of flash)daplink_flashconstructor changes (takes bridge instead of i2c)Related