X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/blobdiff_plain/a3770186a94117be56a8d9a8038a2d540bd2884c..02b66d1a6f44c9fcc3d220db389eb8f97913cae0:/src/adafruit_blinka/microcontroller/ft232h/spi.py?ds=inline diff --git a/src/adafruit_blinka/microcontroller/ft232h/spi.py b/src/adafruit_blinka/microcontroller/ft232h/spi.py index bd4a53b..c768eaf 100644 --- a/src/adafruit_blinka/microcontroller/ft232h/spi.py +++ b/src/adafruit_blinka/microcontroller/ft232h/spi.py @@ -22,7 +22,7 @@ class SPI: # Change GPIO controller to SPI Pin.ft232h_gpio = self._spi.get_gpio() - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments,unused-argument def init( self, baudrate=100000, @@ -60,13 +60,15 @@ class SPI: chunk_end = chunk_start + self._spi.PAYLOAD_MAX_LENGTH self._port.write(buf[chunk_start:chunk_end]) if rest: - self._port.write(buf[-1 * rest :]) + rest_start = start + chunks * self._spi.PAYLOAD_MAX_LENGTH + self._port.write(buf[rest_start:end]) # pylint: disable=unused-argument def readinto(self, buf, start=0, end=None, write_value=0): """Read data from SPI and into the buffer""" end = end if end else len(buf) - result = self._port.read(end - start) + buffer_out = [write_value] * (end - start) + result = self._port.exchange(buffer_out, end - start, duplex=True) for i, b in enumerate(result): buf[start + i] = b