From 79502330def843562b4e3fc502d687c00b3b649f Mon Sep 17 00:00:00 2001 From: Jacob Rosenthal Date: Wed, 15 Dec 2021 09:59:56 -0700 Subject: [PATCH] rename to UsbBus --- embassy-nrf/src/usb.rs | 10 +++++----- examples/nrf/src/bin/usb_uart.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/embassy-nrf/src/usb.rs b/embassy-nrf/src/usb.rs index 5008b8e65..39e53429a 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 84bce65e5..1df37d4ba 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);