]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - src/adafruit_blinka/microcontroller/generic_linux/spi.py
add i2c scan
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / microcontroller / generic_linux / spi.py
index 51bace1c4b9d13ebdaff343d26d4d80f1e776935..58a465db727588abb1b758c1c5987292e1f30f3c 100755 (executable)
@@ -36,7 +36,8 @@ class SPI:
         # Linux SPI driver for AM33XX chip in BeagleBone and PocketBeagle
         # does not support setting SPI_NO_CS mode bit (issue #104)
         if not self.chip.AM33XX and not self.chip.IMX8MX and not self.chip.SAMA5 \
         # Linux SPI driver for AM33XX chip in BeagleBone and PocketBeagle
         # does not support setting SPI_NO_CS mode bit (issue #104)
         if not self.chip.AM33XX and not self.chip.IMX8MX and not self.chip.SAMA5 \
-         and not self.chip.APQ8016:
+         and not self.chip.APQ8016 and not self.chip.T210 and not self.chip.T186 \
+         and not self.chip.T194:
             try:
                 self._spi.no_cs = True  # this doesn't work but try anyways
             except AttributeError:
             try:
                 self._spi.no_cs = True  # this doesn't work but try anyways
             except AttributeError:
@@ -53,14 +54,11 @@ class SPI:
             self._spi.max_speed_hz = self.baudrate
             self._spi.mode = self.mode
             self._spi.bits_per_word = self.bits
             self._spi.max_speed_hz = self.baudrate
             self._spi.mode = self.mode
             self._spi.bits_per_word = self.bits
+            self._spi.writebytes2(buf[start:end])
+            self._spi.close()
         except FileNotFoundError as not_found:
             print("Could not open SPI device - check if SPI is enabled in kernel!")
             raise
         except FileNotFoundError as not_found:
             print("Could not open SPI device - check if SPI is enabled in kernel!")
             raise
-        try:
-            self._spi.writebytes2(buf[start:end])
-        except AttributeError as error:
-            self._spi.writebytes([x for x in buf[start:end]])
-        self._spi.close()
 
     def readinto(self, buf, start=0, end=None, write_value=0):
         if not buf:
 
     def readinto(self, buf, start=0, end=None, write_value=0):
         if not buf: