# alby1/button-board architecture

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

- Interactive diagram: https://gitdiagram.com/alby1/button-board
- Repository: https://github.com/alby1/button-board

## Overview

##### Project Type Identification
This is a hardware interface utility application that processes gamepad/controller inputs to trigger computer actions. It's a standalone tool that interfaces with hardware using the HID (Human Interface Device) protocol.

##### Main Components

A. Core Components:
- HID Device Interface (hidapi)
- Button Input Processor
- Action Executor
- Configuration System

B. File-based Components:
- __main__.py (Entry point)
- board.py (Core controller logic)
- configuration.py (Settings management)
- printer.py (Output handling)

**Hardware Layer**

**Interface Layer**

**Application Layer**

**Output Layer**

##### Specific Elements

- Connected to hidapi via USB interface

- Hidapi.dll dependency
- Connection to board.py

- Board.py as central component
- Configuration.py for settings
- Button input processing logic
- Plugin system (marked as "Future Feature")

- System actions
- Printer.py for logging/output
- Concurrent game input pathway

##### Important Details to Highlight

- Non-exclusive nature of the input handling (show parallel paths to games)
- Plugin architecture (even if not implemented)
- Configuration flow
- Button mapping system

##### Additional Notes

A note section explaining:
- The non-blocking nature of the system
- The concurrent operation with games
- The configuration requirements
- The plugin system (planned)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef hardware fill:#f9d,stroke:#333,stroke-width:2px
    classDef interface fill:#9ef,stroke:#333,stroke-width:2px
    classDef core fill:#9cf,stroke:#333,stroke-width:2px
    classDef output fill:#ff9,stroke:#333,stroke-width:2px
    classDef config fill:#bfb,stroke:#333,stroke-width:2px
    classDef future fill:#ddd,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5

    %% Hardware Layer
    subgraph Hardware
        Controller["Physical Controller"]:::hardware
    end

    %% Interface Layer
    subgraph Interface
        HIDAPI["HIDAPI Bridge"]:::interface
        HIDDll["hidapi.dll"]:::interface
    end

    %% Application Core Layer
    subgraph Core
        Main["Main Application"]:::core
        Board["Board Controller"]:::core
        ButtonProcessor["Button Input Processor"]:::core
        ConfigSystem["Configuration System"]:::config
        PluginSystem["Plugin System"]:::future
    end

    %% Output Layer
    subgraph Output
        ActionExecutor["Action Executor"]:::output
        PrinterOutput["Printer Output"]:::output
        GameInput["Game Input Pass-through"]:::output
    end

    %% Relationships
    Controller --> HIDAPI
    HIDAPI --- HIDDll
    HIDAPI --> Board
    Main --> Board
    Board --> ButtonProcessor
    ButtonProcessor --> ActionExecutor
    ButtonProcessor --> GameInput
    ConfigSystem --> Board
    Board --> PrinterOutput
    PluginSystem -.-> ActionExecutor

    %% Click Events
    click Main "https://github.com/Alby1/button-board/blob/main//__main__.py"
    click Board "https://github.com/Alby1/button-board/blob/main//board.py"
    click ConfigSystem "https://github.com/Alby1/button-board/blob/main//configuration.py"
    click PrinterOutput "https://github.com/Alby1/button-board/blob/main//printer.py"

    %% Legend
    subgraph Legend
        L1["Hardware Component"]:::hardware
        L2["Interface Component"]:::interface
        L3["Core Component"]:::core
        L4["Output Component"]:::output
        L5["Configuration Component"]:::config
        L6["Future Feature"]:::future
    end
```
