Re-enable SPI loopback testing
authorDan White <dan@whiteaudio.com>
Tue, 10 Apr 2012 01:40:33 +0000 (20:40 -0500)
committerDan White <dan@whiteaudio.com>
Tue, 10 Apr 2012 01:40:33 +0000 (20:40 -0500)
python-lib/usbio.py

index a4a2174731679dee23a79411e00a99fdbe40984f..c8c70a5a73ae15321bdc7158b6285ba35a40aab8 100644 (file)
@@ -1,13 +1,13 @@
 #!/usr/bin/env python
 
-#from array import array
-#import struct
-#import time
+from array import array
+import struct
+import time
 
 from myhdl import intbv
 
-#from pyftdi.pyftdi.ftdi import Ftdi
-#from pyftdi.pyftdi.spi import SpiController
+from pyftdi.pyftdi.ftdi import Ftdi
+from pyftdi.pyftdi.spi import SpiController
 
 
 
@@ -483,8 +483,8 @@ class AD524x(object):
             self.send(1)
 
     def updateGPO(self, force=False):
-        if force or (self.gpo1 != self.lastO1) or
-                    (self.gpo2 != self.lastO2):
+        if (force or (self.gpo1 != self.lastO1) or
+                     (self.gpo2 != self.lastO2)):
             self.sendGPO()
 
     def send(self, sel):
@@ -555,7 +555,7 @@ def arr(a):
 
 
 
-if 0:
+if 1:
     sc0 = SpiController()
     sc0.configure(0x0403, 0x6011, 0, loopback=True)
 
@@ -576,5 +576,11 @@ if 0:
         return p._controller._ftdi.read_data_bytes(readlen, 4)
 
 
-    print rw(p0, arr([0,1,2,3]))
-    print rw(p1, arr([4,5,6,7]))
+    print 'Loopback SPI interfaces 0, 1'
+    a = [0,1,2,3,4,5,6,7,8,9]
+    print a
+    print rw(p0, arr(a))
+
+    a = [i for i in range(256)]
+    print a
+    print rw(p1, arr(a))