refactor: LoRaBoard trait with full associated types + BoardParts

- LoRaBoard trait now has associated types: RadioParts, CommParts, DisplayParts, DisplayDriver
- into_parts() is on the trait (enforced by compiler, not implicit convention)
- BoardParts<R, C, D> struct replaces tuple return from into_parts()
- mac_address() stays on trait, MAC also in BoardParts for convenience
- Removed mac field from DisplayParts (display task calls Board::mac_address())
- DisplayDriver associated type requires DrawTarget<Color = BinaryColor>
This commit is contained in:
swaits committed 2026-04-07 09:50:50 -06:00
1 parent 7a54c4dff3
commit ecc451affe
8 files changed
+134 -98

No files matched your search

+6 -9
View File
@@ -77,27 +77,24 @@ cfg_if::cfg_if! {
#[cfg(not(test))]
async fn run(spawner: Spawner) {
let board = <board::Board as LoRaBoard>::init();
let mac = board::Board::mac_address();
let (radio, comm, display) = board.into_parts();
let has_display = display.is_some();
let parts = board.into_parts();
spawner
.spawn(radio::radio_task(radio, &COMMANDS, &RESPONSES, &STATUS))
.spawn(radio::radio_task(parts.radio, &COMMANDS, &RESPONSES, &STATUS))
.expect("spawn radio_task");
spawner
.spawn(host::host_task(
comm,
parts.host,
&COMMANDS,
&RESPONSES,
&DISPLAY_COMMANDS,
has_display,
mac,
parts.display.is_some(),
parts.mac,
))
.expect("spawn host_task");
if let Some(dp) = display {
if let Some(dp) = parts.display {
spawner
.spawn(display::display_task(dp, &STATUS, &DISPLAY_COMMANDS))
.expect("spawn display_task");