]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/rfm12/pd.py
all decoders: introduce a reset() method
[libsigrokdecode.git] / decoders / rfm12 / pd.py
index 30653838629495f8dc3cecf8c6cf5637b460489b..e709696c9ef7fbbc28fc3c86cd2b17126875cd7d 100644 (file)
 ## 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 <http://www.gnu.org/licenses/>.
 ##
 
 import sigrokdecode as srd
 
 class Decoder(srd.Decoder):
-    api_version = 2
+    api_version = 3
     id = 'rfm12'
     name = 'RFM12'
     longname = 'RFM12 control protocol'
@@ -43,7 +42,10 @@ class Decoder(srd.Decoder):
         ('interpretation', 'Interpretation', (5,)),
     )
 
-    def __init__(self, **kwargs):
+    def __init__(self):
+        self.reset()
+
+    def reset(self):
         self.mosi_bytes, self.miso_bytes = [], []
         self.mosi_bits, self.miso_bits = [], []
         self.row_pos = [0, 0, 0]
@@ -460,7 +462,7 @@ class Decoder(srd.Decoder):
         else:
             c = '%02x %02x' % tuple(cmd)
             r = '%02x %02x' % tuple(ret)
-            self.putx(0, 16, ['Uknown command: %s (reply: %s)!' % (c, r)])
+            self.putx(0, 16, ['Unknown command: %s (reply: %s)!' % (c, r)])
 
     def decode(self, ss, es, data):
         ptype, mosi, miso = data