From aed7915007a778b9feb248c576239661e35cb08d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 28 Jan 2021 15:59:38 -0600 Subject: [PATCH 1/1] 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. --- src/adafruit_blinka/microcontroller/ft232h/spi.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.49.0