Available on crate feature 
unstable only.Expand description
§Parallel IO (PARL_IO)
§Overview
The Parallel IO peripheral is a general purpose parallel interface that can be used to connect to external devices such as LED matrix, LCD display, Printer and Camera. The peripheral has independent TX and RX units. Each unit can have up to 8 or 16 data signals (depending on your target hardware) plus 1 or 2 clock signals.
§Configuration
The driver uses DMA (Direct Memory Access) for efficient data transfer.
§Examples
§Initialization for RX
// Initialize DMA buffer and descriptors for data reception
let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(32000, 0);
let mut dma_rx_buf = DmaRxBuf::new(rx_descriptors, rx_buffer)?;
let dma_channel = peripherals.DMA_CH0;
// Configure the 4-bit input pins and clock pin
let mut rx_pins = RxFourBits::new(
    peripherals.GPIO1,
    peripherals.GPIO2,
    peripherals.GPIO3,
    peripherals.GPIO4,
);
let mut rx_clk_pin = NoPin;
// Set up Parallel IO for 1MHz data input, with DMA and bit packing
//  configuration
let parl_io = ParlIo::new(peripherals.PARL_IO, dma_channel)?;
let config = RxConfig::default()
    .with_frequency(Rate::from_mhz(1))
    .with_bit_order(BitPackOrder::Msb)
    .with_timeout_ticks(0xfff);
let mut parl_io_rx = parl_io.rx.with_config(rx_pins, rx_clk_pin, config)?;
// Initialize the buffer and delay
dma_rx_buf.as_mut_slice().fill(0u8);
let delay = Delay::new();
loop {
    // Read data via DMA and print received values
    let transfer = parl_io_rx.read(Some(dma_rx_buf.len()), dma_rx_buf)?;
    (_, parl_io_rx, dma_rx_buf) = transfer.wait();
    delay.delay_millis(500);
}§Initialization for TX
// Initialize DMA buffer and descriptors for data reception
let mut dma_tx_buf = dma_tx_buffer!(32000).unwrap();
let dma_channel = peripherals.DMA_CH0;
// Configure the 4-bit input pins and clock pin
let tx_pins = TxFourBits::new(
    peripherals.GPIO1,
    peripherals.GPIO2,
    peripherals.GPIO3,
    peripherals.GPIO4,
);
let mut pin_conf = TxPinConfigWithValidPin::new(tx_pins, peripherals.GPIO5);
// Set up Parallel IO for 1MHz data input, with DMA and bit packing
//  configuration
 let parl_io = ParlIo::new(
    peripherals.PARL_IO,
    dma_channel,
)?;
let mut clock_pin = ClkOutPin::new(peripherals.GPIO8);
let config = TxConfig::default()
    .with_frequency(Rate::from_mhz(1))
    .with_bit_order(BitPackOrder::Msb);
let mut parl_io_tx = parl_io
    .tx
    .with_config(
        pin_conf,
        clock_pin,
        config,
    )?;
for i in 0..dma_tx_buf.len() {
     dma_tx_buf.as_mut_slice()[i] = (i % 255) as u8;
}
let delay = Delay::new();
loop {
    let transfer = parl_io_tx.write(dma_tx_buf.len(), dma_tx_buf)?;
    (_, parl_io_tx, dma_tx_buf) = transfer.wait();
    delay.delay_millis(500);
}Structs§
- ClkInPin 
- Wraps a GPIO pin which will be used as the TX clock input signal
- ClkOutPin 
- Wraps a GPIO pin which will be used as the clock output signal
- ParlIo
- Parallel IO
- ParlIoRx 
- Parallel IO RX channel
- ParlIoRx Transfer 
- Represents an ongoing (or potentially finished) transfer using the PARL_IO TX.
- ParlIoTx 
- Parallel IO TX channel
- ParlIoTx Transfer 
- Represents an ongoing (or potentially finished) transfer using the PARL_IO TX.
- RxClkInPin 
- Wraps a GPIO pin which will be used as the RX clock input signal
- RxConfig
- PARL_IO RX configuration
- RxCreator
- Creates a RX channel
- RxEightBits 
- Data pin configuration for 8 bit input mode
- RxFourBits 
- Data pin configuration for 4 bit input mode
- RxOneBit 
- Data pin configuration for 1 bit input mode
- RxPinConfig Including Valid Pin 
- Pin configuration where the pin for the valid signal is the MSB pin.
- RxPinConfig With Valid Pin 
- Pin configuration with an additional pin for the valid signal.
- RxSixteenBits 
- Data pin configuration for 16 bit input mode
- RxTwoBits 
- Data pin configuration for 2 bit input mode
- TxConfig
- PARL_IO TX configuration
- TxCreator
- Creates a TX channel
- TxEightBits 
- Data pin configuration for 8 bit output mode
- TxFourBits 
- Data pin configuration for 4 bit output mode
- TxOneBit 
- Data pin configuration for 1 bit output mode
- TxPinConfig Including Valid Pin 
- Pin configuration where the pin for the valid signal is the MSB pin.
- TxPinConfig With Valid Pin 
- Pin configuration with an additional pin for the valid signal.
- TxSixteenBits 
- Data pin configuration for 16 bit output mode
- TxTwoBits 
- Data pin configuration for 2 bit output mode
Enums§
- BitPackOrder 
- Parallel IO bit packing order
- ConfigError 
- Configuration errors.
- EnableMode 
- Enable Mode
- Error
- Parallel IO errors
- ParlIoInterrupt 
- Interrupts generated by the peripheral
- SampleEdge 
- Parallel IO sample edge