krishnax12/hyprland-macropad

A tscircuit package created by krishnax12.

Version
1.0.7
License
CC-BY-SA-3.0
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone krishnax12/hyprland-macropad  # download the package files into ./hyprland-macropad
tsci add krishnax12/hyprland-macropad    # add it to your project as @tsci/krishnax12.hyprland-macropad

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

README.md

# Hyprpad

Six-key USB-C macro keypad for Arch Linux / Hyprland, with an RP2040-Zero and a push rotary encoder. The carrier is 70 × 88 mm, two copper layers, with 19.05 mm key spacing and four 3.2 mm mounting holes.

This is a hardware design prototype. Reference keycaps and supplier switch CAD are included in the 3D assembly; firmware and physical parts are not supplied. No physical board has been manufactured or tested.

## Design source

Adapted from [Adafruit MacroPad RP2040](https://github.com/adafruit/Adafruit-MacroPad-RP2040-PCB), designed by Limor Fried/Ladyada for Adafruit Industries, under CC BY-SA 3.0. The original notice and complete README are retained in `reference/ADAFRUIT-README.md`; see `LICENSE`.

The adaptation keeps direct-to-GPIO keys and a quadrature encoder, reduces twelve keys to six, uses a complete RP2040-Zero module, and omits the OLED, RGB LEDs, speaker, and STEMMA interface. It is not firmware-compatible with the original Adafruit board.

## Components

- U1: Waveshare RP2040-Zero, EasyEDA/LCSC C5350143.
- ENC1: Bourns PEC11R-4020F-S0024, C143788, push switch, 24 pulses/revolution, no detents.
- J1–J6: HanElectricity CPG151101S11-2 MX hot-swap sockets, C49352235, bottom mounted. Add six compatible MX switches and keycaps separately.

All three component definitions were imported using `tsci import --jlcpcb --download --use-exact-footprint`. The socket import is correctly represented as a connector; its switch mounting holes were added using Adafruit’s mechanical pattern. The RP2040 footprint omits the unused underside signal pads and has a 14 × 18 mm cavity to clear the module’s underside components. A copper keepout provides clearance around that cavity. Review module soldering access and assembly fit before fabrication.

The RP2040-Zero STEP model is from [Waveshare](https://www.waveshare.net/w/upload/f/f7/RP2040_Zero_stp.zip), with an OBJ tessellation for previews. Encoder and socket CAD came with their EasyEDA imports. The STEP assembly is generated with CadQuery from Circuit JSON placements and original component models, then re-imported and checked for finite bounds and valid geometry. Install CadQuery 2.6+ to regenerate it. The built-in STEP merge produced invalid bounding geometry in this environment, so `cad/hyprpad-assembly.step` is the verified export. The registry 3D view includes the Minimal enclosure, dial, and reference keycaps as CAD-only assembly parts. The original electronics STEP remains available separately; printable enclosure files and the complete enclosure STEP are provided in the local enclosure bundle. Keycaps are visual references; switches, screws, and physical fit are not certified.

## Connections and firmware requirements

| Input | RP2040 GPIO | Suggested HID/action |
|---|---|---|
| J1 | GP2 | F13 / terminal |
| J2 | GP3 | F14 / launcher |
| J3 | GP4 | F15 / screenshot |
| J4 | GP5 | F16 / floating window |
| J5 | GP6 | F17 / previous workspace |
| J6 | GP7 | F18 / next workspace |
| Encoder A/B | GP8 / GP9 | Volume up/down |
| Encoder push | GP10 | Mute |

Each switch closes to ground. Firmware must enable 3.3 V internal pull-ups, debounce key and encoder-switch inputs, and decode quadrature. Power and USB data enter through the module’s own USB-C connector. The carrier’s 5 V and 3.3 V pads are intentionally unconnected; USB power is already wired inside the module.

## Development

```sh
bun install
bun run typecheck
bunx tsci build --svgs --3d --glbs --solver-debug
python cad/export_step.py
bunx tsci check netlist
bunx tsci check schematic-placement
bunx tsci check placement
bunx tsci check shorts dist/index/circuit.json
bunx tsci check pcb-style dist/index/circuit.json
```

The Hyprpad schematic sheet has USB-C controller, Six macro keys, and Volume encoder sections. Schematic placement starts with MatchPack. `schematic-layout.json` retains the resulting placement plus corrections suggested by the schematic placement checker. The built-in schematic trace solver routes the schematic, and `auto_local` autoroutes PCB copper. No DRC checks are disabled.

The BOM uses LCSC supplier identifiers. The out-of-stock Kailh socket was replaced by HanElectricity C49352235 after checking the imported pad/hole geometry. The three selected parts were listed in stock on LCSC at verification time; quantities and source URLs are recorded in `reference/sourcing.json`. Availability can change. See `validation.json` for the final check results.

The complete STEP assembly is delivered separately because the registry upload limit rejects the module STEP source. The registry uses the module OBJ for 3D previews.

## Minimal enclosure

The default 3D view includes the rounded 77 × 95 mm case, rear-wall USB opening, smooth 20 mm dial with a small cyan indicator, six supplier-model MX switches, and six hollow reference keycaps. These use `assembly.part` and do not add PCB footprints or electrical ports. See `enclosure/ASSEMBLY.txt` for fit assumptions. The separate case parts have valid STEP geometry and zero measured intersection volume against the electronics model; no physical prototype is claimed.

The mechanical fit check records 0.883 mm³ of switch-clip interference with the rigid plate model. Clip engagement, key travel, cable fit, screw retention, and encoder push travel still need physical testing. Zero electrical/layout warnings do not certify mechanical fit. See `enclosure/mechanical-validation.json`.