Cs4272Builder

Struct Cs4272Builder 

Source
pub struct Cs4272Builder<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>
where P1: AnyPin, P2: AnyPin, P3: AnyPin, P4: AnyPin, P5: AnyPin,
{ /* private fields */ }
Expand description

Cs4272 builder, used to initialize, configure and start the driver

Implementations§

Source§

impl<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5> Cs4272Builder<BUFFER_SIZE, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>
where P0: OutputPin, P1: AnyPin<Function = Pio::PinFunction>, P2: AnyPin<Function = Pio::PinFunction>, P3: AnyPin<Function = Pio::PinFunction>, P4: AnyPin<Function = Pio::PinFunction>, P5: AnyPin<Function = Pio::PinFunction>, Pio: PIOExt, ChA: SingleChannel, ChB: SingleChannel,

Source

pub fn new( pin_enable: P0, pin_mclk: P1, pin_in: P2, pin_out: P3, pin_ws: P4, pin_clk: P5, pio: Pio, channel_a: ChA, channel_b: ChB, buffer_tx_a: &'static mut [u32; BUFFER_SIZE], buffer_tx_b: &'static mut [u32; BUFFER_SIZE], buffer_rx_a: &'static mut [u32; BUFFER_SIZE], buffer_rx_b: &'static mut [u32; BUFFER_SIZE], ) -> Self

Initialize a new builder.

Requires passing all the necessary pins, DMAs, pio and buffers we need to run the driver.

Source

pub fn sample_rate(self, sample_rate: HertzU32) -> Self

Set the driver sample rate.

The CS4272 chip supports sample rates between 4kHz and 200kHz, defaults to 48kHz.

Note that not all sample rates are possible since the PIO division is based on the microcontroller clock speed, some deviation from the set sample rate should be expected or accounted for.

Source

pub fn system_frequency(self, system_frequency: HertzU32) -> Self

Set the RP235x system frequency.

In case you have changed the frequency of the system you should update this value, defaults to 150MHz.

Source

pub fn set_irq0(self) -> Self

Sets up interrupt DMA_IRQ_0 for the DMA.

Source

pub fn set_irq1(self) -> Self

Sets up interrupt DMA_IRQ_1 for the DMA.

Source

pub fn start( self, resets: &mut RESETS, ) -> Cs4272<BUFFER_SIZE, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>

Starts the PIO and DMAs, then sets the enable pin high and returns the running driver struct.

Auto Trait Implementations§

§

impl<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5> Freeze for Cs4272Builder<BUFFER_SIZE, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>
where P0: Freeze, Pio: Freeze, ChA: Freeze, ChB: Freeze, <P1 as AnyPin>::Id: Freeze, <P1 as AnyPin>::Function: Freeze, <P1 as AnyPin>::Pull: Freeze, <P2 as AnyPin>::Id: Freeze, <P2 as AnyPin>::Function: Freeze, <P2 as AnyPin>::Pull: Freeze, <P3 as AnyPin>::Id: Freeze, <P3 as AnyPin>::Function: Freeze, <P3 as AnyPin>::Pull: Freeze, <P4 as AnyPin>::Id: Freeze, <P4 as AnyPin>::Function: Freeze, <P4 as AnyPin>::Pull: Freeze, <P5 as AnyPin>::Id: Freeze, <P5 as AnyPin>::Function: Freeze, <P5 as AnyPin>::Pull: Freeze,

§

impl<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5> RefUnwindSafe for Cs4272Builder<BUFFER_SIZE, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>

§

impl<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5> Send for Cs4272Builder<BUFFER_SIZE, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>
where P0: Send, Pio: Send, ChA: Send, ChB: Send, <P1 as AnyPin>::Id: Send, <P1 as AnyPin>::Function: Send, <P1 as AnyPin>::Pull: Send, <P2 as AnyPin>::Id: Send, <P2 as AnyPin>::Function: Send, <P2 as AnyPin>::Pull: Send, <P3 as AnyPin>::Id: Send, <P3 as AnyPin>::Function: Send, <P3 as AnyPin>::Pull: Send, <P4 as AnyPin>::Id: Send, <P4 as AnyPin>::Function: Send, <P4 as AnyPin>::Pull: Send, <P5 as AnyPin>::Id: Send, <P5 as AnyPin>::Function: Send, <P5 as AnyPin>::Pull: Send,

§

impl<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5> Sync for Cs4272Builder<BUFFER_SIZE, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>
where P0: Sync, Pio: Sync, ChA: Sync, ChB: Sync, <P1 as AnyPin>::Id: Sync, <P1 as AnyPin>::Function: Sync, <P1 as AnyPin>::Pull: Sync, <P2 as AnyPin>::Id: Sync, <P2 as AnyPin>::Function: Sync, <P2 as AnyPin>::Pull: Sync, <P3 as AnyPin>::Id: Sync, <P3 as AnyPin>::Function: Sync, <P3 as AnyPin>::Pull: Sync, <P4 as AnyPin>::Id: Sync, <P4 as AnyPin>::Function: Sync, <P4 as AnyPin>::Pull: Sync, <P5 as AnyPin>::Id: Sync, <P5 as AnyPin>::Function: Sync, <P5 as AnyPin>::Pull: Sync,

§

impl<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5> Unpin for Cs4272Builder<BUFFER_SIZE, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>
where P0: Unpin, Pio: Unpin, ChA: Unpin, ChB: Unpin, <P1 as AnyPin>::Id: Unpin, <P1 as AnyPin>::Function: Unpin, <P1 as AnyPin>::Pull: Unpin, <P2 as AnyPin>::Id: Unpin, <P2 as AnyPin>::Function: Unpin, <P2 as AnyPin>::Pull: Unpin, <P3 as AnyPin>::Id: Unpin, <P3 as AnyPin>::Function: Unpin, <P3 as AnyPin>::Pull: Unpin, <P4 as AnyPin>::Id: Unpin, <P4 as AnyPin>::Function: Unpin, <P4 as AnyPin>::Pull: Unpin, <P5 as AnyPin>::Id: Unpin, <P5 as AnyPin>::Function: Unpin, <P5 as AnyPin>::Pull: Unpin,

§

impl<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5> !UnwindSafe for Cs4272Builder<BUFFER_SIZE, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>

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<Choices> CoproductSubsetter<CNil, HNil> for Choices

Source§

type Remainder = Choices

Source§

fn subset( self, ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

Source§

fn lift_into(self) -> U

Performs the indexed conversion.
Source§

impl<Source> Sculptor<HNil, HNil> for Source

Source§

type Remainder = Source

Source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
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.