From 99f5f3b5ac31347795582872a5d92f3d9430c21d Mon Sep 17 00:00:00 2001 From: Iztok Jeras Date: Tue, 10 Jul 2012 23:14:35 +0200 Subject: onewire: the split of the protocol into layers works now --- decoders/onewire_link/Makefile.am | 4 ++-- decoders/onewire_link/__init__.py | 2 -- decoders/onewire_link/onewire_link.py | 13 +++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'decoders/onewire_link') 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. -- cgit v1.2.3-70-g09d2