aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h5
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32h5')
-rw-r--r--examples/stm32h5/src/bin/eth.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/stm32h5/src/bin/eth.rs b/examples/stm32h5/src/bin/eth.rs
index 65cfad8c9..eee1632f5 100644
--- a/examples/stm32h5/src/bin/eth.rs
+++ b/examples/stm32h5/src/bin/eth.rs
@@ -4,7 +4,7 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_net::tcp::TcpSocket; 6use embassy_net::tcp::TcpSocket;
7use embassy_net::{Ipv4Address, Stack, StackResources}; 7use embassy_net::{Ipv4Address, StackResources};
8use embassy_stm32::eth::generic_smi::GenericSMI; 8use embassy_stm32::eth::generic_smi::GenericSMI;
9use embassy_stm32::eth::{Ethernet, PacketQueue}; 9use embassy_stm32::eth::{Ethernet, PacketQueue};
10use embassy_stm32::peripherals::ETH; 10use embassy_stm32::peripherals::ETH;
@@ -28,8 +28,8 @@ bind_interrupts!(struct Irqs {
28type Device = Ethernet<'static, ETH, GenericSMI>; 28type Device = Ethernet<'static, ETH, GenericSMI>;
29 29
30#[embassy_executor::task] 30#[embassy_executor::task]
31async fn net_task(stack: &'static Stack<Device>) -> ! { 31async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! {
32 stack.run().await 32 runner.run().await
33} 33}
34 34
35#[embassy_executor::main] 35#[embassy_executor::main]
@@ -92,12 +92,11 @@ async fn main(spawner: Spawner) -> ! {
92 //}); 92 //});
93 93
94 // Init network stack 94 // Init network stack
95 static STACK: StaticCell<Stack<Device>> = StaticCell::new();
96 static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new(); 95 static RESOURCES: StaticCell<StackResources<3>> = StaticCell::new();
97 let stack = &*STACK.init(Stack::new(device, config, RESOURCES.init(StackResources::new()), seed)); 96 let (stack, runner) = embassy_net::new(device, config, RESOURCES.init(StackResources::new()), seed);
98 97
99 // Launch network task 98 // Launch network task
100 unwrap!(spawner.spawn(net_task(&stack))); 99 unwrap!(spawner.spawn(net_task(runner)));
101 100
102 // Ensure DHCP configuration is up before trying connect 101 // Ensure DHCP configuration is up before trying connect
103 stack.wait_config_up().await; 102 stack.wait_config_up().await;
@@ -109,7 +108,7 @@ async fn main(spawner: Spawner) -> ! {
109 let mut tx_buffer = [0; 1024]; 108 let mut tx_buffer = [0; 1024];
110 109
111 loop { 110 loop {
112 let mut socket = TcpSocket::new(&stack, &mut rx_buffer, &mut tx_buffer); 111 let mut socket = TcpSocket::new(stack, &mut rx_buffer, &mut tx_buffer);
113 112
114 socket.set_timeout(Some(embassy_time::Duration::from_secs(10))); 113 socket.set_timeout(Some(embassy_time::Duration::from_secs(10)));
115 114