Skip to content

USB high speed & full speed support #39

Open
@conorpp

Description

@conorpp

I'm interested in implementing high speed support and can make a PR but am not sure how best how to do it. The way I'm thinking is to make these two changes.

  1. Add method to UsbBus trait to read the current speed of bus.
pub enum UsbSpeed{
    LowSpeed,
    FullSpeed,
    HighSpeed,
    SuperSpeed,
}

pub trait UsbBus: Sync + Sized {
    // ...
    fn get_speed(&mut self) -> UsbSpeed;
    // ...
}
  1. Change method in UsbClass trait to use the UsbSpeed when making the usb descriptors. UsbSpeed would then get read at runtime and passed for each enumeration.
pub trait UsbClass<B: UsbBus> {
    //...
    fn get_configuration_descriptors(&self, writer: &mut DescriptorWriter, speed: UsbSpeed) -> Result<()>;
    //...
}

Problem with (2) is it would be a breaking change for existing classes, although a pretty easy fix.

What do you think? Does this look okay?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions