adafruit_rgb_display.rgb

Base class for all RGB Display devices

  • Author(s): Radomir Dopieralski, Michael McWethy, Matt Land

class adafruit_rgb_display.rgb.Display(width: int, height: int, rotation: int)[source]

Base class for all RGB display devices :param width: number of pixels wide :param height: number of pixels high

fill(color: int | Tuple = 0) None[source]

Fill the whole display with the specified color.

fill_rectangle(x: int, y: int, width: int, height: int, color: int | Tuple) None[source]

Draw a rectangle at specified position with specified width and height, and fill it with the specified color.

hline(x: int, y: int, width: int, color: int | Tuple) None[source]

Draw a horizontal line.

image(img: Image, rotation: int | None = None, x: int = 0, y: int = 0) None[source]

Set buffer to value of Python Imaging Library image. The image should be in 1 bit mode and a size not exceeding the display size when drawn at the supplied origin.

init() None[source]

Run the initialization commands.

pixel(x: int, y: int, color: int | Tuple | None = None) int | None[source]

Read or write a pixel at a given position.

read(command: int | None = None, count: int = 0) ByteString[source]

Abstract method

property rotation: int

Set the default rotation

vline(x: int, y: int, height: int, color: int | Tuple) None[source]

Draw a vertical line.

write(command: int | None = None, data: ByteString | None = None) None[source]

Abstract method

class adafruit_rgb_display.rgb.DisplaySPI(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 1, height: int = 1, baudrate: int = 12000000, polarity: int = 0, phase: int = 0, *, x_offset: int = 0, y_offset: int = 0, rotation: int = 0)[source]

Base class for SPI type devices

read(command: int | None = None, count: int = 0) ByteString[source]

SPI read from device with optional command

reset() None[source]

Reset the device

write(command: int | None = None, data: ByteString | None = None) None[source]

SPI write to the device: commands and data

class adafruit_rgb_display.rgb.DummyPin[source]

Can be used in place of a DigitalInOut() when you don’t want to skip it.

deinit() None[source]

Dummy DigitalInOut deinit

property direction: Direction

Dummy direction DigitalInOut property

property pull: Pull

Dummy pull DigitalInOut property

switch_to_input(*, pull: Pull | None = None) None[source]

Dummy switch_to_input method

switch_to_output(*, value: bool = False, drive_mode: DriveMode | None = None) None[source]

Dummy switch_to_output method

property value: bool

Dummy value DigitalInOut property

adafruit_rgb_display.rgb.color565(r: int | Tuple[int, int, int] | List[int], g: int | None = 0, b: int | None = 0) int[source]

Convert red, green and blue values (0-255) into a 16-bit 565 encoding. As a convenience this is also available in the parent adafruit_rgb_display package namespace.

adafruit_rgb_display.rgb.image_to_data(image: Image) Any[source]

Generator function to convert a PIL image to 16-bit 565 RGB bytes.

adafruit_rgb_display.hx8353

A simple driver for the HX8353-based displays.

  • Author(s): Radomir Dopieralski, Michael McWethy, Matt Land

class adafruit_rgb_display.hx8353.HX8353(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 128, height: int = 128, rotation: int = 0)[source]

A simple driver for the HX8353-based displays.

>>> import busio
>>> import digitalio
>>> import board
>>> from adafruit_rgb_display import color565
>>> import adafruit_rgb_display.hx8353 as hx8353
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
>>> display = hx8353.HX8383(spi, cs=digitalio.DigitalInOut(board.GPIO0),
...    dc=digitalio.DigitalInOut(board.GPIO15))
>>> display.fill(0x7521)
>>> display.pixel(64, 64, 0)

adafruit_rgb_display.ili9341

A simple driver for the ILI9341/ILI9340-based displays.

  • Author(s): Radomir Dopieralski, Michael McWethy, Matt Land

class adafruit_rgb_display.ili9341.ILI9341(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 240, height: int = 320, baudrate: int = 16000000, polarity: int = 0, phase: int = 0, rotation: int = 0)[source]

A simple driver for the ILI9341/ILI9340-based displays.

>>> import busio
>>> import digitalio
>>> import board
>>> from adafruit_rgb_display import color565
>>> import adafruit_rgb_display.ili9341 as ili9341
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
>>> display = ili9341.ILI9341(spi, cs=digitalio.DigitalInOut(board.GPIO0),
...    dc=digitalio.DigitalInOut(board.GPIO15))
>>> display.fill(color565(0xff, 0x11, 0x22))
>>> display.pixel(120, 160, 0)
scroll(dy: int | None = None) int | None[source]

Scroll the display by delta y

adafruit_rgb_display.s6d02a1

A simple driver for the S6D02A1-based displays.

  • Author(s): Radomir Dopieralski, Michael McWethy, Matt Land

class adafruit_rgb_display.s6d02a1.S6D02A1(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 128, height: int = 160, rotation: int = 0)[source]

