Skip to content

Commit f36f97e

Browse files
committed
Rename USB peripheral
This follows the standards established in other modules.
1 parent a0ce654 commit f36f97e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

examples/usb_serial.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
extern crate panic_semihosting;
66

77
use cortex_m_rt::entry;
8-
use stm32l0xx_hal::usb::{Peripheral, UsbBus};
8+
use stm32l0xx_hal::usb::{USB, UsbBus};
99
use stm32l0xx_hal::{pac, prelude::*, rcc, syscfg::SYSCFG};
1010
use usb_device::prelude::*;
1111
use usbd_serial::{SerialPort, USB_CLASS_CDC};
@@ -20,7 +20,7 @@ fn main() -> ! {
2020

2121
let gpioa = dp.GPIOA.split(&mut rcc);
2222

23-
let usb = Peripheral {
23+
let usb = USB {
2424
usb: dp.USB,
2525
pin_dm: gpioa.pa11,
2626
pin_dp: gpioa.pa12,

src/usb.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
//! Please check out the USB examples in the `examples/` directory to see how it
1313
//! fits together.
1414
15-
use crate::stm32::{RCC, USB};
15+
use crate::pac::{self, RCC};
1616
use stm32_usbd::UsbPeripheral;
1717

1818
use crate::gpio::gpioa::{PA11, PA12};
1919
use crate::gpio::{Floating, Input};
2020
pub use stm32_usbd::UsbBus;
2121

22-
pub struct Peripheral {
23-
pub usb: USB,
22+
pub struct USB {
23+
pub usb: pac::USB,
2424
pub pin_dm: PA11<Input<Floating>>,
2525
pub pin_dp: PA12<Input<Floating>>,
2626
}
2727

28-
unsafe impl Sync for Peripheral {}
28+
unsafe impl Sync for USB {}
2929

30-
unsafe impl UsbPeripheral for Peripheral {
31-
const REGISTERS: *const () = USB::ptr() as *const ();
30+
unsafe impl UsbPeripheral for USB {
31+
const REGISTERS: *const () = pac::USB::ptr() as *const ();
3232
const DP_PULL_UP_FEATURE: bool = true;
3333
const EP_MEMORY: *const () = 0x4000_6000 as _;
3434
const EP_MEMORY_SIZE: usize = 1024;
@@ -53,4 +53,4 @@ unsafe impl UsbPeripheral for Peripheral {
5353
}
5454
}
5555

56-
pub type UsbBusType = UsbBus<Peripheral>;
56+
pub type UsbBusType = UsbBus<USB>;

0 commit comments

Comments
 (0)