aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f4/src/bin/eth.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-07-31 01:41:12 +0200
committerDario Nieuwenhuis <[email protected]>2023-07-31 01:41:12 +0200
commit4999b045df4e5956733b0341795714a9214c12d3 (patch)
tree84c40ec27c89bb4dedea30cdafbaad484bfda3cb /examples/stm32f4/src/bin/eth.rs
parentd6c5c1772cf2c6099ab08675afc0fead2e50fffb (diff)
stm32/rng: use bind_interrupts!.
Diffstat (limited to 'examples/stm32f4/src/bin/eth.rs')
-rw-r--r--examples/stm32f4/src/bin/eth.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/stm32f4/src/bin/eth.rs b/examples/stm32f4/src/bin/eth.rs
index d0b164393..496016687 100644
--- a/examples/stm32f4/src/bin/eth.rs
+++ b/examples/stm32f4/src/bin/eth.rs
@@ -11,13 +11,15 @@ use embassy_stm32::eth::{Ethernet, PacketQueue};
11use embassy_stm32::peripherals::ETH; 11use embassy_stm32::peripherals::ETH;
12use embassy_stm32::rng::Rng; 12use embassy_stm32::rng::Rng;
13use embassy_stm32::time::mhz; 13use embassy_stm32::time::mhz;
14use embassy_stm32::{bind_interrupts, eth, Config}; 14use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config};
15use embassy_time::{Duration, Timer}; 15use embassy_time::{Duration, Timer};
16use embedded_io::asynch::Write; 16use embedded_io::asynch::Write;
17use static_cell::make_static; 17use static_cell::make_static;
18use {defmt_rtt as _, panic_probe as _}; 18use {defmt_rtt as _, panic_probe as _};
19
19bind_interrupts!(struct Irqs { 20bind_interrupts!(struct Irqs {
20 ETH => eth::InterruptHandler; 21 ETH => eth::InterruptHandler;
22 HASH_RNG => rng::InterruptHandler<peripherals::RNG>;
21}); 23});
22 24
23type Device = Ethernet<'static, ETH, GenericSMI>; 25type Device = Ethernet<'static, ETH, GenericSMI>;
@@ -36,7 +38,7 @@ async fn main(spawner: Spawner) -> ! {
36 info!("Hello World!"); 38 info!("Hello World!");
37 39
38 // Generate random seed. 40 // Generate random seed.
39 let mut rng = Rng::new(p.RNG); 41 let mut rng = Rng::new(p.RNG, Irqs);
40 let mut seed = [0; 8]; 42 let mut seed = [0; 8];
41 let _ = rng.async_fill_bytes(&mut seed).await; 43 let _ = rng.async_fill_bytes(&mut seed).await;
42 let seed = u64::from_le_bytes(seed); 44 let seed = u64::from_le_bytes(seed);