esp_hal::lcd_cam::lcd

Module dpi

Source
Available on crate feature unstable only.
Expand description

§LCD - RGB/Digital Parallel Interface Mode

§Overview

The LCD_CAM peripheral Dpi driver provides support for the DPI (commonly know as RGB) format/timing. The driver mandates DMA (Direct Memory Access) for efficient data transfer.

§Examples

§A display

The following example shows how to setup and send a solid frame to a DPI display.



let lcd_cam = LcdCam::new(peripherals.LCD_CAM);

let config = dpi::Config::default()
    .with_frequency(Rate::from_mhz(1))
    .with_clock_mode(ClockMode {
        polarity: Polarity::IdleLow,
        phase: Phase::ShiftLow,
    })
    .with_format(Format {
        enable_2byte_mode: true,
        ..Default::default()
    })
    .with_timing(FrameTiming {
        horizontal_active_width: 480,
        horizontal_total_width: 520,
        horizontal_blank_front_porch: 10,

        vertical_active_height: 480,
        vertical_total_height: 510,
        vertical_blank_front_porch: 10,

        hsync_width: 10,
        vsync_width: 10,

        hsync_position: 0,
    })
    .with_vsync_idle_level(Level::High)
    .with_hsync_idle_level(Level::High)
    .with_de_idle_level(Level::Low)
    .with_disable_black_region(false);

let mut dpi = Dpi::new(lcd_cam.lcd, channel, config)?
    .with_vsync(peripherals.GPIO3)
    .with_hsync(peripherals.GPIO46)
    .with_de(peripherals.GPIO17)
    .with_pclk(peripherals.GPIO9)
    // Blue
    .with_data0(peripherals.GPIO10)
    .with_data1(peripherals.GPIO11)
    .with_data2(peripherals.GPIO12)
    .with_data3(peripherals.GPIO13)
    .with_data4(peripherals.GPIO14)
    // Green
    .with_data5(peripherals.GPIO21)
    .with_data6(peripherals.GPIO8)
    .with_data7(peripherals.GPIO18)
    .with_data8(peripherals.GPIO45)
    .with_data9(peripherals.GPIO38)
    .with_data10(peripherals.GPIO39)
    // Red
    .with_data11(peripherals.GPIO40)
    .with_data12(peripherals.GPIO41)
    .with_data13(peripherals.GPIO42)
    .with_data14(peripherals.GPIO2)
    .with_data15(peripherals.GPIO1);

let color: u16 = 0b11111_000000_00000; // RED
for chunk in dma_buf.chunks_mut(2) {
    chunk.copy_from_slice(&color.to_le_bytes());
}

let transfer = dpi.send(false, dma_buf).map_err(|e| e.0)?;
transfer.wait();

Structs§

  • Configuration settings for the RGB/DPI interface.
  • Represents the RGB LCD interface.
  • Represents an ongoing (or potentially finished) transfer using the RGB LCD interface
  • Controls how the peripheral should treat data received from the DMA.
  • The timing numbers for the driver to follow.

Enums§

  • Errors that can occur when configuring the DPI peripheral.