Struct HidWriter
pub struct HidWriter<'d, D, const N: usize>where
D: Driver<'d>,{ /* private fields */ }
Expand description
USB HID writer.
You can obtain a HidWriter
using HidReaderWriter::split
.
Implementations§
§impl<'d, D, const N: usize> HidWriter<'d, D, N>where
D: Driver<'d>,
impl<'d, D, const N: usize> HidWriter<'d, D, N>where
D: Driver<'d>,
pub fn new(
builder: &mut Builder<'d, D>,
state: &'d mut State<'d>,
config: Config<'d>,
) -> HidWriter<'d, D, N>
pub fn new( builder: &mut Builder<'d, D>, state: &'d mut State<'d>, config: Config<'d>, ) -> HidWriter<'d, D, N>
Creates a new HidWriter.
This will allocate one IN endpoint only, so the host won’t be able to send
reports to us. If you need that, consider using HidReaderWriter::new
instead.
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 async fn ready(&mut self)
pub async fn ready(&mut self)
Waits for the interrupt in endpoint to be enabled.
pub async fn write_serialize<IR>(&mut self, r: &IR) -> Result<(), EndpointError>where
IR: AsInputReport,
Available on crate feature usbd-hid
only.
pub async fn write_serialize<IR>(&mut self, r: &IR) -> Result<(), EndpointError>where
IR: AsInputReport,
usbd-hid
only.Writes an input report by serializing the given report structure.
pub async fn write(&mut self, report: &[u8]) -> Result<(), EndpointError>
pub async fn write(&mut self, report: &[u8]) -> Result<(), EndpointError>
Writes report
to its interrupt endpoint.
Auto Trait Implementations§
impl<'d, D, const N: usize> Freeze for HidWriter<'d, D, N>
impl<'d, D, const N: usize> RefUnwindSafe for HidWriter<'d, D, N>
impl<'d, D, const N: usize> Send for HidWriter<'d, D, N>
impl<'d, D, const N: usize> Sync for HidWriter<'d, D, N>
impl<'d, D, const N: usize> Unpin for HidWriter<'d, D, N>
impl<'d, D, const N: usize> UnwindSafe for HidWriter<'d, D, N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more