picodvi – Low-level routines for interacting with PicoDVI Output

Available on these boards
  • Adafruit Feather RP2040 DVI
  • Pajenicko PicoPad
  • Pimoroni Pico dv Base
  • Raspberry Pi Pico
  • Raspberry Pi Pico W
  • WisdPi Tiny RP2040

class picodvi.Framebuffer(width: int, height: int, *, clk_dp: microcontroller.Pin, clk_dn: microcontroller.Pin, red_dp: microcontroller.Pin, red_dn: microcontroller.Pin, green_dp: microcontroller.Pin, green_dn: microcontroller.Pin, blue_dp: microcontroller.Pin, blue_dn: microcontroller.Pin, color_depth: int = 8)

Create a Framebuffer object with the given dimensions. Memory is allocated outside of onto the heap and then moved outside on VM end.


This will change the system clock speed to match the DVI signal. Make sure to initialize other objects after this one so they account for the changed clock.

This allocates a very large framebuffer and is most likely to succeed the earlier it is attempted.

Each dp and dn pair of pins must be neighboring, such as 19 and 20. They must also be ordered the same way. In other words, dp must be less than dn for all pairs or dp must be greater than dn for all pairs.

The framebuffer pixel format varies depending on color_depth:

  • 1 - Each bit is a pixel. Either white (1) or black (0).

  • 2 - Each 2 bits is a pixels. Grayscale between white (0x3) and black (0x0).

  • 8 - Each byte is a pixels in RGB332 format.

  • 16 - Each two bytes are a pixel in RGB565 format.

Two output resolutions are currently supported, 640x480 and 800x480. Monochrome framebuffers (color_depth=1 or 2) must be full resolution. Color framebuffers must be half resolution (320x240 or 400x240) and pixels will be duplicated to create the signal.

A Framebuffer is often used in conjunction with a framebufferio.FramebufferDisplay.

  • width (int) – the width of the target display signal. Only 320, 400, 640 or 800 is currently supported depending on color_depth.

  • height (int) – the height of the target display signal. Only 240 or 480 is currently supported depending on color_depth.

  • clk_dp (Pin) – the positive clock signal pin

  • clk_dn (Pin) – the negative clock signal pin

  • red_dp (Pin) – the positive red signal pin

  • red_dn (Pin) – the negative red signal pin

  • green_dp (Pin) – the positive green signal pin

  • green_dn (Pin) – the negative green signal pin

  • blue_dp (Pin) – the positive blue signal pin

  • blue_dn (Pin) – the negative blue signal pin

  • color_depth (int) – the color depth of the framebuffer in bits. 1, 2 for grayscale and 8 or 16 for color

width: int

The width of the framebuffer, in pixels. It may be doubled for output.

height: int

The width of the framebuffer, in pixels. It may be doubled for output.

deinit() None

Free the resources (pins, timers, etc.) associated with this picodvi.Framebuffer instance. After deinitialization, no further operations may be performed.