X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fmxc6225xu%2Fpd.py;h=1e9045519c90ce41bfecef1dd3b7ac8b9f7872d8;hb=d4d8ac2a005a091f23bf89cff2ff6fbfc8fcd739;hp=c506fb6619040776e8d79c37ff8783467af8ca04;hpb=e28f7aee3b96afeb543e0c3c29e3950ddd61a490;p=libsigrokdecode.git diff --git a/decoders/mxc6225xu/pd.py b/decoders/mxc6225xu/pd.py index c506fb6..1e90455 100644 --- a/decoders/mxc6225xu/pd.py +++ b/decoders/mxc6225xu/pd.py @@ -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 . ## import sigrokdecode as srd @@ -60,7 +59,7 @@ status = { } class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'mxc6225xu' name = 'MXC6225XU' longname = 'MEMSIC MXC6225XU' @@ -72,7 +71,10 @@ class Decoder(srd.Decoder): ('text', 'Human-readable text'), ) - def __init__(self, **kwargs): + def __init__(self): + self.reset() + + def reset(self): self.state = 'IDLE' def start(self): @@ -97,7 +99,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) @@ -165,7 +167,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(?) @@ -213,4 +214,3 @@ class Decoder(srd.Decoder): self.state = 'IDLE' else: pass # TODO? -