summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2017-01-15 13:09:36 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2017-06-16 15:17:15 +0200
commit80307e8aaab4e1269a25f00cbfb2249377855bf7 (patch)
tree478c9c57364469a1333814205a6f9e5eed5ce0e9
parent12c567037d3bb4b52e5553397c2f9aef6859b840 (diff)
downloadlibsigrokdecode-80307e8aaab4e1269a25f00cbfb2249377855bf7.tar.gz
libsigrokdecode-80307e8aaab4e1269a25f00cbfb2249377855bf7.zip
wiegand: Convert to PD API version 3.
-rw-r--r--decoders/wiegand/pd.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/decoders/wiegand/pd.py b/decoders/wiegand/pd.py
index 7a24fc8..42e63b9 100644
--- a/decoders/wiegand/pd.py
+++ b/decoders/wiegand/pd.py
@@ -20,7 +20,7 @@
import sigrokdecode as srd
class Decoder(srd.Decoder):
- api_version = 2
+ api_version = 3
id = 'wiegand'
name = 'Wiegand'
longname = 'Wiegand interface'
@@ -64,7 +64,7 @@ class Decoder(srd.Decoder):
def start(self):
'Register output types and verify user supplied decoder values.'
self.out_ann = self.register(srd.OUTPUT_ANN)
- self._active = self.options['active'] == 'high' and 1 or 0
+ self._active = 1 if self.options['active'] == 'high' else 0
self._inactive = 1 - self._active
def metadata(self, key, value):
@@ -102,8 +102,11 @@ class Decoder(srd.Decoder):
self._state = state
self._bits = []
- def decode(self, ss, es, data):
- for self.samplenum, (d0, d1) in data:
+ def decode(self):
+ while True:
+ # TODO: Come up with more appropriate self.wait() conditions.
+ (d0, d1) = self.wait({'skip': 1})
+
if d0 == self._d0_prev and d1 == self._d1_prev:
if self.es_bit and self.samplenum >= self.es_bit:
if (d0, d1) == (self._inactive, self._inactive):