diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2012-01-25 22:11:38 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2012-01-25 23:49:32 +0100 |
commit | decde15ecb51b3326b31019af61e0a729b9c61d0 (patch) | |
tree | 362aefd1a9759731bdf8ee2cc3d533c83a7faa9a /decoders/i2c | |
parent | 385508e9b12d87519f9144a67e7682b46a592200 (diff) | |
download | libsigrokdecode-decde15ecb51b3326b31019af61e0a729b9c61d0.tar.gz libsigrokdecode-decde15ecb51b3326b31019af61e0a729b9c61d0.zip |
srd: All PDs: Various fixes, cosmetics.
- List all API methods and metadata variables in all PDs to make things
easier and more consistent for new PD writers.
- Fix probe assignment in a few PDs.
- Raise exceptions upon invalid states of the PD state machines (bug).
Diffstat (limited to 'decoders/i2c')
-rw-r--r-- | decoders/i2c/i2c.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/decoders/i2c/i2c.py b/decoders/i2c/i2c.py index 4352c36..816fd79 100644 --- a/decoders/i2c/i2c.py +++ b/decoders/i2c/i2c.py @@ -129,6 +129,7 @@ class Decoder(srd.Decoder): {'id': 'scl', 'name': 'SCL', 'desc': 'Serial clock line'}, {'id': 'sda', 'name': 'SDA', 'desc': 'Serial data line'}, ] + extra_probes = [] options = { 'addressing': ['Slave addressing (in bits)', 7], # 7 or 10 } @@ -158,6 +159,9 @@ class Decoder(srd.Decoder): self.out_proto = self.add(srd.OUTPUT_PROTO, 'i2c') self.out_ann = self.add(srd.OUTPUT_ANN, 'i2c') + def report(self): + pass + def is_start_condition(self, scl, sda): # START condition (S): SDA = falling, SCL = high if (self.oldsda == 1 and sda == 0) and scl == 1: @@ -290,8 +294,7 @@ class Decoder(srd.Decoder): elif self.is_stop_condition(scl, sda): self.found_stop(scl, sda) else: - # Shouldn't happen. - raise Exception("unknown state %d" % self.STATE) + raise Exception('Invalid state %d' % self.STATE) # Save current SDA/SCL values for the next round. self.oldscl = scl |