GC9A01 round display

A 1.28 inch round IPS color display, 240x240 pixels, on a GalaxyCore GC9A01 driven over SPI. Aliases: round TFT, 1.28 inch round LCD, GC9A01A, watch display.

It is the screen in homemade watches, gauges, dials and eyes: a circle of glass on a square of memory. The controller speaks the same command set as the ILI9341 and the ST7789, so the drawing is the Adafruit GFX you already know.

Pins

Pin What it does
GND Ground.
VCC Supply, 3.3 V or 5 V (the module has a regulator).
SCL SPI clock. It says SCL, but it is SPI, not I2C.
SDA SPI data in (MOSI).
RES Reset, active low.
DC Command (low) or data (high).
CS Chip select, active low.
BLK Backlight. Lit when left unwired; pull it low to turn it off.

How it talks

SPI mode 0, most significant bit first. DC low marks a command byte and high its parameters or pixels. 0x2A and 0x2B set the column and row window, 0x2C streams 16-bit RGB565 pixels into it, 0x36 (MADCTL) turns the picture, 0x11 wakes the panel and 0x29 switches it on. Every library first sends a long table of vendor registers from GalaxyCore's sample code; they tune the panel and do not change a pixel in Mokxi.

The glass is round, the memory is square. The center is (120, 120) and the radius 120. The corners of the memory take pixels, and nobody sees them.

The glass inverts. It is IPS, and it shows colors inverted until the driver sends INVON (0x21), which the library does in begin().

The library

Adafruit_GC9A01A.h works as its tutorial uses it:

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_GC9A01A.h"

#define TFT_DC 9
#define TFT_CS 10

Adafruit_GC9A01A tft(TFT_CS, TFT_DC);

void setup() {
  tft.begin();
  tft.fillScreen(GC9A01A_BLACK);
  tft.drawCircle(120, 120, 110, GC9A01A_WHITE);
  tft.fillCircle(120, 120, 40, GC9A01A_RED);
}

void loop() {}

With a reset pin, the constructor takes it third: Adafruit_GC9A01A tft(10, 9, 8). The five-pin form, (cs, dc, mosi, sclk, rst), is software SPI on any pins. The drawing calls are Adafruit GFX's; the text is Mokxi's own 5x7 font.

What the model gets right

The command set it shares with the other TFTs (windows, pixels, MADCTL rotation, sleep, display on and off, inversion), the inverting IPS glass, the 240x240 memory, the reset and chip select, and the backlight pin, from the GC9A01 datasheet.

What it does not model

The vendor registers (gamma, voltages), the color filter order bit, the tearing effect output and reads. The bus is software SPI, so a whole-screen fill takes an Uno a few seconds: draw what moves.

Common mistakes

Redrawing the whole screen every frame. Over SPI that is 115,200 bytes; erase and redraw only what changed, as the watch face does with its hands.

Drawing in the corners. They are memory, not glass.

See it in action

Round watch face draws an analog clock with the time from a DS3231. Open it at /templates.