[][src]Trait usb_host::Driver

pub trait Driver: Debug {
    fn want_device(&self, device: &DeviceDescriptor) -> bool;
fn add_device(
        &mut self,
        device: DeviceDescriptor,
        address: u8
    ) -> Result<(), DriverError>;
fn remove_device(&mut self, address: u8);
fn tick(
        &mut self,
        millis: usize,
        usbhost: &mut dyn USBHost
    ) -> Result<(), DriverError>; }

Trait for drivers on the USB host.

Required methods

fn want_device(&self, device: &DeviceDescriptor) -> bool

Does this driver want device?

Answering true to this not necessarily mean the driver will get device.

fn add_device(
    &mut self,
    device: DeviceDescriptor,
    address: u8
) -> Result<(), DriverError>

Add device with address address to the driver's registry, if necessary.

fn remove_device(&mut self, address: u8)

Remove the device at address address from the driver's registry, if necessary.

fn tick(
    &mut self,
    millis: usize,
    usbhost: &mut dyn USBHost
) -> Result<(), DriverError>

Called regularly by the USB host to allow the driver to do any work necessary on its registered devices.

millis is the current time, in milliseconds from some arbitrary starting point. It should be expected that after a long enough run-time, this value will wrap.

usbhost may be used for communication with the USB when required.

Loading content...

Implementors

Loading content...