]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Merge pull request #173 from caternuson/iss172 3.0.1
authorLimor "Ladyada" Fried <limor@ladyada.net>
Thu, 14 Nov 2019 18:52:29 +0000 (13:52 -0500)
committerGitHub <noreply@github.com>
Thu, 14 Nov 2019 18:52:29 +0000 (13:52 -0500)
Add SPI phase check to FT232H

src/adafruit_blinka/microcontroller/ft232h/spi.py

index 2d42ae0da8d546c9c4132d3e2730c3917e2f546e..a260e7206e42ed2f4e89f8468e481d01f37f7301 100644 (file)
@@ -17,7 +17,12 @@ class SPI:
     def init(self, baudrate=100000, polarity=0, phase=0, bits=8,
                   firstbit=MSB, sck=None, mosi=None, miso=None):
         self._port.set_frequency(baudrate)
+        # FTDI device can only support mode 0 and mode 2
+        # due to the limitation of MPSSE engine.
+        # This means CPHA must = 0
         self._port._cpol = polarity
+        if phase != 0:
+            raise ValueError("Only SPI phase 0 is supported by FT232H.")
         self._port._cpha = phase
 
     @property