summaryrefslogtreecommitdiff
path: root/decoders/onewire_link
diff options
context:
space:
mode:
authorIztok Jeras <iztok.jeras@gmail.com>2012-07-10 23:14:35 +0200
committerIztok Jeras <iztok.jeras@gmail.com>2012-07-15 15:02:57 +0200
commit99f5f3b5ac31347795582872a5d92f3d9430c21d (patch)
tree2686e58cbceca8179ef5973a5600f1db2f79b874 /decoders/onewire_link
parent9cfb16e8532e34b40edf1d980c7438afb31668e0 (diff)
downloadlibsigrokdecode-99f5f3b5ac31347795582872a5d92f3d9430c21d.tar.gz
libsigrokdecode-99f5f3b5ac31347795582872a5d92f3d9430c21d.zip
onewire: the split of the protocol into layers works now
Diffstat (limited to 'decoders/onewire_link')
-rw-r--r--decoders/onewire_link/Makefile.am4
-rw-r--r--decoders/onewire_link/__init__.py2
-rw-r--r--decoders/onewire_link/onewire_link.py13
3 files changed, 9 insertions, 10 deletions
diff --git a/decoders/onewire_link/Makefile.am b/decoders/onewire_link/Makefile.am
index 17b3b04..b043eca 100644
--- a/decoders/onewire_link/Makefile.am
+++ b/decoders/onewire_link/Makefile.am
@@ -18,9 +18,9 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-pkgdatadir = $(DECODERS_DIR)/onewire
+pkgdatadir = $(DECODERS_DIR)/onewire_link
-dist_pkgdata_DATA = __init__.py onewire_link.py onewire_network.py
+dist_pkgdata_DATA = __init__.py onewire_link.py
CLEANFILES = *.pyc
diff --git a/decoders/onewire_link/__init__.py b/decoders/onewire_link/__init__.py
index 0a712ef..6eaeadd 100644
--- a/decoders/onewire_link/__init__.py
+++ b/decoders/onewire_link/__init__.py
@@ -74,5 +74,3 @@ TODO:
'''
from .onewire_link import *
-from .onewire_network import *
-
diff --git a/decoders/onewire_link/onewire_link.py b/decoders/onewire_link/onewire_link.py
index 3236f4d..44bc4f8 100644
--- a/decoders/onewire_link/onewire_link.py
+++ b/decoders/onewire_link/onewire_link.py
@@ -57,8 +57,9 @@ class Decoder(srd.Decoder):
self.state = 'WAIT FOR FALLING EDGE'
self.present = 0
self.bit = 0
+ self.bit_cnt = 0
+ self.command = 0
self.overdrive = 0
- self.cmd_cnt = 0
# Event timing variables
self.fall = 0
self.rise = 0
@@ -171,11 +172,11 @@ class Decoder(srd.Decoder):
if (self.bit): self.state = 'WAIT FOR FALLING EDGE'
else : self.state = 'WAIT FOR RISING EDGE'
self.put(self.fall, self.cnt_bit[self.overdrive], self.out_ann, [0, ['BIT: %01x' % self.bit]])
- self.put(self.out_proto, ['BIT', self.bit])
+ self.put(self.fall, self.cnt_bit[self.overdrive], self.out_proto, ['BIT', self.bit])
# Checking the first command to see if overdrive mode should be entered
- if (self.cmd_cnt <= 8):
- self.command = self.command | (self.bit << self.cmd_cnt)
- elif (self.cmd_cnt == 8):
+ if (self.bit_cnt <= 8):
+ self.command = self.command | (self.bit << self.bit_cnt)
+ elif (self.bit_cnt == 8):
if (self.command in [0x3c, 0x69]):
self.put(self.fall, self.cnt_bit[self.overdrive], self.out_ann, [0, ['ENTER OVERDRIVE MODE']])
# incrementing the bit counter
@@ -195,7 +196,7 @@ class Decoder(srd.Decoder):
# Exit overdrive mode
self.put(self.fall, self.cnt_bit[self.overdrive], self.out_ann, [0, ['EXIT OVERDRIVE MODE']])
self.overdrive = 0
- self.cmd_cnt = 0
+ self.bit_cnt = 0
self.command = 0
elif ((self.samplenum - self.fall > self.cnt_overdrive_reset) and (self.overdrive)):
# Save the sample number for the falling edge.