From 3cd148f0a9d6d47888578e777b29ceca99b9345e Mon Sep 17 00:00:00 2001 From: Julian Leucker <leuckerj@gmail.com> Date: Thu, 9 Jul 2020 17:02:04 +0200 Subject: [PATCH] Add all Pins of a MachXO2 to the preview --- fpga_device_manager/widgets/preview.py | 38 ++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/fpga_device_manager/widgets/preview.py b/fpga_device_manager/widgets/preview.py index 2ad8945..76c3349 100644 --- a/fpga_device_manager/widgets/preview.py +++ b/fpga_device_manager/widgets/preview.py @@ -13,20 +13,40 @@ from fpga_device_manager import Pins PinHeader = namedtuple("PinHeader", "name bank_width pins") _PINS = [ - PinHeader("Pin header 1", 5, [ + PinHeader("Pin header 4 (J2)", 5, [ + ("GND", "142", "140", "138", "GND", "136", "132", "130", "GND", "127", + "125", "121", "GND", "119", "115", "113", "GND", "111", "109", "NC"), + + ("GND", "143", "141", "139", "GND", "137", "133", "131", "GND", "128", + "126", "122", "GND", "120", "117", "114", "GND", "112", "110", "IO0") + ]), + PinHeader("Pin header 1 (J4)", 5, [ ("34", "32", "GND", "27", "GND", "25", "23", "GND", "21", "19", "GND", "13", "11", "GND", "9", "5", "3", "1", "3.3", "3.3"), ("35", "33", "GND", "28", "GND", "26", "24", "GND", "22", "20", "GND", "14", "12", "GND", "10", "6", "4", "2", "NC", "IO3") ]), + PinHeader("Pin header 3 (J3)", 5, [ + ('107', '105', '100', 'GND', '98', '96', 'GND', '94', '92', 'GND', + '86', '84', 'GND', '82', '78', 'GND', '76', '74', '1.2', '1.2'), + + ('106', '104', '99', 'GND', '97', '95', 'GND', '93', '91', 'GND', + '85', '83', 'GND', '81', '77', 'GND', '75', '73', 'NC', 'IO1') + ]), + PinHeader("Pin header 2 (J5)", 5, [ + ('40', '41', 'GND', '44', '45', 'GND', '49', '50', 'GND', '55', + '56', 'GND', '59', '60', 'GND', '65', '67', '70', '71', 'NC'), + + ('38', '39', 'GND', '42', '43', 'GND', '47', '48', 'GND', '52', + '54', 'GND', '57', '58', 'GND', '61', '62', '68', '69', 'IO2') + ]), PinHeader("On-board LEDs", 4, [ - ("D8", "106", "105", "104", "100", "99", "98", "97") + ("107", "106", "105", "104", "100", "99", "98", "97") ]) ] -_SIZE = (450, 200) _BOX_BORDER_WIDTH = 4 _PIN_SIZE = 24 _PIN_BORDER_WIDTH = 3 @@ -141,6 +161,18 @@ class PinHeaderImage(QImage): y += _PIN_SIZE + _PIN_MARGIN +def size(x, pins): + height = 0 + for pin_row in pins: + w, h = PinHeaderImage(pin_row)._header_box_size() + height += h + _PIN_SIZE + + return x, height + + +_SIZE = size(450, _PINS) + + class FPGAPreview(QLabel): """The entire FPGA preview image.""" def __init__(self, *args): -- GitLab