embassy-usb

Crates

git

Versions

default

Flavors

embassy_usb::class::hid

Trait RequestHandler

Source
pub trait RequestHandler {
    // Provided methods
    fn get_report(&mut self, id: ReportId, buf: &mut [u8]) -> Option<usize> { ... }
    fn set_report(&mut self, id: ReportId, data: &[u8]) -> OutResponse { ... }
    fn get_idle_ms(&mut self, id: Option<ReportId>) -> Option<u32> { ... }
    fn set_idle_ms(&mut self, id: Option<ReportId>, duration_ms: u32) { ... }
}
Expand description

Handler for HID-related control requests.

Provided Methods§

Source

fn get_report(&mut self, id: ReportId, buf: &mut [u8]) -> Option<usize>

Reads the value of report id into buf returning the size.

Returns None if id is invalid or no data is available.

Source

fn set_report(&mut self, id: ReportId, data: &[u8]) -> OutResponse

Sets the value of report id to data.

Source

fn get_idle_ms(&mut self, id: Option<ReportId>) -> Option<u32>

Get the idle rate for id.

If id is None, get the idle rate for all reports. Returning None will reject the control request. Any duration at or above 1.024 seconds or below 4ms will be returned as an indefinite idle rate.

Source

fn set_idle_ms(&mut self, id: Option<ReportId>, duration_ms: u32)

Set the idle rate for id to dur.

If id is None, set the idle rate of all input reports to dur. If an indefinite duration is requested, dur will be set to u32::MAX.

Implementors§