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>; }
Expand description

Trait for drivers on the USB host.

Required Methods

Does this driver want device?

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

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

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

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.