From: Jeff Epler Date: Thu, 28 Jan 2021 21:59:38 +0000 (-0600) Subject: ft232h: Fix SPI.readinto's write_value= argument X-Git-Tag: 6.2.0~1^2~2 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/aed7915007a778b9feb248c576239661e35cb08d?hp=--cc ft232h: Fix SPI.readinto's write_value= argument Before, this argument was ignored. This prevented adafruit_sdcard from functioning, as it relies on being able to send out the value 0xff. --- aed7915007a778b9feb248c576239661e35cb08d diff --git a/src/adafruit_blinka/microcontroller/ft232h/spi.py b/src/adafruit_blinka/microcontroller/ft232h/spi.py index 81797b3..af164e9 100644 --- a/src/adafruit_blinka/microcontroller/ft232h/spi.py +++ b/src/adafruit_blinka/microcontroller/ft232h/spi.py @@ -67,7 +67,10 @@ class SPI: 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