chore: replace make_static! macro usage with non-macro version

This commit is contained in:
Ulf Lilleengen
2023-12-21 08:50:54 +01:00
parent d832d45c0b
commit 0acf7b09c3
37 changed files with 313 additions and 188 deletions

View File

@ -14,7 +14,7 @@ use embassy_stm32::peripherals::ETH;
use embassy_stm32::rng::Rng;
use embassy_stm32::{bind_interrupts, eth, peripherals, rng};
use rand_core::RngCore;
use static_cell::make_static;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
teleprobe_meta::timeout!(120);
@ -71,8 +71,9 @@ async fn main(spawner: Spawner) {
#[cfg(not(feature = "stm32f207zg"))]
const PACKET_QUEUE_SIZE: usize = 4;
static PACKETS: StaticCell<PacketQueue<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>> = StaticCell::new();
let device = Ethernet::new(
make_static!(PacketQueue::<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>::new()),
PACKETS.init(PacketQueue::<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>::new()),
p.ETH,
Irqs,
p.PA1,
@ -99,11 +100,13 @@ async fn main(spawner: Spawner) {
//});
// Init network stack
let stack = &*make_static!(Stack::new(
static STACK: StaticCell<Stack<Device>> = StaticCell::new();
static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
let stack = &*STACK.init(Stack::new(
device,
config,
make_static!(StackResources::<2>::new()),
seed
RESOURCES.init(StackResources::<2>::new()),
seed,
));
// Launch network task

View File

@ -15,7 +15,7 @@ use embassy_stm32::rcc::LsConfig;
use embassy_stm32::rtc::{Rtc, RtcConfig};
use embassy_stm32::Config;
use embassy_time::Timer;
use static_cell::make_static;
use static_cell::StaticCell;
#[entry]
fn main() -> ! {
@ -64,7 +64,8 @@ async fn async_main(spawner: Spawner) {
rtc.set_datetime(now.into()).expect("datetime not set");
let rtc = make_static!(rtc);
static RTC: StaticCell<Rtc> = StaticCell::new();
let rtc = RTC.init(rtc);
stop_with_rtc(rtc);