diff options
Diffstat (limited to 'examples/stm32h5/src/bin/eth.rs')
| -rw-r--r-- | examples/stm32h5/src/bin/eth.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/stm32h5/src/bin/eth.rs b/examples/stm32h5/src/bin/eth.rs index b2758cba0..2370656e6 100644 --- a/examples/stm32h5/src/bin/eth.rs +++ b/examples/stm32h5/src/bin/eth.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | 3 | ||
| 5 | use defmt::*; | 4 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| @@ -18,7 +17,7 @@ use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config}; | |||
| 18 | use embassy_time::Timer; | 17 | use embassy_time::Timer; |
| 19 | use embedded_io_async::Write; | 18 | use embedded_io_async::Write; |
| 20 | use rand_core::RngCore; | 19 | use rand_core::RngCore; |
| 21 | use static_cell::make_static; | 20 | use static_cell::StaticCell; |
| 22 | use {defmt_rtt as _, panic_probe as _}; | 21 | use {defmt_rtt as _, panic_probe as _}; |
| 23 | 22 | ||
| 24 | bind_interrupts!(struct Irqs { | 23 | bind_interrupts!(struct Irqs { |
| @@ -67,8 +66,9 @@ async fn main(spawner: Spawner) -> ! { | |||
| 67 | 66 | ||
| 68 | let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; | 67 | let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; |
| 69 | 68 | ||
| 69 | static PACKETS: StaticCell<PacketQueue<4, 4>> = StaticCell::new(); | ||
| 70 | let device = Ethernet::new( | 70 | let device = Ethernet::new( |
| 71 | make_static!(PacketQueue::<4, 4>::new()), | 71 | PACKETS.init(PacketQueue::<4, 4>::new()), |
| 72 | p.ETH, | 72 | p.ETH, |
| 73 | Irqs, | 73 | Irqs, |
| 74 | p.PA1, | 74 | p.PA1, |
| @@ -92,11 +92,13 @@ async fn main(spawner: Spawner) -> ! { | |||
| 92 | //}); | 92 | //}); |
| 93 | 93 | ||
| 94 | // Init network stack | 94 | // Init network stack |
| 95 | let stack = &*make_static!(Stack::new( | 95 | static STACK: StaticCell<Stack<Device>> = StaticCell::new(); |
| 96 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 97 | let stack = &*STACK.init(Stack::new( | ||
| 96 | device, | 98 | device, |
| 97 | config, | 99 | config, |
| 98 | make_static!(StackResources::<2>::new()), | 100 | RESOURCES.init(StackResources::<2>::new()), |
| 99 | seed | 101 | seed, |
| 100 | )); | 102 | )); |
| 101 | 103 | ||
| 102 | // Launch network task | 104 | // Launch network task |
