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
79 changes: 78 additions & 1 deletion bom/manufactuers/wurth_electronik.zen
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,62 @@ def WR_PHD_2_54_SMD_MALE_SINGLE(positions: int) -> list[(str, str)]:
return [(f"{prefix}{positions}{type1}", MANUFACTURER), (f"{prefix}{positions}{type2}", MANUFACTURER)]


def WR_PHD_1_27_THT_MALE_DUAL(pins: int) -> list[(str, str)]:
"""WR-PHD 1.27mm pitch THT Male pin header, 2 rows.

Series: 622xxx, THT, 1.27mm pitch, 2 rows, vertical
Available pins per row: 2, 4, 5, 10

Returns:
List of (mpn, manufacturer)
"""
available = [2, 4, 5, 10]

if pins not in available:
error("WR_PHD_1_27_THT_MALE_DUAL: pins must be one of " + str(available) + ", got " + str(pins))

total = pins * 2
pin_str = f"0{total}" if total < 10 else str(total)
return [(f"6220{pin_str}21121", MANUFACTURER)]


def WR_PHD_2_54_THT_MALE_SINGLE(pins: int) -> list[(str, str)]:
"""WR-PHD 2.54mm pitch THT Male pin header, 1 row.

Series: 613xxx, THT, 2.54mm pitch, 1 row, vertical
Available pins: 2, 3, 4, 5, 6, 8, 10, 15

Returns:
List of (mpn, manufacturer)
"""
available = [2, 3, 4, 5, 6, 8, 10, 15]

if pins not in available:
error("WR_PHD_2_54_THT_MALE_SINGLE: pins must be one of " + str(available) + ", got " + str(pins))

pin_str = f"0{pins}" if pins < 10 else str(pins)
return [(f"6130{pin_str}11121", MANUFACTURER)]


def WR_PHD_2_54_THT_MALE_DUAL(pins: int) -> list[(str, str)]:
"""WR-PHD 2.54mm pitch THT Male pin header, 2 rows.

Series: 613xxx, THT, 2.54mm pitch, 2 rows, vertical
Available pins per row: 2, 3, 4, 5, 10, 20

Returns:
List of (mpn, manufacturer)
"""
available = [2, 3, 4, 5, 10, 20]

if pins not in available:
error("WR_PHD_2_54_THT_MALE_DUAL: pins must be one of " + str(available) + ", got " + str(pins))

total = pins * 2
pin_str = f"0{total}" if total < 10 else str(total)
return [(f"6130{pin_str}21121", MANUFACTURER)]


def WR_PHD_2_54_SMD_MALE_DUAL(positions: int) -> list[(str, str)]:
"""WR-PHD 2.54mm pitch SMD Male pin header, 2 rows.

Expand Down Expand Up @@ -63,7 +119,28 @@ def WR_PHD_2_54_SMD_MALE_DUAL(positions: int) -> list[(str, str)]:


WURTH_ELEKTRONIK_WR_PHD = {
# 2.54mm pitch, 1 row, vertical, Male
# 1.27mm pitch, 2 rows, vertical, Male, THT
("1.27mm", 2, 2, "Vertical", "Male", "THT"): WR_PHD_1_27_THT_MALE_DUAL(2),
("1.27mm", 2, 4, "Vertical", "Male", "THT"): WR_PHD_1_27_THT_MALE_DUAL(4),
("1.27mm", 2, 5, "Vertical", "Male", "THT"): WR_PHD_1_27_THT_MALE_DUAL(5),
("1.27mm", 2, 10, "Vertical", "Male", "THT"): WR_PHD_1_27_THT_MALE_DUAL(10),
# 2.54mm pitch, 1 row, vertical, Male, THT
("2.54mm", 1, 2, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_SINGLE(2),
("2.54mm", 1, 3, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_SINGLE(3),
("2.54mm", 1, 4, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_SINGLE(4),
("2.54mm", 1, 5, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_SINGLE(5),
("2.54mm", 1, 6, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_SINGLE(6),
("2.54mm", 1, 8, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_SINGLE(8),
("2.54mm", 1, 10, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_SINGLE(10),
("2.54mm", 1, 15, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_SINGLE(15),
# 2.54mm pitch, 2 rows, vertical, Male, THT
("2.54mm", 2, 2, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_DUAL(2),
("2.54mm", 2, 3, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_DUAL(3),
("2.54mm", 2, 4, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_DUAL(4),
("2.54mm", 2, 5, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_DUAL(5),
("2.54mm", 2, 10, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_DUAL(10),
("2.54mm", 2, 20, "Vertical", "Male", "THT"): WR_PHD_2_54_THT_MALE_DUAL(20),
# 2.54mm pitch, 1 row, vertical, Male, SMD
("2.54mm", 1, 4, "Vertical", "Male", "SMD"): WR_PHD_2_54_SMD_MALE_SINGLE(4),
("2.54mm", 1, 6, "Vertical", "Male", "SMD"): WR_PHD_2_54_SMD_MALE_SINGLE(6),
("2.54mm", 1, 10, "Vertical", "Male", "SMD"): WR_PHD_2_54_SMD_MALE_SINGLE(10),
Expand Down
49 changes: 38 additions & 11 deletions bom/test/test_match_PH.zen
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,44 @@ load("../match_generics.zen", "assign_house_parts")

PinHeader = Module("../../generics/PinHeader.zen")

PH_SINGLE_ROW_PINS = [4, 6, 10, 14, 16, 24, 32]
PH_DUAL_ROW_PINS = [2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 16, 17, 18]
PH_HOUSE_PARTS = [
(pitch, rows, pins, orientation, gender, mount)
for pitch in ["2.54mm"]
for rows in [1, 2]
for pins in {1: PH_SINGLE_ROW_PINS, 2: PH_DUAL_ROW_PINS}[rows]
for orientation in ["Vertical"]
for gender in ["Male"]
for mount in ["SMD"]
]
# SMD 2.54mm
PH_SMD_SINGLE_ROW_PINS = [4, 6, 10, 14, 16, 24, 32]
PH_SMD_DUAL_ROW_PINS = [2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 16, 17, 18]

# THT 2.54mm
PH_THT_254_SINGLE_ROW_PINS = [2, 3, 4, 5, 6, 8, 10, 15]
PH_THT_254_DUAL_ROW_PINS = [2, 3, 4, 5, 10, 20]

# THT 1.27mm
PH_THT_127_DUAL_ROW_PINS = [2, 4, 5, 10]

PH_HOUSE_PARTS = (
[
# 2.54mm SMD
(pitch, rows, pins, orientation, gender, mount)
for pitch in ["2.54mm"]
for rows in [1, 2]
for pins in {1: PH_SMD_SINGLE_ROW_PINS, 2: PH_SMD_DUAL_ROW_PINS}[rows]
for orientation in ["Vertical"]
for gender in ["Male"]
for mount in ["SMD"]
]
+ [
# 2.54mm THT
(pitch, rows, pins, orientation, gender, mount)
for pitch in ["2.54mm"]
for rows in [1, 2]
for pins in {1: PH_THT_254_SINGLE_ROW_PINS, 2: PH_THT_254_DUAL_ROW_PINS}[rows]
for orientation in ["Vertical"]
for gender in ["Male"]
for mount in ["THT"]
]
+ [
# 1.27mm THT (2 rows only)
("1.27mm", 2, pins, "Vertical", "Male", "THT")
for pins in PH_THT_127_DUAL_ROW_PINS
]
)

for id, (pitch, rows, pins, orientation, gender, mount) in enumerate(PH_HOUSE_PARTS):
pitch_str = pitch.replace(".", "_")
Expand Down