diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2014-03-07 20:17:00 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2014-03-10 15:39:33 +0100 |
commit | 5bb61a25d31c4c32f5109c38d7fd31c9e0d2c441 (patch) | |
tree | 7e46d0e7147e29c58c068099ce1ceb7ffb54ea76 /decoders | |
parent | 70835fd4d2dcf2c67e2448b73f0b7008ddf9fe29 (diff) | |
download | libsigrokdecode-5bb61a25d31c4c32f5109c38d7fd31c9e0d2c441.tar.gz libsigrokdecode-5bb61a25d31c4c32f5109c38d7fd31c9e0d2c441.zip |
ir_nec: Addresses and commands are transmitted LSB-first.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/ir_nec/pd.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/decoders/ir_nec/pd.py b/decoders/ir_nec/pd.py index 8a41a87..1368e41 100644 --- a/decoders/ir_nec/pd.py +++ b/decoders/ir_nec/pd.py @@ -104,14 +104,14 @@ class Decoder(srd.Decoder): self.stop = int(self.samplerate * 0.000652) - 1 # 0.652ms def handle_bit(self, tick): - ret = 0xff + ret = None if tick in range(self.dazero - self.margin, self.dazero + self.margin): ret = 0 elif tick in range(self.daone - self.margin, self.daone + self.margin): ret = 1 - if ret < 2: + if ret in (0, 1): self.putb([0, ['%d' % ret]]) - self.data = self.data * 2 + ret + self.data |= (ret << self.count) # LSB-first self.count = self.count + 1 self.ss_bit = self.samplenum @@ -122,7 +122,7 @@ class Decoder(srd.Decoder): self.ss_start = self.samplenum return True if ret == 0: - self.putd(self.data & 0xff) + self.putd(self.data >> 8) else: self.putx([11, ['%s error: 0x%04X' % (name, self.data)]]) self.data = self.count = 0 |