pub struct HidReader<'d, D: Driver<'d>, const N: usize> { /* private fields */ }Expand description
USB HID reader.
You can obtain a HidReader using HidReaderWriter::split.
Implementations§
Source§impl<'d, D: Driver<'d>, const N: usize> HidReader<'d, D, N>
impl<'d, D: Driver<'d>, const N: usize> HidReader<'d, D, N>
Sourcepub async fn run<T: RequestHandler>(
self,
use_report_ids: bool,
handler: &mut T,
) -> !
pub async fn run<T: RequestHandler>( self, use_report_ids: bool, handler: &mut T, ) -> !
Delivers output reports from the Interrupt Out pipe to handler.
If use_report_ids is true, the first byte of the report will be used as
the ReportId value. Otherwise the ReportId value will be 0.
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError>
Reads an output report from the Interrupt Out pipe.
Note: Any reports sent from the host over the control pipe will be
passed to RequestHandler::set_report() for handling. The application
is responsible for ensuring output reports from both pipes are handled
correctly.
Note: If N > the maximum packet size of the endpoint (i.e. output
reports may be split across multiple packets) and this method’s future
is dropped after some packets have been read, the next call to read()
will return a ReadError::Sync. The range in the sync error
indicates the portion buf that was filled by the current call to
read(). If the dropped future used the same buf, then buf will
contain the full report.