From f38f40d8a245e6fcf3c355197b0780443f21eef0 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Thu, 27 Jul 2023 02:01:25 -0700 Subject: [PATCH] Small fixes (#273) - Fix ncols for switch matrix - Allocate USB pins first, since they're generally dedicated pins --- electronics_abstract_parts/IoControllerInterfaceMixins.py | 2 +- electronics_lib/SwitchMatrix.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/electronics_abstract_parts/IoControllerInterfaceMixins.py b/electronics_abstract_parts/IoControllerInterfaceMixins.py index a916e010e..7812fe569 100644 --- a/electronics_abstract_parts/IoControllerInterfaceMixins.py +++ b/electronics_abstract_parts/IoControllerInterfaceMixins.py @@ -23,7 +23,7 @@ def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) self.usb = self.Port(Vector(UsbDevicePort.empty()), optional=True) - self.implementation(lambda base: base._io_ports.append(self.usb)) + self.implementation(lambda base: base._io_ports.insert(0, self.usb)) class IoControllerI2s(BlockInterfaceMixin[BaseIoController]): diff --git a/electronics_lib/SwitchMatrix.py b/electronics_lib/SwitchMatrix.py index 80d1c32c8..afd60cba4 100644 --- a/electronics_lib/SwitchMatrix.py +++ b/electronics_lib/SwitchMatrix.py @@ -21,7 +21,7 @@ def __init__(self, nrows: IntLike, ncols: IntLike, voltage_drop: RangeLike = (0, self.voltage_drop = self.ArgParameter(voltage_drop) self.nrows = self.ArgParameter(nrows) - self.ncols = self.ArgParameter(nrows) + self.ncols = self.ArgParameter(ncols) self.generator_param(self.nrows, self.ncols) def generate(self):