Compare commits

...

3 commits

Author SHA1 Message Date
42e5b151b0 format code with black 2021-01-28 16:13:05 -06:00
f3b52cf393 nxp_lpc4430: 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.

This fix is speculative and untested.
2021-01-28 15:59:52 -06:00
aed7915007 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.
2021-01-28 15:59:38 -06:00
2 changed files with 3 additions and 2 deletions

View file

@ -67,7 +67,8 @@ 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

View file

@ -93,7 +93,7 @@ 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._transmit([], end - start)
result = self._transmit([write_value] * (end - start), end - start)
for i, b in enumerate(result):
buf[start + i] = b