aboutsummaryrefslogtreecommitdiff
path: root/tests/stm32/src/bin
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-09-11 22:06:26 +0200
committerDario Nieuwenhuis <[email protected]>2024-09-16 21:17:11 +0200
commitbe0d9775e3bcc3c1bd1448e357d7c6cd67b68991 (patch)
tree5e8c444b233a86ade113b096ab1e2934b7bbc7bd /tests/stm32/src/bin
parent7648d42b7f23a2caad29ed6e16123b088ccdc8b5 (diff)
net: refactor to simplify lifetimes/generics.
Diffstat (limited to 'tests/stm32/src/bin')
-rw-r--r--tests/stm32/src/bin/eth.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/stm32/src/bin/eth.rs b/tests/stm32/src/bin/eth.rs
index 9da514881..bf1922dde 100644
--- a/tests/stm32/src/bin/eth.rs
+++ b/tests/stm32/src/bin/eth.rs
@@ -6,7 +6,7 @@
6mod common; 6mod common;
7use common::*; 7use common::*;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_net::{Stack, StackResources}; 9use embassy_net::StackResources;
10use embassy_stm32::eth::generic_smi::GenericSMI; 10use embassy_stm32::eth::generic_smi::GenericSMI;
11use embassy_stm32::eth::{Ethernet, PacketQueue}; 11use embassy_stm32::eth::{Ethernet, PacketQueue};
12use embassy_stm32::peripherals::ETH; 12use embassy_stm32::peripherals::ETH;
@@ -32,8 +32,8 @@ bind_interrupts!(struct Irqs {
32type Device = Ethernet<'static, ETH, GenericSMI>; 32type Device = Ethernet<'static, ETH, GenericSMI>;
33 33
34#[embassy_executor::task] 34#[embassy_executor::task]
35async fn net_task(stack: &'static Stack<Device>) -> ! { 35async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! {
36 stack.run().await 36 runner.run().await
37} 37}
38 38
39#[embassy_executor::main] 39#[embassy_executor::main]
@@ -99,12 +99,11 @@ async fn main(spawner: Spawner) {
99 //}); 99 //});
100 100
101 // Init network stack 101 // Init network stack
102 static STACK: StaticCell<Stack<Device>> = StaticCell::new();
103 static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); 102 static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
104 let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed)); 103 let (stack, runner) = embassy_net::new(device, config, RESOURCES.init(StackResources::new()), seed);
105 104
106 // Launch network task 105 // Launch network task
107 unwrap!(spawner.spawn(net_task(&stack))); 106 unwrap!(spawner.spawn(net_task(runner)));
108 107
109 perf_client::run( 108 perf_client::run(
110 stack, 109 stack,