Skip to content

Commit 92f304a

Browse files
committed
Use list of words in transfer method
The methods and documentation were converted from using strings to using lists of words in a previous commit, but unfortunately I neglected to completely convert the transfer method. This commit makes the transfer method match that behavior as well. Fixes #3
1 parent cc023ec commit 92f304a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,9 @@ def transfer(self, data, speed=0, bits_per_word=0, delay=0):
421421
Returns:
422422
List of words read from SPI bus during transfer
423423
"""
424+
data = array.array('B', data).tostring()
424425
length = len(data)
425-
transmit_buffer = ctypes.create_string_buffer(str(data))
426+
transmit_buffer = ctypes.create_string_buffer(data)
426427
receive_buffer = ctypes.create_string_buffer(length)
427428
spi_ioc_transfer = struct.pack(SPI._IOC_TRANSFER_FORMAT,
428429
ctypes.addressof(transmit_buffer),

0 commit comments

Comments
 (0)