# chinenual/golden-harp architecture

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

- Interactive diagram: https://gitdiagram.com/chinenual/golden-harp
- Repository: https://github.com/chinenual/golden-harp

## Overview

##### Main Components

A. Hardware Layer:
- Golden Harp Controller (Original UME hardware)
- Arduino Adapter (with two variants: Nano and Uno, as indicated by the schematics)
- MIDI Output Interface

B. Software Components:
- Arduino Firmware (golden-harp-adapter)
- Windows Configuration Manager (golden-harp-manager)

##### Detailed Component Breakdown

Arduino Firmware Components (shown as internal modules):
- Configuration Handler (config.ino)
- Harp Input Processing (harpin.ino)
- MIDI Output Processing (midi.ino)
- USB Configuration Interface (usbconfig.ino)

Windows Manager Components:
- Serial Communication (serial.go)
- Configuration Management (config.go)
- UI Layer (ui_windows.go)
- Settings Handler (settings.go)

**┌─────────────────────┐**
- Configuration Layer│
- (Windows Manager)  │
- ┬───────────┘
- ↕ (USB Config)
**┌─────────┴───────────┐**
- Processing Layer   │
- (Arduino Adapter)  │
- ┬───────────┘
- ↓ (MIDI)
**┌─────────┴───────────┐**
- Output Devices     │
- (MIDI Equipment)   │
- ┘

##### Technical Details

- Serial interface specifications
- MIDI output protocol
- USB configuration interface
- Scale/key mapping capabilities
- Touch strip input processing

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef hardware fill:#b3d9ff,stroke:#333
    classDef software fill:#90EE90,stroke:#333
    classDef interface fill:#FFE5B4,stroke:#333
    classDef storage fill:#E6E6FA,stroke:#333
    classDef critical stroke:#ff0000,stroke-width:2px
    
    %% Configuration Layer
    subgraph WindowsManager
        WinMain["Main Program"]
        WinSerial["Serial Communication"]
        WinConfig["Configuration Management"]
        WinUI["Windows UI"]
        WinSettings["Settings Handler"]
        WinCmd["Command Interface"]
        ConfigTemplate["Configuration Template"]
    end
    
    %% Hardware Layer
    subgraph HardwareLayer
        GoldenHarp["Golden Harp Controller"]:::hardware
        ArduinoNano["Arduino Nano Variant"]:::hardware
        ArduinoUno["Arduino Uno Variant"]:::hardware
        MIDIOut["MIDI Output Interface"]:::hardware
    end
    
    %% Arduino Firmware Layer
    subgraph ArduinoFirmware
        MainProgram["Main Program"]:::software
        ConfigHandler["Configuration Handler"]:::software
        HarpInput["Harp Input Processing"]:::software
        MIDIProcess["MIDI Output Processing"]:::software
        USBConfig["USB Configuration Interface"]:::software
        Version["Firmware Version"]:::software
    end
    
    %% Relationships
    GoldenHarp --> ArduinoNano & ArduinoUno
    ArduinoNano & ArduinoUno --> MIDIOut
    
    WinMain --> WinSerial
    WinMain --> WinConfig
    WinMain --> WinUI
    WinConfig --> WinSettings
    WinConfig --> ConfigTemplate
    WinCmd --> WinMain
    
    MainProgram --> ConfigHandler
    MainProgram --> HarpInput
    MainProgram --> MIDIProcess
    MainProgram --> USBConfig
    
    WinSerial -.-> USBConfig
    HarpInput --> MIDIProcess
    MIDIProcess --> MIDIOut
    
    %% Click Events
    click MainProgram "https://github.com/chinenual/golden-harp/blob/master/golden-harp-adapter/golden-harp-adapter.ino"
    click ConfigHandler "https://github.com/chinenual/golden-harp/blob/master/golden-harp-adapter/config.ino"
    click HarpInput "https://github.com/chinenual/golden-harp/blob/master/golden-harp-adapter/harpin.ino"
    click MIDIProcess "https://github.com/chinenual/golden-harp/blob/master/golden-harp-adapter/midi.ino"
    click USBConfig "https://github.com/chinenual/golden-harp/blob/master/golden-harp-adapter/usbconfig.ino"
    click Version "https://github.com/chinenual/golden-harp/blob/master/golden-harp-adapter/version.h"
    click WinMain "https://github.com/chinenual/golden-harp/blob/master/golden-harp-manager/main.go"
    click WinSerial "https://github.com/chinenual/golden-harp/blob/master/golden-harp-manager/serial.go"
    click WinConfig "https://github.com/chinenual/golden-harp/blob/master/golden-harp-manager/config.go"
    click WinUI "https://github.com/chinenual/golden-harp/blob/master/golden-harp-manager/ui_windows.go"
    click WinSettings "https://github.com/chinenual/golden-harp/blob/master/golden-harp-manager/settings.go"
    click WinCmd "https://github.com/chinenual/golden-harp/blob/master/golden-harp-manager/cmd.go"
    click ConfigTemplate "https://github.com/chinenual/golden-harp/blob/master/golden-harp-manager/HarpConfig.xlsx"
    click ArduinoNano "https://github.com/chinenual/golden-harp/blob/master/golden-harp-adapter/nano-schematic.fzz"
    click ArduinoUno "https://github.com/chinenual/golden-harp/blob/master/golden-harp-adapter/uno-schematic.fzz"

    %% Legend
    subgraph Legend
        H["Hardware Component"]:::hardware
        S["Software Component"]:::software
        I["Interface"]:::interface
        DataFlow["→ Data Flow"]
        ConfigFlow["--> Configuration Flow"]
    end
```
