summaryrefslogtreecommitdiff
path: root/decoders/can
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2017-07-02 12:23:09 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2017-07-04 12:01:04 +0200
commit300f9194250913babbd57d5eccc2ceccf9010785 (patch)
treef0b2331a6f4274f307fa089a8164b76e223289b0 /decoders/can
parent8a9f60b1a24de32bb4170b927637655ef19de77b (diff)
downloadlibsigrokdecode-300f9194250913babbd57d5eccc2ceccf9010785.tar.gz
libsigrokdecode-300f9194250913babbd57d5eccc2ceccf9010785.zip
can: rename 'bitpos' variable
Consistently use .sample_point for the member variable that corresponds to the 'sample_point' property. Use 'samplenum' in .get_sample_point() to reflect that the routine returns a sample number. This eliminates the 'bitpos' identifier which was used for two different things.
Diffstat (limited to 'decoders/can')
-rw-r--r--decoders/can/pd.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/decoders/can/pd.py b/decoders/can/pd.py
index 375069f..6904ed9 100644
--- a/decoders/can/pd.py
+++ b/decoders/can/pd.py
@@ -75,11 +75,11 @@ class Decoder(srd.Decoder):
if key == srd.SRD_CONF_SAMPLERATE:
self.samplerate = value
self.bit_width = float(self.samplerate) / float(self.options['bitrate'])
- self.bitpos = (self.bit_width / 100.0) * self.options['sample_point']
+ self.sample_point = (self.bit_width / 100.0) * self.options['sample_point']
# Generic helper for CAN bit annotations.
def putg(self, ss, es, data):
- left, right = int(self.bitpos), int(self.bit_width - self.bitpos)
+ left, right = int(self.sample_point), int(self.bit_width - self.sample_point)
self.put(ss - left, es + right, self.out_ann, data)
# Single-CAN-bit annotation using the current samplenum.
@@ -107,8 +107,8 @@ class Decoder(srd.Decoder):
# Determine the position of the next desired bit's sample point.
def get_sample_point(self, bitnum):
- bitpos = int(self.sof + (self.bit_width * bitnum) + self.bitpos)
- return bitpos
+ samplenum = int(self.sof + (self.bit_width * bitnum) + self.sample_point)
+ return samplenum
def is_stuff_bit(self):
# CAN uses NRZ encoding and bit stuffing.