chore: replace make_static! macro usage with non-macro version
This commit is contained in:
@ -12,6 +12,7 @@ use embassy_stm32::can::{
|
||||
};
|
||||
use embassy_stm32::gpio::{Input, Pull};
|
||||
use embassy_stm32::peripherals::CAN3;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -43,7 +44,8 @@ async fn main(spawner: Spawner) {
|
||||
let rx_pin = Input::new(&mut p.PA15, Pull::Up);
|
||||
core::mem::forget(rx_pin);
|
||||
|
||||
let can: &'static mut Can<'static, CAN3> = static_cell::make_static!(Can::new(p.CAN3, p.PA8, p.PA15, Irqs));
|
||||
static CAN: StaticCell<Can<'static, CAN3>> = StaticCell::new();
|
||||
let can = CAN.init(Can::new(p.CAN3, p.PA8, p.PA15, Irqs));
|
||||
can.as_mut()
|
||||
.modify_filters()
|
||||
.enable_bank(0, Fifo::Fifo0, Mask32::accept_all());
|
||||
@ -56,7 +58,8 @@ async fn main(spawner: Spawner) {
|
||||
|
||||
let (tx, mut rx) = can.split();
|
||||
|
||||
let tx: &'static mut CanTx<'static, 'static, CAN3> = static_cell::make_static!(tx);
|
||||
static CAN_TX: StaticCell<CanTx<'static, 'static, CAN3>> = StaticCell::new();
|
||||
let tx = CAN_TX.init(tx);
|
||||
spawner.spawn(send_can_message(tx)).unwrap();
|
||||
|
||||
loop {
|
||||
|
@ -15,7 +15,7 @@ use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config};
|
||||
use embassy_time::Timer;
|
||||
use embedded_io_async::Write;
|
||||
use rand_core::RngCore;
|
||||
use static_cell::make_static;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -64,8 +64,9 @@ async fn main(spawner: Spawner) -> ! {
|
||||
|
||||
let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF];
|
||||
|
||||
static PACKETS: StaticCell<PacketQueue<16, 16>> = StaticCell::new();
|
||||
let device = Ethernet::new(
|
||||
make_static!(PacketQueue::<16, 16>::new()),
|
||||
PACKETS.init(PacketQueue::<16, 16>::new()),
|
||||
p.ETH,
|
||||
Irqs,
|
||||
p.PA1,
|
||||
@ -89,11 +90,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
|
||||
|
Reference in New Issue
Block a user