X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=decoders%2Fmxc6225xu%2Fpd.py;h=c1a2a810a9a3d560b6b78df94ecda135b19be41d;hb=3a851e5c7ba119cea6e8604a3f3e7ac27c80f536;hp=39564a957f1e4d0ea4557c9316f82060d2eae704;hpb=24c74fd30fb161837c5f8b01baf3c0fe2dfa4ed5;p=libsigrokdecode.git diff --git a/decoders/mxc6225xu/pd.py b/decoders/mxc6225xu/pd.py index 39564a9..c1a2a81 100644 --- a/decoders/mxc6225xu/pd.py +++ b/decoders/mxc6225xu/pd.py @@ -1,5 +1,5 @@ ## -## This file is part of the sigrok project. +## This file is part of the libsigrokdecode project. ## ## Copyright (C) 2012 Uwe Hermann ## @@ -18,8 +18,6 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## -# MEMSIC MXC6225XU protocol decoder - import sigrokdecode as srd # Definitions of various bits in MXC6225XU registers. @@ -70,24 +68,19 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['i2c'] outputs = ['mxc6225xu'] - probes = [] - optional_probes = [ + optional_probes = ( {'id': 'int', 'name': 'INT', 'desc': 'DTOS interrupt output pin'}, - ] - options = {} - annotations = [ - ['Text', 'Human-readable text'], - ] + ) + annotations = ( + ('text', 'Human-readable text'), + ) def __init__(self, **kwargs): self.state = 'IDLE' - def start(self, metadata): - # self.out_proto = self.add(srd.OUTPUT_PROTO, 'mxc6225xu') - self.out_ann = self.add(srd.OUTPUT_ANN, 'mxc6225xu') - - def report(self): - pass + def start(self): + # self.out_python = self.register(srd.OUTPUT_PYTHON) + self.out_ann = self.register(srd.OUTPUT_ANN) def putx(self, data): self.put(self.ss, self.es, self.out_ann, data) @@ -167,12 +160,12 @@ class Decoder(srd.Decoder): def decode(self, ss, es, data): cmd, databyte = data - # Store the start/end samples of this I2C packet. + # Store the start/end samples of this I²C packet. self.ss, self.es = ss, es # State machine. if self.state == 'IDLE': - # Wait for an I2C START condition. + # Wait for an I²C START condition. if cmd != 'START': return self.state = 'GET SLAVE ADDR' @@ -225,5 +218,5 @@ class Decoder(srd.Decoder): else: pass # TODO? else: - raise Exception('Invalid state: %d' % self.state) + raise Exception('Invalid state: %s' % self.state)