# afiskon/stm32-ssd1306 architecture

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

- Interactive diagram: https://gitdiagram.com/afiskon/stm32-ssd1306
- Repository: https://github.com/afiskon/stm32-ssd1306

## Overview

stm32-ssd1306 is an STM32 C library for drawing text, bitmaps, and graphics on SSD1306-compatible OLEDs over I2C or four-wire SPI. The principal workflow is application code calling the display API, which updates a framebuffer and transfers it to the display through STM32 HAL. Font data and example drawing routines support that workflow; custom-font guidance is documented separately. Source excerpts show the driver’s rendering and transfer behavior, but not the complete SPI implementation or example firmware wiring.

Main entry points: [`ssd1306/ssd1306.c`](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.c) (Display driver), [`ssd1306/ssd1306_tests.c`](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_tests.c) (Display demonstrations), [`ssd1306/ssd1306_fonts.h`](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_fonts.h) (Font definitions), [`ssd1306/ssd1306_fonts.c`](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_fonts.c) (Built-in font data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Display library"]
  node_driver["Display driver<br/>[ssd1306.c]"]
  node_api_header["Public API and config<br/>[ssd1306.h]"]
  node_config_template["Config template"]
  node_framebuffer["Framebuffer and drawing<br/>[ssd1306.c]"]
  node_transport["I2C / SPI transport<br/>[ssd1306.c]"]
end

subgraph group_assets["Fonts and assets"]
  node_font_api["Font definitions<br/>[ssd1306_fonts.h]"]
  node_font_data["Built-in font data<br/>[ssd1306_fonts.c]"]
end

subgraph group_examples["Usage examples"]
  node_custom_fonts["Custom-font tools"]
  node_display_tests["Display demonstrations<br/>[ssd1306_tests.c]"]
  node_test_api["Demo declarations<br/>[ssd1306_tests.h]"]
  node_tester_firmware["OLED tester firmware"]
end

node_application(("STM32 application"))
node_hal["STM32 HAL"]
node_oled["Compatible OLED"]

node_application -->|"calls API"| node_driver
node_driver -->|"draws into"| node_framebuffer
node_driver -->|"flushes buffer"| node_transport
node_transport -->|"uses bus calls"| node_hal
node_hal -.->|"transfers display data"| node_oled
node_application -->|"selects font"| node_font_api
node_font_data -->|"defines fonts"| node_font_api
node_display_tests -->|"calls drawing API"| node_driver
node_display_tests -->|"uses fonts"| node_font_api
node_test_api -.->|"declares demos"| node_display_tests
node_tester_firmware -.->|"runs demos"| node_display_tests
node_custom_fonts -.->|"produces font data"| node_font_data
node_config_template -->|"configures options"| node_api_header

click node_driver "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.c"
click node_api_header "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.h"
click node_config_template "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_conf_template.h"
click node_framebuffer "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.c"
click node_transport "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.c"
click node_font_api "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_fonts.h"
click node_font_data "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_fonts.c"
click node_custom_fonts "https://github.com/afiskon/stm32-ssd1306/tree/master/examples/custom-fonts"
click node_display_tests "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_tests.c"
click node_test_api "https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_tests.h"
click node_tester_firmware "https://github.com/afiskon/stm32-ssd1306/tree/master/examples/oled-tester/firmware"

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_driver,node_api_header,node_config_template,node_framebuffer,node_transport toneBlue
class node_font_api,node_font_data toneAmber
class node_custom_fonts,node_display_tests,node_test_api,node_tester_firmware toneMint
class node_application,node_hal,node_oled toneIndigo
```

## Components

### Display library

- [Display driver](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.c): `ssd1306/ssd1306.c`
- [Public API and config](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.h): `ssd1306/ssd1306.h`
- [Config template](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_conf_template.h): `ssd1306/ssd1306_conf_template.h`
- [Framebuffer and drawing](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.c): `ssd1306/ssd1306.c`
- [I2C / SPI transport](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306.c): `ssd1306/ssd1306.c`

### Fonts and assets

- [Font definitions](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_fonts.h): `ssd1306/ssd1306_fonts.h`
- [Built-in font data](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_fonts.c): `ssd1306/ssd1306_fonts.c`

### Usage examples

- [Custom-font tools](https://github.com/afiskon/stm32-ssd1306/tree/master/examples/custom-fonts): `examples/custom-fonts`
- [Display demonstrations](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_tests.c): `ssd1306/ssd1306_tests.c`
- [Demo declarations](https://github.com/afiskon/stm32-ssd1306/blob/master/ssd1306/ssd1306_tests.h): `ssd1306/ssd1306_tests.h`
- [OLED tester firmware](https://github.com/afiskon/stm32-ssd1306/tree/master/examples/oled-tester/firmware): `examples/oled-tester/firmware`

### Other components

- **STM32 application**
- **STM32 HAL**
- **Compatible OLED**

## Connections

- STM32 application → Display driver: calls API (evidence: `README.md`)
- Display driver → Framebuffer and drawing: draws into (evidence: `ssd1306/ssd1306.c`)
- Display driver → I2C / SPI transport: flushes buffer (evidence: `ssd1306/ssd1306.c`)
- I2C / SPI transport → STM32 HAL: uses bus calls (evidence: `ssd1306/ssd1306.c`)
- STM32 HAL → Compatible OLED: transfers display data
- STM32 application → Font definitions: selects font
- Built-in font data → Font definitions: defines fonts (evidence: `ssd1306/ssd1306_fonts.c`)
- Display demonstrations → Display driver: calls drawing API (evidence: `ssd1306/ssd1306_tests.c`)
- Display demonstrations → Font definitions: uses fonts (evidence: `ssd1306/ssd1306_tests.c`)
- Demo declarations → Display demonstrations: declares demos (evidence: `ssd1306/ssd1306_tests.c`)
- OLED tester firmware → Display demonstrations: runs demos
- Custom-font tools → Built-in font data: produces font data (evidence: `README.md`)
- Config template → Public API and config: configures options (evidence: `ssd1306/ssd1306_conf_template.h`)
