Refactor peripheral/bus/phy APIs (prep for pico/PIO)

- Refactor PHY to be higher-level with a field focus (controller/peripheral address,
  control byte, etc)
  - Phy layer is now device address aware (ACK's automatically) (Hardens
    previously ~implicit design to only support emulating one AVCLAN
    unit per mockingboard build)
- Redesign `phy_active` => `phy_frame_pending` (to allow
  asynchronous/buffered frame reads on pico) and embed within
  Peripheral::read
- Add `deafen` function: like mute, but also ignore incoming messages (i.e.
  don't receive/process at all). Makes `Bus::is_active` always return
  `false`.
- Add debug bus driving functions

Assisted-by: Claude Code (Opus 5)
This commit is contained in:
Allen Hill
2026-09-17 13:19:31 -07:00
parent 9efbb01ccf
commit 8a47b5b776
8 changed files with 361 additions and 244 deletions
+5 -2
View File
@@ -40,7 +40,7 @@ public:
"update the sentinel value in avclan.h");
Peripheral(Bus &bus, uint16_t address) : bus{bus}, address_{address} {
bus.init();
bus.init(address);
(std::get<Devs>(devices_).init(), ...);
}
@@ -59,7 +59,10 @@ public:
expected<std::unique_ptr<Frame>, Error::Read>
read(Frame::Print print = Frame::Print{}) {
return bus.read(address_, print);
if (!bus.is_active())
return unexpected{detail::Error::Read::NO_FRAME};
return bus.read(print);
};
expected<std::unique_ptr<Frame>, detail::SendError>