diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2018-04-08 18:55:08 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2018-04-08 19:09:02 +0200 |
commit | 3a843174bf6d0d178f39a7cd0d443a051f4e9a95 (patch) | |
tree | b138a1b25cbe22fa5b62774dda4d0a773cb2ff42 | |
parent | 218b51394cd9c23a18e21815bf8ab5cd716040d3 (diff) | |
download | libsigrokdecode-3a843174bf6d0d178f39a7cd0d443a051f4e9a95.tar.gz libsigrokdecode-3a843174bf6d0d178f39a7cd0d443a051f4e9a95.zip |
rc_encode: Add self.putx() helper.
-rw-r--r-- | decoders/rc_encode/pd.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/decoders/rc_encode/pd.py b/decoders/rc_encode/pd.py index b0dda1f..1c1f579 100644 --- a/decoders/rc_encode/pd.py +++ b/decoders/rc_encode/pd.py @@ -113,6 +113,9 @@ class Decoder(srd.Decoder): self.out_ann = self.register(srd.OUTPUT_ANN) self.model = self.options['remote'] + def putx(self, data): + self.put(self.ss, self.es, self.out_ann, data) + def decode(self): while True: pin = self.wait({0: 'e'}) @@ -134,10 +137,8 @@ class Decoder(srd.Decoder): self.es = self.samplenum self.bits.append([decode_bit(self.pulses), self.ss, self.es]) # Save states and times. - self.put(self.ss, self.es, self.out_ann, - [0, [decode_bit(self.pulses)]]) # Write decoded bit. - self.put(self.ss, self.es, self.out_ann, - [1, [pinlabels(self.bit_count)]]) # Write pin labels. + self.putx([0, [decode_bit(self.pulses)]]) # Write decoded bit. + self.putx([1, [pinlabels(self.bit_count)]]) # Write pin labels. self.pulses = [] self.ss = self.samplenum else: @@ -150,8 +151,7 @@ class Decoder(srd.Decoder): samples = self.samplenum - self.samplenumber_last pin = self.wait({'skip': 8 * samples}) # Wait for end of sync bit. self.es = self.samplenum - self.put(self.ss, self.es, self.out_ann, - [0, ['Sync']]) # Write sync label. + self.putx([0, ['Sync']]) # Write sync label. self.reset() # Reset and wait for next set of pulses. self.state = 'DECODE_TIMEOUT' if not self.state == 'DECODE_TIMEOUT': |