MustafaMulla29/rp2040-bldc-motor-controller-new

73×72 mm 4-layer USB‑C PD (5/9/15/20 V) RP2040 controller PCB with protected power switching, MCT8329A sensorless BLDC three-phase MOSFET bridge, USB data/programming, onboard controls, and three motor outputs feeding a 2212 motor through rigid bullet adapters.

Version
0.3.100
License
unset
Stars
0

assembly/component-cable.tsx

import React from "react"
import { assembly } from "@tscircuit/core"
import { dimensions as d } from "./dimensions"
import { matingPoint, type Part } from "./attachments"

/** Project-level named attachments for custom CAD owners. The small core
 * extension accepts world points; callers only reference component-local ports.
 * This is not an upstream JSX API or a replacement for PCB connector selectors.
 */
export function MotorLead({ name, motor, phase, adapter }:
  { name: string; motor: Part; phase: string; adapter: Part }) {
  const start = motor.ports[phase], end = adapter.ports.motor
  if (start?.kind !== "fixed_wire" || end?.kind !== "bullet_female" || end.diameter !== d.motor.plugDiameter) {
    throw new Error(`Incompatible motor-lead attachments for ${name}`)
  }
  return <assembly.cable name={name} from={`.${motor.name}`} to={`.${adapter.name}`}
    model={d.motorLead.model}
    fromMatingPoint={matingPoint(motor, phase)}
    toMatingPoint={matingPoint(adapter, "motor", d.motorLead.genericMaleContactDepth)} />
}