MustafaMulla29/wireless-mouse-pcb
A 3D-printed wireless mouse enclosure housing a 44×70 mm PCB with nRF52810 BLE control, optical sensor, USB-C LiPo charging/power circuitry, buttons, scroll encoder/wheel, and battery bay.
- Version
- 1.0.18
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone MustafaMulla29/wireless-mouse-pcb # download the package files into ./wireless-mouse-pcb
tsci add MustafaMulla29/wireless-mouse-pcb # add it to your project as @tsci/MustafaMulla29.wireless-mouse-pcbIn 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.
enclosure/extract-reference.ts
// Copies the mechanical rows of the built PCB into reference-board.json.
// The enclosure reads only this file, the same way the BLDC enclosure reads
// its reference board. Re-run after every PCB rebuild:
// bun enclosure/extract-reference.ts
import { createHash } from "node:crypto"
import { access, readFile, writeFile } from "node:fs/promises"
process.chdir(import.meta.dir)
const candidates = ["../index.circuit.circuit.json", "../dist/index/circuit.json"]
let source = candidates[0]
for (const candidate of candidates) {
try {
await access(candidate)
source = candidate
break
} catch {}
}
const bytes = await readFile(source)
const rows = JSON.parse(bytes.toString()) as any[]
const keep = new Set([
"pcb_board",
"pcb_hole",
"pcb_cutout",
"source_component",
"pcb_component",
"cad_component",
])
const slim = rows
.filter((r) => keep.has(r.type))
.map((r) => {
if (r.type !== "cad_component") return r
const { model_obj_url, model_step_url, model_glb_url, ...rest } = r
return rest
})
await writeFile("reference-board.json", JSON.stringify(slim, null, 1) + "\n")
const sha256 = createHash("sha256").update(bytes).digest("hex")
await writeFile(
"reference-board.provenance.json",
JSON.stringify({ source, sha256, rows: slim.length }, null, 2) + "\n",
)
console.log(`reference-board.json: ${slim.length} rows from ${source} (${sha256.slice(0, 12)})`)