diff options
| author | Raul Alimbekov <[email protected]> | 2025-12-16 09:05:22 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-16 09:05:22 +0300 |
| commit | c9a04b4b732b7a3b696eb8223664c1a7942b1875 (patch) | |
| tree | 6dbe5c02e66eed8d8762f13f95afd24f8db2b38c /examples/stm32f4/src/bin/eth_w5500.rs | |
| parent | cde24a3ef1117653ba5ed4184102b33f745782fb (diff) | |
| parent | 5ae6e060ec1c90561719aabdc29d5b6e7b8b0a82 (diff) | |
Merge branch 'main' into main
Diffstat (limited to 'examples/stm32f4/src/bin/eth_w5500.rs')
| -rw-r--r-- | examples/stm32f4/src/bin/eth_w5500.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/stm32f4/src/bin/eth_w5500.rs b/examples/stm32f4/src/bin/eth_w5500.rs index 7ce3bfe75..e274d2a66 100644 --- a/examples/stm32f4/src/bin/eth_w5500.rs +++ b/examples/stm32f4/src/bin/eth_w5500.rs | |||
| @@ -7,13 +7,14 @@ use embassy_net::tcp::TcpSocket; | |||
| 7 | use embassy_net::{Ipv4Address, StackResources}; | 7 | use embassy_net::{Ipv4Address, StackResources}; |
| 8 | use embassy_net_wiznet::chip::W5500; | 8 | use embassy_net_wiznet::chip::W5500; |
| 9 | use embassy_net_wiznet::{Device, Runner, State}; | 9 | use embassy_net_wiznet::{Device, Runner, State}; |
| 10 | use embassy_stm32::exti::ExtiInput; | 10 | use embassy_stm32::exti::{self, ExtiInput}; |
| 11 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; | 11 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 12 | use embassy_stm32::mode::Async; | 12 | use embassy_stm32::mode::Async; |
| 13 | use embassy_stm32::rng::Rng; | 13 | use embassy_stm32::rng::Rng; |
| 14 | use embassy_stm32::spi::Spi; | 14 | use embassy_stm32::spi::Spi; |
| 15 | use embassy_stm32::spi::mode::Master; | ||
| 15 | use embassy_stm32::time::Hertz; | 16 | use embassy_stm32::time::Hertz; |
| 16 | use embassy_stm32::{bind_interrupts, peripherals, rng, spi, Config}; | 17 | use embassy_stm32::{Config, bind_interrupts, interrupt, peripherals, rng, spi}; |
| 17 | use embassy_time::{Delay, Timer}; | 18 | use embassy_time::{Delay, Timer}; |
| 18 | use embedded_hal_bus::spi::ExclusiveDevice; | 19 | use embedded_hal_bus::spi::ExclusiveDevice; |
| 19 | use embedded_io_async::Write; | 20 | use embedded_io_async::Write; |
| @@ -22,9 +23,10 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 22 | 23 | ||
| 23 | bind_interrupts!(struct Irqs { | 24 | bind_interrupts!(struct Irqs { |
| 24 | HASH_RNG => rng::InterruptHandler<peripherals::RNG>; | 25 | HASH_RNG => rng::InterruptHandler<peripherals::RNG>; |
| 26 | EXTI0 => exti::InterruptHandler<interrupt::typelevel::EXTI0>; | ||
| 25 | }); | 27 | }); |
| 26 | 28 | ||
| 27 | type EthernetSPI = ExclusiveDevice<Spi<'static, Async>, Output<'static>, Delay>; | 29 | type EthernetSPI = ExclusiveDevice<Spi<'static, Async, Master>, Output<'static>, Delay>; |
| 28 | #[embassy_executor::task] | 30 | #[embassy_executor::task] |
| 29 | async fn ethernet_task(runner: Runner<'static, W5500, EthernetSPI, ExtiInput<'static>, Output<'static>>) -> ! { | 31 | async fn ethernet_task(runner: Runner<'static, W5500, EthernetSPI, ExtiInput<'static>, Output<'static>>) -> ! { |
| 30 | runner.run().await | 32 | runner.run().await |
| @@ -74,7 +76,7 @@ async fn main(spawner: Spawner) -> ! { | |||
| 74 | let cs = Output::new(p.PA4, Level::High, Speed::VeryHigh); | 76 | let cs = Output::new(p.PA4, Level::High, Speed::VeryHigh); |
| 75 | let spi = unwrap!(ExclusiveDevice::new(spi, cs, Delay)); | 77 | let spi = unwrap!(ExclusiveDevice::new(spi, cs, Delay)); |
| 76 | 78 | ||
| 77 | let w5500_int = ExtiInput::new(p.PB0, p.EXTI0, Pull::Up); | 79 | let w5500_int = ExtiInput::new(p.PB0, p.EXTI0, Pull::Up, Irqs); |
| 78 | let w5500_reset = Output::new(p.PB1, Level::High, Speed::VeryHigh); | 80 | let w5500_reset = Output::new(p.PB1, Level::High, Speed::VeryHigh); |
| 79 | 81 | ||
| 80 | let mac_addr = [0x02, 234, 3, 4, 82, 231]; | 82 | let mac_addr = [0x02, 234, 3, 4, 82, 231]; |
