# jyh9521/epd-nrf5-jp architecture

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

- Interactive diagram: https://gitdiagram.com/jyh9521/epd-nrf5-jp
- Repository: https://github.com/jyh9521/epd-nrf5-jp

## Overview

EPD-nRF5-JP is firmware and a browser controller for a Japanese electronic-paper calendar. The main firmware workflow advances device time, handles BLE commands, prepares calendar/display data, renders a frame, and refreshes the panel; the Web Bluetooth UI connects to the device to sync time, change display mode, transfer images, and manage week-start settings. The README documents those capabilities, while the sampled source confirms the timer-to-service and service-to-renderer links. Web UI internals and several firmware subsystems were not sampled, so their internal edges are omitted.

Main entry points: [`GUI/GUI.c`](https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/GUI.c) (Display composition), [`EPD/EPD_driver.c`](https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/EPD_driver.c) (EPD driver layer), [`EPD/EPD_service.c`](https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/EPD_service.c) (EPD BLE service), [`html/js/main.js`](https://github.com/jyh9521/epd-nrf5-jp/blob/main/html/js/main.js) (Web Bluetooth UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Firmware runtime"]
  node_clock["Clock and app<br/>[main.c]"]
end

subgraph group_ble["BLE control"]
  node_service["EPD BLE service<br/>[EPD_service.c]"]
  node_settings[("Device settings<br/>[EPD_config.c]")]
end

subgraph group_calendar["Calendar rendering"]
  node_gui["Display composition<br/>[GUI.c]"]
  node_holidays["Japanese holidays<br/>[JapaneseCalendar.c]"]
  node_rokuyo["Rokuyo calendar<br/>[JapaneseRokuyo.c]"]
  node_lunar["Lunar dates<br/>[Lunar.c]"]
  node_graphics["Graphics primitives<br/>[Adafruit_GFX.c]"]
  node_fonts["Font data<br/>[fonts.c]"]
  node_u8font["U8g2 font rendering<br/>[u8g2_font.c]"]
end

subgraph group_display["Panel output"]
  node_driver["EPD driver layer<br/>[EPD_driver.c]"]
  node_controller["Panel controllers<br/>[SSD16xx.c]"]
  node_uc["UC81xx controller<br/>[UC81xx.c]"]
end

subgraph group_web["Browser controller"]
  node_webui["Web Bluetooth UI<br/>[main.js]"]
end

node_webuser(("Browser user"))
node_panel["EPD panel"]
node_device["Calendar device"]

node_clock -->|"ticks display"| node_service
node_service -->|"renders frame"| node_gui
node_gui -->|"writes image"| node_driver
node_driver -.->|"refreshes panel"| node_panel
node_driver -.->|"dispatches driver"| node_controller
node_driver -.->|"dispatches driver"| node_uc
node_webuser -->|"operates"| node_webui
node_webui -->|"connects BLE"| node_device
node_webui -->|"sends commands"| node_service
node_service -->|"stores settings"| node_settings
node_gui -.->|"uses dates"| node_holidays
node_gui -.->|"uses rokuyo"| node_rokuyo
node_gui -.->|"uses lunar dates"| node_lunar
node_gui -.->|"draws primitives"| node_graphics
node_gui -.->|"uses glyphs"| node_fonts
node_gui -.->|"renders text"| node_u8font

click node_clock "https://github.com/jyh9521/epd-nrf5-jp/blob/main/main.c"
click node_service "https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/EPD_service.c"
click node_settings "https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/EPD_config.c"
click node_gui "https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/GUI.c"
click node_holidays "https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/JapaneseCalendar.c"
click node_rokuyo "https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/JapaneseRokuyo.c"
click node_lunar "https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/Lunar.c"
click node_graphics "https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/Adafruit_GFX.c"
click node_fonts "https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/fonts.c"
click node_u8font "https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/u8g2_font.c"
click node_driver "https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/EPD_driver.c"
click node_controller "https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/SSD16xx.c"
click node_uc "https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/UC81xx.c"
click node_webui "https://github.com/jyh9521/epd-nrf5-jp/blob/main/html/js/main.js"

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_webuser toneBlue
class node_service,node_settings toneAmber
class node_gui,node_holidays,node_rokuyo,node_lunar,node_graphics,node_fonts,node_u8font toneMint
class node_driver,node_controller,node_uc toneRose
class node_webui,node_panel,node_device toneIndigo
```

## Components

### Firmware runtime

- [Clock and app](https://github.com/jyh9521/epd-nrf5-jp/blob/main/main.c): `main.c`

### BLE control

- [EPD BLE service](https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/EPD_service.c): `EPD/EPD_service.c`
- [Device settings](https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/EPD_config.c): `EPD/EPD_config.c`

### Calendar rendering

- [Display composition](https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/GUI.c): `GUI/GUI.c`
- [Japanese holidays](https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/JapaneseCalendar.c): `GUI/JapaneseCalendar.c`
- [Rokuyo calendar](https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/JapaneseRokuyo.c): `GUI/JapaneseRokuyo.c`
- [Lunar dates](https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/Lunar.c): `GUI/Lunar.c`
- [Graphics primitives](https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/Adafruit_GFX.c): `GUI/Adafruit_GFX.c`
- [Font data](https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/fonts.c): `GUI/fonts.c`
- [U8g2 font rendering](https://github.com/jyh9521/epd-nrf5-jp/blob/main/GUI/u8g2_font.c): `GUI/u8g2_font.c`

### Panel output

- [EPD driver layer](https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/EPD_driver.c): `EPD/EPD_driver.c`
- [Panel controllers](https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/SSD16xx.c): `EPD/SSD16xx.c`
- [UC81xx controller](https://github.com/jyh9521/epd-nrf5-jp/blob/main/EPD/UC81xx.c): `EPD/UC81xx.c`

### Browser controller

- [Web Bluetooth UI](https://github.com/jyh9521/epd-nrf5-jp/blob/main/html/js/main.js): `html/js/main.js`

### Other components

- **Browser user**
- **EPD panel**
- **Calendar device**

## Connections

- Clock and app → EPD BLE service: ticks display (evidence: `main.c`)
- EPD BLE service → Display composition: renders frame (evidence: `EPD/EPD_service.c`)
- Display composition → EPD driver layer: writes image
- EPD driver layer → EPD panel: refreshes panel
- EPD driver layer → Panel controllers: dispatches driver
- EPD driver layer → UC81xx controller: dispatches driver
- Browser user → Web Bluetooth UI: operates (evidence: `README.md`)
- Web Bluetooth UI → Calendar device: connects BLE (evidence: `README.md`)
- Web Bluetooth UI → EPD BLE service: sends commands (evidence: `README.md`)
- EPD BLE service → Device settings: stores settings (evidence: `README.md`)
- Display composition → Japanese holidays: uses dates
- Display composition → Rokuyo calendar: uses rokuyo
- Display composition → Lunar dates: uses lunar dates
- Display composition → Graphics primitives: draws primitives
- Display composition → Font data: uses glyphs
- Display composition → U8g2 font rendering: renders text
