@tscircuit/cli 0.0.185 → 0.0.187

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,55 @@
1
1
  import { layout } from "@tscircuit/layout"
2
+ import { ArduinoProMicroBreakout } from "example-project/src/ArduinoProMicroBreakout"
3
+ import { Key } from "example-project/src/Key"
2
4
  import manualEdits from "example-project/src/manual-edits"
3
5
  import { SwitchShaft } from "example-project/src/SwitchShaft"
4
6
 
5
- export const MacroKeypad = () => (
6
- <board width="20mm" height="20mm">
7
- <SwitchShaft name="SW1" pcbX={3} pcbY={3} />
8
- {/* <SwitchShaft name="SW2" /> */}
9
- </board>
10
- )
7
+ export const MacroKeypad = () => {
8
+ const keyPositions = Array.from({ length: 9 })
9
+ .map((_, i) => ({
10
+ keyNum: i + 1,
11
+ col: i % 3,
12
+ row: Math.floor(i / 3),
13
+ }))
14
+ .map((p) => ({
15
+ ...p,
16
+ x: p.col * 19.05 - 19.05,
17
+ y: p.row * 19.05 - 19.05,
18
+ }))
19
+
20
+ const rowToMicroPin = {
21
+ 0: "D2",
22
+ 1: "D3",
23
+ 2: "D4",
24
+ }
25
+ const colToMicroPin = {
26
+ 0: "D5",
27
+ 1: "D6",
28
+ 2: "D7",
29
+ }
30
+
31
+ return (
32
+ <board width="120mm" height="80mm">
33
+ {keyPositions.map(({ keyNum, x, y }) => (
34
+ <Key name={`K${keyNum}`} keyNum={keyNum} pcbX={x} pcbY={y} />
35
+ ))}
36
+ <ArduinoProMicroBreakout key="u1" name="U1" pcbX={44} />
37
+ {keyPositions.map(({ keyNum, row, col }) => (
38
+ <trace
39
+ // @ts-ignore
40
+ key={`trace-${keyNum}-col`}
41
+ from={`.SW${keyNum} .pin1`}
42
+ to={`.U1 .${colToMicroPin[col as 0 | 1 | 2]}`}
43
+ />
44
+ ))}
45
+ {keyPositions.map(({ keyNum, row, col }) => (
46
+ <trace
47
+ // @ts-ignore
48
+ key={`trace-${keyNum}-row`}
49
+ from={`.D${keyNum} .pin2`}
50
+ to={`.U1 .${rowToMicroPin[row as 0 | 1 | 2]}`}
51
+ />
52
+ ))}
53
+ </board>
54
+ )
55
+ }
@@ -0,0 +1,37 @@
1
+ export const ArduinoProMicroBreakout = (props: {
2
+ name: string
3
+ pcbX?: number
4
+ pcbY?: number
5
+ }) => (
6
+ <chip
7
+ {...props}
8
+ footprint="dip24_w0.7in_h1.3in"
9
+ pinLabels={{
10
+ pin1: "TXD",
11
+ pin2: "RXI",
12
+ pin3: "GND1",
13
+ pin4: "GND2",
14
+ pin5: "D2",
15
+ pin6: "D3",
16
+ pin7: "D4",
17
+ pin8: "D5",
18
+ pin9: "D6",
19
+ pin10: "D7",
20
+ pin11: "D8",
21
+ pin12: "D9",
22
+ // right side (from bottom)
23
+ pin13: "D10",
24
+ pin14: "D16",
25
+ pin15: "D14",
26
+ pin16: "D15",
27
+ pin17: "A0",
28
+ pin18: "A1",
29
+ pin19: "A2",
30
+ pin20: "A3",
31
+ pin21: "VCC",
32
+ pin22: "RST",
33
+ pin23: "GND3",
34
+ pin24: "RAW",
35
+ }}
36
+ />
37
+ )
@@ -0,0 +1,36 @@
1
+ import { SwitchShaft } from "./SwitchShaft"
2
+
3
+ export const Key = (props: {
4
+ name: string
5
+ keyNum: number
6
+ pcbX: number
7
+ pcbY: number
8
+ }) => {
9
+ const shaftName = `SW${props.keyNum}`
10
+ const diodeName = `D${props.keyNum}`
11
+ return (
12
+ <>
13
+ <SwitchShaft
14
+ key="shaft1"
15
+ name={shaftName}
16
+ pcbX={props.pcbX}
17
+ pcbY={props.pcbY}
18
+ />
19
+ <diode
20
+ // @ts-ignore
21
+ key="diode"
22
+ pcbRotation={-90}
23
+ name={diodeName}
24
+ footprint="0603"
25
+ pcbX={props.pcbX + 7}
26
+ pcbY={props.pcbY - 6}
27
+ />
28
+ <trace
29
+ // @ts-ignore
30
+ key="trace1"
31
+ from={`.${shaftName} .pin2`}
32
+ to={`.${diodeName} .pin1`}
33
+ />
34
+ </>
35
+ )
36
+ }
@@ -14,30 +14,23 @@ export const SwitchShaft = (props: {
14
14
  {...props}
15
15
  footprint={
16
16
  <footprint>
17
+ {/* <silkscreentext text={props.name} /> */}
17
18
  <smtpad
18
19
  shape="rect"
19
20
  width="2.55mm"
20
21
  height="2.5mm"
21
22
  portHints={["pin1"]}
23
+ layer="top"
22
24
  />
23
25
  <smtpad
24
26
  shape="rect"
25
27
  width="2.55mm"
26
28
  height="2.5mm"
27
29
  portHints={["pin2"]}
30
+ layer="top"
28
31
  />
29
- <platedhole
30
- shape="circle"
31
- name="H1"
32
- holeDiameter="3mm"
33
- outerDiameter="3.1mm"
34
- />
35
- <platedhole
36
- shape="circle"
37
- name="H2"
38
- holeDiameter="3mm"
39
- outerDiameter="3.1mm"
40
- />
32
+ <hole name="H1" diameter="3mm" />
33
+ <hole name="H2" diameter="3mm" />
41
34
  <constraint xDist="6.35mm" centerToCenter left=".H1" right=".H2" />
42
35
  <constraint yDist="2.54mm" centerToCenter top=".H1" bottom=".H2" />
43
36
  <constraint edgeToEdge xDist="11.3mm" left=".pin1" right=".pin2" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.0.185",
3
+ "version": "0.0.187",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Command line tool for developing, publishing and installing tscircuit circuits",
@@ -8,6 +8,7 @@
8
8
  "scripts": {
9
9
  "start": "bun cli/cli.ts",
10
10
  "dev": "bun run build:dev-server && concurrently 'bun run dev:frontend' 'bun run dev:test-project'",
11
+ "dev:fast": "concurrently 'bun run dev:frontend' 'bun run dev:test-project'",
11
12
  "dev:frontend": "vite dev --config frontend/vite.config.ts",
12
13
  "dev:test-project": "bun --hot cli/cli.ts dev --no-cleanup --cwd ./example-project",
13
14
  "start:dev-server": "bun build:dev-server && bun cli/cli.ts dev -y --cwd ./example-project",
@@ -36,7 +37,7 @@
36
37
  "@edge-runtime/primitives": "^4.1.0",
37
38
  "@hono/node-server": "^1.8.2",
38
39
  "@tscircuit/builder": "*",
39
- "@tscircuit/core": "0.0.35",
40
+ "@tscircuit/core": "0.0.41",
40
41
  "@tscircuit/props": "^0.0.62",
41
42
  "archiver": "^7.0.1",
42
43
  "axios": "^1.6.7",
@@ -98,7 +99,7 @@
98
99
  "@tscircuit/manual-edit-events": "^0.0.4",
99
100
  "@tscircuit/pcb-viewer": "^1.4.4",
100
101
  "@tscircuit/schematic-viewer": "^1.2.14",
101
- "@tscircuit/soup-util": "^0.0.20",
102
+ "@tscircuit/soup-util": "^0.0.23",
102
103
  "@tscircuit/table-viewer": "0.0.8",
103
104
  "@types/archiver": "^6.0.2",
104
105
  "@types/bun": "^1.0.8",