]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - src/adafruit_blinka/microcontroller/generic_linux/spi.py
Fixed requirements to use setup.py and rpi-lgpio for the gpio
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / microcontroller / generic_linux / spi.py
index 50ad8c154067fd669b972f40bf69ec473ef330cf..6cce03700b5634a11281e75bbf9301b1b407f225 100755 (executable)
@@ -73,7 +73,7 @@ class SPI:
 
     def write(self, buf, start=0, end=None):
         """Write data from the buffer to SPI"""
 
     def write(self, buf, start=0, end=None):
         """Write data from the buffer to SPI"""
-        if not buf:
+        if buf is None or len(buf) < 1:
             return
         if end is None:
             end = len(buf)
             return
         if end is None:
             end = len(buf)
@@ -91,7 +91,7 @@ class SPI:
 
     def readinto(self, buf, start=0, end=None, write_value=0):
         """Read data from SPI and into the buffer"""
 
     def readinto(self, buf, start=0, end=None, write_value=0):
         """Read data from SPI and into the buffer"""
-        if not buf:
+        if buf is None or len(buf) < 1:
             return
         if end is None:
             end = len(buf)
             return
         if end is None:
             end = len(buf)
@@ -116,7 +116,9 @@ class SPI:
         """Perform a half-duplex write from buffer_out and then
         read data into buffer_in
         """
         """Perform a half-duplex write from buffer_out and then
         read data into buffer_in
         """
-        if not buffer_out or not buffer_in:
+        if buffer_out is None or buffer_in is None:
+            return
+        if len(buffer_out) < 1 or len(buffer_in) < 1:
             return
         if out_end is None:
             out_end = len(buffer_out)
             return
         if out_end is None:
             out_end = len(buffer_out)