embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

EndpointOptions

Struct EndpointOptions 

Source
#[non_exhaustive]
pub struct EndpointOptions { pub max_packet_size: Option<u16>, pub buffers: u8, pub max_burst: u8, pub additional_transactions: u8, }
Expand description

Endpoint settings chosen by the user rather than by the class.

These trade throughput for hardware resources, and don’t change how a class works. Classes take them in their configuration for the endpoints where they matter, and pass them to the InterfaceAltBuilder methods that allocate those endpoints. Other endpoints use EndpointOptions::new().

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§max_packet_size: Option<u16>

Max packet size of a bulk endpoint, in bytes, or None for the largest one the device speed allows: 64 at full speed, 512 at high speed and 1024 at SuperSpeed. Ignored for endpoints that aren’t bulk.

A smaller one saves packet memory. Only full speed allows that, with 8, 16 or 32.

Default: None

§buffers: u8

Number of packets the hardware may buffer for each endpoint.

More buffers let the hardware move the next packet while software is still busy with the previous one, which improves throughput, at the cost of more packet memory. Drivers use as many buffers as they support, up to this number.

Default: 1

§max_burst: u8

Maximum burst size at SuperSpeed, in packets minus one. Ignored for endpoints that aren’t bulk, and at lower speeds.

Default: 0 Max: 15

§additional_transactions: u8

Additional transaction opportunities per microframe at high speed (wMaxPacketSize bits 12..11). Ignored for non-periodic endpoints and at other speeds.

Default: 0 Max: 2

Implementations§

Source§

impl EndpointOptions

Source

pub const fn new() -> Self

Create the default endpoint options.

Trait Implementations§

Source§

impl Clone for EndpointOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for EndpointOptions

Source§

impl Debug for EndpointOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EndpointOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for EndpointOptions

Source§

impl Format for EndpointOptions
where Option<u16>: Format,

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for EndpointOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EndpointOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.