Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/fn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export { smdpinheader } from "./smdpinheader"
export { platedhole } from "./platedhole"
export { sot } from "./sot"
export { sot343 } from "./sot343"
export { sot343bfp650 } from "./sot343bfp650"
export { m2host } from "./m2host"
export { mountedpcbmodule } from "./mountedpcbmodule"
export { to92l } from "./to92l"
Expand Down
52 changes: 52 additions & 0 deletions src/fn/sot343bfp650.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import type { AnyCircuitElement, PcbCourtyardRect } from "circuit-json"
import { z } from "zod"
import { rectpad } from "../helpers/rectpad"
import { silkscreenRef } from "../helpers/silkscreenRef"
import { silkscreenpath } from "../helpers/silkscreenpath"
import { base_def } from "../helpers/zod/base_def"

export const sot343bfp650_def = base_def.extend({
fn: z.literal("sot343bfp650"),
num_pins: z.literal(4).default(4),
})

export const sot343bfp650 = (
rawParams: z.input<typeof sot343bfp650_def>,
): { circuitJson: AnyCircuitElement[]; parameters: any } => {
const parameters = sot343bfp650_def.parse(rawParams)
const pads = [
rectpad(1, -0.65, -1, 0.7, 0.7),
rectpad(2, 0.5, -1, 0.9, 0.7),
rectpad(3, 0.65, 1, 0.7, 0.7),
rectpad(4, -0.65, 1, 0.7, 0.7),
]
const silkscreen = [
silkscreenpath([
{ x: -1, y: -0.2 },
{ x: -1, y: 0.2 },
]),
silkscreenpath([
{ x: 1, y: 0.2 },
{ x: 1, y: -0.2 },
]),
]
const courtyard: PcbCourtyardRect = {
type: "pcb_courtyard_rect",
pcb_courtyard_rect_id: "",
pcb_component_id: "",
center: { x: 0, y: 0 },
width: 3,
height: 3.2,
layer: "top",
}

return {
circuitJson: [
...pads,
...silkscreen,
silkscreenRef(0, 2.1, 0.4),
courtyard,
],
parameters,
}
}
1 change: 1 addition & 0 deletions src/footprinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export type Footprinter = {
sot323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">
sot89: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw" | "h">
sot343: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">
sot343bfp650: () => FootprinterParamsBuilder<never>
sod323w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">
smc: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">
minimelf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/sot343bfp650_c151520.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions tests/sot343bfp650.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect, test } from "bun:test"
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
import { fp } from "../src/footprinter"

test("sot343bfp650 matches C151520", () => {
const circuitJson = fp.string("sot343bfp650").circuitJson()
const pads = circuitJson.filter((element) => element.type === "pcb_smtpad")

expect(pads).toHaveLength(4)
expect(pads[0]).toMatchObject({ x: -0.65, y: -1, width: 0.7, height: 0.7 })
expect(pads[1]).toMatchObject({ x: 0.5, y: -1, width: 0.9, height: 0.7 })
expect(pads[2]).toMatchObject({ x: 0.65, y: 1, width: 0.7, height: 0.7 })
expect(pads[3]).toMatchObject({ x: -0.65, y: 1, width: 0.7, height: 0.7 })

expect(convertCircuitJsonToPcbSvg(circuitJson)).toMatchSvgSnapshot(
import.meta.path,
"sot343bfp650_c151520",
)
})
Loading