# kakkun61/okdcc architecture

> Architecture diagram of the GitHub repository kakkun61/okdcc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kakkun61/okdcc
- Repository: https://github.com/kakkun61/okdcc

## Overview

##### Main Components
- Embedded Monitor Application – Located under app/monitor. This is the main executable that integrates with the hardware.
- Hardware Subsystem – Under app/monitor/hardware you find design files (KiCad projects), which represent the physical aspects.
- Core Logic Module – In the logic folder. Contains the internal algorithms and control systems.
- Electric/Driver Module – In the electric folder. Contains lower-level drivers and electrical control functionalities.
- User Interface Module – In the ui folder. Manages the display/UI aspects probably leveraging the LVGL library.
- External Dependencies – “lib/lvgl” for graphical user interface elements and “lib/munit” for testing.
- Testing & Mocks – The test directories and the mock folder (e.g., mock/x11), which assist in both unit testing and simulation of different environments.
- Documentation & Build Infrastructure – The doc folder, CMakeLists on various modules, platformio.ini, and other configuration files that define builds and integration pipelines.

##### Relationships and Interactions Among Components
- The Embedded Monitor Application acts as the orchestrator. It calls into:
- The Logic Module for the main decision-making and processing.
- The UI Module to drive display interactions.
- The Electric Module to perform hardware control functions.
- The Logic Module may interoperate with both the UI and Electric modules to carry out its algorithms.
- The Testing components validate the functionalities of these modules. Mocks help simulate external systems (like an X11 display).
- External libraries (e.g., LVGL) integrate with the UI module, and testing frameworks (munit) support unit tests.
- Platform-specific manifests (library.json, library.properties) ensure compatibility with PlatformIO and Arduino ecosystems.

##### Architectural Patterns and Design Principles
- Modularization: Clear separation of concerns into distinct directories (app, logic, ui, electric) shows adherence to modular design.
- Layering: The system isolates hardware interfacing, business logic, and UI presentation into separate layers.
- Testability: The presence of dedicated test and mock directories suggests an emphasis on unit and integration testing.
- Cross-Platform Considerations: Use of mocks and multi-platform build files (PlatformIO and Arduino manifests) indicate support for diverse environments.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Main Runtime Modules
    A["Embedded Monitor Application"]:::runtime
    B["Hardware Subsystem (PCB Design)"]:::runtime
    C["Core Logic Module"]:::runtime
    D["Electric Module"]:::runtime
    E["User Interface Module"]:::runtime

    %% External Dependencies
    H["LVGL Library"]:::external
    I["munit Testing Framework"]:::external

    %% Documentation/Build Infrastructure
    G["Documentation & Build Infrastructure"]:::documentation

    %% Testing Components Subgraph
    subgraph "Testing Components"
        CT1["Logic Tests"]:::test
        CT2["Electric Tests"]:::test
        CT3["Mocks (X11)"]:::test
    end

    %% Relationships
    A -->|"calls"| C
    A -->|"calls"| D
    A -->|"calls"| E
    A -->|"interfaces_with"| B

    C -->|"coordinates_with"| E
    C -->|"controls"| D

    E -->|"depends_on"| H

    %% Testing relationships
    C -->|"tested_by"| CT1
    D -->|"tested_by"| CT2
    E -->|"tested_by"| CT3

    I -->|"supports"| CT1
    I -->|"supports"| CT2
    I -->|"supports"| CT3

    %% Documentation/Build integration
    G -->|"configures"| A

    %% Styles
    classDef runtime fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef test fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef external fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef documentation fill:#fff3cd,stroke:#856404,stroke-width:2px;

    %% Click Events
    click A "https://github.com/kakkun61/okdcc/tree/master/app/monitor"
    click B "https://github.com/kakkun61/okdcc/tree/master/app/monitor/hardware"
    click C "https://github.com/kakkun61/okdcc/tree/master/logic"
    click D "https://github.com/kakkun61/okdcc/tree/master/electric"
    click E "https://github.com/kakkun61/okdcc/tree/master/ui"
    click H "https://github.com/kakkun61/okdcc/tree/master/lib/lvgl"
    click I "https://github.com/kakkun61/okdcc/tree/master/lib/munit"
    click CT1 "https://github.com/kakkun61/okdcc/tree/master/logic/test"
    click CT2 "https://github.com/kakkun61/okdcc/tree/master/test/electric"
    click CT3 "https://github.com/kakkun61/okdcc/tree/master/mock/x11"
    click G "https://github.com/kakkun61/okdcc/tree/master/doc"
```
