rp2040_pac

Struct PIO0

source
pub struct PIO0 { /* private fields */ }
Expand description

Programmable IO block

Implementations§

source§

impl PIO0

source

pub const PTR: *const RegisterBlock = {0x50200000 as *const pio0::RegisterBlock}

Pointer to the register block

source

pub const fn ptr() -> *const RegisterBlock

Return the pointer to the register block

source

pub unsafe fn steal() -> Self

Steal an instance of this peripheral

§Safety

Ensure that the new instance of the peripheral cannot be used in a way that may race with any existing instances, for example by only accessing read-only or write-only registers, or by consuming the original peripheral and using critical sections to coordinate access between multiple new instances.

Additionally, other software such as HALs may rely on only one peripheral instance existing to ensure memory safety; ensure no stolen instances are passed to such software.

Methods from Deref<Target = RegisterBlock>§

source

pub fn ctrl(&self) -> &CTRL

0x00 - PIO control register

source

pub fn fstat(&self) -> &FSTAT

0x04 - FIFO status register

source

pub fn fdebug(&self) -> &FDEBUG

0x08 - FIFO debug register

source

pub fn flevel(&self) -> &FLEVEL

0x0c - FIFO levels

source

pub fn txf(&self, n: usize) -> &TXF

0x10..0x20 - Direct write access to the TX FIFO for this state machine. Each write pushes one word to the FIFO. Attempting to write to a full FIFO has no effect on the FIFO state or contents, and sets the sticky FDEBUG_TXOVER error flag for this FIFO.

source

pub fn txf_iter(&self) -> impl Iterator<Item = &TXF>

Iterator for array of: 0x10..0x20 - Direct write access to the TX FIFO for this state machine. Each write pushes one word to the FIFO. Attempting to write to a full FIFO has no effect on the FIFO state or contents, and sets the sticky FDEBUG_TXOVER error flag for this FIFO.

source

pub fn rxf(&self, n: usize) -> &RXF

0x20..0x30 - Direct read access to the RX FIFO for this state machine. Each read pops one word from the FIFO. Attempting to read from an empty FIFO has no effect on the FIFO state, and sets the sticky FDEBUG_RXUNDER error flag for this FIFO. The data returned to the system on a read from an empty FIFO is undefined.

source

pub fn rxf_iter(&self) -> impl Iterator<Item = &RXF>

Iterator for array of: 0x20..0x30 - Direct read access to the RX FIFO for this state machine. Each read pops one word from the FIFO. Attempting to read from an empty FIFO has no effect on the FIFO state, and sets the sticky FDEBUG_RXUNDER error flag for this FIFO. The data returned to the system on a read from an empty FIFO is undefined.

source

pub fn irq(&self) -> &IRQ

0x30 - State machine IRQ flags register. Write 1 to clear. There are 8 state machine IRQ flags, which can be set, cleared, and waited on by the state machines. There’s no fixed association between flags and state machines – any state machine can use any flag.

Any of the 8 flags can be used for timing synchronisation between state machines, using IRQ and WAIT instructions. The lower four of these flags are also routed out to system-level interrupt requests, alongside FIFO status interrupts – see e.g. IRQ0_INTE.

source

pub fn irq_force(&self) -> &IRQ_FORCE

0x34 - Writing a 1 to each of these bits will forcibly assert the corresponding IRQ. Note this is different to the INTF register: writing here affects PIO internal state. INTF just asserts the processor-facing IRQ signal for testing ISRs, and is not visible to the state machines.

source

pub fn input_sync_bypass(&self) -> &INPUT_SYNC_BYPASS

0x38 - There is a 2-flipflop synchronizer on each GPIO input, which protects PIO logic from metastabilities. This increases input delay, and for fast synchronous IO (e.g. SPI) these synchronizers may need to be bypassed. Each bit in this register corresponds to one GPIO.
0 -> input is synchronized (default)
1 -> synchronizer is bypassed
If in doubt, leave this register as all zeroes.

source

pub fn dbg_padout(&self) -> &DBG_PADOUT

0x3c - Read to sample the pad output values PIO is currently driving to the GPIOs. On RP2040 there are 30 GPIOs, so the two most significant bits are hardwired to 0.

source

pub fn dbg_padoe(&self) -> &DBG_PADOE

0x40 - Read to sample the pad output enables (direction) PIO is currently driving to the GPIOs. On RP2040 there are 30 GPIOs, so the two most significant bits are hardwired to 0.

source

pub fn dbg_cfginfo(&self) -> &DBG_CFGINFO

0x44 - The PIO hardware has some free parameters that may vary between chip products.
These should be provided in the chip datasheet, but are also exposed here.

source

pub fn instr_mem(&self, n: usize) -> &INSTR_MEM

0x48..0xc8 - Write-only access to instruction memory location %s

source

pub fn instr_mem_iter(&self) -> impl Iterator<Item = &INSTR_MEM>

Iterator for array of: 0x48..0xc8 - Write-only access to instruction memory location %s

source

pub fn sm(&self, n: usize) -> &SM

0xc8..0x128 - Cluster SM%s, containing SM*_CLKDIV, SM*_EXECCTRL, SM*_SHIFTCTRL, SM*_ADDR, SM*_INSTR, SM*_PINCTRL

source

pub fn sm_iter(&self) -> impl Iterator<Item = &SM>

Iterator for array of: 0xc8..0x128 - Cluster SM%s, containing SM*_CLKDIV, SM*_EXECCTRL, SM*_SHIFTCTRL, SM*_ADDR, SM*_INSTR, SM*_PINCTRL

source

pub fn intr(&self) -> &INTR

0x128 - Raw Interrupts

source

pub fn sm_irq(&self, n: usize) -> &SM_IRQ

0x12c..0x144 - Cluster SM_IRQ%s, containing IRQ*_INTE, IRQ*_INTF, IRQ*_INTS

source

pub fn sm_irq_iter(&self) -> impl Iterator<Item = &SM_IRQ>

Iterator for array of: 0x12c..0x144 - Cluster SM_IRQ%s, containing IRQ*_INTE, IRQ*_INTF, IRQ*_INTS

Trait Implementations§

source§

impl Debug for PIO0

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for PIO0

source§

type Target = RegisterBlock

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Send for PIO0

Auto Trait Implementations§

§

impl Freeze for PIO0

§

impl RefUnwindSafe for PIO0

§

impl !Sync for PIO0

§

impl Unpin for PIO0

§

impl UnwindSafe for PIO0

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.