aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf52840/src/bin
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-08-05 21:38:30 +0200
committerDario Nieuwenhuis <[email protected]>2024-08-07 14:58:20 +0200
commit59cb1531c91386cec8d7b209630b6b4d9eb7fd7c (patch)
tree9d5268c5fc9ea6014a69313eeff268b5d3aed256 /examples/nrf52840/src/bin
parent21edbd3c17837f9a3f196fe1bdda4a065805d12f (diff)
examples: ensure at least 3 sockets to avoid running out (DHCP, DNS, the user's)
Diffstat (limited to 'examples/nrf52840/src/bin')
-rw-r--r--examples/nrf52840/src/bin/ethernet_enc28j60.rs9
-rw-r--r--examples/nrf52840/src/bin/usb_ethernet.rs2
-rw-r--r--examples/nrf52840/src/bin/wifi_esp_hosted.rs9
3 files changed, 5 insertions, 15 deletions
diff --git a/examples/nrf52840/src/bin/ethernet_enc28j60.rs b/examples/nrf52840/src/bin/ethernet_enc28j60.rs
index 279f32edc..94cf09c88 100644
--- a/examples/nrf52840/src/bin/ethernet_enc28j60.rs
+++ b/examples/nrf52840/src/bin/ethernet_enc28j60.rs
@@ -66,16 +66,11 @@ async fn main(spawner: Spawner) {
66 let seed = u64::from_le_bytes(seed); 66 let seed = u64::from_le_bytes(seed);
67 67
68 // Init network stack 68 // Init network stack
69 static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); 69 static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
70 static STACK: StaticCell< 70 static STACK: StaticCell<
71 Stack<Enc28j60<ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static>, Delay>, Output<'static>>>, 71 Stack<Enc28j60<ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static>, Delay>, Output<'static>>>,
72 > = StaticCell::new(); 72 > = StaticCell::new();
73 let stack = STACK.init(Stack::new( 73 let stack = STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed));
74 device,
75 config,
76 RESOURCES.init(StackResources::<2>::new()),
77 seed,
78 ));
79 74
80 unwrap!(spawner.spawn(net_task(stack))); 75 unwrap!(spawner.spawn(net_task(stack)));
81 76
diff --git a/examples/nrf52840/src/bin/usb_ethernet.rs b/examples/nrf52840/src/bin/usb_ethernet.rs
index a7e5c2668..e56b215e3 100644
--- a/examples/nrf52840/src/bin/usb_ethernet.rs
+++ b/examples/nrf52840/src/bin/usb_ethernet.rs
@@ -115,7 +115,7 @@ async fn main(spawner: Spawner) {
115 let seed = u64::from_le_bytes(seed); 115 let seed = u64::from_le_bytes(seed);
116 116
117 // Init network stack 117 // Init network stack
118 static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); 118 static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
119 static STACK: StaticCell<Stack<Device<'static, MTU>>> = StaticCell::new(); 119 static STACK: StaticCell<Stack<Device<'static, MTU>>> = StaticCell::new();
120 let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed)); 120 let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed));
121 121
diff --git a/examples/nrf52840/src/bin/wifi_esp_hosted.rs b/examples/nrf52840/src/bin/wifi_esp_hosted.rs
index 00bd50081..a3b69a99b 100644
--- a/examples/nrf52840/src/bin/wifi_esp_hosted.rs
+++ b/examples/nrf52840/src/bin/wifi_esp_hosted.rs
@@ -89,14 +89,9 @@ async fn main(spawner: Spawner) {
89 let seed = u64::from_le_bytes(seed); 89 let seed = u64::from_le_bytes(seed);
90 90
91 // Init network stack 91 // Init network stack
92 static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); 92 static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
93 static STACK: StaticCell<Stack<hosted::NetDriver<'static>>> = StaticCell::new(); 93 static STACK: StaticCell<Stack<hosted::NetDriver<'static>>> = StaticCell::new();
94 let stack = &*STACK.init(Stack::new( 94 let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed));
95 device,
96 config,
97 RESOURCES.init(StackResources::<2>::new()),
98 seed,
99 ));
100 95
101 unwrap!(spawner.spawn(net_task(stack))); 96 unwrap!(spawner.spawn(net_task(stack)));
102 97