diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2017-01-15 10:50:46 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2017-01-18 12:38:23 +0100 |
commit | 00177e99094dc8a186238c12ee205cac105f9108 (patch) | |
tree | 3fbf66ddf60b05c50c32afd2a30fd74283e9ef3c /decoders | |
parent | d47dd3d900f96d831b5f9c9f87d9b9c941a1777e (diff) | |
download | libsigrokdecode-00177e99094dc8a186238c12ee205cac105f9108.tar.gz libsigrokdecode-00177e99094dc8a186238c12ee205cac105f9108.zip |
mdio: Convert to PD API version 3
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/mdio/pd.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/decoders/mdio/pd.py b/decoders/mdio/pd.py index 873079a..ed6cfef 100644 --- a/decoders/mdio/pd.py +++ b/decoders/mdio/pd.py @@ -29,7 +29,7 @@ import sigrokdecode as srd class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'mdio' name = 'MDIO' longname = 'Management Data Input/Output' @@ -62,7 +62,7 @@ class Decoder(srd.Decoder): ) def __init__(self): - self.last_mdc = 1 + self.initial_pins = [1, 1] self.illegal_bus = 0 self.samplenum = -1 self.clause45_addr = -1 # Clause 45 is context sensitive. @@ -317,14 +317,8 @@ class Decoder(srd.Decoder): self.process_state(self.state, mdio) - def decode(self, ss, es, data): - for (self.samplenum, pins) in data: - # Ignore identical samples early on (for performance reasons). - if self.last_mdc == pins[0]: - continue - self.last_mdc = pins[0] - if pins[0] == 0: # Check for rising edge. - continue - - # Found the correct clock edge, now get/handle the bit(s). + def decode(self): + while True: + # Process pin state upon rising MDC edge. + pins = self.wait({0: 'r'}) self.handle_bit(pins[1]) |