Fix interrupt version to be buildable

This commit is contained in:
hodasemi 2023-01-06 18:36:46 +01:00
parent f3329f210a
commit 34d112b38b

View file

@ -12,7 +12,7 @@ mod app {
use rp_pico as bsp; use rp_pico as bsp;
use bsp::hal::{ use bsp::hal::{
clocks::{init_clocks_and_plls, Clock}, clocks::init_clocks_and_plls,
gpio::{bank0::Gpio26, Floating, Input, Pin}, gpio::{bank0::Gpio26, Floating, Input, Pin},
rom_data::reset_to_usb_boot, rom_data::reset_to_usb_boot,
sio::Sio, sio::Sio,
@ -31,9 +31,10 @@ mod app {
const SCAN_TIME_US: MicrosDurationU32 = MicrosDurationU32::secs(1); const SCAN_TIME_US: MicrosDurationU32 = MicrosDurationU32::secs(1);
struct Data { static mut USB_BUS: Option<UsbBusAllocator<UsbBus>> = None;
pub struct Data {
i: usize, i: usize,
usb_bus: UsbBusAllocator<UsbBus>,
usb_dev: UsbDevice<'static, UsbBus>, usb_dev: UsbDevice<'static, UsbBus>,
serial: Serial<'static>, serial: Serial<'static>,
@ -95,18 +96,23 @@ mod app {
led_pin.set_low().unwrap(); led_pin.set_low().unwrap();
// Set up the USB driver // Set up the USB driver
let usb_bus = UsbBusAllocator::new(UsbBus::new( unsafe {
USB_BUS = Some(UsbBusAllocator::new(UsbBus::new(
c.device.USBCTRL_REGS, c.device.USBCTRL_REGS,
c.device.USBCTRL_DPRAM, c.device.USBCTRL_DPRAM,
clocks.usb_clock, clocks.usb_clock,
true, true,
&mut resets, &mut resets,
)); )))
};
let serial = Serial::new(&usb_bus); let serial = Serial::new(unsafe { USB_BUS.as_ref().unwrap() });
// Create a USB device with a fake VID and PID // Create a USB device with a fake VID and PID
let usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd)) let usb_dev = UsbDeviceBuilder::new(
unsafe { USB_BUS.as_ref().unwrap() },
UsbVidPid(0x16c0, 0x27dd),
)
.manufacturer("Fake company") .manufacturer("Fake company")
.product("Serial port") .product("Serial port")
.serial_number("TEST") .serial_number("TEST")
@ -121,7 +127,6 @@ mod app {
let data = Data { let data = Data {
i: 0, i: 0,
usb_bus,
usb_dev, usb_dev,
serial, serial,