# EPD Reference Driver — GDEY075T7 (UC8179) ## Source **Repository:** [ekosboard/firmware](https://github.com/ekosboard/firmware) **File:** [`src/components/EPD/driver/epd_GDEY075T7.c`](https://github.com/ekosboard/firmware/blob/main/src/components/EPD/driver/epd_GDEY075T7.c) ## Panel Info - **Controller:** UC8179 - **Panel:** GDEY075T7 (Good Display 7.5" B/W, 800×480) - **Platform:** ESP-IDF (native SPI) - **Grayscale:** 4-level support present but marked as "NOT TESTED" ## Key Implementation Details ### BUSY Pin Polarity - **Reference driver:** HIGH = Busy, LOW = Idle - **⚠️ Our board is INVERTED:** LOW = Busy, HIGH = Idle - Wait loop polls `gpio_get_level(BUSY) == 0` to detect idle (reference) - Our code uses `== 0` to wait while busy (opposite meaning, same code pattern) ### Clear Screen (White) - Writes `0xFF` to **both** old (0x10) and new (0x13) data layers - `0xFF` = White, `0x00` = Black ### Display Image - Writes `0x00` to old data layer (0x10) — assumes previous state was black - Writes actual image data to new data layer (0x13) ### Sleep Sequence 1. `0x50` with `0xF7` — VCOM and data interval setting before sleep 2. `0x02` — Power Off 3. Wait for BUSY idle 4. `0x07` + `0xA5` — Deep Sleep ### Init Sequence (Full Refresh) 1. Hardware reset (RST low 10ms, high 10ms) 2. `0x01` — Power Setting: VGH=20V, VGL=-20V, VDH=15V, VDL=-15V, VDHR=4.2V 3. `0x06` — Booster Soft Start: 0x17, 0x17, 0x28, 0x17 4. `0x04` — Power On + 100ms delay + wait busy 5. `0x00` — Panel Setting: `0x1F` (KW B/W mode) 6. `0x61` — Resolution: 800×480 7. `0x15` — DUSPI disabled 8. `0x50` — VCOM: 0x10, 0x07 9. `0x60` — TCON: 0x22 10. `0xE3` — PWS: 0x22 ### Fast Refresh - `0xE0` → `0x02` (enable fast mode) - `0xE5` → `0x5A` (fast refresh timing) ### Partial Update - Uses `0x91` (partial in) / `0x92` (partial out) + `0x90` (resolution setting) - Writes `~data` (inverted) to old layer to force transitions - Sets `0x50` → `0x21` (N2OCP disabled) for partial mode ### 4-Level Grayscale - Requires different booster settings: `0x27, 0x27, 0x18, 0x17` - `0xE5` → `0x5F` for grayscale timing - Data encoding: 2 bits per pixel (0xC0=white, 0x00=black, 0x80=gray1, 0x40=gray2) - Old layer and new layer encode different bit planes, both inverted (`~temp3`)