pub struct Endpoint<'a, B: UsbBus, D: EndpointDirection> { /* private fields */ }
Expand description

Handle for a USB endpoint. The endpoint direction is constrained by the D type argument, which must be either In or Out.

Implementations

Gets the endpoint address including direction bit.

Gets the endpoint transfer type.

Gets the maximum packet size for the endpoint.

Gets the poll interval for interrupt endpoints.

Sets the STALL condition for the endpoint.

Clears the STALL condition of the endpoint.

Writes a single packet of data to the specified endpoint and returns number of bytes actually written.

The only reason for a short write is if the caller passes a slice larger than the amount of memory allocated earlier, and this is generally an error in the class implementation.

Errors

Note: USB bus implementation errors are directly passed through, so be prepared to handle other errors as well.

Reads a single packet of data from the specified endpoint and returns the actual length of the packet.

This should also clear any NAK flags and prepare the endpoint to receive the next packet.

Errors

Note: USB bus implementation errors are directly passed through, so be prepared to handle other errors as well.

  • InvalidEndpoint - The ep_addr does not point to a valid endpoint that was previously allocated with UsbBus::alloc_ep.
  • WouldBlock - There is no packet to be read. Note that this is different from a received zero-length packet, which is valid in USB. A zero-length packet will return Ok(0).
  • BufferOverflow - The received packet is too long to fix in buf. This is generally an error in the class implementation.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.