"""Electrical contracts for the ten explicit USB2517 strap pulldowns.""" STRAPS = dict(zip(range(900, 910), (51, 49, 47, 33, 31, 17, 15, 50, 48, 34))) REFS = {f'R{n}' for n in STRAPS} def verify_hub_straps(board, check): for refnum, pin in STRAPS.items(): ref = f'R{refnum}' check(f'Hub strap {ref} approved 100k part', board.parts[ref]['MPN'] == '0402WGF1003TCE' and board.parts[ref]['LCSC'] == 'C25741' and board.resistor(ref) == 100000) check(f'Hub strap U32.{pin} dedicated pull-down', board.net_members[board.net('U32', pin)] == {('U32', str(pin)), (ref, '2')} and board.net(ref, 1) == 'GND') for pin, ref in ((41, 'R711'), (42, 'R712')): check(f'Hub configuration select {pin} low', board.resistor(ref) == 10000 and {board.net(ref, 1), board.net(ref, 2)} == {'GND', board.net('U32', pin)}) check('Hub configuration select 13 low', board.net('U32', 13) == 'GND')