Skip to content
Merged
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export const Microcontroller_RP2040 = ({
pcbRotation={90}
schX={10.4}
schY={-13.2}
schRotation={270}
schRotation={90}
/>
<XL_1608SURC_06
name="D_PWR"
Expand All @@ -409,7 +409,7 @@ export const Microcontroller_RP2040 = ({
pcbRotation={90}
schX={14.5}
schY={-13.4}
schRotation={270}
schRotation={90}
/>

<resistor
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 7 additions & 34 deletions lib/Microcontroller_RP2040/imports/XL_1608SURC_06.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,22 @@
import type { LedProps } from "@tscircuit/props"

const pinLabels = {
pin1: ["cathode", "neg"],
pin2: ["anode", "pos"],
} as const

export const XL_1608SURC_06 = (props: LedProps) => {
const { name = "LED1", ...restProps } = props

return (
<led
name={name}
pinLabels={pinLabels}
supplierPartNumbers={{
jlcpcb: ["C965799"],
}}
manufacturerPartNumber="XL_1608SURC_06"
footprint={
<footprint>
{/*
The XINGLIGHT datasheet numbers cathode as pad 1 and anode as
pad 2, opposite tscircuit's generic LED source-pin numbering.
Keep the standard schematic symbol semantics and swap only the
physical pad-to-source-port mapping here.
*/}
<smtpad
portHints={["pin2", "cathode", "neg"]}
pcbX="-0.749mm"
pcbY="0mm"
width="0.8mm"
height="0.8mm"
shape="rect"
/>
<smtpad
portHints={["pin1", "anode", "pos"]}
pcbX="0.749mm"
pcbY="0mm"
width="0.8mm"
height="0.8mm"
shape="rect"
/>
<silkscreenpath
route={[
{ x: -0.749, y: 0.8 },
{ x: 1.349, y: 0.8 },
{ x: 1.349, y: -0.8 },
{ x: -0.749, y: -0.8 },
]}
/>
</footprint>
}
footprint="res_p1.498mm_pw0.8mm_ph0.8mm"
cadModel={{
objUrl:
"https://modelcdn.tscircuit.com/easyeda_models/assets/C965799.obj?uuid=d0740cb8891c49a88b6949cb978926f3",
Expand Down
42 changes: 20 additions & 22 deletions tests/test.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -459,37 +459,35 @@ test("Microcontroller_RP2040 renders its complete support circuit", async () =>
.sort((a, b) => (a.pin_number ?? 0) - (b.pin_number ?? 0))

expect(ledPorts[0].pin_number).toBe(1)
expect(ledPorts[0].port_hints).toContain("anode")
expect(ledPorts[0].port_hints).toContain("pos")
expect(ledPorts[0].port_hints).not.toContain("cathode")
expect(ledPorts[0].port_hints).toContain("cathode")
expect(ledPorts[0].port_hints).toContain("neg")
expect(ledPorts[0].port_hints).not.toContain("anode")
expect(ledPorts[1].pin_number).toBe(2)
expect(ledPorts[1].port_hints).toContain("cathode")
expect(ledPorts[1].port_hints).toContain("neg")
expect(ledPorts[1].port_hints).not.toContain("anode")
expect(ledPorts[1].port_hints).toContain("anode")
expect(ledPorts[1].port_hints).toContain("pos")
expect(ledPorts[1].port_hints).not.toContain("cathode")

const pcbComponent = circuit.db.pcb_component.getWhere({
source_component_id: ledComponent.source_component_id,
})!
const pcbPads = circuit.db.pcb_smtpad.list({
pcb_component_id: pcbComponent.pcb_component_id,
})
const cathodePad = pcbPads.find((pad) =>
pad.port_hints?.includes("cathode"),
const cathodePcbPort = circuit.db.pcb_port.getWhere({
source_port_id: ledPorts[0].source_port_id,
})!
const anodePcbPort = circuit.db.pcb_port.getWhere({
source_port_id: ledPorts[1].source_port_id,
})!
const cathodePad = pcbPads.find(
(pad) => pad.pcb_port_id === cathodePcbPort.pcb_port_id,
)!
const anodePad = pcbPads.find((pad) => pad.port_hints?.includes("anode"))!

expect(cathodePad.port_hints).toContain("pin2")
expect(anodePad.port_hints).toContain("pin1")
expect(cathodePad.pcb_port_id).toBe(
circuit.db.pcb_port.getWhere({
source_port_id: ledPorts[1].source_port_id,
})!.pcb_port_id,
)
expect(anodePad.pcb_port_id).toBe(
circuit.db.pcb_port.getWhere({
source_port_id: ledPorts[0].source_port_id,
})!.pcb_port_id,
)
const anodePad = pcbPads.find(
(pad) => pad.pcb_port_id === anodePcbPort.pcb_port_id,
)!

expect(cathodePad.port_hints).toContain("1")
expect(anodePad.port_hints).toContain("2")
}
expect(
circuitJson.filter((element) => element.type.endsWith("_error")),
Expand Down
Loading