[][src]Struct usbd_hid::hid_class::HIDClass

pub struct HIDClass<'a, B: UsbBus> { /* fields omitted */ }

HIDClass provides an interface to declare, read & write HID reports.

Users are expected to provide the report descriptor, as well as pack and unpack reports which are read or staged for transmission.

Methods

impl<'_, B: UsbBus> HIDClass<'_, B>[src]

pub fn new<'a>(
    alloc: &'a UsbBusAllocator<B>,
    report_descriptor: &'static [u8],
    poll_ms: u8
) -> HIDClass<'a, B>
[src]

Creates a new HIDClass with the provided UsbBus & HID report descriptor.

poll_ms configures how frequently the host should poll for reading/writing HID reports. A lower value means better throughput & latency, at the expense of CPU on the device & bandwidth on the bus. A value of 10 is reasonable for high performance uses, and a value of 255 is good for best-effort usecases.

pub fn push_input(&self, data: &[u8]) -> Result<usize>[src]

Tries to write an input report. Data is expected to be a valid HID report for INPUT items. If report ID's were used in the descriptor, the report ID corresponding to this report must be be present before the contents of the report.

Trait Implementations

impl<'_, B: UsbBus> UsbClass<B> for HIDClass<'_, B>[src]

Auto Trait Implementations

impl<'a, B> Send for HIDClass<'a, B>

impl<'a, B> Sync for HIDClass<'a, B>

impl<'a, B> Unpin for HIDClass<'a, B>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.