embassy-usb-host

Crates

git

Versions

default

Flavors

UacOut

Struct UacOut 

Source
pub struct UacOut<'d, A: UsbHostAllocator<'d>> {
    pub output_channel: A::Pipe<Isochronous, Out>,
    pub feedback_channel: Option<A::Pipe<Isochronous, In>>,
    /* private fields */
}
Expand description

Represents an output audio stream to a USB Audio Class (UAC) device.

This struct manages the output and feedback pipes for isochronous audio streaming, as well as timing and format information required for correct streaming.

Fields§

§output_channel: A::Pipe<Isochronous, Out>

Output pipe for isochronous audio streaming.

§feedback_channel: Option<A::Pipe<Isochronous, In>>

Feedback pipe for isochronous feedback endpoint.

Implementations§

Source§

impl<'d, A: UsbHostAllocator<'d>> UacOut<'d, A>

Source

pub async fn output_stream( &mut self, is_connected: impl Fn() -> bool, callback: impl FnMut(&mut [u8]), ) -> Result<(), RequestError>

Starts the output audio stream, invoking the provided callback to fill each packet.

The callback is called repeatedly with a mutable buffer for each packet to be sent. Returns an error if the stream cannot be started or if a USB error occurs.

Source

pub async fn update_sampling_freq(&mut self) -> Result<(), RequestError>

Updates the current sampling frequency by reading from the feedback endpoint.

Returns an error if the feedback cannot be read or parsed.

Auto Trait Implementations§

§

impl<'d, A> Freeze for UacOut<'d, A>

§

impl<'d, A> RefUnwindSafe for UacOut<'d, A>

§

impl<'d, A> Send for UacOut<'d, A>

§

impl<'d, A> Sync for UacOut<'d, A>

§

impl<'d, A> Unpin for UacOut<'d, A>

§

impl<'d, A> UnwindSafe for UacOut<'d, A>

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 = Infallible

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.