X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka.git/blobdiff_plain/ceb9335735eca4763f42b04e4772ff2922ca9518..c4584b61465986a4adf80121be18eb33d4afc2c3:/src/adafruit_blinka/microcontroller/generic_linux/spi.py diff --git a/src/adafruit_blinka/microcontroller/generic_linux/spi.py b/src/adafruit_blinka/microcontroller/generic_linux/spi.py index 9ef05fc..51bace1 100755 --- a/src/adafruit_blinka/microcontroller/generic_linux/spi.py +++ b/src/adafruit_blinka/microcontroller/generic_linux/spi.py @@ -35,7 +35,8 @@ 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: + if not self.chip.AM33XX and not self.chip.IMX8MX and not self.chip.SAMA5 \ + and not self.chip.APQ8016: try: self._spi.no_cs = True # this doesn't work but try anyways except AttributeError: @@ -52,11 +53,14 @@ 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.close() 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: