]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/adns5020/pd.py
all decoders: introduce a reset() method
[libsigrokdecode.git] / decoders / adns5020 / pd.py
index ccb83d49a387678f09f0d7e68f20bff2a992ae39..55f6853b0099921e739f6b8490928b44749e493f 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
 ##
 
 import sigrokdecode as srd
@@ -40,12 +39,12 @@ regs = {
 }
 
 class Decoder(srd.Decoder):
-    api_version = 2
+    api_version = 3
     id = 'adns5020'
     name = 'ADNS-5020'
     longname = 'Avago ADNS-5020 optical mouse sensor'
     desc = 'Bidirectional command and data over an SPI-like protocol.'
-    license = 'gplv2'
+    license = 'gplv2+'
     inputs = ['spi']
     outputs = ['adns5020']
     annotations = (
@@ -59,7 +58,10 @@ class Decoder(srd.Decoder):
         ('warnings', 'Warnings', (2,)),
     )
 
-    def __init__(self, **kwargs):
+    def __init__(self):
+        self.reset()
+
+    def reset(self):
         self.ss_cmd, self.es_cmd = 0, 0
         self.mosi_bytes = []
 
@@ -106,8 +108,8 @@ class Decoder(srd.Decoder):
         if reg > 0x63:
             reg_desc = 'Unknown'
         if write:
-            self.putx([1, ['%s=>%#x' % (reg_desc, arg)]])
+            self.putx([1, ['%s%#x' % (reg_desc, arg)]])
         else:
-            self.putx([0, ['%s<=%d' % (reg_desc, arg)]])
+            self.putx([0, ['%s%d' % (reg_desc, arg)]])
 
         self.mosi_bytes = []