[−][src]Struct usbd_hid::hid_class::HIDClass
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]
alloc: &'a UsbBusAllocator<B>,
report_descriptor: &'static [u8],
poll_ms: u8
) -> HIDClass<'a, B>
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]
fn get_configuration_descriptors(
&self,
writer: &mut DescriptorWriter
) -> Result<()>
[src]
&self,
writer: &mut DescriptorWriter
) -> Result<()>
fn control_in(&mut self, xfer: ControlIn<B>)
[src]
fn control_out(&mut self, xfer: ControlOut<B>)
[src]
fn get_bos_descriptors(&self, writer: &mut BosWriter) -> Result<(), UsbError>
[src]
fn get_string(&self, index: StringIndex, lang_id: u16) -> Option<&str>
[src]
fn reset(&mut self)
[src]
fn poll(&mut self)
[src]
fn endpoint_setup(&mut self, addr: EndpointAddress)
[src]
fn endpoint_out(&mut self, addr: EndpointAddress)
[src]
fn endpoint_in_complete(&mut self, addr: EndpointAddress)
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,