host/drivers: add possibility to pass cond dict to ease trigger pattern generation
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 23 Dec 2014 19:53:05 +0000 (20:53 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 23 Dec 2014 19:53:05 +0000 (20:53 +0100)
miscope/host/drivers.py

index eab1d9e75219e1b0811907a7560253d928e2eb72..a3d6563360381c48dc9ebbe05f72166e890bf9d6 100644 (file)
@@ -67,7 +67,11 @@ class MiLaDriver():
                print(s, end="|")
                sys.stdout.flush()
 
-       def prog_term(self, port, trigger, mask):
+       def prog_term(self, port, trigger=0, mask=0, cond=None):
+               if cond is not None:
+                       for k, v in cond.items():
+                               trigger |= getattr(self, k+"_o")*v
+                               mask |= getattr(self, k+"_m")*v
                t = getattr(self, "mila_trigger_port{d}_trig".format(d=int(port)))
                m = getattr(self, "mila_trigger_port{d}_mask".format(d=int(port)))
                t.write(trigger)