Expose Bus mute via Peripheral

This commit is contained in:
Allen Hill
2026-07-06 17:13:05 -07:00
parent b538e07577
commit 7ceed80128
2 changed files with 11 additions and 5 deletions
+10 -4
View File
@@ -25,6 +25,8 @@ public:
uint16_t address() const { return address_; }; uint16_t address() const { return address_; };
uint16_t controller() const { return controller_; }; uint16_t controller() const { return controller_; };
void mute(bool mute) { bus.mute(mute); };
bool is_muted() const { return bus.is_muted(); };
Error::Read read(Frame *in, Frame::Print print) { Error::Read read(Frame *in, Frame::Print print) {
return bus.read(address_, in, print); return bus.read(address_, in, print);
@@ -87,8 +89,10 @@ public:
out->data[3] = to_underlying(Lancheck_End_Resp); out->data[3] = to_underlying(Lancheck_End_Resp);
out->reaction = 1; out->reaction = 1;
break; break;
case PACK3(COMMUNICATION_V1, COMM_CTRL, to_underlying(Advertise_Function)): case PACK3(COMMUNICATION_V1, COMM_CTRL,
case PACK3(COMMUNICATION_V2, COMM_CTRL, to_underlying(Advertise_Function)): to_underlying(Advertise_Function)):
case PACK3(COMMUNICATION_V2, COMM_CTRL,
to_underlying(Advertise_Function)):
((Devs::id == static_cast<Device>(b3) ((Devs::id == static_cast<Device>(b3)
? std::get<Devs>(devices_).enable(out), ? std::get<Devs>(devices_).enable(out),
0 : 0), 0 : 0),
@@ -108,8 +112,10 @@ public:
out->reaction = 1; out->reaction = 1;
break; break;
} }
case PACK3(COMMUNICATION_V1, COMM_CTRL, to_underlying(List_Functions_Req)): case PACK3(COMMUNICATION_V1, COMM_CTRL,
case PACK3(COMMUNICATION_V2, COMM_CTRL, to_underlying(List_Functions_Req)): { to_underlying(List_Functions_Req)):
case PACK3(COMMUNICATION_V2, COMM_CTRL,
to_underlying(List_Functions_Req)): {
controller_ = in->controller_addr; controller_ = in->controller_addr;
out->peripheral_addr = controller_; out->peripheral_addr = controller_;
out->is_unicast = true; out->is_unicast = true;
+1 -1
View File
@@ -127,7 +127,7 @@ int main() {
case 'k': toggle_flag(&echoCharacters, "Echo characters: "); break; case 'k': toggle_flag(&echoCharacters, "Echo characters: "); break;
case 'm': case 'm':
toggle_flag(&muteBus, "Mute device: "); toggle_flag(&muteBus, "Mute device: ");
AVCLAN_muteDevice(muteBus); peripheral.mute(muteBus);
break; break;
// X/x isn't a toggle interface because this is used // X/x isn't a toggle interface because this is used