A 3×3 mechanical macropad built around a Pro Micro (ATmega32u4) running QMK. This repo includes a QMK keymap, a keyboard.json definition, a single-file browser configurator that generates keymap.c, and a Windows batch script to auto-apply + compile new keymaps.
Links:
- Firmware macros (QMK):
keymap.c
Implements 9 custom macro keycodes and handles them inprocess_record_user(). - Keyboard definition (QMK JSON):
keyboard.json
Defines the 3×3 matrix, diode direction, Pro Micro pin mapping, and layout coordinates. - Offline configurator (single HTML file):
macropad-config-tool.html
Click keys, choose a macro type, then export a ready-to-compilekeymap.c. - Automation script (Windows):
update-keymap.bat
Watches your Downloads folder forkeymap.c, backs up the existing one, copies the new file into your QMK keymap folder, and runsqmk compile.
The current keymap.c ships with a few common macros wired in:
- Key 1: Ctrl+C
- Key 2: Ctrl+V
- Key 3: Alt+Tab
- Key 4: Ctrl+Shift+Esc
- Key 5: Ctrl+A
- Key 6: Win+L
- Keys 7–9: empty placeholders
There’s also a timestamped backup file included: keymap_backup_20250829_215935.c.
In the browser configurator (macropad-config-tool.html)
- Uses event delegation + DOM events via
addEventListenerto manage key selection and inputs. - Exports files client-side using
Blob+URL.createObjectURL(no server needed). - Imports saved configs with
FileReaderto reload a JSON profile. - Generates C output with template literals (clean string assembly) and escapes quotes safely.
- UI layout is done with CSS Grid (
display: grid) and square keys viaaspect-ratio.
In the QMK keymap (keymap.c)
- Defines macros as custom keycodes starting at
SAFE_RANGEto avoid collisions with built-in keycodes. - Implements all macro behavior in
process_record_userso key handling stays centralized. - Uses QMK’s string/macro helpers like
SEND_STRINGandSS_*sequences for modifiers and taps.
In the Windows script (update-keymap.bat)
- Polls for a downloaded
keymap.c, then creates a timestamped backup before overwriting. - Runs QMK CLI compilation (
qmk compile) after copying the new keymap. - Uses conservative defaults: auto-flash is present but commented out.
- QMK Firmware + QMK CLI (required for building): https://qmk.fm/
The batch script assumes you haveqmkon PATH and a localqmk_firmwarecheckout. - Browser-only UI (no build tools, no dependencies): plain HTML/CSS/JS.
Fonts are a system stack (Segoe UI,Tahoma, etc.) — no external web fonts used.
.
├── assets/
├── keymap.c
├── keymap_backup_20250829_215935.c
├── keyboard.json
├── macropad-config-tool.html
└── update-keymap.bat



