Struct rp2040_hal::pwm::SliceDmaWriteCc

source ·
pub struct SliceDmaWriteCc<S: SliceId, M: ValidSliceMode<S>> { /* private fields */ }
Expand description

Type representing DMA access to PWM cc register.

Both channels are accessed together, because of narrow write replication.

use cortex_m::singleton;
use rp2040_hal::dma::{double_buffer, DMAExt};
use rp2040_hal::pwm::{CcFormat, SliceDmaWrite, Slices};


let mut pac = rp2040_pac::Peripherals::take().unwrap();

// Init PWMs
let pwm_slices = Slices::new(pac.PWM, &mut pac.RESETS);

// Configure PWM4
let mut pwm = pwm_slices.pwm4;
pwm.enable();

let buf = singleton!(: [CcFormat; 4] = [CcFormat{a: 0x1000, b: 0x9000}; 4]).unwrap();
let buf2 = singleton!(: [CcFormat; 4] = [CcFormat{a: 0xf000, b: 0x5000}; 4]).unwrap();

let dma = pac.DMA.split(&mut pac.RESETS);

let dma_pwm = SliceDmaWrite::from(pwm);

let dma_conf = double_buffer::Config::new((dma.ch0, dma.ch1), buf, dma_pwm.cc);

Trait Implementations§

source§

impl<S: SliceId, M: ValidSliceMode<S>> WriteTarget for SliceDmaWriteCc<S, M>

Safety: tx_address_count points to a register which is always a valid write target.

§

type TransmittedWord = CcFormat

Type which is transferred in a single DMA transfer.
source§

fn tx_treq() -> Option<u8>

Returns the DREQ number for this data sink (None for memory buffers).
source§

fn tx_address_count(&mut self) -> (u32, u32)

Returns the address and the maximum number of words that can be transferred from this data source in a single DMA operation. Read more
source§

fn tx_increment(&self) -> bool

Returns whether the address shall be incremented after each transfer.
source§

impl<S: SliceId, M: ValidSliceMode<S>> EndlessWriteTarget for SliceDmaWriteCc<S, M>

Auto Trait Implementations§

§

impl<S, M> Freeze for SliceDmaWriteCc<S, M>

§

impl<S, M> RefUnwindSafe for SliceDmaWriteCc<S, M>

§

impl<S, M> Send for SliceDmaWriteCc<S, M>
where S: Send, M: Send,

§

impl<S, M> Sync for SliceDmaWriteCc<S, M>
where S: Sync, M: Sync,

§

impl<S, M> Unpin for SliceDmaWriteCc<S, M>
where S: Unpin, M: Unpin,

§

impl<S, M> UnwindSafe for SliceDmaWriteCc<S, M>
where S: UnwindSafe, M: UnwindSafe,

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

§

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

§

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

§

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

§

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.