Skip to content

Commit

Permalink
allow static_mut_refs - more
Browse files Browse the repository at this point in the history
  • Loading branch information
usbalbin committed Dec 14, 2024
1 parent a14e3f4 commit a880f39
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/ethernet-nucleo-h743zi2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ fn main() -> ! {

let mac_addr = smoltcp::wire::EthernetAddress::from_bytes(&MAC_ADDRESS);
let (_eth_dma, eth_mac) = unsafe {
#[allow(static_mut_refs)] // TODO: Fix this
DES_RING.write(ethernet::DesRing::new());

ethernet::new(
Expand All @@ -131,6 +132,7 @@ fn main() -> ! {
rmii_txd0,
rmii_txd1,
),
#[allow(static_mut_refs)] // TODO: Fix this
DES_RING.assume_init_mut(),
mac_addr,
ccdr.peripheral.ETH1MAC,
Expand Down
8 changes: 7 additions & 1 deletion examples/usb_phy_serial_interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,17 @@ unsafe fn main() -> ! {
}
}

USB_BUS_ALLOCATOR = Some(UsbBus::new(usb, USB_MEMORY_1.assume_init_mut()));
#[allow(static_mut_refs)] // TODO: Fix this
{
USB_BUS_ALLOCATOR =
Some(UsbBus::new(usb, USB_MEMORY_1.assume_init_mut()));
}

#[allow(static_mut_refs)] // TODO: Fix this
let usb_serial =
usbd_serial::SerialPort::new(USB_BUS_ALLOCATOR.as_ref().unwrap());

#[allow(static_mut_refs)] // TODO: Fix this
let usb_dev = UsbDeviceBuilder::new(
USB_BUS_ALLOCATOR.as_ref().unwrap(),
UsbVidPid(VID, PID),
Expand Down
1 change: 1 addition & 0 deletions examples/usb_rtic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ mod app {
}

// Now we may assume that EP_MEMORY is initialised
#[allow(static_mut_refs)] // TODO: Fix this
let usb_bus = cortex_m::singleton!(
: usb_device::class_prelude::UsbBusAllocator<UsbBus<USB1>> =
UsbBus::new(usb, unsafe { EP_MEMORY.assume_init_mut() })
Expand Down
1 change: 1 addition & 0 deletions examples/usb_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ fn main() -> ! {
}

// Now we may assume that EP_MEMORY is initialised
#[allow(static_mut_refs)] // TODO: Fix this
let usb_bus = UsbBus::new(usb, unsafe { EP_MEMORY.assume_init_mut() });

let mut serial = usbd_serial::SerialPort::new(&usb_bus);
Expand Down

0 comments on commit a880f39

Please sign in to comment.