embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

Config

Struct Config 

Source
pub struct Config<'d, const N: usize> {
    pub sample_rates_hz: &'d [u32],
    pub sample_width: SampleWidth,
    pub line_out_channels: Channels<'d>,
    pub line_in_channels: Channels<'d>,
    pub line_out_feature_unit: Vec<FeatureUnitControls, N, u8>,
    pub line_in_feature_unit: Vec<FeatureUnitControls, N, u8>,
    pub line_out_volume_range: VolumeRange,
    pub line_in_volume_range: VolumeRange,
    pub interrupt_endpoint: bool,
}
Expand description

I/O box stream settings and optional host controls.

Fields§

§sample_rates_hz: &'d [u32]

Supported sample rates in Hz, shared by both directions: one to ten discrete values, in any order. The first is reported before the host selects a rate.

§sample_width: SampleWidth

The audio sample resolution of both streams.

§line_out_channels: Channels<'d>

Line out channels.

§line_in_channels: Channels<'d>

Line in channels.

§line_out_feature_unit: Vec<FeatureUnitControls, N, u8>

Controls the USB host can change on each line out channel.

Use heapless::Vec::new() to omit the Feature Unit. Otherwise, provide one entry more than there are channels: the master first, then each channel in stream order. Use FeatureUnitControls::empty for no controls on a channel. At most 62 entries (the descriptor’s length is a byte).

§line_in_feature_unit: Vec<FeatureUnitControls, N, u8>

Controls the USB host can change on each line in channel, as Self::line_out_feature_unit.

§line_out_volume_range: VolumeRange

The volume range of the line out Feature Unit.

§line_in_volume_range: VolumeRange

The volume range of the line in Feature Unit.

§interrupt_endpoint: bool

Add an AudioControl interrupt endpoint, so the host learns about volume and mute changes the device makes itself (ControlMonitor::set_line_out_volume).

Implementations§

Source§

impl<'d, const N: usize> Config<'d, N>

Source

pub const fn new( sample_rates_hz: &'d [u32], sample_width: SampleWidth, line_out_channels: Channels<'d>, line_in_channels: Channels<'d>, ) -> Self

Creates an I/O box configuration without Feature Units.

Trait Implementations§

Source§

impl<'d, const N: usize> Clone for Config<'d, N>

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

Auto Trait Implementations§

§

impl<'d, const N: usize> Forget for Config<'d, N>

§

impl<'d, const N: usize> Freeze for Config<'d, N>

§

impl<'d, const N: usize> Move for Config<'d, N>

§

impl<'d, const N: usize> RefUnwindSafe for Config<'d, N>

§

impl<'d, const N: usize> Send for Config<'d, N>

§

impl<'d, const N: usize> Sync for Config<'d, N>

§

impl<'d, const N: usize> Unpin for Config<'d, N>

§

impl<'d, const N: usize> UnsafeUnpin for Config<'d, N>

§

impl<'d, const N: usize> UnwindSafe for Config<'d, N>

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.