embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

Config

Struct Config 

Source
pub struct Config<'d> {
    pub sample_rates_hz: &'d [u32],
    pub sample_width: SampleWidth,
    pub channels: &'d [Channel],
    pub feature_unit: Vec<FeatureUnitControls, MAX_AUDIO_CHANNEL_COUNT, u8>,
    pub max_packet_size: u16,
    pub feedback_refresh_period: FeedbackRefresh,
}
Expand description

Speaker stream settings and optional host controls.

Fields§

§sample_rates_hz: &'d [u32]

Supported sample rates in Hz: one to ten discrete values. The first is reported before the host selects a rate.

§sample_width: SampleWidth

The audio sample resolution.

§channels: &'d [Channel]

Audio channels in stream order (one to twelve). Entries must be unique and follow wChannelConfig bit order, as listed in Channel.

§feature_unit: Vec<FeatureUnitControls, MAX_AUDIO_CHANNEL_COUNT, u8>

Controls the USB host can change on each channel.

Use heapless::Vec::new() to omit the Feature Unit. Otherwise, provide channels.len() + 1 entries: the master first, then each audio channel in Self::channels order. Use FeatureUnitControls::empty for no controls on a channel.

§max_packet_size: u16

Maximum bytes per USB packet. Allow room for sample rate variation, for example twice the bytes played per (micro)frame.

§feedback_refresh_period: FeedbackRefresh

How often the device sends sample rate feedback to the host.

Implementations§

Source§

impl<'d> Config<'d>

Source

pub const fn new( sample_rates_hz: &'d [u32], sample_width: SampleWidth, channels: &'d [Channel], max_packet_size: u16, feedback_refresh_period: FeedbackRefresh, ) -> Self

Creates a speaker configuration without a Feature Unit.

Trait Implementations§

Source§

impl<'d> Clone for Config<'d>

Source§

fn clone(&self) -> Config<'d>

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

Auto Trait Implementations§

§

impl<'d> Freeze for Config<'d>

§

impl<'d> RefUnwindSafe for Config<'d>

§

impl<'d> Send for Config<'d>

§

impl<'d> Sync for Config<'d>

§

impl<'d> Unpin for Config<'d>

§

impl<'d> UnsafeUnpin for Config<'d>

§

impl<'d> UnwindSafe for Config<'d>

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, <T as TryFrom<U>>::Error>

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.