]> Repositories - Adafruit_Blinka-hackapet.git/blobdiff - src/adafruit_blinka/microcontroller/generic_linux/spi.py
add SPI frequency property
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / microcontroller / generic_linux / spi.py
index ef442b162576d0b4e440a4f51e6b74e8730fc5b4..a93c46b0183779d5808cd8eee22bd869eb9f0553 100755 (executable)
@@ -35,12 +35,18 @@ class SPI:
     def set_no_cs(self):
         # 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:
+        if not self.chip.AM33XX and not self.chip.IMX8MX and not self.chip.SAMA5 \
+         and not self.chip.APQ8016 and not self.chip.T210 and not self.chip.T186 \
+         and not self.chip.T194 and not self.chip.SUN8I:
             try:
                 self._spi.no_cs = True  # this doesn't work but try anyways
             except AttributeError:
                 pass
 
+    @property
+    def frequency(self):
+        return self.baudrate
+
     def write(self, buf, start=0, end=None):
         if not buf:
             return
@@ -52,7 +58,7 @@ class SPI:
             self._spi.max_speed_hz = self.baudrate
             self._spi.mode = self.mode
             self._spi.bits_per_word = self.bits
-            self._spi.writebytes([x for x in buf[start:end]])
+            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!")