1.8 inch display

class TFT.TFT[source]

Bases: object

FW Driver for an ST7735S TFT controller.

CE_DESELECT()[source]

Deselect TFT CS pin.

Parameters:none
Returns:none
CE_OUTPUT()[source]

Set TFT CS pin as output

Parameters:none
Returns:none
CE_SELECT()[source]

Select TFT CS pin.

Parameters:none
Returns:none
clear(color=(0, 0, 0))[source]

Clear the image buffer to the specified RGB color (default black).

Parameters:color – Background color.
Returns:none
command(data)[source]

Write a byte or array of bytes to the display as command data.

Parameters:data – Single byte command.
Returns:none
data(data)[source]

Write a byte or array of bytes to the display as display data.

Parameters:data – Data byte
Returns:none
display(image=None)[source]

Write the provided image to the hardware. If no image parameter is provided the display buffer will be written to the hardware. If an image is provided, it should be RGB format and the same dimensions as the display hardware.

Parameters:image – picture image
Returns:none
draw()[source]

Return a PIL ImageDraw instance for 2D drawing on the image buffer.

Parameters:none
Returns:none
fullDisplay()[source]

Sets the display in full screen mode.

Parameters:none
Returns:none
idleMode(onoff)[source]

Puts the display or takes it out of idle mode

Parameters:onoff – idle mode status
Returns:none
initialize()[source]

Intializes the display controller and prepares the it for any subsequent operations.

Parameters:none
Returns:none
invert(status)[source]

Disables color inversion on the display.

Parameters:status – Color inversion status.
Returns:none
reset()[source]

Resets the display, (RST) reset pin must be connected.

Parameters:none
Returns:none
scrollArea(tfa, vsa, bfa, firstline)[source]

Sets the scroll area.

Parameters:
  • tfa – top fixed area row
  • vsa – vertical scrolling area
  • bfa – bottom fixed area row
  • firstline – Beginning of first line
Returns:

none

send(data, dataOrCmd=True, length=4096)[source]

Writes a byte or array of bytes to the display. dataOrCmd parameter controls if byte should be interpreted as display data (True)/ command data otherwise. Length is an optional size of bytes to write in a single SPI transaction, with a default of 4096.

Parameters:
  • data – Single byte or an array of bytes.
  • dataOrCmd – Flag for command or data mode
  • length – size of array
Returns:

none

setAddrWindow(x0=0, y0=0, x1=None, y1=None)[source]

Set the pixel address window for proceeding drawing commands.

Parameters:
  • x0 – x0 and x1 should define the minimum and maximum x pixel bounds.
  • y0
  • x1 – y0 and y1 should define the minimum and maximum y pixel bound.
  • y1
Returns:

none

setColorMode(slef, mode)[source]

Sets the pixel color depth. This can be 12,16 or 18 bit.

Parameters:mode – Constant number
Returns:none
setGamma(gamma)[source]

Sets the gamma mode of the display.

Parameters:gamma – Is from 1 to 4.
Returns:none
setPartialArea(start, end)[source]

Sets the partial scroll area. This function is used in conjuction with the scrollArea function.

Parameters:
  • start – start of patial area
  • end – end of patial area
Returns:

none

setRotation(mode)[source]

Sets the display text orientation. Mirrored modes are also supported on top of portrait and landscape modes.

Parameters:mode – orientation data
Returns:none
sleep()[source]

Return a PIL ImageDraw instance for 2D drawing on the image buffer.

Parameters:none
Returns:none
turnOff()[source]

Blanks out the display.

Parameters:none
Returns:none
turnOn()[source]

This function turn on the display from idle mode.

Parameters:none
Returns:none
wakeUp()[source]

Wakes the display from sleep mode.

Parameters:none
Returns:none
TFT.color565(r, g, b)[source]

Convert red, green, blue components to a 16-bit 565 RGB value. Components should be values 0 to 255.

Parameters:
  • r – Red byte.
  • g – Green byte.
  • b – Blue byte.
Returns:

pixel - 16-bit 565 RGB value

TFT.image_to_data(image)[source]

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

Parameters:image – PIL image
Returns:imgArray

Previous topic

Altimeter/ Barometer/ Temperature sensor

Next topic

Capacitive touch controller (3 buttons)

This Page