summaryrefslogtreecommitdiff
path: root/decoders/nrf24l01
diff options
context:
space:
mode:
authorJens Steinhauser <jens.steinhauser@gmail.com>2014-10-19 21:29:07 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2014-10-19 23:01:26 +0200
commit22630a3d54361f083877a68724e8b823d5e063a7 (patch)
tree57bc1f795d1df909f39d9533a219c9d953381323 /decoders/nrf24l01
parent3cc4c4a96dba8390ec4eabbd62cc1d50d653640e (diff)
downloadlibsigrokdecode-22630a3d54361f083877a68724e8b823d5e063a7.tar.gz
libsigrokdecode-22630a3d54361f083877a68724e8b823d5e063a7.zip
nrf24l01: Don't decode incomplete commands.
Wait for the CS# line to be inactive before decoding the commands.
Diffstat (limited to 'decoders/nrf24l01')
-rw-r--r--decoders/nrf24l01/pd.py6
1 files changed, 5 insertions, 1 deletions
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)