embassy-usb-driver

Crates

git

Versions

default

Flavors

Skip to main content

EndpointInterval

Struct EndpointInterval 

Source
pub struct EndpointInterval { /* private fields */ }
Expand description

Polling interval of an endpoint.

This is the period the endpoint is serviced with, independent of the bus speed, so it means the same thing wherever it is stored: in an EndpointConfig, an EndpointInfo, or a host-side pipe. It is kept as a whole number of microframes (125 µs, the high-speed bus interval), and one frame (1 ms) is 8 microframes, so equal periods are always equal values: from_ms(1) == from_microframes(8).

The bInterval byte of an endpoint descriptor is a speed- and transfer-type-specific encoding of this period, which b_interval and from_b_interval convert to and from.

Bulk and control endpoints have no polling period, they use EndpointInterval::NONE.

Implementations§

Source§

impl EndpointInterval

Source

pub const NONE: Self

No polling period, for bulk and control endpoints.

For a periodic (interrupt or isochronous) endpoint this is the shortest period, every frame or microframe.

Source

pub const fn from_ms(ms: u8) -> Self

A period of ms milliseconds (frames).

Source

pub const fn from_microframes(microframes: u32) -> Self

A period of microframes microframes (125 µs units).

Source

pub const fn microframes(self) -> u32

The period in microframes (125 µs units).

Source

pub const fn frames(self) -> u32

The period in whole frames (1 ms), rounded up and at least 1.

Source

pub const fn full_speed_b_interval(self, ep_type: EndpointType) -> u8

The bInterval of a full-speed (or low-speed) endpoint descriptor for this period.

Interrupt endpoints use a linear period of 1..=255 frames, isochronous endpoints the exponential period 2^(bInterval-1) frames, rounded up to a power of two. Bulk and control endpoints use 0.

Source

pub const fn high_speed_b_interval(self, ep_type: EndpointType) -> u8

The bInterval of a high-speed (or SuperSpeed) endpoint descriptor for this period.

Interrupt and isochronous endpoints use the exponential period 2^(bInterval-1) microframes, rounded up to a power of two. Bulk and control endpoints use 0.

Source

pub const fn b_interval(self, speed: Speed, ep_type: EndpointType) -> u8

The bInterval of an endpoint descriptor at speed for this period.

Source

pub const fn from_b_interval( speed: Speed, ep_type: EndpointType, b_interval: u8, ) -> Self

The period of an endpoint with the descriptor bInterval at speed.

The inverse of b_interval for the values it produces. Bulk and control endpoints have no period, which gives EndpointInterval::NONE.

Trait Implementations§

Source§

impl Clone for EndpointInterval

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 EndpointInterval

Source§

impl Debug for EndpointInterval

Source§

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

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

impl Default for EndpointInterval

Source§

fn default() -> Self

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

impl Eq for EndpointInterval

Source§

impl Format for EndpointInterval

Source§

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

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for EndpointInterval

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 EndpointInterval

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.