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 bsp::hal::{
clocks::{init_clocks_and_plls, Clock},
clocks::init_clocks_and_plls,
gpio::{bank0::Gpio26, Floating, Input, Pin},
rom_data::reset_to_usb_boot,
sio::Sio,
@ -31,9 +31,10 @@ mod app {
const SCAN_TIME_US: MicrosDurationU32 = MicrosDurationU32::secs(1);
struct Data {
static mut USB_BUS: Option<UsbBusAllocator<UsbBus>> = None;
pub struct Data {
i: usize,
usb_bus: UsbBusAllocator<UsbBus>,
usb_dev: UsbDevice<'static, UsbBus>,
serial: Serial<'static>,
@ -95,23 +96,28 @@ mod app {
led_pin.set_low().unwrap();
// Set up the USB driver
let usb_bus = UsbBusAllocator::new(UsbBus::new(
c.device.USBCTRL_REGS,
c.device.USBCTRL_DPRAM,
clocks.usb_clock,
true,
&mut resets,
));
unsafe {
USB_BUS = Some(UsbBusAllocator::new(UsbBus::new(
c.device.USBCTRL_REGS,
c.device.USBCTRL_DPRAM,
clocks.usb_clock,
true,
&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
let usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.device_class(2) // from: https://www.usb.org/defined-class-codes
.build();
let usb_dev = UsbDeviceBuilder::new(
unsafe { USB_BUS.as_ref().unwrap() },
UsbVidPid(0x16c0, 0x27dd),
)
.manufacturer("Fake company")
.product("Serial port")
.serial_number("TEST")
.device_class(2) // from: https://www.usb.org/defined-class-codes
.build();
let adc = Adc::new(c.device.ADC, &mut resets);
@ -121,7 +127,6 @@ mod app {
let data = Data {
i: 0,
usb_bus,
usb_dev,
serial,