summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2017-06-16 16:17:50 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2017-06-16 16:17:50 +0200
commit6e333d9ef8495fd93b47ea856b0dbbdb5d33309e (patch)
treebe22d235de30115479f59c3b386c47bbe69392d4
parent7a85bbbe3391fc245014d03d5415048239c2e591 (diff)
downloadlibsigrokdecode-6e333d9ef8495fd93b47ea856b0dbbdb5d33309e.tar.gz
libsigrokdecode-6e333d9ef8495fd93b47ea856b0dbbdb5d33309e.zip
dsi: Cosmetics, drop obsolete comments.
-rw-r--r--decoders/dsi/pd.py25
1 files changed, 7 insertions, 18 deletions
diff --git a/decoders/dsi/pd.py b/decoders/dsi/pd.py
index f2ca4be..d049b9c 100644
--- a/decoders/dsi/pd.py
+++ b/decoders/dsi/pd.py
@@ -40,14 +40,14 @@ class Decoder(srd.Decoder):
)
annotations = (
('bit', 'Bit'),
- ('startbit', 'Startbit'),
- ('Level', 'Dimmer level'),
+ ('startbit', 'Start bit'),
+ ('level', 'Dimmer level'),
('raw', 'Raw data'),
)
annotation_rows = (
('bits', 'Bits', (0,)),
- ('raw', 'Raw Data',(3,)),
- ('fields', 'Fields', (1, 2,)),
+ ('raw', 'Raw data', (3,)),
+ ('fields', 'Fields', (1, 2)),
)
def __init__(self):
@@ -55,8 +55,6 @@ class Decoder(srd.Decoder):
self.samplenum = None
self.edges, self.bits, self.ss_es_bits = [], [], []
self.state = 'IDLE'
- self.nextSamplePoint = None
- self.nextSample = None
def start(self):
self.out_ann = self.register(srd.OUTPUT_ANN)
@@ -108,10 +106,9 @@ class Decoder(srd.Decoder):
def decode(self, ss, es, data):
if not self.samplerate:
raise SamplerateError('Cannot decode without samplerate.')
- bit = 0;
+ bit = 0
for (self.samplenum, pins) in data:
self.dsi = pins[0]
- # data.itercnt += 1
if self.options['polarity'] == 'active-high':
self.dsi ^= 1 # Invert.
@@ -128,15 +125,9 @@ class Decoder(srd.Decoder):
self.state = 'PHASE1'
self.old_dsi = self.dsi
# Get the next sample point.
- # self.nextSamplePoint = self.samplenum + int(self.halfbit / 2)
self.old_dsi = self.dsi
- # bit = self.dsi
continue
- # if(self.samplenum == self.nextSamplePoint):
- # bit = self.dsi
- # continue
-
if self.old_dsi != self.dsi:
self.edges.append(self.samplenum)
elif self.samplenum == (self.edges[-1] + int(self.halfbit * 1.5)):
@@ -149,9 +140,9 @@ class Decoder(srd.Decoder):
self.phase0 = bit
self.state = 'PHASE1'
elif self.state == 'PHASE1':
- if (bit == 1) and (self.phase0 == 1): # Stop bit
+ if (bit == 1) and (self.phase0 == 1): # Stop bit.
if len(self.bits) == 17 or len(self.bits) == 9:
- # Forward or Backward
+ # Forward or Backward.
self.handle_bits(len(self.bits))
self.reset_decoder_state() # Reset upon errors.
continue
@@ -159,6 +150,4 @@ class Decoder(srd.Decoder):
self.bits.append([self.edges[-3], bit])
self.state = 'PHASE0'
- # self.nextSamplePoint = self.edges[-1] + int(self.halfbit / 2)
-
self.old_dsi = self.dsi