# yishunzhikong/ssd1306_oled_json architecture

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

- Interactive diagram: https://gitdiagram.com/yishunzhikong/ssd1306_oled_json
- Repository: https://github.com/yishunzhikong/ssd1306_oled_json

## Overview

This is a Linux SSD1306 OLED display application driven by JSON configuration. Its main workflow is to load system and page settings, select pages in sequence, periodically render configured elements, and send the display buffer over I²C to the OLED. The README also documents built-in system-data, shell-command, text, numeric, and geometric elements. The excerpts show the application timer, some rendering dispatch, and display/I²C operations; wiring for unsampled element handlers is represented only where documented.

Main entry points: [`Main/dataapi.c`](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c) (Config Loading), [`Main/Main.c`](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c) (Element Dispatch), [`SSD1306_OLED_Library/SSD1306_OLED.c`](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/SSD1306_OLED_Library/SSD1306_OLED.c) (OLED Driver), [`I2C_Library/I2C.c`](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/I2C_Library/I2C.c) (I²C Transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_config["Configuration"]
  node_config_file["JSON Config<br/>[config.json]"]
  node_json_loader["Config Loading<br/>[dataapi.c]"]
  node_json_parser["cJSON Parser<br/>[cJSON.c]"]
  node_settings["Display Settings<br/>[dataapi.c]"]
end

subgraph group_pages["Page Runtime"]
  node_app["Application<br/>[Main.c]"]
  node_page_data["Page Data<br/>[dataapi.c]"]
  node_page_selector["Page Selection<br/>[dataapi.c]"]
  node_page_scheduler["Page Scheduler<br/>[Main.c]"]
  node_timer["Refresh Timer<br/>[Main.c]"]
end

subgraph group_render["Rendering"]
  node_element_dispatch["Element Dispatch<br/>[Main.c]"]
  node_system_values["System Values<br/>[Main.c]"]
  node_shell_commands["Shell Output<br/>[dataapi.c]"]
  node_geometry["Shape Drawing<br/>[SSD1306_OLED.c]"]
  node_text["Text Drawing<br/>[SSD1306_OLED.c]"]
end

subgraph group_hardware["Display Hardware"]
  node_display_driver["OLED Driver<br/>[SSD1306_OLED.c]"]
  node_i2c["I²C Transport<br/>[I2C.c]"]
end

node_operator(("Operator"))
node_linux_fs["Linux Filesystem"]
node_shell["Shell"]
node_oled(("SSD1306 OLED"))

node_operator -->|"launches"| node_app
node_operator -->|"configures"| node_config_file
node_app -->|"loads config"| node_json_loader
node_json_loader -->|"reads file"| node_linux_fs
node_json_loader -->|"parses JSON"| node_json_parser
node_json_loader -->|"extracts settings"| node_settings
node_json_loader -->|"extracts pages"| node_page_data
node_page_data -->|"provides pages"| node_page_selector
node_app -->|"runs pages"| node_page_scheduler
node_page_scheduler -->|"selects page"| node_page_selector
node_page_scheduler -->|"sets timing"| node_timer
node_page_scheduler -->|"renders page"| node_element_dispatch
node_element_dispatch -->|"reads system data"| node_system_values
node_system_values -.->|"reads sysfs"| node_linux_fs
node_element_dispatch -->|"requests command"| node_shell_commands
node_shell_commands -.->|"runs command"| node_shell
node_element_dispatch -->|"draws shapes"| node_geometry
node_element_dispatch -->|"draws text"| node_text
node_app -->|"clears and displays"| node_display_driver
node_geometry -->|"draws pixels"| node_display_driver
node_text -->|"writes glyphs"| node_display_driver
node_display_driver -->|"sends display data"| node_i2c
node_i2c -->|"writes bus"| node_oled

click node_config_file "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/config.json"
click node_app "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c"
click node_json_loader "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c"
click node_json_parser "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/cJSON/cJSON.c"
click node_settings "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c"
click node_page_data "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c"
click node_page_selector "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c"
click node_page_scheduler "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c"
click node_timer "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c"
click node_element_dispatch "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c"
click node_system_values "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c"
click node_shell_commands "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c"
click node_geometry "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/SSD1306_OLED_Library/SSD1306_OLED.c"
click node_text "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/SSD1306_OLED_Library/SSD1306_OLED.c"
click node_display_driver "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/SSD1306_OLED_Library/SSD1306_OLED.c"
click node_i2c "https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/I2C_Library/I2C.c"

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_config_file,node_json_loader,node_json_parser,node_settings toneBlue
class node_app,node_page_data,node_page_selector,node_page_scheduler,node_timer toneAmber
class node_element_dispatch,node_system_values,node_shell_commands,node_geometry,node_text toneMint
class node_display_driver,node_i2c toneRose
class node_operator,node_linux_fs,node_shell,node_oled toneIndigo
```

## Components

### Configuration

- [JSON Config](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/config.json): `config.json`
- [Config Loading](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c): `Main/dataapi.c`
- [cJSON Parser](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/cJSON/cJSON.c): `cJSON/cJSON.c`
- [Display Settings](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c): `Main/dataapi.c`

### Page Runtime

- [Application](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c): `Main/Main.c`
- [Page Data](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c): `Main/dataapi.c`
- [Page Selection](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c): `Main/dataapi.c`
- [Page Scheduler](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c): `Main/Main.c`
- [Refresh Timer](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c): `Main/Main.c`

### Rendering

- [Element Dispatch](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c): `Main/Main.c`
- [System Values](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/Main.c): `Main/Main.c`
- [Shell Output](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/Main/dataapi.c): `Main/dataapi.c`
- [Shape Drawing](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/SSD1306_OLED_Library/SSD1306_OLED.c): `SSD1306_OLED_Library/SSD1306_OLED.c`
- [Text Drawing](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/SSD1306_OLED_Library/SSD1306_OLED.c): `SSD1306_OLED_Library/SSD1306_OLED.c`

### Display Hardware

- [OLED Driver](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/SSD1306_OLED_Library/SSD1306_OLED.c): `SSD1306_OLED_Library/SSD1306_OLED.c`
- [I²C Transport](https://github.com/yishunzhikong/ssd1306_oled_json/blob/master/I2C_Library/I2C.c): `I2C_Library/I2C.c`

### Other components

- **Operator**
- **Linux Filesystem**
- **Shell**
- **SSD1306 OLED**

## Connections

- Operator → Application: launches
- Operator → JSON Config: configures
- Application → Config Loading: loads config
- Config Loading → Linux Filesystem: reads file
- Config Loading → cJSON Parser: parses JSON
- Config Loading → Display Settings: extracts settings
- Config Loading → Page Data: extracts pages
- Page Data → Page Selection: provides pages
- Application → Page Scheduler: runs pages
- Page Scheduler → Page Selection: selects page
- Page Scheduler → Refresh Timer: sets timing
- Page Scheduler → Element Dispatch: renders page
- Element Dispatch → System Values: reads system data
- System Values → Linux Filesystem: reads sysfs
- Element Dispatch → Shell Output: requests command
- Shell Output → Shell: runs command
- Element Dispatch → Shape Drawing: draws shapes
- Element Dispatch → Text Drawing: draws text
- Application → OLED Driver: clears and displays
- Shape Drawing → OLED Driver: draws pixels
- Text Drawing → OLED Driver: writes glyphs
- OLED Driver → I²C Transport: sends display data
- I²C Transport → SSD1306 OLED: writes bus
