summaryrefslogtreecommitdiff
path: root/decoders/onewire_link
diff options
context:
space:
mode:
Diffstat (limited to 'decoders/onewire_link')
-rw-r--r--decoders/onewire_link/pd.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/decoders/onewire_link/pd.py b/decoders/onewire_link/pd.py
index 9503d15..93cd51a 100644
--- a/decoders/onewire_link/pd.py
+++ b/decoders/onewire_link/pd.py
@@ -20,6 +20,9 @@
import sigrokdecode as srd
+class SamplerateError(Exception):
+ pass
+
class Decoder(srd.Decoder):
api_version = 2
id = 'onewire_link'
@@ -185,8 +188,8 @@ class Decoder(srd.Decoder):
% (time_min*1000000, time_max*1000000)]])
def decode(self, ss, es, data):
- if self.samplerate is None:
- raise Exception("Cannot decode without samplerate.")
+ if not self.samplerate:
+ raise SamplerateError('Cannot decode without samplerate.')
for (self.samplenum, (owr, pwr)) in data:
# State machine.
if self.state == 'WAIT FOR FALLING EDGE':