{"id":13802215,"url":"https://github.com/russhughes/st7789s3_esp_lcd","last_synced_at":"2025-10-25T02:30:32.951Z","repository":{"id":112294697,"uuid":"576524350","full_name":"russhughes/st7789s3_esp_lcd","owner":"russhughes","description":"Fast ESP_LCD based MicroPython driver for the TTGO T-Display-S3 st7789 display written in C","archived":false,"fork":false,"pushed_at":"2024-03-20T04:37:27.000Z","size":11573,"stargazers_count":17,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-04T04:31:54.806Z","etag":null,"topics":["esp32s3","micropython","st7789","t-display-s3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/russhughes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-10T05:27:48.000Z","updated_at":"2024-09-02T20:39:39.000Z","dependencies_parsed_at":"2024-03-20T05:44:45.963Z","dependency_job_id":null,"html_url":"https://github.com/russhughes/st7789s3_esp_lcd","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"63d78dadd0bc27dace2fa9e5aaf2a69e7afb94a5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2Fst7789s3_esp_lcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2Fst7789s3_esp_lcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2Fst7789s3_esp_lcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2Fst7789s3_esp_lcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/russhughes","download_url":"https://codeload.github.com/russhughes/st7789s3_esp_lcd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238059129,"owners_count":19409601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32s3","micropython","st7789","t-display-s3"],"created_at":"2024-08-04T00:01:39.219Z","updated_at":"2025-10-25T02:30:25.870Z","avatar_url":"https://github.com/russhughes.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Display"],"readme":"See https://github.com/russhughes/s3lcd for a much faster Framebuffered version of the \ndriver using the ESP_LCD esp-idf component. It's a beta release and has minor differences \nfrom this driver.\n\n# ESP_LCD MicroPython driver for the TTGO T-Display-S3 st7789 display\n\nWarning: This is a work in progress and may contain bugs and/or incorrect documentation.\n\nThis driver is based on [devbis' st7789_mpy driver.](https://github.com/devbis/st7789_mpy)\nI modified the original driver for one of my projects to add:\n\n- Support for the TTGO T-Dispay-S3 with a parallel interface using the ESP_LCD\n  interface with DMA.\n- Display framebuffer enabling alpha blending for many drawing methods.\n- Display Rotation.\n- Scrolling\n- Writing text using bitmaps converted from True Type fonts\n- Drawing text using 8 and 16-bit wide bitmap fonts\n- Drawing text using Hershey vector fonts\n- Drawing JPGs using the TJpgDec - Tiny JPEG Decompressor R0.01d. from\n  http://elm-chan.org/fsw/tjpgd/00index.html\n- Drawing PNGs using the pngle library from https://github.com/kikuchan/pngle\n- Drawing and rotating Polygons and filled Polygons\n\nIncluded are 12 bitmap fonts derived from classic pc text mode fonts, 26\nHershey vector fonts and several example programs for different devices.\n\n\n## Pre-compiled firmware\n\nThe firmware directory contains pre-compiled MicroPython v1.20.0 firmware compiled\nusing ESP IDF v4.4.4 The firmware includes the st7789 C driver and several frozen\npython font files. See the README.md file in the fonts folder for more information\nabout the font files.\n\n\n## Thanks go out to:\n\n- https://github.com/devbis for the original driver this is based on.\n- https://github.com/hklang10 for letting me know of the new mp_raise_ValueError().\n- https://github.com/aleggon for finding the correct offsets for 240x240\n  displays and for discovering issues compiling STM32 ports.\n\n-- Russ\n\n## Overview\n\nThis is a driver for MicroPython to handle cheap displays based on the ST7789\nchip. The driver is written in C.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/russhughes/st7789_mpy/master/docs/ST7789.jpg\" alt=\"ST7789 display photo\"/\u003e\n\u003c/p\u003e\n\n\n# Setup MicroPython Build Environment in Ubuntu 20.04.2\n\nSee the MicroPython\n[README.md](https://github.com/micropython/micropython/blob/master/ports/esp32/README.md#setting-up-esp-idf-and-the-build-environment)\nif you run into any build issues not directly related to the st7789 driver. The\nrecommended MicroPython build instructions may have changed.\n\nUpdate and upgrade Ubuntu using apt-get if you are using a new install of\nUbuntu or the Windows Subsystem for Linux.\n\n```bash\nsudo apt-get -y update\nsudo apt-get -y upgrade\n```\n\nUse apt-get to install the required build tools.\n\n```bash\nsudo apt-get -y install build-essential libffi-dev git pkg-config cmake virtualenv python3-pip python3-virtualenv\n```\n\n### Install a compatible esp-idf SDK\n\nThe MicroPython README.md states: \"The ESP-IDF changes quickly, and MicroPython\nonly supports certain versions. I have had good luck using IDF v4.4.3\n\nClone the esp-idf SDK repo -- this usually takes several minutes.\n\n```bash\ngit clone -b v4.4.3 --recursive https://github.com/espressif/esp-idf.git\ncd esp-idf/\ngit pull\n```\n\nIf you already have a copy of the IDF, you can checkout a version compatible\nwith MicroPython and update the submodules using:\n\n```bash\n$ cd esp-idf\n$ git checkout v4.4.3\n$ git submodule update --init --recursive\n```\n\nInstall the esp-idf SDK.\n\n```bash\n./install.sh\n```\n\nSource the esp-idf export.sh script to set the required environment variables.\nYou must source the file and not run it using ./export.sh. You will need to\nsource this file before compiling MicroPython.\n\n```bash\nsource export.sh\ncd ..\n```\n\nClone the MicroPython repo.\n\n```bash\ngit clone https://github.com/micropython/micropython.git\n```\n\nClone the st7789 driver repo.\n\n```bash\ngit clone https://github.com/russhughes/st7789s3_mpy.git\n```\n\nUpdate the git submodules and compile the MicroPython cross-compiler\n\n```bash\ncd micropython/\ngit submodule update --init\ncd mpy-cross/\nmake\ncd ..\ncd ports/esp32\n```\n\nCopy any .py files you want to include in the firmware as frozen python modules\nto the modules subdirectory in ports/esp32. Be aware there is a limit to the\nflash space available. You will know you have exceeded this limit if you\nreceive an error message saying the code won't fit in the partition or if your\nfirmware continuously reboots with an error.\n\nFor example:\n\n```bash\ncp ../../../st7789s3_mpy/fonts/bitmap/vga1_16x16.py modules\ncp ../../../st7789s3_mpy/fonts/truetype/NotoSans_32.py modules\ncp ../../../st7789s3_mpy/fonts/vector/scripts.py modules\n```\n\nBuild the MicroPython firmware with the driver and frozen .py files in the\nmodules directory. If you did not add any .py files to the modules directory,\nyou can leave out the FROZEN_MANIFEST and FROZEN_MPY_DIR settings.\n\n```bash\nmake USER_C_MODULES=../../../../st7789s3_mpy/st7789/micropython.cmake FROZEN_MANIFEST=\"\" FROZEN_MPY_DIR=$UPYDIR/modules\n```\n\nErase and flash the firmware to your device. Set PORT= to the ESP32's usb\nserial port. I could not get the USB serial port to work under the Windows\nSubsystem (WSL2) for Linux. If you have the same issue, you can copy the\nfirmware.bin file and use the Windows esptool.py to flash your device.\n\n```bash\nmake USER_C_MODULES=../../../../st7789s3_mpy/st7789/micropython.cmake PORT=/dev/ttyUSB0 erase\nmake USER_C_MODULES=../../../../st7789s3_mpy/st7789/micropython.cmake PORT=/dev/ttyUSB0 deploy\n```\n\nThe firmware.bin file will be in the build-GENERIC directory. To flash using\nthe python esptool.py utility. Use pip3 to install the esptool if it's not\nalready installed.\n\n```bash\npip3 install esptool\n```\n\nSet PORT= to the ESP32's USB serial port\n\n```bash\nesptool.py --port COM3 erase_flash\nesptool.py --chip esp32 --port COM3 write_flash -z 0x0 firmware.bin\n```\n## CMake building instructions for MicroPython 1.14 and later\n\nfor ESP32:\n\n    $ cd micropython/ports/esp32\n\nAnd then compile the module with specified USER_C_MODULES dir.\n\n    $ make USER_C_MODULES=../../../../st7789s3_mpy/st7789/micropython.cmake\n\n\n## Methods\n\nNote: Optional Parameters are shown enclosed in '{' and '}' characters.\n\n- `st7789.ST7789(width, height, d7, d6, d5, d4, d3, d2, d1, d0, wr, rd, reset, dc, cs {, backlight, power, rotations, rotation, color_order, inversion, options})`\n\n    ### Required positional arguments:\n    - `width` display width\n    - `height` display height\n    - `d7`: 8-bit data bus pin bit 7 (Most significant bit)\n    - `d6`: 8-bit data bus pin bit 6\n    - `d5`: 8-bit data bus pin bit 5\n    - `d4`: 8-bit data bus pin bit 4\n    - `d3`: 8-bit data bus pin bit 3\n    - `d2`: 8-bit data bus pin bit 2\n    - `d1`: 8-bit data bus pin bit 1\n    - `d0`: 8-bit data bus pin bit 0 (Least significant bit)\n    - `wr`: write strobe pin\n    - `rd`: read strobe pin\n    - `reset` sets the pin connected to the display's hardware reset\n    - `dc` sets the pin connected to the display data/command selection input.\n    - `cs` sets the pin connected to the displays chip select input.\n\n    ### Optional keyworld arguments:\n\n    - `backlight` sets the pin connected to the display's backlight enable\n      input. The display's backlight input can often be left floating or\n      disconnected as the backlight on some displays is always powered on and\n      cannot be turned off.\n\n    - `power` sets the pin connected to the display's power enable input.\n\n    - `rotations` sets the orientation table. The orientation table is a list\n      of tuples for each `rotation` used to set the width, height, x_gap,\n      y_gap, swap_xy, mirror_x, and mirror_y values.\n\n      Default `rotations` are included for the following st7789 and st7735\n      display sizes:\n\n      Display | Default Orientation Tables\n      ------- | --------------------------\n      240x320 | [(240, 320, 0, 0, false, false, false), (320, 240, 0, 0, true, true, false), (240, 320, 0, 0, false, true, true), (320, 240, 0, 0, true, false, true)]\n      170x320 | [(170, 320, 35, 0, false, false, false), (320, 170, 0, 35, true, true, false), (170, 320, 35, 0, false, true, true), (320, 170, 0, 35, true, false, true)]\n      240x240 | [(240, 240, 0, 0, false, false, false), (240, 240, 0, 0, true, true, false), (240, 240, 0, 80, false, true, true), (240, 240, 80, 0, true, false, true)]\n      135x240 | [(135, 240, 52, 40, false, false, false), (240, 135, 40, 53, true, true, false), (135, 240, 53, 40, false, true, true), (240, 135, 40, 52, true, false, true)]\n      128x160 | [(128, 160, 0, 0, false, false, false), (160, 128, 0, 0, true, true, false), (128, 160, 0, 0, false, true, true), (160, 128, 0, 0, true, false, true)]\n      128x128 | [(128, 128, 2, 1, false, false, false), (128, 128, 1, 2, true, true, false), (128, 128, 2, 3, false, true, true), {128, 128, 3, 2, true, false, true)]\n\n      You may define up to 4 rotations.\n\n    - `rotation` sets the display rotation according to the orientation table.\n\n      The default orientation table defines four counter-clockwise rotations\n      for 240x320, 240x240, 134x240, 128x160 and 128x128 displays with the\n      LCD's ribbon cable at the bottom of the display. The default rotation is\n      Portrait (0 degrees).\n\n      Index | Rotation\n      ----- | --------\n      0     | Portrait (0 degrees)\n      1     | Landscape (90 degrees)\n      2     | Reverse Portrait (180 degrees)\n      3     | Reverse Landscape (270 degrees)\n\n    - `color_order` sets the color order used by the driver (st7789.RGB or\n      st7789.BGR)\n\n    - `inversion` Sets the display color inversion mode if True, clears the\n      display color inversion mode if false.\n\n    - `options` Sets driver option flags.\n\n      Option        | Description\n      ------------- | -----------\n      st7789.WRAP   | pixels, lines, polygons, and Hershey text will wrap around the display both horizontally and vertically.\n      st7789.WRAP_H | pixels, lines, polygons, and Hershey text will wrap around the display horizontally.\n      st7789.WRAP_V | pixels, lines, polygons, and Hershey text will wrap around the display vertically.\n\n- `deinit()`\n\n    Frees memory used by buffers and deletes the dedicated GPIO bundle.  This\n    method should be called before reinitalizing the display without hard\n    resetting the microcontroller.\n\n- `show({wait})`\n\n    Update the display from the framebuffer. If the optional `wait` parameter is\n    True, this method blocks until the display refresh is complete.  You must\n    use show() method to update the display before you will see anything on the\n    display.\n\n- `inversion_mode(bool)` Sets the display color inversion mode if True, clears\n  the display color inversion mode if False.\n\n- `init()`\n\n  Must be called to initialize the display.\n\n- `on()`\n\n  Turn on the backlight pin if one was defined during init.\n\n- `off()`\n\n  Turn off the backlight pin if one was defined during init.\n\n- `fill({color, alpha})`\n\n  Fill the display with the specified color optionally `alpha` blended with the\n  background. `color` defaults to BLACK, `alpha` defaults to 255.\n\n- `pixel(x, y {, color, alpha})`\n\n  Set the specified pixel to the given `color`. `color` defaults to WHITE,\n  `alpha` defaults to 255.\n\n- `line(x0, y0, x1, y1 {, color, aplha})`\n\n  Draws a single line with the provided `color` from (`x0`, `y0`) to (`x1`,\n  `y1`). `color` defaults to BLACK, `alpha` defaults to 255.\n\n- `hline(x, y, w {, color, alpha})`\n\n  Draws a single horizontal line with the provided `color` and `length` in\n  pixels. `color` defaults to BLACK, `alpha` defaults to 255.\n\n- `vline(x, y, length {, color, alpha})`\n\n  Draws a single horizontal line with the provided `color` and `length` in\n  pixels. `color` defaults to BLACK, `alpha` defaults to 255.\n\n- `rect(x, y, width, height {, color, alpha})`\n\n  Draws a rectangle from (`x`, `y`) with corresponding dimensions. `color`\n  defaults to BLACK, `alpha` defaults to 255.\n\n- `fill_rect(x, y, width, height {, color, alpha})`\n\n  Fill rectangle `width` by `height` starting at `x`, `y` with `color`\n  optionally `alpha` blended with the background. `color` defaults to BLACK,\n  `alpha` defaults to 255.\n\n- `circle(x, y, r {, color, alpha})`\n\n  Draws a circle with radius `r` centered at the (`x`, `y`) coordinates in the\n  given `color`. `color` defaults to BLACK,\n  `alpha` defaults to 255.\n\n- `fill_circle(x, y, r {, color, alpha})`\n\n  Draws a filled circle with radius `r` centered at the (`x`, `y`) coordinates\n  in the given `color`. `color` defaults to BLACK, `alpha` defaults to 255.\n\n- `blit_buffer(buffer, x, y, width, height {, alpha})`\n\n  Copy bytes() or bytearray() content to the screen internal memory. Note:\n  every color requires 2 bytes in the array. `alpha` defaults to 255.\n\n- `text(font, s, x, y {, fg, bg, alpha})`\n\n  Write text to the display using the specified bitmap `font` with the\n  coordinates as the upper-left corner of the text. The optional arguments `fg`\n  and `bg` can set the foreground and background colors of the text; otherwise\n  the foreground color defaults to `WHITE`, and the background color defaults\n  to `BLACK`. `alpha` defaults to 255. See the `README.md` in the\n  `fonts/bitmap` directory for example fonts.\n\n- `write(bitmap_font, s, x, y {, fg, bg, alpha})`\n\n  Write text to the display using the specified proportional or Monospace\n  bitmap font module with the coordinates as the upper-left corner of the text.\n  The foreground and background colors of the text can be set by the optional\n  arguments `fg` and `bg`, otherwise the foreground color defaults to `WHITE`\n  and the background color defaults to `BLACK`. `alpha` defaults to 255.\n\n  See the `README.md` in the `truetype/fonts` directory for example fonts.\n  Returns the width of the string as printed in pixels. Accepts UTF8 encoded\n  strings.\n\n  The `font2bitmap` utility creates compatible 1 bit per pixel bitmap modules\n  from Proportional or Monospaced True Type fonts. The character size,\n  foreground, background colors, and characters in the bitmap module may be\n  specified as parameters. Use the -h option for details. If you specify a\n  buffer_size during the display initialization, it must be large enough to\n  hold the widest character (HEIGHT * MAX_WIDTH * 2).\n\n- `write_len(bitap_font, s)`\n\n  Returns the string's width in pixels if printed in the specified font.\n\n- `draw(vector_font, s, x, y {, fg, scale, alpha})`\n\n  Draw text to the display using the specified Hershey vector font with the\n  coordinates as the lower-left corner of the text. The foreground color of the\n  text can be set by the optional argument `fg`. Otherwise the foreground color\n  defaults to `WHITE`. The size of the text can be scaled by specifying a\n  `scale` value. The `scale` value must be larger than 0 and can be a\n  floating-point or an integer value. The `scale` value defaults to 1.0.\n  `alpha` defaults to 255. See the README.md in the `vector/fonts` directory,\n  for example fonts and the utils directory for a font conversion program.\n\n- `draw_len(vector_font, s {, scale})`\n\n  Returns the string's width in pixels if drawn with the specified font.\n\n- `jpg(jpg_filename, x, y)`\n\n  Draw a JPG file on the display at the given `x` and `y` coordinates as the\n  upper left corner of the image. This method requires an additional 3100 bytes\n  of memory for it's work buffer.\n\n- `jpg_decode(jpg_filename {, x, y, width, height})`\n\n  Decode a jpg file and return it or a portion of it as a tuple composed of\n  (buffer, width, height). The buffer is a color565 blit_buffer compatible byte\n  array. The buffer will require width * height * 2 bytes of memory.\n\n  If the optional x, y, width, and height parameters are given, the buffer will\n  only contain the specified area of the image. See\n  examples/T-DISPLAY/clock/clock.py and\n  examples/T-DISPLAY/toasters_jpg/toasters_jpg.py for examples.\n\n- `png(png_filename, x, y)`\n\n  Draw a PNG file on the display with upper left corner of the image at the\n  given `x` and `y` coordinates. The PNG will not be clipped it must be able to\n  fit fully on the display or it will not be drawn. Transparency is supported,\n  see the alien.py program in the examples/png folder for an example.\n\n- `polygon_center(polygon)`\n\n   Return the center of the `polygon` as an (x, y) tuple. The `polygon` should\n   consist of a list of (x, y) tuples forming a closed convex polygon.\n\n- `fill_polygon(polygon, x, y, color {, alpha, angle, center_x, center_y})`\n\n  Draw a filled `polygon` at the `x`, and `y` coordinates in the `color` given.\n  `alpha` defaults to 255. The polygon may be rotated `angle` radians about the\n  `center_x` and `center_y` point. The polygon should consist of a list of (x,\n  y) tuples forming a closed convex polygon.\n\n  See the TWATCH-2020 `watch.py` demo for an example.\n\n- `polygon(polygon, x, y, color {, alpha, angle, center_x, center_y)`\n\n  Draw a `polygon` at the `x`, and `y` coordinates in the `color` given.\n  `alpha` defaults to 255. The polygon may be rotated `angle` radians about the\n  `center_x` and `center_y` point. The polygon should consist of a list of (x,\n  y) tuples forming a closed convex polygon.\n\n  See the T-Display `roids.py` for an example.\n\n- `bitmap(bitmap, x , y {, alpha, index})` or `bitmap((bitmap_as_bytes, w, h), x , y {, alpha})`\n\n  Draw a bitmap using the specified `x`, `y` coordinates as the upper-left\n  corner of the `bitmap`.\n\n  - If the `bitmap` parameter is a bitmap module, the `index` parameter may be\n    specified to select a specific bitmap from the module. The `index`\n    parameter must be an integer value greater than or equal to 0 and less than\n    the number of bitmaps in the module. The `index` value defaults to 0.\n    `alpha` defaults to 255.\n\n  - If the `bitmap_module` parameter is a tuple, the tuple must contain a\n    bitmap as a byte array, the width of the bitmap in pixels, and the height\n    of the bitmap in pixels. `alpha` defaults to 255.\n\n  The `imgtobitmap.py` utility creates compatible 1 to 8 bit per pixel bitmap\n  modules from image files using the Pillow Python Imaging Library.\n\n  The `monofont2bitmap.py` utility creates compatible 1 to 8 bit per pixel\n  bitmap modules from Monospaced True Type fonts. See the `inconsolata_16.py`,\n  `inconsolata_32.py` and `inconsolata_64.py` files in the `examples/lib`\n  folder for sample modules and the `mono_font.py` program for an example using\n  the generated modules.\n\n  The character sizes, bit per pixel, foreground, background colors, and the\n  characters to include in the bitmap module may be specified as parameters.\n  Use the -h option for details. Bits per pixel settings larger than one may be\n  used to create antialiased characters at the expense of memory use.\n\n- `width()`\n\n  Returns the current logical width of the display. (ie a 135x240 display\n  rotated 90 degrees is 240 pixels wide)\n\n- `height()`\n\n  Returns the current logical height of the display. (ie a 135x240 display\n  rotated 90 degrees is 135 pixels high)\n\n- `rotation(r)`\n\n  Set the rotates the logical display in a counter-clockwise direction.\n  0-Portrait (0 degrees), 1-Landscape (90 degrees), 2-Inverse Portrait (180\n  degrees), 3-Inverse Landscape (270 degrees)\n\nThe module exposes predefined colors:\n  `BLACK`, `BLUE`, `RED`, `GREEN`, `CYAN`, `MAGENTA`, `YELLOW`, and `WHITE`\n\n## Scrolling\n\nThe st7789 display controller contains a 240 by 320-pixel frame buffer used to\nstore the pixels for the display. For scrolling, the frame buffer consists of\nthree separate areas; The (`tfa`) top fixed area, the (`height`) scrolling\narea, and the (`bfa`) bottom fixed area. The `tfa` is the upper portion of the\nframe buffer in pixels not to scroll. The `height` is the center portion of the\nframe buffer in pixels to scroll. The `bfa` is the lower portion of the frame\nbuffer in pixels not to scroll. These values control the ability to scroll the\nentire or a part of the display.\n\nFor displays that are 320 pixels high, setting the `tfa` to 0, `height` to 320,\nand `bfa` to 0 will allow scrolling of the entire display. You can set the\n`tfa` and `bfa` to a non-zero value to scroll a portion of the display. `tfa` +\n`height` + `bfa` = should equal 320, otherwise the scrolling mode is undefined.\n\nDisplays less than 320 pixels high, the `tfa`, `height`, and `bfa` will need to\nbe adjusted to compensate for the smaller LCD panel. The actual values will\nvary depending on the configuration of the LCD panel. For example, scrolling\nthe entire 135x240 TTGO T-Display requires a `tfa` value of 40, `height` value\nof 240, and `bfa` value of 40 (40+240+40=320) because the T-Display LCD shows\n240 rows starting at the 40th row of the frame buffer, leaving the last 40 rows\nof the frame buffer undisplayed.\n\nOther displays like the Waveshare Pico LCD 1.3 inch 240x240 display require the\n`tfa` set to 0, `height` set to 240, and `bfa` set to 80 (0+240+80=320) to\nscroll the entire display. The Pico LCD 1.3 shows 240 rows starting at the 0th\nrow of the frame buffer, leaving the last 80 rows of the frame buffer\nundisplayed.\n\nThe `vscsad` method sets the (VSSA) Vertical Scroll Start Address. The VSSA\nsets the line in the frame buffer that will be the first line after the `tfa`.\n\n    The ST7789 datasheet warns:\n\n    The value of the vertical scrolling start address is absolute (with reference to the frame memory),\n    it must not enter the fixed area (defined by Vertical Scrolling Definition, otherwise undesirable\n    image will be displayed on the panel.\n\n- `vscrdef(tfa, height, bfa)` Set the vertical scrolling parameters.\n\n  `tfa` is the top fixed area in pixels. The top fixed area is the upper\n  portion of the display frame buffer that will not be scrolled.\n\n  `height` is the total height in pixels of the area scrolled.\n\n  `bfa` is the bottom fixed area in pixels. The bottom fixed area is the lower\n  portion of the display frame buffer that will not be scrolled.\n\n- `vscsad(vssa)` Set the vertical scroll address.\n\n  `vssa` is the vertical scroll start address in pixels. The vertical scroll\n  start address is the line in the frame buffer will be the first line shown\n  after the TFA.\n\n## Helper functions\n\n- `color565(r, g, b)`\n\n  Pack a color into 2-bytes rgb565 format\n\n- `map_bitarray_to_rgb565(bitarray, buffer, width {, color, bg_color})`\n\n  Convert a `bitarray` to the rgb565 color `buffer` suitable for blitting. Bit\n  1 in `bitarray` is a pixel with `color` and 0 - with `bg_color`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusshughes%2Fst7789s3_esp_lcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusshughes%2Fst7789s3_esp_lcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusshughes%2Fst7789s3_esp_lcd/lists"}