mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-10-25 03:30:46 +00:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user