# gelosan3d/magicpad architecture

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

- Interactive diagram: https://gitdiagram.com/gelosan3d/magicpad
- Repository: https://github.com/gelosan3d/magicpad

## Overview

Angelos’ MagicPad is a custom macropad with a KMK firmware configuration, a KiCad electronics design, and Fusion CAD models. The user operates keys and rotary encoders; firmware scans the configured inputs, changes active layers on encoder rotation, and configures RGB LEDs. The README also documents an OLED, but its layer-update routine is not enabled in the sampled firmware. Hardware-to-firmware wiring is inferred from the project design; the sampled files do not show the physical device in operation.

Main entry points: [`Firmware/KMK/main.py`](https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/main.py) (KMK runtime), [`PCB/Macropad_v3.kicad_sch`](https://github.com/gelosan3d/magicpad/blob/main/PCB/Macropad_v3.kicad_sch) (Circuit schematic), [`CAD/Case_Assembly_v1.f3z`](https://github.com/gelosan3d/magicpad/blob/main/CAD/Case_Assembly_v1.f3z) (Case models), [`Firmware/KMK/pins.py`](https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/pins.py) (Pin mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Firmware"]
  node_firmware_runtime["KMK runtime<br/>[main.py]"]
  node_pin_mapping["Pin mapping<br/>[pins.py]"]
  node_layer_control["Layer switching<br/>[main.py]"]
  node_rgb_output["RGB LEDs<br/>[main.py]"]
  node_oled_display["OLED display<br/>[pins.py]"]
end

subgraph group_electronics["Electronics"]
  node_controls["Keys and encoders"]
  node_schematic["Circuit schematic"]
  node_pcb_layout["PCB layout"]
end

subgraph group_enclosure["Enclosure and build"]
  node_case_models["Case models"]
  node_case_exports["Case exports<br/>[Case_Top.step]"]
  node_production_package["Production package<br/>[Macropad_v3.zip]"]
end

node_user(("User"))

node_user -->|"operates"| node_controls
node_controls -.->|"provides inputs"| node_firmware_runtime
node_firmware_runtime -->|"imports pins"| node_pin_mapping
node_firmware_runtime -->|"configures layers"| node_layer_control
node_firmware_runtime -->|"configures LEDs"| node_rgb_output
node_firmware_runtime -->|"initializes display"| node_oled_display
node_schematic -.->|"documents circuit"| node_pcb_layout
node_case_models -.->|"has STEP exports"| node_case_exports
node_schematic -.->|"production deliverable"| node_production_package

click node_controls "https://github.com/gelosan3d/magicpad/blob/main/PCB/Macropad_v3.kicad_sch"
click node_firmware_runtime "https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/main.py"
click node_pin_mapping "https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/pins.py"
click node_layer_control "https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/main.py"
click node_rgb_output "https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/main.py"
click node_oled_display "https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/pins.py"
click node_schematic "https://github.com/gelosan3d/magicpad/blob/main/PCB/Macropad_v3.kicad_sch"
click node_pcb_layout "https://github.com/gelosan3d/magicpad/blob/main/PCB/Macropad_v3.kicad_pcb"
click node_case_models "https://github.com/gelosan3d/magicpad/blob/main/CAD/Case_Assembly_v1.f3z"
click node_case_exports "https://github.com/gelosan3d/magicpad/blob/main/CAD/Case_Top.step"
click node_production_package "https://github.com/gelosan3d/magicpad/blob/main/Production/Macropad_v3.zip"

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_firmware_runtime,node_pin_mapping,node_layer_control,node_rgb_output,node_oled_display,node_user toneBlue
class node_controls,node_schematic,node_pcb_layout toneAmber
class node_case_models,node_case_exports,node_production_package toneMint
```

## Components

### Firmware

- [KMK runtime](https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/main.py): `Firmware/KMK/main.py`
- [Pin mapping](https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/pins.py): `Firmware/KMK/pins.py`
- [Layer switching](https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/main.py): `Firmware/KMK/main.py`
- [RGB LEDs](https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/main.py): `Firmware/KMK/main.py`
- [OLED display](https://github.com/gelosan3d/magicpad/blob/main/Firmware/KMK/pins.py): `Firmware/KMK/pins.py`

### Electronics

- [Keys and encoders](https://github.com/gelosan3d/magicpad/blob/main/PCB/Macropad_v3.kicad_sch): `PCB/Macropad_v3.kicad_sch`
- [Circuit schematic](https://github.com/gelosan3d/magicpad/blob/main/PCB/Macropad_v3.kicad_sch): `PCB/Macropad_v3.kicad_sch`
- [PCB layout](https://github.com/gelosan3d/magicpad/blob/main/PCB/Macropad_v3.kicad_pcb): `PCB/Macropad_v3.kicad_pcb`

### Enclosure and build

- [Case models](https://github.com/gelosan3d/magicpad/blob/main/CAD/Case_Assembly_v1.f3z): `CAD/Case_Assembly_v1.f3z`
- [Case exports](https://github.com/gelosan3d/magicpad/blob/main/CAD/Case_Top.step): `CAD/Case_Top.step`
- [Production package](https://github.com/gelosan3d/magicpad/blob/main/Production/Macropad_v3.zip): `Production/Macropad_v3.zip`

### Other components

- **User**

## Connections

- User → Keys and encoders: operates (evidence: `README.md`)
- Keys and encoders → KMK runtime: provides inputs
- KMK runtime → Pin mapping: imports pins (evidence: `Firmware/KMK/main.py`)
- KMK runtime → Layer switching: configures layers (evidence: `Firmware/KMK/main.py`)
- KMK runtime → RGB LEDs: configures LEDs (evidence: `Firmware/KMK/main.py`)
- KMK runtime → OLED display: initializes display (evidence: `Firmware/KMK/main.py`)
- Circuit schematic → PCB layout: documents circuit (evidence: `README.md`)
- Case models → Case exports: has STEP exports (evidence: `README.md`)
- Circuit schematic → Production package: production deliverable
