pub struct VendorClass<'d, D: Driver<'d>> { /* private fields */ }Expand description
Vendor-specific bulk USB class.
Implements bidirectional communication over one Bulk IN and one Bulk OUT endpoint.
Implementations§
Source§impl<'d, D: Driver<'d>> VendorClass<'d, D>
impl<'d, D: Driver<'d>> VendorClass<'d, D>
Sourcepub fn new(
builder: &mut Builder<'d, D>,
state: &'d mut State<'d>,
config: Config<'d>,
) -> Self
pub fn new( builder: &mut Builder<'d, D>, state: &'d mut State<'d>, config: Config<'d>, ) -> Self
Creates a new VendorClass with the provided configuration.
Sourcepub fn interface(&self) -> InterfaceNumber
pub fn interface(&self) -> InterfaceNumber
Gets the interface number.
Sourcepub fn max_packet_size(&self) -> u16
pub fn max_packet_size(&self) -> u16
Gets the maximum packet size in bytes.
Sourcepub async fn write_packet(&mut self, data: &[u8]) -> Result<(), EndpointError>
pub async fn write_packet(&mut self, data: &[u8]) -> Result<(), EndpointError>
Writes a single packet into the IN endpoint.
Sourcepub async fn read_packet(
&mut self,
data: &mut [u8],
) -> Result<usize, EndpointError>
pub async fn read_packet( &mut self, data: &mut [u8], ) -> Result<usize, EndpointError>
Reads a single packet from the OUT endpoint.
Sourcepub async fn write_transfer(
&mut self,
data: &[u8],
needs_zlp: bool,
) -> Result<(), EndpointDisabledError>
pub async fn write_transfer( &mut self, data: &[u8], needs_zlp: bool, ) -> Result<(), EndpointDisabledError>
Writes a multi-packet transfer into the IN endpoint.
Sourcepub async fn read_transfer(
&mut self,
data: &mut [u8],
) -> Result<usize, EndpointError>
pub async fn read_transfer( &mut self, data: &mut [u8], ) -> Result<usize, EndpointError>
Reads a multi-packet transfer from the OUT endpoint until a short packet is received.
Sourcepub async fn wait_connection(&mut self)
pub async fn wait_connection(&mut self)
Waits for the USB host to enable this interface.
Auto Trait Implementations§
impl<'d, D> Forget for VendorClass<'d, D>
impl<'d, D> Freeze for VendorClass<'d, D>
impl<'d, D> Move for VendorClass<'d, D>
impl<'d, D> RefUnwindSafe for VendorClass<'d, D>
impl<'d, D> Send for VendorClass<'d, D>
impl<'d, D> Sync for VendorClass<'d, D>
impl<'d, D> Unpin for VendorClass<'d, D>
impl<'d, D> UnsafeUnpin for VendorClass<'d, D>
impl<'d, D> UnwindSafe for VendorClass<'d, D>
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