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.

index.circuit.tsx

PCBPCB preview for index.circuit.tsx
SchematicSchematic preview for index.circuit.tsx
import { MinimalEnclosure } from "./enclosure/MinimalEnclosure"
import schematicLayout from "./schematic-layout.json"
import { Fragment } from "react"
import { RP2040_Zero } from "./imports/RP2040_Zero/RP2040_Zero"
import { PEC11R_4020F_S0024 } from "./imports/PEC11R_4020F_S0024/PEC11R_4020F_S0024"
import { CPG151101S11_2 } from "./imports/CPG151101S11_2/CPG151101S11_2"

const keys = [
  { name: "J1", gpio: "GP2", x: -19.05, y: 0, label: "TERM" },
  { name: "J2", gpio: "GP3", x: 0, y: 0, label: "APPS" },
  { name: "J3", gpio: "GP4", x: 19.05, y: 0, label: "SHOT" },
  { name: "J4", gpio: "GP5", x: -19.05, y: -19.05, label: "FLOAT" },
  { name: "J5", gpio: "GP6", x: 0, y: -19.05, label: "PREV" },
  { name: "J6", gpio: "GP7", x: 19.05, y: -19.05, label: "NEXT" },
] as const

export default () => (
  <board
    width={70}
    height={88}
    schLayout={{ layoutMode: "relative" }}
    autorouter={{ preset: "auto_local", traceClearance: 0.3 }}
  >
    <schematicsheet name="Hyprpad">
      <schematicsection name="controller" displayName="USB-C controller" />
      <schematicsection name="keys" displayName="Six macro keys" />
      <schematicsection name="encoder" displayName="Volume encoder" />
      <RP2040_Zero
        name="U1"
        schX={0}
        schY={0}
        schSectionName="controller"
        schWidth={1.9}
        schMarginX={3}
        schMarginY={2}
        pcbX={-16}
        pcbY={27}
        connections={{ GND: "net.GND" }}
        noConnect={[
          "GP0",
          "GP1",
          "GP11",
          "GP12",
          "GP13",
          "GP14",
          "GP15",
          "GP26",
          "GP27",
          "GP28",
          "GP29",
          "3V3",
          "5V",
          "pin24",
          "pin25",
          "pin26",
          "pin27",
          "pin28",
          "pin29",
          "pin30",
          "pin31",
          "pin32",
          "pin33",
        ]}
      />
      <PEC11R_4020F_S0024
        name="ENC1"
        schX={6}
        schY={0}
        schSectionName="encoder"
        schWidth={1.6}
        schMarginX={3}
        schMarginY={2}
        pcbX={19.05}
        pcbY={25}
        connections={{ C: "net.GND", pin5: "net.GND" }}
        noConnect={["pin7", "pin8"]}
      />
      <trace name="ENC_A" from=".ENC1 > .A" to=".U1 > .GP8" />
      <trace name="ENC_B" from=".ENC1 > .B" to=".U1 > .GP9" />
      <trace name="ENC_SW" from=".ENC1 > .pin4" to=".U1 > .GP10" />
      <schematictext
        text="RP2040-Zero: USB-powered, 3.3 V GPIO"
        schX={0}
        schY={7}
        fontSize={0.25}
      />
      <schematictext
        text="Keys and encoder use internal pull-ups"
        schX={0}
        schY={6.5}
        fontSize={0.25}
      />
      {keys.map(({ name, gpio, x, y, label }) => (
        <Fragment key={name}>
          <CPG151101S11_2
            name={name}
            schX={schematicLayout[name].x}
            schY={schematicLayout[name].y}
            schSectionName="keys"
            schRotation={270}
            schMarginX={2}
            schMarginY={1}
            pcbX={x + 0.635}
            pcbY={y - 3.81}
            layer="bottom"
            connections={{ pin2: "net.GND" }}
            pinAttributes={{
              pin1: { isPassive: true },
              pin2: { isPassive: true },
            }}
          />
          <trace
            name={`KEY${name.slice(1)}`}
            from={`.${name} > .pin1`}
            to={`.U1 > .${gpio}`}
          />
          <silkscreentext text={label} pcbX={x} pcbY={y - 8} fontSize={1} />
        </Fragment>
      ))}
      <hole name="H1" diameter={3.2} pcbX={-30} pcbY={38} />
      <hole name="H2" diameter={3.2} pcbX={30} pcbY={38} />
      <hole name="H3" diameter={3.2} pcbX={-30} pcbY={-30} />
      <hole name="H4" diameter={3.2} pcbX={30} pcbY={-30} />
      <silkscreentext
        text="HYPRPAD / KRISHNAX12"
        pcbX={0}
        pcbY={-32}
        fontSize={1.2}
      />
      <silkscreentext text="USB-C" pcbX={-16} pcbY={42} fontSize={1} />
    </schematicsheet>
    <MinimalEnclosure />
  </board>
)