pub struct Assembler<const PROGRAM_SIZE: usize> { /* private fields */ }Expand description
A PIO Assembler. See chapter three of the RP2040 Datasheet.
Implementations§
Source§impl<const PROGRAM_SIZE: usize> Assembler<PROGRAM_SIZE>
impl<const PROGRAM_SIZE: usize> Assembler<PROGRAM_SIZE>
Sourcepub fn new_with_side_set(side_set: SideSet) -> Assembler<PROGRAM_SIZE>
pub fn new_with_side_set(side_set: SideSet) -> Assembler<PROGRAM_SIZE>
Create a new Assembler with SideSet settings.
Sourcepub fn assemble(self) -> ArrayVec<u16, PROGRAM_SIZE>
pub fn assemble(self) -> ArrayVec<u16, PROGRAM_SIZE>
Assemble the program into PIO instructions.
Sourcepub fn version(&self) -> PioVersion
pub fn version(&self) -> PioVersion
Check the program for instructions and operands available only on the RP2350.
Sourcepub fn assemble_program(self) -> Program<PROGRAM_SIZE>
pub fn assemble_program(self) -> Program<PROGRAM_SIZE>
Assemble the program into Program.
The program contains the instructions and side-set info set. You can directly compile into a program with
correct wrapping with Self::assemble_with_wrap, or you can set the wrapping after the compilation with
Program::set_wrap.
Sourcepub fn assemble_with_wrap(
self,
source: Label,
target: Label,
) -> Program<PROGRAM_SIZE>
pub fn assemble_with_wrap( self, source: Label, target: Label, ) -> Program<PROGRAM_SIZE>
Assemble the program into Program with wrapping.
Takes pair of labels controlling the wrapping. The first label is the source (top) of the wrap while the second label is the target (bottom) of the wrap. The source label should be positioned after the instruction from which the wrapping happens.
Sourcepub fn label_offset(&self, label: &Label) -> u8
pub fn label_offset(&self, label: &Label) -> u8
Get the offset of a label in the program.
Source§impl<const PROGRAM_SIZE: usize> Assembler<PROGRAM_SIZE>
impl<const PROGRAM_SIZE: usize> Assembler<PROGRAM_SIZE>
Sourcepub fn jmp(&mut self, condition: JmpCondition, label: &mut Label)
pub fn jmp(&mut self, condition: JmpCondition, label: &mut Label)
Emit a jmp instruction to label for condition.
Sourcepub fn jmp_with_delay(
&mut self,
condition: JmpCondition,
label: &mut Label,
delay: u8,
)
pub fn jmp_with_delay( &mut self, condition: JmpCondition, label: &mut Label, delay: u8, )
Emit a jmp instruction to label for condition.
Sourcepub fn jmp_with_side_set(
&mut self,
condition: JmpCondition,
label: &mut Label,
side_set: u8,
)
pub fn jmp_with_side_set( &mut self, condition: JmpCondition, label: &mut Label, side_set: u8, )
Emit a jmp instruction to label for condition.
Sourcepub fn jmp_with_delay_and_side_set(
&mut self,
condition: JmpCondition,
label: &mut Label,
delay: u8,
side_set: u8,
)
pub fn jmp_with_delay_and_side_set( &mut self, condition: JmpCondition, label: &mut Label, delay: u8, side_set: u8, )
Emit a jmp instruction to label for condition.
Sourcepub fn wait(
&mut self,
polarity: u8,
source: WaitSource,
index: u8,
relative: bool,
)
pub fn wait( &mut self, polarity: u8, source: WaitSource, index: u8, relative: bool, )
Emit a wait instruction with polarity from source with index which may be
relative.
Sourcepub fn wait_with_delay(
&mut self,
polarity: u8,
source: WaitSource,
index: u8,
relative: bool,
delay: u8,
)
pub fn wait_with_delay( &mut self, polarity: u8, source: WaitSource, index: u8, relative: bool, delay: u8, )
Emit a wait instruction with polarity from source with index which may be
relative.
Sourcepub fn wait_with_side_set(
&mut self,
polarity: u8,
source: WaitSource,
index: u8,
relative: bool,
side_set: u8,
)
pub fn wait_with_side_set( &mut self, polarity: u8, source: WaitSource, index: u8, relative: bool, side_set: u8, )
Emit a wait instruction with polarity from source with index which may be
relative.
Sourcepub fn wait_with_delay_and_side_set(
&mut self,
polarity: u8,
source: WaitSource,
index: u8,
relative: bool,
delay: u8,
side_set: u8,
)
pub fn wait_with_delay_and_side_set( &mut self, polarity: u8, source: WaitSource, index: u8, relative: bool, delay: u8, side_set: u8, )
Emit a wait instruction with polarity from source with index which may be
relative.
Sourcepub fn in(&mut self, source: InSource, bit_count: u8)
pub fn in(&mut self, source: InSource, bit_count: u8)
Emit an in instruction from source with bit_count.
Sourcepub fn in_with_delay(&mut self, source: InSource, bit_count: u8, delay: u8)
pub fn in_with_delay(&mut self, source: InSource, bit_count: u8, delay: u8)
Emit an in instruction from source with bit_count.
Sourcepub fn in_with_side_set(
&mut self,
source: InSource,
bit_count: u8,
side_set: u8,
)
pub fn in_with_side_set( &mut self, source: InSource, bit_count: u8, side_set: u8, )
Emit an in instruction from source with bit_count.
Sourcepub fn in_with_delay_and_side_set(
&mut self,
source: InSource,
bit_count: u8,
delay: u8,
side_set: u8,
)
pub fn in_with_delay_and_side_set( &mut self, source: InSource, bit_count: u8, delay: u8, side_set: u8, )
Emit an in instruction from source with bit_count.
Sourcepub fn out(&mut self, destination: OutDestination, bit_count: u8)
pub fn out(&mut self, destination: OutDestination, bit_count: u8)
Emit an out instruction to source with bit_count.
Sourcepub fn out_with_delay(
&mut self,
destination: OutDestination,
bit_count: u8,
delay: u8,
)
pub fn out_with_delay( &mut self, destination: OutDestination, bit_count: u8, delay: u8, )
Emit an out instruction to source with bit_count.
Sourcepub fn out_with_side_set(
&mut self,
destination: OutDestination,
bit_count: u8,
side_set: u8,
)
pub fn out_with_side_set( &mut self, destination: OutDestination, bit_count: u8, side_set: u8, )
Emit an out instruction to source with bit_count.
Sourcepub fn out_with_delay_and_side_set(
&mut self,
destination: OutDestination,
bit_count: u8,
delay: u8,
side_set: u8,
)
pub fn out_with_delay_and_side_set( &mut self, destination: OutDestination, bit_count: u8, delay: u8, side_set: u8, )
Emit an out instruction to source with bit_count.
Sourcepub fn push(&mut self, if_full: bool, block: bool)
pub fn push(&mut self, if_full: bool, block: bool)
Emit a push instruction with if_full and block.
Sourcepub fn push_with_delay(&mut self, if_full: bool, block: bool, delay: u8)
pub fn push_with_delay(&mut self, if_full: bool, block: bool, delay: u8)
Emit a push instruction with if_full and block.
Sourcepub fn push_with_side_set(&mut self, if_full: bool, block: bool, side_set: u8)
pub fn push_with_side_set(&mut self, if_full: bool, block: bool, side_set: u8)
Emit a push instruction with if_full and block.
Sourcepub fn push_with_delay_and_side_set(
&mut self,
if_full: bool,
block: bool,
delay: u8,
side_set: u8,
)
pub fn push_with_delay_and_side_set( &mut self, if_full: bool, block: bool, delay: u8, side_set: u8, )
Emit a push instruction with if_full and block.
Sourcepub fn pull(&mut self, if_empty: bool, block: bool)
pub fn pull(&mut self, if_empty: bool, block: bool)
Emit a pull instruction with if_empty and block.
Sourcepub fn pull_with_delay(&mut self, if_empty: bool, block: bool, delay: u8)
pub fn pull_with_delay(&mut self, if_empty: bool, block: bool, delay: u8)
Emit a pull instruction with if_empty and block.
Sourcepub fn pull_with_side_set(&mut self, if_empty: bool, block: bool, side_set: u8)
pub fn pull_with_side_set(&mut self, if_empty: bool, block: bool, side_set: u8)
Emit a pull instruction with if_empty and block.
Sourcepub fn pull_with_delay_and_side_set(
&mut self,
if_empty: bool,
block: bool,
delay: u8,
side_set: u8,
)
pub fn pull_with_delay_and_side_set( &mut self, if_empty: bool, block: bool, delay: u8, side_set: u8, )
Emit a pull instruction with if_empty and block.
Sourcepub fn mov(
&mut self,
destination: MovDestination,
op: MovOperation,
source: MovSource,
)
pub fn mov( &mut self, destination: MovDestination, op: MovOperation, source: MovSource, )
Emit a mov instruction to destination using op from source.
Sourcepub fn mov_with_delay(
&mut self,
destination: MovDestination,
op: MovOperation,
source: MovSource,
delay: u8,
)
pub fn mov_with_delay( &mut self, destination: MovDestination, op: MovOperation, source: MovSource, delay: u8, )
Emit a mov instruction to destination using op from source.
Sourcepub fn mov_with_side_set(
&mut self,
destination: MovDestination,
op: MovOperation,
source: MovSource,
side_set: u8,
)
pub fn mov_with_side_set( &mut self, destination: MovDestination, op: MovOperation, source: MovSource, side_set: u8, )
Emit a mov instruction to destination using op from source.
Sourcepub fn mov_with_delay_and_side_set(
&mut self,
destination: MovDestination,
op: MovOperation,
source: MovSource,
delay: u8,
side_set: u8,
)
pub fn mov_with_delay_and_side_set( &mut self, destination: MovDestination, op: MovOperation, source: MovSource, delay: u8, side_set: u8, )
Emit a mov instruction to destination using op from source.
Sourcepub fn mov_to_rx(&mut self, fifo_index: MovRxIndex)
pub fn mov_to_rx(&mut self, fifo_index: MovRxIndex)
Emit a mov to rx instruction.
Sourcepub fn mov_to_rx_with_delay(&mut self, fifo_index: MovRxIndex, delay: u8)
pub fn mov_to_rx_with_delay(&mut self, fifo_index: MovRxIndex, delay: u8)
Emit a mov to rx instruction.
Sourcepub fn mov_to_rx_with_side_set(&mut self, fifo_index: MovRxIndex, side_set: u8)
pub fn mov_to_rx_with_side_set(&mut self, fifo_index: MovRxIndex, side_set: u8)
Emit a mov to rx instruction.
Sourcepub fn mov_to_rx_with_delay_and_side_set(
&mut self,
fifo_index: MovRxIndex,
delay: u8,
side_set: u8,
)
pub fn mov_to_rx_with_delay_and_side_set( &mut self, fifo_index: MovRxIndex, delay: u8, side_set: u8, )
Emit a mov to rx instruction.
Sourcepub fn mov_from_rx(&mut self, fifo_index: MovRxIndex)
pub fn mov_from_rx(&mut self, fifo_index: MovRxIndex)
Emit a mov from rx instruction.
Sourcepub fn mov_from_rx_with_delay(&mut self, fifo_index: MovRxIndex, delay: u8)
pub fn mov_from_rx_with_delay(&mut self, fifo_index: MovRxIndex, delay: u8)
Emit a mov from rx instruction.
Sourcepub fn mov_from_rx_with_side_set(
&mut self,
fifo_index: MovRxIndex,
side_set: u8,
)
pub fn mov_from_rx_with_side_set( &mut self, fifo_index: MovRxIndex, side_set: u8, )
Emit a mov from rx instruction.
Sourcepub fn mov_from_rx_with_delay_and_side_set(
&mut self,
fifo_index: MovRxIndex,
delay: u8,
side_set: u8,
)
pub fn mov_from_rx_with_delay_and_side_set( &mut self, fifo_index: MovRxIndex, delay: u8, side_set: u8, )
Emit a mov from rx instruction.
Sourcepub fn irq(
&mut self,
clear: bool,
wait: bool,
index: u8,
index_mode: IrqIndexMode,
)
pub fn irq( &mut self, clear: bool, wait: bool, index: u8, index_mode: IrqIndexMode, )
Emit an irq instruction using clear and wait with index which may be relative.
Sourcepub fn irq_with_delay(
&mut self,
clear: bool,
wait: bool,
index: u8,
index_mode: IrqIndexMode,
delay: u8,
)
pub fn irq_with_delay( &mut self, clear: bool, wait: bool, index: u8, index_mode: IrqIndexMode, delay: u8, )
Emit an irq instruction using clear and wait with index which may be relative.
Sourcepub fn irq_with_side_set(
&mut self,
clear: bool,
wait: bool,
index: u8,
index_mode: IrqIndexMode,
side_set: u8,
)
pub fn irq_with_side_set( &mut self, clear: bool, wait: bool, index: u8, index_mode: IrqIndexMode, side_set: u8, )
Emit an irq instruction using clear and wait with index which may be relative.
Sourcepub fn irq_with_delay_and_side_set(
&mut self,
clear: bool,
wait: bool,
index: u8,
index_mode: IrqIndexMode,
delay: u8,
side_set: u8,
)
pub fn irq_with_delay_and_side_set( &mut self, clear: bool, wait: bool, index: u8, index_mode: IrqIndexMode, delay: u8, side_set: u8, )
Emit an irq instruction using clear and wait with index which may be relative.
Sourcepub fn set(&mut self, destination: SetDestination, data: u8)
pub fn set(&mut self, destination: SetDestination, data: u8)
Emit a set instruction
Sourcepub fn set_with_delay(
&mut self,
destination: SetDestination,
data: u8,
delay: u8,
)
pub fn set_with_delay( &mut self, destination: SetDestination, data: u8, delay: u8, )
Emit a set instruction
Sourcepub fn set_with_side_set(
&mut self,
destination: SetDestination,
data: u8,
side_set: u8,
)
pub fn set_with_side_set( &mut self, destination: SetDestination, data: u8, side_set: u8, )
Emit a set instruction
Sourcepub fn set_with_delay_and_side_set(
&mut self,
destination: SetDestination,
data: u8,
delay: u8,
side_set: u8,
)
pub fn set_with_delay_and_side_set( &mut self, destination: SetDestination, data: u8, delay: u8, side_set: u8, )
Emit a set instruction
Sourcepub fn nop(&mut self)
pub fn nop(&mut self)
Emit a mov instruction from Y to Y without operation effectively acting as a nop
instruction.
Sourcepub fn nop_with_delay(&mut self, delay: u8)
pub fn nop_with_delay(&mut self, delay: u8)
Emit a mov instruction from Y to Y without operation effectively acting as a nop
instruction.
Sourcepub fn nop_with_side_set(&mut self, side_set: u8)
pub fn nop_with_side_set(&mut self, side_set: u8)
Emit a mov instruction from Y to Y without operation effectively acting as a nop
instruction.
Sourcepub fn nop_with_delay_and_side_set(&mut self, delay: u8, side_set: u8)
pub fn nop_with_delay_and_side_set(&mut self, delay: u8, side_set: u8)
Emit a mov instruction from Y to Y without operation effectively acting as a nop
instruction.