X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fonewire_network%2Fpd.py;h=5d850b5897abc5912843d20d5c2dc27335391dba;hb=3f3c4614b551855d7cf56e83ec7fb883592050ab;hp=bddc4a8434246d12cbef28623c19ab191be57350;hpb=486b19ce017c6663be6574dacd0c823304903bca;p=libsigrokdecode.git diff --git a/decoders/onewire_network/pd.py b/decoders/onewire_network/pd.py index bddc4a8..5d850b5 100644 --- a/decoders/onewire_network/pd.py +++ b/decoders/onewire_network/pd.py @@ -14,8 +14,7 @@ ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## along with this program; if not, see . ## import sigrokdecode as srd @@ -33,7 +32,7 @@ command = { } class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'onewire_network' name = '1-Wire network layer' longname = '1-Wire serial communication bus (network layer)' @@ -45,7 +44,10 @@ class Decoder(srd.Decoder): ('text', 'Human-readable text'), ) - def __init__(self, **kwargs): + def __init__(self): + self.reset() + + def reset(self): self.ss_block = 0 self.es_block = 0 self.state = 'COMMAND' @@ -130,7 +132,7 @@ class Decoder(srd.Decoder): # Data collector. def onewire_collect(self, length, val, ss, es): # Storing the sample this sequence begins with. - if self.bit_cnt == 1: + if self.bit_cnt == 0: self.ss_block = ss self.data = self.data & ~(1 << self.bit_cnt) | (val << self.bit_cnt) self.bit_cnt += 1