diff --git a/embassy-nrf/src/usb.rs b/embassy-nrf/src/usb.rs index 5008b8e6..39e53429 100644 --- a/embassy-nrf/src/usb.rs +++ b/embassy-nrf/src/usb.rs @@ -4,15 +4,15 @@ pub use embassy_hal_common::usb::*; use nrf_usbd::{UsbPeripheral, Usbd}; use usb_device::bus::UsbBusAllocator; -pub struct UsbThing; -unsafe impl UsbPeripheral for UsbThing { +pub struct UsbBus; +unsafe impl UsbPeripheral for UsbBus { // todo hardcoding const REGISTERS: *const () = crate::pac::USBD::ptr() as *const (); } -impl UsbThing { +impl UsbBus { // todo should it consume a USBD peripheral? - pub fn new() -> UsbBusAllocator> { + pub fn new() -> UsbBusAllocator> { unsafe { (*crate::pac::USBD::ptr()).intenset.write(|w| { w.sof().set_bit(); @@ -23,7 +23,7 @@ impl UsbThing { }) }; - Usbd::new(UsbThing) + Usbd::new(UsbBus) } } diff --git a/examples/nrf/src/bin/usb_uart.rs b/examples/nrf/src/bin/usb_uart.rs index 84bce65e..1df37d4b 100644 --- a/examples/nrf/src/bin/usb_uart.rs +++ b/examples/nrf/src/bin/usb_uart.rs @@ -16,7 +16,7 @@ use panic_probe as _; // print out panic messages use embassy::executor::Spawner; use embassy::io::{AsyncBufReadExt, AsyncWriteExt}; use embassy::time::{Duration, Timer}; -use embassy_nrf::usb::{State, Usb, UsbSerial, UsbThing}; +use embassy_nrf::usb::{State, Usb, UsbBus, UsbSerial}; use embassy_nrf::{interrupt, Peripherals}; use usb_device::device::{UsbDeviceBuilder, UsbVidPid}; @@ -25,7 +25,7 @@ async fn main(_spawner: Spawner, _p: Peripherals) { let mut tx_buffer = [0u8; 1024]; let mut rx_buffer = [0u8; 640]; - let usb_bus = UsbThing::new(); + let usb_bus = UsbBus::new(); let serial = UsbSerial::new(&usb_bus, &mut rx_buffer, &mut tx_buffer);