X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fmxc6225xu%2Fpd.py;h=832eb06d61092d0f8a27a2bbf9e3a2dcc512b336;hb=991c44f33a55733610f6d9da1efbcc5bf1074dee;hp=c1a2a810a9a3d560b6b78df94ecda135b19be41d;hpb=da9bcbd9f45b0153465c55ec726a0d76f6d7f01e;p=libsigrokdecode.git diff --git a/decoders/mxc6225xu/pd.py b/decoders/mxc6225xu/pd.py index c1a2a81..832eb06 100644 --- a/decoders/mxc6225xu/pd.py +++ b/decoders/mxc6225xu/pd.py @@ -60,7 +60,7 @@ status = { } class Decoder(srd.Decoder): - api_version = 1 + api_version = 2 id = 'mxc6225xu' name = 'MXC6225XU' longname = 'MEMSIC MXC6225XU' @@ -68,18 +68,14 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['i2c'] outputs = ['mxc6225xu'] - optional_probes = ( - {'id': 'int', 'name': 'INT', 'desc': 'DTOS interrupt output pin'}, - ) annotations = ( ('text', 'Human-readable text'), ) - def __init__(self, **kwargs): + def __init__(self): self.state = 'IDLE' def start(self): - # self.out_python = self.register(srd.OUTPUT_PYTHON) self.out_ann = self.register(srd.OUTPUT_ANN) def putx(self, data): @@ -101,7 +97,7 @@ class Decoder(srd.Decoder): # Bits[7:7]: INT int_val = (b >> 7) & 1 s = 'unchanged and no' if (int_val == 0) else 'changed or' - ann = 'INT = %d: Orientation %s shake event occured\n' % (int_val, s) + ann = 'INT = %d: Orientation %s shake event occurred\n' % (int_val, s) # Bits[6:5]: SH[1:0] sh = (((b >> 6) & 1) << 1) | ((b >> 5) & 1) @@ -169,7 +165,6 @@ class Decoder(srd.Decoder): if cmd != 'START': return self.state = 'GET SLAVE ADDR' - self.block_start_sample = ss elif self.state == 'GET SLAVE ADDR': # Wait for an address write operation. # TODO: We should only handle packets to the slave(?) @@ -217,6 +212,3 @@ class Decoder(srd.Decoder): self.state = 'IDLE' else: pass # TODO? - else: - raise Exception('Invalid state: %s' % self.state) -