From 834e9b99bea6456792eaf2a4ea2e83eb38760c46 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 23 Dec 2014 20:53:05 +0100 Subject: [PATCH] host/drivers: add possibility to pass cond dict to ease trigger pattern generation --- miscope/host/drivers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/miscope/host/drivers.py b/miscope/host/drivers.py index eab1d9e75..a3d656336 100644 --- a/miscope/host/drivers.py +++ b/miscope/host/drivers.py @@ -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)