summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
Diffstat (limited to 'decoders')
-rw-r--r--decoders/ir_rc5/pd.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/decoders/ir_rc5/pd.py b/decoders/ir_rc5/pd.py
index e18a90b..e1c47b6 100644
--- a/decoders/ir_rc5/pd.py
+++ b/decoders/ir_rc5/pd.py
@@ -67,7 +67,7 @@ class Decoder(srd.Decoder):
def start(self):
self.out_ann = self.register(srd.OUTPUT_ANN)
- self.old_ir = 1 if self.options['polarity'] == 'active-low' else 0
+ self.next_edge = 'l' if self.options['polarity'] == 'active-low' else 'h'
def metadata(self, key, value):
if key == srd.SRD_CONF_SAMPLERATE:
@@ -143,11 +143,7 @@ class Decoder(srd.Decoder):
raise SamplerateError('Cannot decode without samplerate.')
while True:
- (self.ir,) = self.wait()
-
- # Wait for any edge (rising or falling).
- if self.old_ir == self.ir:
- continue
+ (self.ir,) = self.wait({0: self.next_edge})
# State machine.
if self.state == 'IDLE':
@@ -155,7 +151,7 @@ class Decoder(srd.Decoder):
self.edges.append(self.samplenum)
self.bits.append([self.samplenum, bit])
self.state = 'MID1'
- self.old_ir = self.ir
+ self.next_edge = 'l' if self.ir else 'h'
continue
edge = self.edge_type()
if edge == 'e':
@@ -184,4 +180,4 @@ class Decoder(srd.Decoder):
self.handle_bits()
self.reset_decoder_state()
- self.old_ir = self.ir
+ self.next_edge = 'l' if self.ir else 'h'