# jef-sure/ili9341_dgx architecture

> Architecture diagram of the GitHub repository jef-sure/ili9341_dgx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jef-sure/ili9341_dgx
- Repository: https://github.com/jef-sure/ili9341_dgx
- Video tour (about a minute): https://gitdiagram.com/jef-sure/ili9341_dgx/video

## Overview

This ESP32 weather clock connects to Wi-Fi, obtains location to determine a time zone, synchronizes time with NTP, and periodically retrieves weather. Its display task renders animated, morphing digits and temperature/weather symbols into virtual screens, then presents them on a physical display. The DGX graphics library supplies drawing, fonts, virtual-screen composition, and multiple hardware-controller backends. The README documents these capabilities; sampled excerpts show the rendering, HTTP helper, and one display driver, but do not expose all application-task wiring, so uncertain call links are omitted.

Main entry points: [`main/main.c`](https://github.com/jef-sure/ili9341_dgx/blob/main/main/main.c) (Clock runtime), [`components/dgx/src/screen.c`](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/screen.c) (Screen interface), [`main/http_client_request.c`](https://github.com/jef-sure/ili9341_dgx/blob/main/main/http_client_request.c) (HTTP requests), [`main/auto_location.c`](https://github.com/jef-sure/ili9341_dgx/blob/main/main/auto_location.c) (Location lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Clock application"]
  node_clock["Clock runtime<br/>[main.c]"]
  node_digits["Digit animation<br/>[main.c]"]
  node_time["System time<br/>[main.c]"]
end

subgraph group_network["Network data"]
  node_location["Location lookup<br/>[auto_location.c]"]
  node_timezone["Time zones<br/>[tzones.c]"]
  node_weather["Weather polling<br/>[weather.c]"]
  node_http["HTTP requests"]
end

subgraph group_graphics["DGX graphics"]
  node_virtual["Virtual screens<br/>[v_screen.c]"]
  node_interscreen["Screen composition<br/>[interscreen.c]"]
  node_drawing["Drawing primitives<br/>[draw.c]"]
  node_fonts["Font rendering<br/>[font.c]"]
  node_screen["Screen interface<br/>[screen.c]"]
end

subgraph group_hardware["Display hardware"]
  node_spi["SPI transport<br/>[spi_screen.c]"]
  node_ili["ILI9341 driver<br/>[spi_ili9341.c]"]
  node_i2cdrivers["I2C OLED driver<br/>[i2c_ssd1306.c]"]
  node_otherdrivers["Other display drivers"]
end

node_wifi(("Wi-Fi access point"))
node_ipinfo(("ipinfo.io"))
node_openweather(("OpenWeatherMap"))
node_ntp(("Public NTP"))
node_panel["Physical display"]

node_clock -->|"connects"| node_wifi
node_clock -->|"starts lookup"| node_location
node_clock -->|"syncs time"| node_time
node_clock -->|"starts polling"| node_weather
node_clock -->|"runs animation"| node_digits
node_location -->|"requests data"| node_http
node_http -->|"GET request"| node_ipinfo
node_location -->|"determines zone"| node_timezone
node_weather -->|"requests data"| node_http
node_http -->|"GET request"| node_openweather
node_time -->|"synchronizes"| node_ntp
node_digits -->|"draws curves"| node_drawing
node_digits -->|"uses symbols"| node_fonts
node_digits -->|"renders into"| node_virtual
node_weather -->|"renders weather"| node_virtual
node_virtual -->|"composes screens"| node_interscreen
node_interscreen -->|"presents frame"| node_screen
node_screen -->|"uses transport"| node_spi
node_spi -->|"dispatches to"| node_ili
node_spi -->|"transfers pixels"| node_panel
node_screen -.->|"supports backend"| node_i2cdrivers
node_screen -.->|"supports backends"| node_otherdrivers

click node_clock "https://github.com/jef-sure/ili9341_dgx/blob/main/main/main.c"
click node_digits "https://github.com/jef-sure/ili9341_dgx/blob/main/main/main.c"
click node_location "https://github.com/jef-sure/ili9341_dgx/blob/main/main/auto_location.c"
click node_timezone "https://github.com/jef-sure/ili9341_dgx/blob/main/main/tzones.c"
click node_weather "https://github.com/jef-sure/ili9341_dgx/blob/main/main/weather.c"
click node_http "https://github.com/jef-sure/ili9341_dgx/blob/main/main/http_client_request.c"
click node_time "https://github.com/jef-sure/ili9341_dgx/blob/main/main/main.c"
click node_virtual "https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/v_screen.c"
click node_interscreen "https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/interscreen.c"
click node_drawing "https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/draw.c"
click node_fonts "https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/font.c"
click node_screen "https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/screen.c"
click node_spi "https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/spi_screen.c"
click node_ili "https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/drivers/spi_ili9341.c"
click node_i2cdrivers "https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/drivers/i2c_ssd1306.c"
click node_otherdrivers "https://github.com/jef-sure/ili9341_dgx/tree/main/components/dgx/src/drivers"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_clock,node_digits,node_time toneBlue
class node_location,node_timezone,node_weather,node_http toneAmber
class node_virtual,node_interscreen,node_drawing,node_fonts,node_screen toneMint
class node_spi,node_ili,node_i2cdrivers,node_otherdrivers toneRose
class node_wifi,node_ipinfo,node_openweather,node_ntp,node_panel toneIndigo
```

## Components

### Clock application

- [Clock runtime](https://github.com/jef-sure/ili9341_dgx/blob/main/main/main.c): `main/main.c`
- [Digit animation](https://github.com/jef-sure/ili9341_dgx/blob/main/main/main.c): `main/main.c`
- [System time](https://github.com/jef-sure/ili9341_dgx/blob/main/main/main.c): `main/main.c`

### Network data

- [Location lookup](https://github.com/jef-sure/ili9341_dgx/blob/main/main/auto_location.c): `main/auto_location.c`
- [Time zones](https://github.com/jef-sure/ili9341_dgx/blob/main/main/tzones.c): `main/tzones.c`
- [Weather polling](https://github.com/jef-sure/ili9341_dgx/blob/main/main/weather.c): `main/weather.c`
- [HTTP requests](https://github.com/jef-sure/ili9341_dgx/blob/main/main/http_client_request.c): `main/http_client_request.c`

### DGX graphics

- [Virtual screens](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/v_screen.c): `components/dgx/src/v_screen.c`
- [Screen composition](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/interscreen.c): `components/dgx/src/interscreen.c`
- [Drawing primitives](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/draw.c): `components/dgx/src/draw.c`
- [Font rendering](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/font.c): `components/dgx/src/font.c`
- [Screen interface](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/screen.c): `components/dgx/src/screen.c`

### Display hardware

- [SPI transport](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/spi_screen.c): `components/dgx/src/spi_screen.c`
- [ILI9341 driver](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/drivers/spi_ili9341.c): `components/dgx/src/drivers/spi_ili9341.c`
- [I2C OLED driver](https://github.com/jef-sure/ili9341_dgx/blob/main/components/dgx/src/drivers/i2c_ssd1306.c): `components/dgx/src/drivers/i2c_ssd1306.c`
- [Other display drivers](https://github.com/jef-sure/ili9341_dgx/tree/main/components/dgx/src/drivers): `components/dgx/src/drivers`

### Other components

- **Wi-Fi access point**
- **ipinfo.io**
- **OpenWeatherMap**
- **Public NTP**
- **Physical display**

## Connections

- Clock runtime → Wi-Fi access point: connects
- Clock runtime → Location lookup: starts lookup
- Clock runtime → System time: syncs time
- Clock runtime → Weather polling: starts polling
- Clock runtime → Digit animation: runs animation
- Location lookup → HTTP requests: requests data
- HTTP requests → ipinfo.io: GET request
- Location lookup → Time zones: determines zone
- Weather polling → HTTP requests: requests data
- HTTP requests → OpenWeatherMap: GET request
- System time → Public NTP: synchronizes
- Digit animation → Drawing primitives: draws curves
- Digit animation → Font rendering: uses symbols
- Digit animation → Virtual screens: renders into
- Weather polling → Virtual screens: renders weather
- Virtual screens → Screen composition: composes screens
- Screen composition → Screen interface: presents frame
- Screen interface → SPI transport: uses transport
- SPI transport → ILI9341 driver: dispatches to
- SPI transport → Physical display: transfers pixels
- Screen interface → I2C OLED driver: supports backend
- Screen interface → Other display drivers: supports backends
