{"id":46977741,"url":"https://github.com/limingjie/ch32v003-st7735-driver","last_synced_at":"2026-03-11T12:48:22.845Z","repository":{"id":190598160,"uuid":"682955810","full_name":"limingjie/CH32V003-ST7735-Driver","owner":"limingjie","description":"A minimal ST7735 LCD driver for CH32V003","archived":false,"fork":false,"pushed_at":"2023-09-09T11:19:06.000Z","size":3036,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-27T08:35:35.939Z","etag":null,"topics":["ch32v003","diy","driver","hardware","lcd","risc-v","st7789"],"latest_commit_sha":null,"homepage":"","language":"C","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/limingjie.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}},"created_at":"2023-08-25T08:55:38.000Z","updated_at":"2023-12-28T22:35:02.000Z","dependencies_parsed_at":"2023-12-16T00:13:54.778Z","dependency_job_id":"ca09ec1c-44ea-4265-a598-86471458867a","html_url":"https://github.com/limingjie/CH32V003-ST7735-Driver","commit_stats":null,"previous_names":["limingjie/ch32v003-st7735-driver"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/limingjie/CH32V003-ST7735-Driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limingjie%2FCH32V003-ST7735-Driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limingjie%2FCH32V003-ST7735-Driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limingjie%2FCH32V003-ST7735-Driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limingjie%2FCH32V003-ST7735-Driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/limingjie","download_url":"https://codeload.github.com/limingjie/CH32V003-ST7735-Driver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limingjie%2FCH32V003-ST7735-Driver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30381678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ch32v003","diy","driver","hardware","lcd","risc-v","st7789"],"created_at":"2026-03-11T12:48:19.659Z","updated_at":"2026-03-11T12:48:22.823Z","avatar_url":"https://github.com/limingjie.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CH32V003 ST7735 Driver\n\nA minimal ST7735 LCD driver for CH32V003 that supports both [ch32v003fun](https://github.com/cnlohr/ch32v003fun) and [PlatformIO CH32V](https://github.com/Community-PIO-CH32V/platform-ch32v). It should also work in [MounRiver Studio](http://www.mounriver.com/).\n\nDMA is used to accelerate the data transmission where possible.\n\n![ST7735](images/ST7735.webp)\n\n- [CH32V003 ST7735 Driver](#ch32v003-st7735-driver)\n  - [Usage](#usage)\n    - [Wiring](#wiring)\n    - [Initialization](#initialization)\n    - [Text](#text)\n    - [Drawing](#drawing)\n  - [Configuration](#configuration)\n    - [Change Resolution and Offset](#change-resolution-and-offset)\n    - [RGB Color Macro](#rgb-color-macro)\n    - [Set Rotation and RGB Ordering](#set-rotation-and-rgb-ordering)\n    - [Invert Colors](#invert-colors)\n  - [Known Issues](#known-issues)\n  - [CH32V003 Development Guide](#ch32v003-development-guide)\n  - [References](#references)\n  - [License](#license)\n\n## Usage\n\n### Wiring\n\nST7735 8-pin module\n\n![ST7735 8-Pin Module](images/ST7735_8_Pin.webp)\n\n| CH32V003         | ST7735      | Power | Description                           |\n| ---------------- | ----------- | ----- | ------------------------------------- |\n|                  | 1 - `LEDA`  |       | Connect to 3V3 via a 15-100Ω resistor |\n|                  | 2 - `GND`   | `GND` | GND                                   |\n| `PC2`            | 3 - `RESET` |       | Reset                                 |\n| `PC3`            | 4 - `RS`    |       | DC (Data / Command)                   |\n| `PC6` (SPI MOSI) | 5 - `SDA`   |       | SPI MOSI (Master Output Slave In)     |\n| `PC5` (SPI SCLK) | 6 - `SCL`   |       | SPI SCLK (Serial Clock)               |\n|                  | 7 - `VDD`   | `3V3` | VDD                                   |\n| `PC4`            | 8 - `CS`    |       | SPI CS/SS (Chip/Slave Select)         |\n\nNote: To not use CS, define the `ST7735_NO_CS` macro in `st7735.h`. Make ST7735 always enabled by pulling CS to ground.\n\n```C\n#define ST7735_NO_CS\n```\n\n### Initialization\n\nInclude the header file.\n\n```C\n#include \"st7735.h\"\n```\n\nThen invoke `tft_init()` function to initialize the driver.\n\n```C\ntft_init();\n```\n\n### Text\n\nPrint a string.\n\n```C\ntft_set_color(RED);\ntft_set_background_color(BLACK);\ntft_set_cursor(2, 2);\ntft_print(\"Hello World!\");\n```\n\nPrint integers.\n\n```C\ntft_set_color(RED);\ntft_set_background_color(BLACK);\ntft_set_cursor(2, 10);\ntft_print_number(123, 0);   // Align left as the width is less thant the number.\ntft_set_cursor(2, 20);\ntft_print_number(-123, 30); // Align right as the width is greater than the number.\n```\n\n### Drawing\n\nDraw a pixel.\n\n```C\ntft_draw_pixel(80, 30, RED);\n```\n\nDraw a line.\n\n```C\ntft_draw_line(10, 10, 30, 30, BLUE);\n```\n\nDraw a rectangle.\n\n```C\ntft_draw_rect(10, 10, 30, 30, BLUE);\n```\n\nFill a rectangle area.\n\n```C\ntft_fill_rect(10, 10, 30, 30, BLUE);\n```\n\n## Configuration\n\nDepends on which ST7735 variants you have, it may require different configurations. You can configure the behavior in `st7735.h` or `st7735.c`.\n\n### Change Resolution and Offset\n\n```C\n// st7735.h\n#define ST7735_WIDTH    160\n#define ST7735_HEIGHT   80\n#define ST7735_X_OFFSET 1\n#define ST7735_Y_OFFSET 26\n```\n\n### RGB Color Macro\n\n```C\n// st7735.h\n#define RGB565(r, g, b) ((((r)\u00260xF8) \u003c\u003c 8) | (((g)\u00260xFC) \u003c\u003c 3) | ((b) \u003e\u003e 3))\n#define BGR565(r, g, b) ((((b)\u00260xF8) \u003c\u003c 8) | (((g)\u00260xFC) \u003c\u003c 3) | ((r) \u003e\u003e 3))\n#define RGB             RGB565\n```\n\n### Set Rotation and RGB Ordering\n\n```C\n// st7735.c\nvoid tft_init(void)\n{\n    ...\n    // Set rotation\n    write_command_8(ST7735_MADCTL);\n    write_data_8(ST7735_MADCTL_MY | ST7735_MADCTL_MV | ST7735_MADCTL_BGR);  // 0 - Horizontal\n    // write_data_8(ST7735_MADCTL_BGR);                                        // 1 - Vertical\n    // write_data_8(ST7735_MADCTL_MX | ST7735_MADCTL_MV | ST7735_MADCTL_BGR);  // 2 - Horizontal\n    // write_data_8(ST7735_MADCTL_MX | ST7735_MADCTL_MY | ST7735_MADCTL_BGR);  // 3 - Vertical\n    ...\n}\n```\n\n### Invert Colors\n\n```C\n// st7735.c\nvoid tft_init(void)\n{\n    ...\n    // Invert display\n    write_command_8(ST7735_INVON);\n    // write_command_8(ST7735_INVOFF);\n    ...\n}\n```\n\n## Known Issues\n\n- [x] (Fixed) ~~The CS pin does not work understand PlatformIO. Pull the CS pin to ground as a temporary solution.~~\n- [x] (Fixed) ~~The draw text function creates partial text on a diagonal line from top left, I thought it is caused by hardware, it turns out I set a mistake the Y coordinate as X coordinate.~~\n\n## CH32V003 Development Guide\n\n[CH32V003 Development Guide](CH32V003_Dev_Guide.md)\n\n## References\n\n- [moononournation: Arduino_GFX](https://github.com/moononournation/Arduino_GFX)\n- [Morita_Hikaru: CH32V003/Driver/CH32V003_LCD_Driver.zip](https://gitee.com/morita/ch32-v003/tree/master/Driver)\n- [E. Brombaugh: SPI OLED demonstration](https://github.com/cnlohr/ch32v003fun/tree/master/examples/spi_oled)\n\n## License\n\n![CC by-nc-sa](images/by-nc-sa.svg)\n\nThis work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/).\n\n- Attribution - You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.\n- NonCommercial - You may not use the material for commercial purposes.\n- ShareAlike - If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimingjie%2Fch32v003-st7735-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimingjie%2Fch32v003-st7735-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimingjie%2Fch32v003-st7735-driver/lists"}