diff options
| author | Ulf Lilleengen <[email protected]> | 2023-12-21 10:02:11 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-12-21 10:02:11 +0000 |
| commit | 530ead5fdeba97dd7d84798463436d1c75bbe96e (patch) | |
| tree | 40c027b0f69efe9a9edb9913c0c1122a9b608318 /tests/stm32/src | |
| parent | 8442e72589f47182f8ca1c979c668afc800e5d1e (diff) | |
| parent | 0acf7b09c3bc9176d00479d601356d8df2537a9b (diff) | |
Merge pull request #2339 from embassy-rs/make-static-remove
Replace make_static! macro usage with non-macro version
Diffstat (limited to 'tests/stm32/src')
| -rw-r--r-- | tests/stm32/src/bin/eth.rs | 13 | ||||
| -rw-r--r-- | tests/stm32/src/bin/stop.rs | 5 |
2 files changed, 11 insertions, 7 deletions
diff --git a/tests/stm32/src/bin/eth.rs b/tests/stm32/src/bin/eth.rs index 754354944..c01f33a97 100644 --- a/tests/stm32/src/bin/eth.rs +++ b/tests/stm32/src/bin/eth.rs | |||
| @@ -14,7 +14,7 @@ use embassy_stm32::peripherals::ETH; | |||
| 14 | use embassy_stm32::rng::Rng; | 14 | use embassy_stm32::rng::Rng; |
| 15 | use embassy_stm32::{bind_interrupts, eth, peripherals, rng}; | 15 | use embassy_stm32::{bind_interrupts, eth, peripherals, rng}; |
| 16 | use rand_core::RngCore; | 16 | use rand_core::RngCore; |
| 17 | use static_cell::make_static; | 17 | use static_cell::StaticCell; |
| 18 | use {defmt_rtt as _, panic_probe as _}; | 18 | use {defmt_rtt as _, panic_probe as _}; |
| 19 | 19 | ||
| 20 | teleprobe_meta::timeout!(120); | 20 | teleprobe_meta::timeout!(120); |
| @@ -71,8 +71,9 @@ async fn main(spawner: Spawner) { | |||
| 71 | #[cfg(not(feature = "stm32f207zg"))] | 71 | #[cfg(not(feature = "stm32f207zg"))] |
| 72 | const PACKET_QUEUE_SIZE: usize = 4; | 72 | const PACKET_QUEUE_SIZE: usize = 4; |
| 73 | 73 | ||
| 74 | static PACKETS: StaticCell<PacketQueue<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>> = StaticCell::new(); | ||
| 74 | let device = Ethernet::new( | 75 | let device = Ethernet::new( |
| 75 | make_static!(PacketQueue::<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>::new()), | 76 | PACKETS.init(PacketQueue::<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>::new()), |
| 76 | p.ETH, | 77 | p.ETH, |
| 77 | Irqs, | 78 | Irqs, |
| 78 | p.PA1, | 79 | p.PA1, |
| @@ -99,11 +100,13 @@ async fn main(spawner: Spawner) { | |||
| 99 | //}); | 100 | //}); |
| 100 | 101 | ||
| 101 | // Init network stack | 102 | // Init network stack |
| 102 | let stack = &*make_static!(Stack::new( | 103 | static STACK: StaticCell<Stack<Device>> = StaticCell::new(); |
| 104 | static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); | ||
| 105 | let stack = &*STACK.init(Stack::new( | ||
| 103 | device, | 106 | device, |
| 104 | config, | 107 | config, |
| 105 | make_static!(StackResources::<2>::new()), | 108 | RESOURCES.init(StackResources::<2>::new()), |
| 106 | seed | 109 | seed, |
| 107 | )); | 110 | )); |
| 108 | 111 | ||
| 109 | // Launch network task | 112 | // Launch network task |
diff --git a/tests/stm32/src/bin/stop.rs b/tests/stm32/src/bin/stop.rs index b9810673a..f8e3c43d7 100644 --- a/tests/stm32/src/bin/stop.rs +++ b/tests/stm32/src/bin/stop.rs | |||
| @@ -15,7 +15,7 @@ use embassy_stm32::rcc::LsConfig; | |||
| 15 | use embassy_stm32::rtc::{Rtc, RtcConfig}; | 15 | use embassy_stm32::rtc::{Rtc, RtcConfig}; |
| 16 | use embassy_stm32::Config; | 16 | use embassy_stm32::Config; |
| 17 | use embassy_time::Timer; | 17 | use embassy_time::Timer; |
| 18 | use static_cell::make_static; | 18 | use static_cell::StaticCell; |
| 19 | 19 | ||
| 20 | #[entry] | 20 | #[entry] |
| 21 | fn main() -> ! { | 21 | fn main() -> ! { |
| @@ -64,7 +64,8 @@ async fn async_main(spawner: Spawner) { | |||
| 64 | 64 | ||
| 65 | rtc.set_datetime(now.into()).expect("datetime not set"); | 65 | rtc.set_datetime(now.into()).expect("datetime not set"); |
| 66 | 66 | ||
| 67 | let rtc = make_static!(rtc); | 67 | static RTC: StaticCell<Rtc> = StaticCell::new(); |
| 68 | let rtc = RTC.init(rtc); | ||
| 68 | 69 | ||
| 69 | stop_with_rtc(rtc); | 70 | stop_with_rtc(rtc); |
| 70 | 71 | ||
