Module imxrt_hal::usbd

source ·
Expand description

USB device.

This module re-exports types from the imxrt-usbd package. The driver is compatible with the usb-device ecosystem.

It also provides Instances, an implementation of imxrt_usbd::Peripherals over imxrt-ral USB instances.

§Example

Construct a BusAdapter with USB peripheral instances. See the BusAdapter documentation for more information on how to use the bus.

use imxrt_hal as hal;
use imxrt_ral as ral;

use hal::usbd;

let mut usb_analog = unsafe { ral::usb_analog::USB_ANALOG::instance() };
let usb_instances = usbd::Instances {
    usb: unsafe { ral::usb::USB1::instance() },
    usbnc: unsafe { ral::usbnc::USBNC1::instance() },
    usbphy: unsafe { ral::usbphy::USBPHY1::instance() },
};

// Prepare the USB clocks.
let mut ccm_analog = unsafe { ral::ccm_analog::CCM_ANALOG::instance() };
hal::ccm::analog::pll3::restart(&mut ccm_analog);

static ENDPOINT_MEMORY: usbd::EndpointMemory<2048> = usbd::EndpointMemory::new();
static ENDPOINT_STATE: usbd::EndpointState = usbd::EndpointState::max_endpoints();

let usbd = usbd::BusAdapter::new(usb_instances, &ENDPOINT_MEMORY, &ENDPOINT_STATE);

Modules§

  • USB general purpose timers.

Structs§

Enums§

  • USB low / full / high speed setting.

Constants§

Traits§