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 input_terminal: TerminalType,
    pub feature_unit: Vec<FeatureUnitControls, MAX_AUDIO_CHANNEL_COUNT, u8>,
}
Expand description

Everything the audio source advertises to the host.

The stream has no synch (feedback) endpoint: an asynchronous source has none [USB 2.0 5.12.4.2] — the data stream itself carries the rate, and the host follows it.

Fields§

§sample_rates_hz: &'d [u32]

The supported sample rates in Hz, as discrete values. At least one, at most ten. The first is the one reported before the host sets any.

§sample_width: SampleWidth

The audio sample resolution.

§channels: &'d [Channel]

The audio channels, in stream order (up to 12). The host numbers the logical channels by wChannelConfig bit order, so the entries must be unique and in that order. One entry is a mono stream.

§input_terminal: TerminalType

What the Input Terminal is; the host shows the device by it. Must not be TerminalType::UsbStreaming — that is the Output Terminal’s role.

§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.

Implementations§

Source§

impl<'d> Config<'d>

Source

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

Creates a microphone 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.