slmisc / gd32v-lcd

LCD library with DMA support for Sipeed Longan Nano (GD32VF103)
BSD 3-Clause "New" or "Revised" License
28 stars 1 forks source link
gd32v gd32vf103

gd32v-lcd

LCD library with DMA support for Sipeed Longan Nano (GD32VF103). Also supports setting up automated framebuffer refresh in background.

Overview

The official example repository for GD32V has a rudimentary LCD library but the support for DMA transfers appears to be unfinished and I could not get it working. Therefore, I decided to roll my own. This project contains a DMA-enabled LCD library with all bulk operations such as buffer reads and writes running asynchronously in background for maximum performance. The display controller interface is similar to ST7735 (Datasheet PDF) in case you're looking for low-level documentation.

This library also supports setting up continuous automatic framebuffer upload in background so that you can effectively use the display as a memory mapped device. Unfortunately, there is no vertical sync pin connected on Sipeed Longan Nano, so avoiding tearing is not possible without hardware modifications (assuming that the LCD controller is similar to ST7735 in this regard).

There are two simple graphics effects in the main file, one demonstrating on-demand framebuffer upload, and one demonstrating automatic background refresh.

Amiga ball Starfield

Thanks to Kevin Sangeelee for the comprehensive blog post on GD32VF103 that was very helpful for me in understanding how to set up the interrupts on this hardware.