diff options
-rw-r--r-- | kvmd/plugins/hid/spi.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/kvmd/plugins/hid/spi.py b/kvmd/plugins/hid/spi.py index cf48f803..7eaa447f 100644 --- a/kvmd/plugins/hid/spi.py +++ b/kvmd/plugins/hid/spi.py @@ -104,7 +104,6 @@ class _SpiPhy(BasePhy): # pylint: disable=too-many-instance-attributes chip: int, hw_cs: bool, sw_cs_pin: int, - cs_high: bool, max_freq: int, block_usec: int, read_timeout: float, @@ -114,7 +113,6 @@ class _SpiPhy(BasePhy): # pylint: disable=too-many-instance-attributes self.__chip = chip self.__hw_cs = hw_cs self.__sw_cs_pin = sw_cs_pin - self.__cs_high = cs_high self.__max_freq = max_freq self.__block_usec = block_usec self.__read_timeout = read_timeout @@ -128,18 +126,16 @@ class _SpiPhy(BasePhy): # pylint: disable=too-many-instance-attributes with contextlib.closing(spidev.SpiDev(self.__bus, self.__chip)) as spi: spi.mode = 0 spi.no_cs = (not self.__hw_cs) - if self.__hw_cs: - spi.cshigh = self.__cs_high spi.max_speed_hz = self.__max_freq def xfer(data: bytes) -> bytes: try: if sw_cs_line is not None: - sw_cs_line.set_value(int(self.__cs_high)) + sw_cs_line.set_value(0) return spi.xfer(data, self.__max_freq, self.__block_usec) finally: if sw_cs_line is not None: - sw_cs_line.set_value(int(not self.__cs_high)) + sw_cs_line.set_value(1) yield _SpiPhyConnection( xfer=xfer, @@ -151,7 +147,7 @@ class _SpiPhy(BasePhy): # pylint: disable=too-many-instance-attributes if self.__sw_cs_pin > 0: with contextlib.closing(gpiod.Chip(env.GPIO_DEVICE_PATH)) as chip: line = chip.get_line(self.__sw_cs_pin) - line.request("kvmd::hid-mcu::sw_cs", gpiod.LINE_REQ_DIR_OUT, default_vals=[int(not self.__cs_high)]) + line.request("kvmd::hid-mcu::sw_cs", gpiod.LINE_REQ_DIR_OUT, default_vals=[1]) yield line else: yield None @@ -177,7 +173,6 @@ class Plugin(BaseMcuHid): "chip": Option(-1, type=valid_int_f0), "hw_cs": Option(False, type=valid_bool), "sw_cs_pin": Option(-1, type=valid_gpio_pin_optional), - "cs_high": Option(False, type=valid_bool), "max_freq": Option(200000, type=valid_int_f1), "block_usec": Option(1, type=valid_int_f0), "read_timeout": Option(0.5, type=valid_float_f01), |