From: Jens Steinhauser Date: Sun, 19 Oct 2014 19:29:07 +0000 (+0200) Subject: nrf24l01: Don't decode incomplete commands. X-Git-Tag: libsigrokdecode-0.4.0~149 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=22630a3d54361f083877a68724e8b823d5e063a7;p=libsigrokdecode.git nrf24l01: Don't decode incomplete commands. Wait for the CS# line to be inactive before decoding the commands. --- diff --git a/decoders/nrf24l01/pd.py b/decoders/nrf24l01/pd.py index a40f454..38e5ac6 100644 --- a/decoders/nrf24l01/pd.py +++ b/decoders/nrf24l01/pd.py @@ -87,6 +87,7 @@ class Decoder(srd.Decoder): def __init__(self, **kwargs): self.next() self.requirements_met = True + self.cs_was_released = False def start(self): self.out_ann = self.register(srd.OUTPUT_ANN) @@ -275,6 +276,8 @@ class Decoder(srd.Decoder): if data2 == -1: self.requirements_met = False raise ChannelError('CS# pin required.') + elif data2 == 1: + self.cs_was_released = True if data1 == 0 and data2 == 1: # Rising edge, the complete command is transmitted, process @@ -288,7 +291,8 @@ class Decoder(srd.Decoder): self.finish_command((self.mb_s, self.mb_e)) self.next() - elif ptype == 'DATA': + self.cs_was_released = True + elif ptype == 'DATA' and self.cs_was_released: mosi, miso = data1, data2 pos = (ss, es)