]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/onewire_network/pd.py
onewire_network: add a missing 'Resume ROM' command
[libsigrokdecode.git] / decoders / onewire_network / pd.py
index fca16dae272de10d9830d90bd6fc8d44fe3403fc..c31d5f96b2e66aa67d86fb7518bc407587dec312 100644 (file)
@@ -29,10 +29,11 @@ command = {
     0xec: ['Conditional search ROM', 'SEARCH ROM'],
     0x3c: ['Overdrive skip ROM'    , 'TRANSPORT' ],
     0x69: ['Overdrive match ROM'   , 'GET ROM'   ],
+    0xa5: ['Resume'                , 'TRANSPORT' ],
 }
 
 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)'
@@ -40,11 +41,15 @@ class Decoder(srd.Decoder):
     license = 'gplv2+'
     inputs = ['onewire_link']
     outputs = ['onewire_network']
+    tags = ['Embedded/industrial']
     annotations = (
         ('text', 'Human-readable text'),
     )
 
     def __init__(self):
+        self.reset()
+
+    def reset(self):
         self.ss_block = 0
         self.es_block = 0
         self.state = 'COMMAND'
@@ -129,7 +134,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