pub struct Cs4272Builder<const BUFFER_SIZE: usize, Pio, ChA, ChB, P0, P1, P2, P3, P4, P5>{ /* 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,
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,
Sourcepub 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
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.
Sourcepub fn sample_rate(self, sample_rate: HertzU32) -> Self
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.
Sourcepub fn system_frequency(self, system_frequency: HertzU32) -> Self
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.
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>where
P0: RefUnwindSafe,
Pio: RefUnwindSafe,
ChA: RefUnwindSafe,
ChB: RefUnwindSafe,
<P1 as AnyPin>::Id: RefUnwindSafe,
<P1 as AnyPin>::Function: RefUnwindSafe,
<P1 as AnyPin>::Pull: RefUnwindSafe,
<P2 as AnyPin>::Id: RefUnwindSafe,
<P2 as AnyPin>::Function: RefUnwindSafe,
<P2 as AnyPin>::Pull: RefUnwindSafe,
<P3 as AnyPin>::Id: RefUnwindSafe,
<P3 as AnyPin>::Function: RefUnwindSafe,
<P3 as AnyPin>::Pull: RefUnwindSafe,
<P4 as AnyPin>::Id: RefUnwindSafe,
<P4 as AnyPin>::Function: RefUnwindSafe,
<P4 as AnyPin>::Pull: RefUnwindSafe,
<P5 as AnyPin>::Id: RefUnwindSafe,
<P5 as AnyPin>::Function: RefUnwindSafe,
<P5 as AnyPin>::Pull: RefUnwindSafe,
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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