From d829f94b947f395c846ecfe1fe70213e6129a71f Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Tue, 28 Jan 2025 14:58:07 +0000 Subject: [PATCH] fmt --- examples/rp/src/bin/light.rs | 26 +++++++++++++++++++++----- rs-matter-embassy/src/nal.rs | 14 +++++++------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/examples/rp/src/bin/light.rs b/examples/rp/src/bin/light.rs index a04ffe3..c92cfe1 100644 --- a/examples/rp/src/bin/light.rs +++ b/examples/rp/src/bin/light.rs @@ -43,7 +43,10 @@ use rs_matter_embassy::matter::data_model::system_model::descriptor; use rs_matter_embassy::matter::utils::init::InitMaybeUninit; use rs_matter_embassy::matter::utils::select::Coalesce; use rs_matter_embassy::nal::net::driver::{Driver as _, HardwareAddress}; -use rs_matter_embassy::nal::{create_link_local_ipv6, multicast_mac_for_link_local_ipv6, MDNS_MULTICAST_MAC_IPV4, MDNS_MULTICAST_MAC_IPV6}; +use rs_matter_embassy::nal::{ + create_link_local_ipv6, multicast_mac_for_link_local_ipv6, MDNS_MULTICAST_MAC_IPV4, + MDNS_MULTICAST_MAC_IPV6, +}; use rs_matter_embassy::rand::rp::rp_rand; use rs_matter_embassy::stack::persist::DummyPersist; use rs_matter_embassy::stack::test_device::{ @@ -144,10 +147,23 @@ async fn main(spawner: Spawner) { // cyw43 is a bit special in that it needs to have allowlisted all multicast MAC addresses // it should listen on. Therefore, add the mDNS ipv4 and ipv6 multicast MACs to the list, // as well as the ipv6 neightbour solicitation requests' MAC to the list - let HardwareAddress::Ethernet(mac) = net_device.hardware_address() else { unreachable!() }; - control.add_multicast_address(MDNS_MULTICAST_MAC_IPV4).await.unwrap(); - control.add_multicast_address(MDNS_MULTICAST_MAC_IPV6).await.unwrap(); - control.add_multicast_address(multicast_mac_for_link_local_ipv6(&create_link_local_ipv6(&mac))).await.unwrap(); + let HardwareAddress::Ethernet(mac) = net_device.hardware_address() else { + unreachable!() + }; + control + .add_multicast_address(MDNS_MULTICAST_MAC_IPV4) + .await + .unwrap(); + control + .add_multicast_address(MDNS_MULTICAST_MAC_IPV6) + .await + .unwrap(); + control + .add_multicast_address(multicast_mac_for_link_local_ipv6(&create_link_local_ipv6( + &mac, + ))) + .await + .unwrap(); let controller: ExternalController<_, 20> = ExternalController::new(bt_device); diff --git a/rs-matter-embassy/src/nal.rs b/rs-matter-embassy/src/nal.rs index 1a5a881..dfa9548 100644 --- a/rs-matter-embassy/src/nal.rs +++ b/rs-matter-embassy/src/nal.rs @@ -47,14 +47,14 @@ pub fn create_net_stack( } /// The MAC address used for mDNS multicast queries over IPv4 -/// -/// Useful with wifi stack implementations (i.e. cyw43) that require explicit +/// +/// Useful with wifi stack implementations (i.e. cyw43) that require explicit /// allowlisting of the multicast MAC addresses they should be listening on. pub const MDNS_MULTICAST_MAC_IPV4: [u8; 6] = [0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb]; /// The MAC address used for mDNS multicast queries over IPv6 -/// -/// Useful with wifi stack implementations (i.e. cyw43) that require explicit +/// +/// Useful with wifi stack implementations (i.e. cyw43) that require explicit /// allowlisting of the multicast MAC addresses they should be listening on. pub const MDNS_MULTICAST_MAC_IPV6: [u8; 6] = [0x33, 0x33, 0x00, 0x00, 0x00, 0xfb]; @@ -93,10 +93,10 @@ pub fn create_link_local_ipv6(mac: &[u8; 6]) -> Ipv6Addr { /// Get the multicast MAC address corresponding to the given IPv6 link-local address. /// -/// Useful with Wifi stack implementations (i.e. cyw43) that require explicit +/// Useful with Wifi stack implementations (i.e. cyw43) that require explicit /// allowlisting of the multicast MAC addresses they should be listening on. -/// -/// Note that the provided IP should be a link-local IP (fe80::/10) or else this +/// +/// Note that the provided IP should be a link-local IP (fe80::/10) or else this /// function would return a bogus result. pub fn multicast_mac_for_link_local_ipv6(ip: &Ipv6Addr) -> [u8; 6] { let mut mac = [0x33, 0x33, 0xff, 0, 0, 0];