{"id":22807938,"url":"https://github.com/gavinlyonsrepo/st7789_tft_pico","last_synced_at":"2025-10-20T20:30:49.185Z","repository":{"id":267703804,"uuid":"902094385","full_name":"gavinlyonsrepo/ST7789_TFT_PICO","owner":"gavinlyonsrepo","description":"TFT SPI LCD, ST7789 Driver, Raspberry pi PICO  display library. C++ SDK","archived":false,"fork":false,"pushed_at":"2024-12-20T20:18:56.000Z","size":201,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T00:00:00.203Z","etag":null,"topics":["display-driver","display-library","lcd","lcd-display","lcd-library","library","pico-sdk","raspberry-pi","raspberry-pi-pico","raspberry-pi-pico-rp2040","rp2040","rpi-pico","st7789","st7789-display","st7789-display-driver","st7789v","tft"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gavinlyonsrepo.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":"2024-12-11T22:31:25.000Z","updated_at":"2024-12-31T23:43:40.000Z","dependencies_parsed_at":"2024-12-11T23:39:16.845Z","dependency_job_id":null,"html_url":"https://github.com/gavinlyonsrepo/ST7789_TFT_PICO","commit_stats":null,"previous_names":["gavinlyonsrepo/st7789_tft_pico"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2FST7789_TFT_PICO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2FST7789_TFT_PICO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2FST7789_TFT_PICO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2FST7789_TFT_PICO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavinlyonsrepo","download_url":"https://codeload.github.com/gavinlyonsrepo/ST7789_TFT_PICO/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237393038,"owners_count":19302720,"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":["display-driver","display-library","lcd","lcd-display","lcd-library","library","pico-sdk","raspberry-pi","raspberry-pi-pico","raspberry-pi-pico-rp2040","rp2040","rpi-pico","st7789","st7789-display","st7789-display-driver","st7789v","tft"],"created_at":"2024-12-12T11:07:15.826Z","updated_at":"2025-10-20T20:30:49.180Z","avatar_url":"https://github.com/gavinlyonsrepo.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n# This project has been amalgamated into [URL LINK](https://github.com/gavinlyonsrepo/displaylib_16bit_PICO)\r\n\r\n\r\n\r\n\r\n## Overview\r\n\r\n* Name: ST7789_TFT_PICO\r\n\r\n* Description:\r\n\r\n0. Library for a TFT SPI LCD, ST7789 Driver\r\n1. Raspberry pi PICO RP2040 library.\r\n2. Inverse colour, rotate, sleep modes supported.\r\n3. 12 fonts included.\r\n4. Graphics + print class included.\r\n5. bi-color, 16 bit and 24 colour Bitmaps supported.\r\n6. Hardware and software SPI\r\n\r\n* Author: Gavin Lyons\r\n* Developed on Toolchain:\r\n\t1. Raspberry pi PICO RP2040\r\n\t2. SDK(2.1.0) C++\r\n\t3. compiler G++ for arm-none-eabi(13.2.1)\r\n\t4. CMAKE(VERSION 3.18) , VScode(1.95.3)\r\n\t5. Linux Mint 22.1\r\n\r\n\r\n## Test\r\n\r\nThere are  example files included. User picks the one they want \r\nby editing the CMakeLists.txt :: add_executable(${PROJECT_NAME}  section.\r\nComment in one path and one path only.\r\n\r\n| Filename  | Function  | Note |\r\n| --- | --- | --- |\r\n| ST7789_TFT_HELLO | Hello world  | --- |\r\n| ST7789_TFT_TEXT | Text  + fonts | --- |\r\n| ST7789_TFT_GRAPHICS| Graphics | --- |\r\n| ST7789_TFT_FUNCTIONS_FPS| Functions(like rotate scroll) + FPS test | --- |\r\n| ST7789_TFT_BMP_DATA | 1, 16 \u0026 24 bit colour bitmaps tests +  FPS test | Bitmap data is stored in arrays on PICO |\r\n\r\n\r\n## Software\r\n\r\n\r\n### User Options\r\n\r\nIn the main.cpp example files. There are four sections in \"Setup()\" function \r\nwhere user can make adjustments to select for SPI type used, PCB type used and screen size.\r\n\r\n\r\n0. USER OPTION 0 SPI_SPEED + TYPE \r\n1. USER OPTION 1 GPIO\r\n2. USER OPTION 2 SCREEN SECTION \r\n\r\n\r\n*USER OPTION 0 SPI SPEED* \r\n\r\nHere the user can pass the SPI Bus freq in kiloHertz, Currently set to 8 Mhz.\r\nMax SPI speed on the PICO is 62.5Mhz. There is a file with SPI test results for the FPS tests in extra/doc folder. 2nd parameter is the SPI interface(spi0 spi1 etc). \r\n\r\nIf users wants software SPI just call this method \r\nwith just one argument for the optional GPIO software uS delay,\r\nwhich by default is zero. Setting this higher can be used to slow down Software SPI \r\nwhich may be beneficial in  some setups.   \r\n\r\n*USER OPTION 1 GPIO*\r\n\r\nThe 5 GPIO pins used, the clock and data lines must be the clock and data lines \r\nof spi interface chosen in option 0 if using hardware SPI.\r\n\r\n*USER OPTION 2 Screen size  + Offsets*\r\n\r\nIn the main.cpp file, in USER OPTION 2 .\r\nUser can adjust screen pixel height, screen pixel width and x \u0026 y screen offsets.\r\nThese offsets can be used in the event of screen damage or manufacturing errors around edge \r\nsuch as cropped data or defective pixels.\r\nThe function TFTInitScreenSize sets them.\r\n\r\n### Fonts\r\n\r\nFont data table:\r\n\r\n| num | enum name | Char size XbyY | ASCII range | Size bytes | Size Scale-able |\r\n| ------ | ------ | ------ | ------ |  ------ | ----- |\r\n| 1 | $_Default | 5x8 |0-0xFF, Full Extended|1275 |Y|\r\n| 2 | $_Thick   | 7x8 |0x20-0x5A, no lowercase letters |406|Y|\r\n| 3 | $_SevenSeg  | 4x8 |0x20-0x7A |360|Y|\r\n| 4 | $_Wide | 8x8 |0x20-0x5A, no lowercase letters|464|Y|\r\n| 5 | $_Tiny | 3x8 |0x20-0x7E |285|Y|\r\n| 6 | $_Homespun  | 7x8 |0x20-0x7E |658|Y|\r\n| 7 | $_Bignum | 16x32 |0x2D-0x3A ,0-10 - . / : |896|N|\r\n| 8 | $_Mednum | 16x16 |0x2D-0x3A ,0-10 - . / :|448|N|\r\n| 9 | $_ArialRound| 16x24 | 0x20-0x7E |4608|N|\r\n| 10 | $_ArialBold | 16x16 |0x20-0x7E |3072|N|\r\n| 11 | $_Mia| 8x16 | 0x20-0x7E |1520|N|\r\n| 12 | $_Dedica | 6x12 |0x20-0x7E |1152|N|\r\n\r\n1. $ = TFTFont\r\n2. A print class is available to print out many data types.\r\n3. Fonts 1-6 are byte high(at text size 1) scale-able fonts, columns of padding added by SW.\r\n4. Font 7-8 are large numerical fonts and cannot be scaled(just one size).\r\n5. Fonts 9-12 Alphanumeric fonts and cannot be scaled(just one size)\r\nThese fonts are optional and can be removed from program\r\nby commenting out the relevant TFT_OPTIONAL_FONT_X define in the  ST7789_TFT_Font.hpp file\r\n\r\nFont Methods:\r\n\r\n| Font num | Method | Size parameter | Notes |\r\n| ------ | ------ | ------ |  ------ |\r\n| 1-6 | drawChar|Y| draws single  character |\r\n| 1-6 | drawText |Y| draws character array |\r\n| 7-12 | drawChar|N| draws single  character |\r\n| 7-12 | drawText|N| draws character array |\r\n| 1-12 | print |~| Polymorphic print class which will print out many data types |\r\n\r\nThese functions return an error code in event of an error.\r\n\r\n### Bitmap\r\n\r\nFunctions to support drawing bitmaps, \r\n\r\n| Num | Function Name | Colour support | test bitmap data size |  Note |\r\n| ------ | ------ | ------ | ------ | ------ |\r\n| 1 | TFTdrawIcon | bi-colour | (8 x (0-Max_y))  | Data vertically addressed |\r\n| 2 | TFTdrawBitmap | bi-colour | 2048 bytes  | Data horizontally  addressed |\r\n| 3 | TFTdrawBitmap16Data | 16 bit color 565  | 32768  | Data from array on PICO |\r\n| 4 | TFTdrawBitmap24Data  | 24 bit color  | 49152  | Data from array on PICO, Converted by software to 16-bit color  |\r\n| 5 | TFTdrawSpriteData  | 16 bit color  565 | 32768  | Data from array on PICO, Draws background color transparent | \r\n\r\n\r\n1. Bitmap size in kiloBytes = (screenWidth * screenHeight * bitsPerPixel)/(1024 * 8)\r\n2. Math in bitmap size column 2-5  assumes 128x128 bitmap.\r\n3. The data array for 1 and 2 is created from image files using file data conversion tool [link](https://javl.github.io/image2cpp/)\r\n4. The data array for 3 and 5 is created from BMP files using file data conversion tool [link](https://notisrac.github.io/FileToCArray/)\r\n\r\nThese functions will return an error code in event of an error.\r\n\r\n## Hardware\r\n\r\nConnections as setup in main.cpp  test file.\r\n\r\n| TFT PinNum | Pindesc |  HW SPI |\r\n| --- | --- | --- | \r\n| 1 | LED | VCC |   \r\n| 2 | SCLK | GPIO18 |\r\n| 3 | SDA | GPIO19 |\r\n| 4 | A0/DC |  GPIO3  |\r\n| 5 | RESET |   GPIO17 |\r\n| 6 | SS/CS |  GPIO2 |\r\n| 7 | GND | GND |\r\n| 8 | VCC |  VCC  |\r\n\r\n1. NOTE connect LED backlight pin 1 thru a resistor to 3.3/5V VCC.\r\n2. This is a 3.3V logic device do NOT connect the I/O logic lines to 5V logic device.\r\n3. You can connect VCC to 5V if there is a 3.3 volt regulator on back of TFT module.\r\n4. SW SPI pick any GPIO you like , HW SPI SCLK and SDA will be tied to spio interface.\r\n5. Backlight on/off control is left to user.\r\n\r\n## Output\r\n\r\n[![output pic](https://github.com/gavinlyonsrepo/Display_Lib_RPI/blob/main/extra/images/st7789output.jpg)](https://github.com/gavinlyonsrepo/Display_Lib_RPI/blob/main/extra/images/st7789output.jpg)\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinlyonsrepo%2Fst7789_tft_pico","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavinlyonsrepo%2Fst7789_tft_pico","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinlyonsrepo%2Fst7789_tft_pico/lists"}