A simple driver for the S6D02A1-based displays.

>>> import busio
>>> import digitalio
>>> import board
>>> from adafruit_rgb_display import color565
>>> import adafruit_rgb_display.s6d02a1 as s6d02a1
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
>>> display = s6d02a1.S6D02A1(spi, cs=digitalio.DigitalInOut(board.GPIO0),
...    dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
>>> display.fill(0x7521)
>>> display.pixel(64, 64, 0)

adafruit_rgb_display.ssd1331

A simple driver for the SSD1331-based displays.

  • Author(s): Radomir Dopieralski, Michael McWethy, Matt Land

class adafruit_rgb_display.ssd1331.SSD1331(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 96, height: int = 64, baudrate: int = 16000000, polarity: int = 0, phase: int = 0, *, rotation: int = 0)[source]

A simple driver for the SSD1331-based displays.

import busio
import digitalio
import board
from adafruit_rgb_display import color565
import adafruit_rgb_display.ssd1331 as ssd1331
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
display = ssd1331.SSD1331(spi, cs=digitalio.DigitalInOut(board.GPIO0),
                            dc=digitalio.DigitalInOut(board.GPIO15),
                            rst=digitalio.DigitalInOut(board.GPIO16))

display.fill(0x7521)
display.pixel(32, 32, 0)
write(command: int | None = None, data: ByteString | None = None) None[source]

write procedure specific to SSD1331

adafruit_rgb_display.ssd1351

A simple driver for the SSD1351-based displays.

  • Author(s): Radomir Dopieralski, Michael McWethy, Matt Land

class adafruit_rgb_display.ssd1351.SSD1351(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 128, height: int = 128, baudrate: int = 16000000, polarity: int = 0, phase: int = 0, *, x_offset: int = 0, y_offset: int = 0, rotation: int = 0)[source]

A simple driver for the SSD1351-based displays.

>>> import busio
>>> import digitalio
>>> import board
>>> from adafruit_rgb_display import color565
>>> import adafruit_rgb_display.ssd1351 as ssd1351
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
>>> display = ssd1351.SSD1351(spi, cs=digitalio.DigitalInOut(board.GPIO0),
...    dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
>>> display.fill(0x7521)
>>> display.pixel(32, 32, 0)

adafruit_rgb_display.st7735

A simple driver for the ST7735-based displays.

  • Author(s): Radomir Dopieralski, Michael McWethy, Matt Land

class adafruit_rgb_display.st7735.ST7735(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 128, height: int = 128, baudrate: int = 16000000, polarity: int = 0, phase: int = 0, *, x_offset: int = 0, y_offset: int = 0, rotation: int = 0)[source]

A simple driver for the ST7735-based displays.

>>> import busio
>>> import digitalio
>>> import board
>>> from adafruit_rgb_display import color565
>>> import adafruit_rgb_display.st7735 as st7735
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
>>> display = st7735.ST7735(spi, cs=digitalio.DigitalInOut(board.GPIO0),
...    dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
>>> display.fill(0x7521)
>>> display.pixel(64, 64, 0)
class adafruit_rgb_display.st7735.ST7735R(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 128, height: int = 160, baudrate: int = 16000000, polarity: int = 0, phase: int = 0, *, x_offset: int = 0, y_offset: int = 0, rotation: int = 0, bgr: bool = False, invert: bool = False)[source]

A simple driver for the ST7735R-based displays.

init() None[source]

Run the initialization commands.

class adafruit_rgb_display.st7735.ST7735S(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, bl: DigitalInOut, rst: DigitalInOut | None = None, width: int = 128, height: int = 160, baudrate: int = 16000000, polarity: int = 0, phase: int = 0, *, x_offset: int = 2, y_offset: int = 1, rotation: int = 0)[source]

A simple driver for the ST7735S-based displays.

adafruit_rgb_display.st7789

A simple driver for the ST7789-based displays.

  • Author(s): Melissa LeBlanc-Williams, Matt Land

class adafruit_rgb_display.st7789.ST7789(spi: SPI, dc: DigitalInOut, cs: DigitalInOut, rst: DigitalInOut | None = None, width: int = 240, height: int = 320, baudrate: int = 16000000, polarity: int = 0, phase: int = 0, *, x_offset: int = 0, y_offset: int = 0, rotation: int = 0)[source]

A simple driver for the ST7789-based displays.

>>> import busio
>>> import digitalio
>>> import board
>>> from adafruit_rgb_display import color565
>>> import adafruit_rgb_display.st7789 as st7789
>>> spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
>>> display = st7789.ST7789(spi, cs=digitalio.DigitalInOut(board.GPIO0),
...    dc=digitalio.DigitalInOut(board.GPIO15), rst=digitalio.DigitalInOut(board.GPIO16))
>>> display.fill(0x7521)
>>> display.pixel(64, 64, 0)
init() None[source]

Run the initialization commands.