summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Thiele <stephan.thiele@mailbox.org>2019-04-17 20:04:22 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2019-10-06 23:38:45 +0200
commit2d9e1115baa6a5806e4ecfa435cc06395afc2337 (patch)
treeeeaf75db8078d44b6627658f845cc7fd39aea454
parent6c890c087168b929a3017613b6ebfb7822a4f0fa (diff)
downloadlibsigrokdecode-2d9e1115baa6a5806e4ecfa435cc06395afc2337.tar.gz
libsigrokdecode-2d9e1115baa6a5806e4ecfa435cc06395afc2337.zip
can: introduce fast bitrate
-rw-r--r--decoders/can/pd.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/decoders/can/pd.py b/decoders/can/pd.py
index 8c417fd..5d27b28 100644
--- a/decoders/can/pd.py
+++ b/decoders/can/pd.py
@@ -37,7 +37,8 @@ class Decoder(srd.Decoder):
{'id': 'can_rx', 'name': 'CAN RX', 'desc': 'CAN bus line'},
)
options = (
- {'id': 'bitrate', 'desc': 'Bitrate (bits/s)', 'default': 1000000},
+ {'id': 'nominal_bitrate', 'desc': 'Nominal Bitrate (bits/s)', 'default': 1000000},
+ {'id': 'fast_bitrate', 'desc': 'Fast Bitrate (bits/s)', 'default': 2000000},
{'id': 'sample_point', 'desc': 'Sample point (%)', 'default': 70.0},
)
annotations = (
@@ -82,7 +83,7 @@ class Decoder(srd.Decoder):
def metadata(self, key, value):
if key == srd.SRD_CONF_SAMPLERATE:
self.samplerate = value
- self.bit_width = float(self.samplerate) / float(self.options['bitrate'])
+ self.bit_width = float(self.samplerate) / float(self.options['nominal_bitrate'])
self.sample_point = (self.bit_width / 100.0) * self.options['sample_point']
# Generic helper for CAN bit annotations.