Devesh36/clear-mouse

A transparent, right-handed wireless mouse assembly with a 44×58 mm control PCB, LiPo battery, optical sensor, click buttons, scroll encoder, DPI/middle buttons, USB‑C charging, and 3D‑printed housing/mechanical hardware.

Version
0.1.5
License
unset
Stars
0

Use with the tscircuit CLI

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

tsci clone Devesh36/clear-mouse  # download the package files into ./clear-mouse
tsci add Devesh36/clear-mouse    # add it to your project as @tsci/Devesh36.clear-mouse

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.

parts.tsx

import { Fragment } from "react";
export { MDBT42V_512KV2 as Mcu } from "./imports/MDBT42V_512KV2";
export { PMW3610DM_SUDU as Sensor } from "./imports/PMW3610DM_SUDU";
export { BQ24074RGTR as Charger } from "./imports/BQ24074RGTR";
export { TPS7A0230PDBVR as Regulator } from "./imports/TPS7A0230PDBVR";
export { TLV70019DDCR as SensorLdo } from "./imports/TLV70019DDCR";
export { D2FC_F_7N_20M_ as Click } from "./imports/D2FC_F_7N_20M_";
export { EC10E1220505 as Encoder } from "./imports/EC10E1220505";
export { MSK12C02 as PowerSwitch } from "./imports/MSK12C02";
export { S2B_PH_SM4_TB_LF__SN_ as BatteryConnector } from "./imports/S2B_PH_SM4_TB_LF__SN_";
export { TS_1088_AR02016 as Button } from "./imports/TS_1088_AR02016";
export const S = (sheet: string, x: number, y: number) => ({
	schSheetName: sheet === "RAILS" && y < -10 ? "LDO" : sheet,
	schSectionName: sheet === "RAILS" && y < -10 ? "LDO" : sheet,
	schX: x * 0.56,
	schY: y * 0.56,
});
export function Sheets() {
	return (
		<>
			{Object.entries({
				POWER: "USB-C charging and power path",
				RAILS: "3.0V low-quiescent-current supply",
				LDO: "1.9V sensor supply",
				MCU: "Bluetooth controller and service",
				OPTICS: "PMW3610 tracking sensor",
				INPUTS: "Mouse controls and status",
			}).map(([name, label]) => (
				<Fragment key={name}>
					<schematicsheet name={name} displayName={label}>
						<schematicsection
							name={name}
							displayName={name}
							sectionTitleFontSize={0.16}
						/>
					</schematicsheet>
				</Fragment>
			))}
		</>
	);
}
type Passive = {
	name: string;
	x: number;
	y: number;
	s: string;
	sx: number;
	sy: number;
	a: string;
	b?: string;
	v?: string;
	rot?: number;
	maxLen?: number;
	direct?: boolean;
};
const resistorParts: Record<string, string> = {
	"10k": "RC0402FR-0710KL",
	"17.8k": "RC0402FR-0717K8L",
	"100k": "RC0402FR-07100KL",
	"5.1k": "RC0402FR-075K1L",
	"4.42k": "RC0402FR-074K42L",
	"1k": "RC0402FR-071KL",
	"200k": "RC0402FR-07200KL",
	"1.12M": "RC0402FR-071M12L",
	"33": "RC0402FR-0733RL",
	"220k": "RC0402FR-07220KL",
};
export function R({
	name,
	x,
	y,
	s,
	sx,
	sy,
	a,
	b = "GND",
	v = "10k",
	rot = 0,
}: Passive) {
	return (
		<resistor
			name={name}
			resistance={v}
			footprint="res_p0.8656mm_pw0.5657mm_ph0.54mm_cyw1.9313mm_cyh1.04mm"
			manufacturerPartNumber={resistorParts[v]}
			pcbX={x}
			pcbY={y}
			pcbRotation={rot}
			schRotation={-90}
			{...S(s, sx, sy)}
			connections={{ pin1: `net.${a}`, pin2: `net.${b}` }}
		/>
	);
}
const caps: Record<string, { mpn: string; fp: string; volts: string }> = {
	"100nF": {
		mpn: "CL05B104KO5NNNC",
		fp: "cap_p0.8402mm_pw0.5mm_ph0.54mm_cyw1.8402mm_cyh1.04mm",
		volts: "16V",
	},
	"10nF": {
		mpn: "CL05B103KB5NNNC",
		fp: "cap_p0.8402mm_pw0.5mm_ph0.54mm_cyw1.8402mm_cyh1.04mm",
		volts: "50V",
	},
	"1uF": { mpn: "GRM188R71C105KA12D", fp: "0603", volts: "16V" },
	"3.3uF": { mpn: "GRM21BR71C335KA73L", fp: "0805", volts: "16V" },
	"10uF": { mpn: "GRM21BR71A106KE51L", fp: "0805", volts: "10V" },
	"22uF": { mpn: "GRM21BR61A226ME44L", fp: "0805", volts: "10V" },
};
export function C({
	name,
	x,
	y,
	s,
	sx,
	sy,
	a,
	b = "GND",
	v = "100nF",
	rot = 0,
	maxLen,
	direct = false,
}: Passive) {
	const p = caps[v];
	return (
		<capacitor
			name={name}
			maxDecouplingTraceLength={maxLen}
			capacitance={v}
			footprint={p.fp}
			manufacturerPartNumber={p.mpn}
			maxVoltageRating={p.volts}
			pcbX={x}
			pcbY={y}
			pcbRotation={rot}
			schRotation={-90}
			{...S(s, sx, sy)}
			connections={direct ? undefined : { pin1: `net.${a}`, pin2: `net.${b}` }}
		/>
	);
}

export { A_150060VS75000 as GreenLed } from "./imports/A_150060VS75000";
export { A_150060RS75000 as RedLed } from "./imports/A_150060RS75000";