mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-09-25 13:22:06 +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:
+16
-6
@@ -74,12 +74,10 @@ int main() {
|
||||
print_help();
|
||||
|
||||
while (true) {
|
||||
if (peripheral.bus_is_active()) {
|
||||
if (auto msg = peripheral.read(Print{.print = printAllFrames,
|
||||
.binary = printBinary,
|
||||
.verbose = verbose}))
|
||||
incoming.push(std::move(*msg));
|
||||
}
|
||||
if (auto msg = peripheral.read(Print{.print = printAllFrames,
|
||||
.binary = printBinary,
|
||||
.verbose = verbose}))
|
||||
incoming.push(std::move(*msg));
|
||||
|
||||
if (const auto *in = incoming.peek()) {
|
||||
if (auto resp = peripheral.route(*in)) {
|
||||
@@ -180,6 +178,16 @@ int main() {
|
||||
while (peripheral.device<CDChanger>().media_busy()) {}
|
||||
puts("end");
|
||||
break;
|
||||
case '+':
|
||||
peripheral.get_bus().deafen(true);
|
||||
peripheral.get_bus().set_dominant();
|
||||
puts("Set bus dominant...");
|
||||
break;
|
||||
case '-':
|
||||
peripheral.get_bus().set_recessive();
|
||||
peripheral.get_bus().deafen(false);
|
||||
puts("Set bus recessive...");
|
||||
break;
|
||||
#ifdef MEASURE_BUS
|
||||
case 'M': peripheral.get_bus().measure(); break;
|
||||
#endif
|
||||
@@ -324,6 +332,8 @@ void print_help() {
|
||||
"s - MIC skip forward\n"
|
||||
"b - MIC skip backward\n"
|
||||
"M - Measure bit-timing (pulse-widths and periods)\n"
|
||||
"+ - Set bus driven/dominant\n"
|
||||
"- - Set bus idle/recessive\n"
|
||||
#endif
|
||||
"? - Print this message");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user