diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2016-08-26 15:19:54 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2016-12-07 22:45:47 +0100 |
commit | e500b376b5cf74f4862688f310b9b8008bfc3eea (patch) | |
tree | 27464de181b01c0d1f22e8feae83d6a0b46b2a28 /decoders | |
parent | 5e39fa54152db51fd9bdfb33edfd55a54493821d (diff) | |
download | libsigrokdecode-e500b376b5cf74f4862688f310b9b8008bfc3eea.tar.gz libsigrokdecode-e500b376b5cf74f4862688f310b9b8008bfc3eea.zip |
stepper_motor: Convert to PD API version 3.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/stepper_motor/pd.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/decoders/stepper_motor/pd.py b/decoders/stepper_motor/pd.py index 7664fc4..b6ff9b1 100644 --- a/decoders/stepper_motor/pd.py +++ b/decoders/stepper_motor/pd.py @@ -24,7 +24,7 @@ class SamplerateError(Exception): pass class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'stepper_motor' name = 'Stepper motor' longname = 'Stepper motor position / speed' @@ -87,11 +87,9 @@ class Decoder(srd.Decoder): if key == srd.SRD_CONF_SAMPLERATE: self.samplerate = value - def decode(self, ss, es, data): + def decode(self): if not self.samplerate: raise SamplerateError('Cannot decode without samplerate.') - - for (self.samplenum, (step, direction)) in data: - if step == 1 and self.oldstep == 0: - self.step(self.samplenum, direction) - self.oldstep = step + while True: + step, direction = self.wait({0: 'r'}) + self.step(self.samplenum, direction) |