embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

ControlMonitor

Struct ControlMonitor 

Source
pub struct ControlMonitor<'d, const N: usize> { /* private fields */ }
Expand description

Control status change monitor.

Await Self::changed, then read the updated settings. Channels are numbered from 0 in stream order.

Implementations§

Source§

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

Source

pub fn line_out_volume(&self, channel: usize) -> Option<Volume>

A line out channel’s volume with the master applied. None without a Feature Unit, for a channel past the last, or if neither the channel nor the master has controls.

Source

pub fn line_in_volume(&self, channel: usize) -> Option<Volume>

A line in channel’s volume with the master applied, as Self::line_out_volume.

Source

pub fn sample_rate_hz(&self) -> u32

Get the sample rate in Hz. Before the host sets one, and again after a bus reset, it is the first advertised rate.

Source

pub fn set_clock_valid(&self, valid: bool)

Set the clock validity reported to the host (valid by default). Report the clock as invalid while it doesn’t run at the selected rate, for example during a rate change.

Source

pub fn set_line_out_volume(&self, channel: usize, volume: Volume)

Set a line out channel’s own volume (not the master’s) from the device side, for example from a front panel. The host is told through the interrupt endpoint, if there is one; Self::changed doesn’t fire. Without a mute control, Volume::Muted sets the volume to silence. Out-of-range volumes are clamped to the advertised range.

Source

pub fn set_line_in_volume(&self, channel: usize, volume: Volume)

Set a line in channel’s own volume from the device side, as Self::set_line_out_volume.

Source

pub async fn changed(&self)

Wait for the sample rate, a volume or a mute state to change. Single consumer: await this from at most one task.

Auto Trait Implementations§

§

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

§

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

§

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

§

impl<'d, const N: usize> Freeze for ControlMonitor<'d, N>
where &'d SharedControl<'d, N>: Freeze,

§

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

§

impl<'d, const N: usize> Send for ControlMonitor<'d, N>
where &'d SharedControl<'d, N>: Send,

§

impl<'d, const N: usize> Sync for ControlMonitor<'d, N>
where &'d SharedControl<'d, N>: Sync,

§

impl<'d, const N: usize> Unpin for ControlMonitor<'d, N>
where &'d SharedControl<'d, N>: Unpin,

§

impl<'d, const N: usize> UnsafeUnpin for ControlMonitor<'d, N>
where &'d SharedControl<'d, N>: UnsafeUnpin,

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