ST7789 driver class Args: spi (spi): spi object **Required** width (int): display width **Required** height (int): display height **Required** reset (pin): reset pin dc (pin): dc pin **Required** cs (pin): cs pin backlight(pin): backlight pin rotation (int): - 0-Portrait - 1-Landscape - 2-Inverted Portrait - 3-Inverted Landscape color_order (int): - RGB: Red, Green Blue, default - BGR: Blue, Green, Red custom_init (tuple): custom initialization commands - ((b'command', b'data', delay_ms), ...) custom_rotations (tuple): custom rotation definitions - ((width, height, xstart, ystart, madctl, needs_swap), ...)
Method | __init__ |
Initialize display. |
Method | bitmap |
Draw a bitmap on display at the specified column and row |
Method | blit |
Copy buffer to display at the given location. |
Method | fill |
Fill the entire FrameBuffer with the specified color. |
Method | fill |
Draw a rectangle at the given location, size and filled with color. |
Method | get |
Undocumented |
Method | hard |
Hard reset display. |
Method | hline |
Draw horizontal line at the given location and color. |
Method | init |
Initialize display. |
Method | inversion |
Enable or disable display inversion mode. |
Method | line |
Draw a single pixel wide line starting at x0, y0 and ending at x1, y1. |
Method | pbitmap |
Draw a bitmap on display at the specified column and row one row at a time |
Method | pixel |
Draw a pixel at the given location and color. |
Method | polygon |
Draw a polygon on the display. |
Method | rect |
Draw a rectangle at the given location, size and color. |
Method | rotation |
Set display rotation. |
Method | set |
Undocumented |
Method | sleep |
Enable or disable display sleep mode. |
Method | soft |
Soft reset display. |
Method | text |
Draw text on display in specified font and colors. 8 and 16 bit wide fonts are supported. |
Method | vline |
Draw vertical line at the given location and color. |
Method | vscrdef |
Set Vertical Scrolling Definition. |
Method | vscsad |
Set Vertical Scroll Start Address of RAM. |
Method | write |
Write a string using a converted true-type font on the display starting at the specified column and row |
Method | write |
Returns the width in pixels of the string if it was written with the specified font |
Instance Variable | backlight |
Undocumented |
Instance Variable | color |
Undocumented |
Instance Variable | cs |
Undocumented |
Instance Variable | dc |
Undocumented |
Instance Variable | height |
Undocumented |
Instance Variable | init |
Undocumented |
Instance Variable | needs |
Undocumented |
Instance Variable | physical |
Undocumented |
Instance Variable | physical |
Undocumented |
Instance Variable | reset |
Undocumented |
Instance Variable | rotations |
Undocumented |
Instance Variable | spi |
Undocumented |
Instance Variable | width |
Undocumented |
Instance Variable | xstart |
Undocumented |
Instance Variable | ystart |
Undocumented |
Static Method | _find |
Undocumented |
Static Method | _pack16 |
Pack a character into a byte array. |
Static Method | _pack8 |
Undocumented |
Method | _set |
Set window to column and row address. |
Method | _text16 |
Internal method to draw characters with width of 16 and heights of 16 or 32. |
Method | _text8 |
Internal method to write characters with width of 8 and heights of 8 or 16. |
Method | _write |
SPI write to the device: commands and data. |
Instance Variable | _backlight |
Undocumented |
Instance Variable | _rotation |
Undocumented |
Initialize display.
Draw a bitmap on display at the specified column and row Args: bitmap (bitmap_module): The module containing the bitmap to draw x (int): column to start drawing at y (int): row to start drawing at index (int): Optional index of bitmap to draw from multiple bitmap module
Copy buffer to display at the given location. Args: buffer (bytes): Data to copy to display x (int): Top left corner x coordinate Y (int): Top left corner y coordinate width (int): Width height (int): Height
Draw a rectangle at the given location, size and filled with color. Args: x (int): Top left corner x coordinate y (int): Top left corner y coordinate width (int): Width in pixels height (int): Height in pixels color (int): 565 encoded color
Draw horizontal line at the given location and color. Args: x (int): x coordinate Y (int): y coordinate length (int): length of line color (int): 565 encoded color
Enable or disable display inversion mode. Args: value (bool): if True enable inversion mode. if False disable inversion mode
Draw a single pixel wide line starting at x0, y0 and ending at x1, y1. Args: x0 (int): Start point x coordinate y0 (int): Start point y coordinate x1 (int): End point x coordinate y1 (int): End point y coordinate color (int): 565 encoded color
Draw a bitmap on display at the specified column and row one row at a time Args: bitmap (bitmap_module): The module containing the bitmap to draw x (int): column to start drawing at y (int): row to start drawing at index (int): Optional index of bitmap to draw from multiple bitmap module
Draw a pixel at the given location and color. Args: x (int): x coordinate Y (int): y coordinate color (int): 565 encoded color
Draw a polygon on the display. Args: points (list): List of points to draw. x (int): X-coordinate of the polygon's position. y (int): Y-coordinate of the polygon's position. color (int): 565 encoded color. angle (float): Rotation angle in radians (default: 0). center_x (int): X-coordinate of the rotation center (default: 0). center_y (int): Y-coordinate of the rotation center (default: 0). Raises: ValueError: If the polygon has less than 3 points.
Draw a rectangle at the given location, size and color. Args: x (int): Top left corner x coordinate y (int): Top left corner y coordinate width (int): Width in pixels height (int): Height in pixels color (int): 565 encoded color
Set display rotation. Args: rotation (int): - 0-Portrait - 1-Landscape - 2-Inverted Portrait - 3-Inverted Landscape custom_rotations can have any number of rotations
Enable or disable display sleep mode. Args: value (bool): if True enable sleep mode. if False disable sleep mode
Draw text on display in specified font and colors. 8 and 16 bit wide fonts are supported. Args: font (module): font module to use. text (str): text to write x0 (int): column to start drawing at y0 (int): row to start drawing at color (int): 565 encoded color to use for characters background (int): 565 encoded color to use for background
Draw vertical line at the given location and color. Args: x (int): x coordinate Y (int): y coordinate length (int): length of line color (int): 565 encoded color
Set Vertical Scrolling Definition. To scroll a 135x240 display these values should be 40, 240, 40. There are 40 lines above the display that are not shown followed by 240 lines that are shown followed by 40 more lines that are not shown. You could write to these areas off display and scroll them into view by changing the TFA, VSA and BFA values. Args: tfa (int): Top Fixed Area vsa (int): Vertical Scrolling Area bfa (int): Bottom Fixed Area
Set Vertical Scroll Start Address of RAM. Defines which line in the Frame Memory will be written as the first line after the last line of the Top Fixed Area on the display Example: for line in range(40, 280, 1): tft.vscsad(line) utime.sleep(0.01) Args: vssa (int): Vertical Scrolling Start Address
Write a string using a converted true-type font on the display starting at the specified column and row Args: font (font): The module containing the converted true-type font s (string): The string to write x (int): column to start writing y (int): row to start writing fg (int): foreground color, optional, defaults to WHITE bg (int): background color, optional, defaults to BLACK
Returns the width in pixels of the string if it was written with the specified font Args: font (font): The module containing the converted true-type font string (string): The string to measure Returns: int: The width of the string in pixels
Pack a character into a byte array. Args: char (str): character to pack Returns: 128 bytes: character bitmap in color565 format
Set window to column and row address. Args: x0 (int): column start address y0 (int): row start address x1 (int): column end address y1 (int): row end address
Internal method to draw characters with width of 16 and heights of 16 or 32. Args: font (module): font module to use text (str): text to write x0 (int): column to start drawing at y0 (int): row to start drawing at color (int): 565 encoded color to use for characters background (int): 565 encoded color to use for background
Internal method to write characters with width of 8 and heights of 8 or 16. Args: font (module): font module to use text (str): text to write x0 (int): column to start drawing at y0 (int): row to start drawing at color (int): 565 encoded color to use for characters background (int): 565 encoded color to use for background