summaryrefslogtreecommitdiff
path: root/decoders/dmx512/pd.py
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2017-06-15 22:27:43 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2017-06-15 22:28:10 +0200
commite992ae3a525cbc0d6441bdf102dae347f1ccf6d0 (patch)
tree90dc4545d5346eb8eabf5c788fc066fcd7fa79d5 /decoders/dmx512/pd.py
parentba2eca6e2d52e6ebe342a50ebf7b0c00a55bdc55 (diff)
downloadlibsigrokdecode-e992ae3a525cbc0d6441bdf102dae347f1ccf6d0.tar.gz
libsigrokdecode-e992ae3a525cbc0d6441bdf102dae347f1ccf6d0.zip
dmx512: Use a nicer 'dmx' pin name variable.
Diffstat (limited to 'decoders/dmx512/pd.py')
-rw-r--r--decoders/dmx512/pd.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/decoders/dmx512/pd.py b/decoders/dmx512/pd.py
index 2f4471f..4da7076 100644
--- a/decoders/dmx512/pd.py
+++ b/decoders/dmx512/pd.py
@@ -77,7 +77,7 @@ class Decoder(srd.Decoder):
# Seek for an interval with no state change with a length between
# 88 and 1000000 us (BREAK).
if self.state == 'FIND BREAK':
- pins = self.wait({0: 'h' if self.run_bit == 0 else 'l'})
+ (dmx,) = self.wait({0: 'h' if self.run_bit == 0 else 'l'})
runlen = (self.samplenum - self.run_start) * self.sample_usec
if runlen > 88 and runlen < 1000000:
self.putr([1, ['Break']])
@@ -87,23 +87,23 @@ class Decoder(srd.Decoder):
elif runlen >= 1000000:
# Error condition.
self.putr([10, ['Invalid break length']])
- self.run_bit = pins[0]
+ self.run_bit = dmx
self.run_start = self.samplenum
# Directly following the BREAK is the MARK AFTER BREAK.
elif self.state == 'MARK MAB':
- pins = self.wait({0: 'h' if self.run_bit == 0 else 'l'})
+ (dmx,) = self.wait({0: 'h' if self.run_bit == 0 else 'l'})
self.putr([2, ['MAB']])
self.state = 'READ BYTE'
self.channel = 0
self.bit = 0
- self.aggreg = pins[0]
+ self.aggreg = dmx
self.run_start = self.samplenum
# Mark and read a single transmitted byte
# (start bit, 8 data bits, 2 stop bits).
elif self.state == 'READ BYTE':
- pins = self.wait({'skip': 1})
+ (dmx,) = self.wait({'skip': 1})
self.next_sample = self.run_start + (self.bit + 1) * self.skip_per_bit
- self.aggreg += pins[0]
+ self.aggreg += dmx
if self.samplenum != self.next_sample:
continue
bit_value = 0 if round(self.aggreg/self.skip_per_bit) == self.bit_break else 1
@@ -124,7 +124,7 @@ class Decoder(srd.Decoder):
self.out_ann, [10, ['Invalid stop bit']])
if self.bit == 10:
# On invalid 2nd stop bit, search for new break.
- self.run_bit = pins[0]
+ self.run_bit = dmx
self.state = 'FIND BREAK'
else:
# Label and process one bit.
@@ -146,18 +146,18 @@ class Decoder(srd.Decoder):
# Continue by scanning the IFT.
self.channel += 1
self.run_start = self.samplenum
- self.run_bit = pins[0]
+ self.run_bit = dmx
self.state = 'MARK IFT'
- self.aggreg = pins[0]
+ self.aggreg = dmx
self.bit += 1
# Mark the INTERFRAME-TIME between bytes / INTERPACKET-TIME between packets.
elif self.state == 'MARK IFT':
- pins = self.wait({0: 'h' if self.run_bit == 0 else 'l'})
+ (dmx,) = self.wait({0: 'h' if self.run_bit == 0 else 'l'})
if self.channel > 512:
self.putr([8, ['Interpacket']])
self.state = 'FIND BREAK'
- self.run_bit = pins[0]
+ self.run_bit = dmx
self.run_start = self.samplenum
else:
self.putr([7, ['Interframe']])