pub unsafe trait UsbPeripheral: Send + Sync {
    const REGISTERS: *const ();
    const HIGH_SPEED: bool;
    const FIFO_DEPTH_WORDS: usize;
    const ENDPOINT_COUNT: usize;

    fn enable();
    fn ahb_frequency_hz(&self) -> u32;

    fn phy_type(&self) -> PhyType { ... }
    fn setup_internal_hs_phy(&self) { ... }
}
Expand description

A trait for device-specific USB peripherals. Implement this to add support for a new hardware platform. Peripherals that have this trait must have the same register block as STM32 USB OTG peripherals.

Required Associated Constants

Pointer to the register block

true for High Speed variants of the peripheral, false for Full Speed

FIFO size in 32-bit words

Number of (bidirectional) endpoints

Required Methods

Enables USB device on its peripheral bus

AHB frequency in hertz

Provided Methods

Returns PHY type that should be used for USB peripheral

Performs initial setup of the internal high-speed PHY

This function should turn on LDO and PLL and wait for PHY clock to become stable.

Implementors