PIO2

Struct PIO2 

Source
pub struct PIO2 { /* private fields */ }
Expand description

Programmable IO block

Implementations§

Source§

impl PIO2

Source

pub const PTR: *const RegisterBlock = {0x50400000 as *const rp235x_hal::rp235x_pac::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() -> PIO2

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) -> &Reg<CTRL_SPEC>

0x00 - PIO control register

Source

pub fn fstat(&self) -> &Reg<FSTAT_SPEC>

0x04 - FIFO status register

Source

pub fn fdebug(&self) -> &Reg<FDEBUG_SPEC>

0x08 - FIFO debug register

Source

pub fn flevel(&self) -> &Reg<FLEVEL_SPEC>

0x0c - FIFO levels

Source

pub fn txf(&self, n: usize) -> &Reg<TXF_SPEC>

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 = &Reg<TXF_SPEC>>

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) -> &Reg<RXF_SPEC>

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 = &Reg<RXF_SPEC>>

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) -> &Reg<IRQ_SPEC>

0x30 - State machine IRQ flags register. Write 1 to clear. There are eight 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 eight flags can be used for timing synchronisation between state machines, using IRQ and WAIT instructions. Any combination of the eight flags can also routed out to either of the two system-level interrupt requests, alongside FIFO status interrupts – see e.g. IRQ0_INTE.

Source

pub fn irq_force(&self) -> &Reg<IRQ_FORCE_SPEC>

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) -> &Reg<INPUT_SYNC_BYPASS_SPEC>

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) -> &Reg<DBG_PADOUT_SPEC>

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) -> &Reg<DBG_PADOE_SPEC>

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) -> &Reg<DBG_CFGINFO_SPEC>

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) -> &Reg<INSTR_MEM_SPEC>

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

Source

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

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 rxf0_putget(&self, n: usize) -> &Reg<RXF0_PUTGET_SPEC>

0x128..0x138 - Direct read/write access to entry %s of SM0’s RX FIFO, if SHIFTCTRL_FJOIN_RX_PUT xor SHIFTCTRL_FJOIN_RX_GET is set.

Source

pub fn rxf0_putget_iter(&self) -> impl Iterator<Item = &Reg<RXF0_PUTGET_SPEC>>

Iterator for array of: 0x128..0x138 - Direct read/write access to entry %s of SM0’s RX FIFO, if SHIFTCTRL_FJOIN_RX_PUT xor SHIFTCTRL_FJOIN_RX_GET is set.

Source

pub fn rxf1_putget(&self, n: usize) -> &Reg<RXF1_PUTGET_SPEC>

0x138..0x148 - Direct read/write access to entry %s of SM1’s RX FIFO, if SHIFTCTRL_FJOIN_RX_PUT xor SHIFTCTRL_FJOIN_RX_GET is set.

Source

pub fn rxf1_putget_iter(&self) -> impl Iterator<Item = &Reg<RXF1_PUTGET_SPEC>>

Iterator for array of: 0x138..0x148 - Direct read/write access to entry %s of SM1’s RX FIFO, if SHIFTCTRL_FJOIN_RX_PUT xor SHIFTCTRL_FJOIN_RX_GET is set.

Source

pub fn rxf2_putget(&self, n: usize) -> &Reg<RXF2_PUTGET_SPEC>

0x148..0x158 - Direct read/write access to entry %s of SM2’s RX FIFO, if SHIFTCTRL_FJOIN_RX_PUT xor SHIFTCTRL_FJOIN_RX_GET is set.

Source

pub fn rxf2_putget_iter(&self) -> impl Iterator<Item = &Reg<RXF2_PUTGET_SPEC>>

Iterator for array of: 0x148..0x158 - Direct read/write access to entry %s of SM2’s RX FIFO, if SHIFTCTRL_FJOIN_RX_PUT xor SHIFTCTRL_FJOIN_RX_GET is set.

Source

pub fn rxf3_putget(&self, n: usize) -> &Reg<RXF3_PUTGET_SPEC>

0x158..0x168 - Direct read/write access to entry %s of SM3’s RX FIFO, if SHIFTCTRL_FJOIN_RX_PUT xor SHIFTCTRL_FJOIN_RX_GET is set.

Source

pub fn rxf3_putget_iter(&self) -> impl Iterator<Item = &Reg<RXF3_PUTGET_SPEC>>

Iterator for array of: 0x158..0x168 - Direct read/write access to entry %s of SM3’s RX FIFO, if SHIFTCTRL_FJOIN_RX_PUT xor SHIFTCTRL_FJOIN_RX_GET is set.

Source

pub fn gpiobase(&self) -> &Reg<GPIOBASE_SPEC>

0x168 - Relocate GPIO 0 (from PIO’s point of view) in the system GPIO numbering, to access more than 32 GPIOs from PIO. Only the values 0 and 16 are supported (only bit 4 is writable).

Source

pub fn intr(&self) -> &Reg<INTR_SPEC>

0x16c - Raw Interrupts

Source

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

0x170..0x188 - 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: 0x170..0x188 - Cluster SM_IRQ%s, containing IRQ*_INTE, IRQ*_INTF, IRQ*_INTS

Trait Implementations§

Source§

impl Debug for PIO2

Source§

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

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

impl Deref for PIO2

Source§

type Target = RegisterBlock

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<PIO2 as Deref>::Target

Dereferences the value.
Source§

impl Send for PIO2

Auto Trait Implementations§

§

impl Freeze for PIO2

§

impl RefUnwindSafe for PIO2

§

impl !Sync for PIO2

§

impl Unpin for PIO2

§

impl UnwindSafe for PIO2

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.