aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-net-driver/src/lib.rs3
-rw-r--r--embassy-net/Cargo.toml1
-rw-r--r--embassy-net/src/device.rs2
-rw-r--r--embassy-net/src/lib.rs13
-rw-r--r--embassy-stm32-wpan/Cargo.toml3
-rw-r--r--examples/stm32wb/Cargo.toml3
6 files changed, 22 insertions, 3 deletions
diff --git a/embassy-net-driver/src/lib.rs b/embassy-net-driver/src/lib.rs
index 4149bf4a4..09def20c4 100644
--- a/embassy-net-driver/src/lib.rs
+++ b/embassy-net-driver/src/lib.rs
@@ -164,6 +164,9 @@ pub enum Medium {
164 /// 164 ///
165 /// Examples of devices of this type are the Linux `tun`, PPP interfaces, VPNs in tun (layer 3) mode. 165 /// Examples of devices of this type are the Linux `tun`, PPP interfaces, VPNs in tun (layer 3) mode.
166 Ip, 166 Ip,
167
168 /// IEEE 802_15_4 medium
169 Ieee802154,
167} 170}
168 171
169impl Default for Medium { 172impl Default for Medium {
diff --git a/embassy-net/Cargo.toml b/embassy-net/Cargo.toml
index 6dc429ddc..9b6a11c16 100644
--- a/embassy-net/Cargo.toml
+++ b/embassy-net/Cargo.toml
@@ -37,6 +37,7 @@ proto-ipv4 = ["smoltcp/proto-ipv4"]
37proto-ipv6 = ["smoltcp/proto-ipv6"] 37proto-ipv6 = ["smoltcp/proto-ipv6"]
38medium-ethernet = ["smoltcp/medium-ethernet"] 38medium-ethernet = ["smoltcp/medium-ethernet"]
39medium-ip = ["smoltcp/medium-ip"] 39medium-ip = ["smoltcp/medium-ip"]
40medium-ieee802154 = ["smoltcp/medium-ieee802154"]
40igmp = ["smoltcp/proto-igmp"] 41igmp = ["smoltcp/proto-igmp"]
41 42
42[dependencies] 43[dependencies]
diff --git a/embassy-net/src/device.rs b/embassy-net/src/device.rs
index 4513c86d3..d29ab8970 100644
--- a/embassy-net/src/device.rs
+++ b/embassy-net/src/device.rs
@@ -51,6 +51,8 @@ where
51 Medium::Ethernet => phy::Medium::Ethernet, 51 Medium::Ethernet => phy::Medium::Ethernet,
52 #[cfg(feature = "medium-ip")] 52 #[cfg(feature = "medium-ip")]
53 Medium::Ip => phy::Medium::Ip, 53 Medium::Ip => phy::Medium::Ip,
54 #[cfg(feature = "medium-ieee802154")]
55 Medium::Ieee802154 => phy::Medium::Ieee802154,
54 #[allow(unreachable_patterns)] 56 #[allow(unreachable_patterns)]
55 _ => panic!( 57 _ => panic!(
56 "Unsupported medium {:?}. Make sure to enable it in embassy-net's Cargo features.", 58 "Unsupported medium {:?}. Make sure to enable it in embassy-net's Cargo features.",
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs
index 0d0a986f6..ad98d7f68 100644
--- a/embassy-net/src/lib.rs
+++ b/embassy-net/src/lib.rs
@@ -24,9 +24,11 @@ use embassy_net_driver::{Driver, LinkState, Medium};
24use embassy_sync::waitqueue::WakerRegistration; 24use embassy_sync::waitqueue::WakerRegistration;
25use embassy_time::{Instant, Timer}; 25use embassy_time::{Instant, Timer};
26use futures::pin_mut; 26use futures::pin_mut;
27#[allow(unused_imports)]
27use heapless::Vec; 28use heapless::Vec;
28#[cfg(feature = "igmp")] 29#[cfg(feature = "igmp")]
29pub use smoltcp::iface::MulticastError; 30pub use smoltcp::iface::MulticastError;
31#[allow(unused_imports)]
30use smoltcp::iface::{Interface, SocketHandle, SocketSet, SocketStorage}; 32use smoltcp::iface::{Interface, SocketHandle, SocketSet, SocketStorage};
31#[cfg(feature = "dhcpv4")] 33#[cfg(feature = "dhcpv4")]
32use smoltcp::socket::dhcpv4::{self, RetryConfig}; 34use smoltcp::socket::dhcpv4::{self, RetryConfig};
@@ -34,6 +36,8 @@ use smoltcp::socket::dhcpv4::{self, RetryConfig};
34pub use smoltcp::wire::IpListenEndpoint; 36pub use smoltcp::wire::IpListenEndpoint;
35#[cfg(feature = "medium-ethernet")] 37#[cfg(feature = "medium-ethernet")]
36pub use smoltcp::wire::{EthernetAddress, HardwareAddress}; 38pub use smoltcp::wire::{EthernetAddress, HardwareAddress};
39#[cfg(feature = "medium-ieee802154")]
40pub use smoltcp::wire::{HardwareAddress, Ieee802154Address};
37pub use smoltcp::wire::{IpAddress, IpCidr, IpEndpoint}; 41pub use smoltcp::wire::{IpAddress, IpCidr, IpEndpoint};
38#[cfg(feature = "proto-ipv4")] 42#[cfg(feature = "proto-ipv4")]
39pub use smoltcp::wire::{Ipv4Address, Ipv4Cidr}; 43pub use smoltcp::wire::{Ipv4Address, Ipv4Cidr};
@@ -232,7 +236,7 @@ impl<D: Driver + 'static> Stack<D> {
232 resources: &'static mut StackResources<SOCK>, 236 resources: &'static mut StackResources<SOCK>,
233 random_seed: u64, 237 random_seed: u64,
234 ) -> Self { 238 ) -> Self {
235 #[cfg(feature = "medium-ethernet")] 239 #[cfg(any(feature = "medium-ethernet", feature = "medium-ieee802154"))]
236 let medium = device.capabilities().medium; 240 let medium = device.capabilities().medium;
237 241
238 let hardware_addr = match medium { 242 let hardware_addr = match medium {
@@ -240,6 +244,8 @@ impl<D: Driver + 'static> Stack<D> {
240 Medium::Ethernet => HardwareAddress::Ethernet(EthernetAddress(device.ethernet_address())), 244 Medium::Ethernet => HardwareAddress::Ethernet(EthernetAddress(device.ethernet_address())),
241 #[cfg(feature = "medium-ip")] 245 #[cfg(feature = "medium-ip")]
242 Medium::Ip => HardwareAddress::Ip, 246 Medium::Ip => HardwareAddress::Ip,
247 #[cfg(feature = "medium-ieee802154")]
248 Medium::Ieee802154 => HardwareAddress::Ieee802154(Ieee802154Address::Absent),
243 #[allow(unreachable_patterns)] 249 #[allow(unreachable_patterns)]
244 _ => panic!( 250 _ => panic!(
245 "Unsupported medium {:?}. Make sure to enable it in embassy-net's Cargo features.", 251 "Unsupported medium {:?}. Make sure to enable it in embassy-net's Cargo features.",
@@ -262,6 +268,7 @@ impl<D: Driver + 'static> Stack<D> {
262 268
263 let next_local_port = (random_seed % (LOCAL_PORT_MAX - LOCAL_PORT_MIN) as u64) as u16 + LOCAL_PORT_MIN; 269 let next_local_port = (random_seed % (LOCAL_PORT_MAX - LOCAL_PORT_MIN) as u64) as u16 + LOCAL_PORT_MIN;
264 270
271 #[cfg_attr(feature = "medium-ieee802154", allow(unused_mut))]
265 let mut socket = SocketStack { 272 let mut socket = SocketStack {
266 sockets, 273 sockets,
267 iface, 274 iface,
@@ -269,6 +276,7 @@ impl<D: Driver + 'static> Stack<D> {
269 next_local_port, 276 next_local_port,
270 }; 277 };
271 278
279 #[cfg_attr(feature = "medium-ieee802154", allow(unused_mut))]
272 let mut inner = Inner { 280 let mut inner = Inner {
273 device, 281 device,
274 link_up: false, 282 link_up: false,
@@ -287,6 +295,9 @@ impl<D: Driver + 'static> Stack<D> {
287 dns_waker: WakerRegistration::new(), 295 dns_waker: WakerRegistration::new(),
288 }; 296 };
289 297
298 #[cfg(feature = "medium-ieee802154")]
299 let _ = config;
300
290 #[cfg(feature = "proto-ipv4")] 301 #[cfg(feature = "proto-ipv4")]
291 match config.ipv4 { 302 match config.ipv4 {
292 ConfigV4::Static(config) => { 303 ConfigV4::Static(config) => {
diff --git a/embassy-stm32-wpan/Cargo.toml b/embassy-stm32-wpan/Cargo.toml
index 868bffe74..082d00f1c 100644
--- a/embassy-stm32-wpan/Cargo.toml
+++ b/embassy-stm32-wpan/Cargo.toml
@@ -17,6 +17,7 @@ embassy-time = { version = "0.1.2", path = "../embassy-time", optional = true }
17embassy-futures = { version = "0.1.0", path = "../embassy-futures" } 17embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
18embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common" } 18embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common" }
19embassy-embedded-hal = { version = "0.1.0", path = "../embassy-embedded-hal" } 19embassy-embedded-hal = { version = "0.1.0", path = "../embassy-embedded-hal" }
20embassy-net-driver-channel = { version = "0.1.0", path = "../embassy-net-driver-channel", optional=true }
20 21
21defmt = { version = "0.3", optional = true } 22defmt = { version = "0.3", optional = true }
22cortex-m = "0.7.6" 23cortex-m = "0.7.6"
@@ -32,7 +33,7 @@ bitflags = { version = "2.3.3", optional = true }
32defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt", "stm32wb-hci?/defmt"] 33defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt", "stm32wb-hci?/defmt"]
33 34
34ble = ["dep:stm32wb-hci"] 35ble = ["dep:stm32wb-hci"]
35mac = ["dep:bitflags"] 36mac = ["dep:bitflags", "dep:embassy-net-driver-channel"]
36 37
37stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ] 38stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ]
38stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ] 39stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ]
diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml
index becf2d3fb..8585b99f9 100644
--- a/examples/stm32wb/Cargo.toml
+++ b/examples/stm32wb/Cargo.toml
@@ -10,6 +10,7 @@ embassy-executor = { version = "0.2.0", path = "../../embassy-executor", feature
10embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 10embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] }
12embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", features = ["defmt", "stm32wb55rg"] } 12embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", features = ["defmt", "stm32wb55rg"] }
13embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "udp", "medium-ieee802154", "nightly"], optional=true }
13 14
14defmt = "0.3" 15defmt = "0.3"
15defmt-rtt = "0.4" 16defmt-rtt = "0.4"
@@ -24,7 +25,7 @@ heapless = { version = "0.7.5", default-features = false }
24 25
25[features] 26[features]
26default = ["ble", "mac"] 27default = ["ble", "mac"]
27mac = ["embassy-stm32-wpan/mac"] 28mac = ["embassy-stm32-wpan/mac", "dep:embassy-net"]
28ble = ["embassy-stm32-wpan/ble"] 29ble = ["embassy-stm32-wpan/ble"]
29 30
30[[bin]] 31[[bin]]