Inky Base Class

class inky.inky.Inky(resolution=(400, 300), colour='black', cs_channel=0, dc_pin=22, reset_pin=27, busy_pin=17, h_flip=False, v_flip=False, spi_bus=None, i2c_bus=None, gpio=None)[source]

Inky e-Ink Display Driver.

Generally it is more convenient to use either the inky.InkyPHAT or inky.InkyWHAT classes.

Initialise an Inky Display.

Parameters:
  • resolution (tuple(int, int)) – Display resolution (width, height) in pixels, default: (400, 300).

  • colour (str) – One of ‘red’, ‘black’ or ‘yellow’, default: ‘black’.

  • cs_channel (int) – Chip-select channel for SPI communication, default: 0.

  • dc_pin (int) – Data/command pin for SPI communication, default: 22.

  • reset_pin (int) – Device reset pin, default: 27.

  • busy_pin (int) – Device busy/wait pin: 17.

  • h_flip (bool) – Enable horizontal display flip, default: False.

  • v_flip (bool) – Enable vertical display flip, default: False.

  • spi_bus (spidev.SpiDev) – SPI device. If None then a default spidev.SpiDev object is used. Default: None.

  • i2c_bus (smbus2.SMBus) – SMB object. If None then smbus2.SMBus(1) is used.

  • gpio (RPi.GPIO) – GPIO module. If None then RPi.GPIO is imported. Default: None.

set_border(colour)[source]

Set the border colour.

Parameters:

colour (int) – The border colour. Valid values are inky.BLACK, inky.WHITE, inky.RED and inky.YELLOW.

set_image(image)[source]

Copy an image to the buffer.

The dimensions of image should match the dimensions of the display being used.

Parameters:

image (PIL.Image.Image or numpy.ndarray or list) – Image to copy.

set_pixel(x, y, v)[source]

Set a single pixel on the buffer.

Parameters:
  • x (int) – x position on display.

  • y (int) – y position on display.

  • v (int) – Colour to set, valid values are inky.BLACK, inky.WHITE, inky.RED and inky.YELLOW.

setup()[source]

Set up Inky GPIO and reset display.

show(busy_wait=True)[source]

Show buffer on display.

Parameters:

busy_wait (bool) – If True, wait for display update to finish before returning, default: True.