summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
Diffstat (limited to 'decoders')
-rw-r--r--decoders/nrf24l01/pd.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/decoders/nrf24l01/pd.py b/decoders/nrf24l01/pd.py
index 99a7d6e..a40f454 100644
--- a/decoders/nrf24l01/pd.py
+++ b/decoders/nrf24l01/pd.py
@@ -86,6 +86,7 @@ class Decoder(srd.Decoder):
def __init__(self, **kwargs):
self.next()
+ self.requirements_met = True
def start(self):
self.out_ann = self.register(srd.OUTPUT_ANN)
@@ -264,9 +265,17 @@ class Decoder(srd.Decoder):
self.warn(pos, 'wrong data for "ACTIVATE" command')
def decode(self, ss, es, data):
+ if not self.requirements_met:
+ return
+
ptype, data1, data2 = data
if ptype == 'CS-CHANGE':
+ if data1 == -1:
+ if data2 == -1:
+ self.requirements_met = False
+ raise ChannelError('CS# pin required.')
+
if data1 == 0 and data2 == 1:
# Rising edge, the complete command is transmitted, process
# the bytes that were send after the command byte.
@@ -284,6 +293,7 @@ class Decoder(srd.Decoder):
pos = (ss, es)
if miso is None or mosi is None:
+ self.requirements_met = False
raise ChannelError('Both MISO and MOSI pins required.')
if self.first: