diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2014-08-30 00:55:56 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2014-08-30 00:55:56 +0200 |
commit | 586361052b414d9e17fdecf54c5db0282c25339f (patch) | |
tree | e508d9d61eeb74a45d1346632d5a59990aae80f1 /decoders | |
parent | 5302d1e99ed4234b622e7d85ff3e58e2e4648f25 (diff) | |
download | libsigrokdecode-586361052b414d9e17fdecf54c5db0282c25339f.tar.gz libsigrokdecode-586361052b414d9e17fdecf54c5db0282c25339f.zip |
spdif: Simplify get_pulse_type() a bit.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/spdif/pd.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/decoders/spdif/pd.py b/decoders/spdif/pd.py index ca7e0bb..9646386 100644 --- a/decoders/spdif/pd.py +++ b/decoders/spdif/pd.py @@ -84,12 +84,12 @@ class Decoder(srd.Decoder): if key == srd.SRD_CONF_SAMPLERATE: self.samplerate = value - def get_pulse_type(self, pulse): + def get_pulse_type(self): if self.range1 == 0 or self.range2 == 0: return -1 - if pulse >= self.range2: + if self.pulse_width >= self.range2: return 2 - elif pulse >= self.range1: + elif self.pulse_width >= self.range1: return 0 else: return 1 @@ -130,12 +130,12 @@ class Decoder(srd.Decoder): self.state = 'DECODE STREAM' def decode_stream(self): - pulse = self.get_pulse_type(self.pulse_width) + pulse = self.get_pulse_type() if not self.seen_preamble: # This is probably the start of a preamble, decode it. if pulse == 2: - self.preamble.append(self.get_pulse_type(self.pulse_width)) + self.preamble.append(self.get_pulse_type()) self.state = 'DECODE PREAMBLE' self.ss_edge = self.samplenum - self.pulse_width - 1 return @@ -194,13 +194,13 @@ class Decoder(srd.Decoder): def decode_preamble(self): if self.preamble_state == 0: - self.preamble.append(self.get_pulse_type(self.pulse_width)) + self.preamble.append(self.get_pulse_type()) self.preamble_state = 1 elif self.preamble_state == 1: - self.preamble.append(self.get_pulse_type(self.pulse_width)) + self.preamble.append(self.get_pulse_type()) self.preamble_state = 2 elif self.preamble_state == 2: - self.preamble.append(self.get_pulse_type(self.pulse_width)) + self.preamble.append(self.get_pulse_type()) self.preamble_state = 0 self.state = 'DECODE STREAM' if self.preamble == [2, 0, 1, 0]: |