diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2017-01-15 11:12:13 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2017-01-18 12:38:24 +0100 |
commit | 1153584350aeba4a58aa5bd54aeb2fcd33126c22 (patch) | |
tree | 92a93c0d56775fc49bb5d94a57410fd7e71871f3 /decoders | |
parent | d9135fe1d8982160e2b8283120a07ade7b9e0566 (diff) | |
download | libsigrokdecode-1153584350aeba4a58aa5bd54aeb2fcd33126c22.tar.gz libsigrokdecode-1153584350aeba4a58aa5bd54aeb2fcd33126c22.zip |
sdcard_sd: Convert to PD API version 3
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/sdcard_sd/pd.py | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/decoders/sdcard_sd/pd.py b/decoders/sdcard_sd/pd.py index 8743a19..02e78d7 100644 --- a/decoders/sdcard_sd/pd.py +++ b/decoders/sdcard_sd/pd.py @@ -21,7 +21,7 @@ import sigrokdecode as srd from common.sdcard import (cmd_names, acmd_names, accepted_voltages, card_status, sd_status) class Decoder(srd.Decoder): - api_version = 2 + api_version = 3 id = 'sdcard_sd' name = 'SD card (SD mode)' longname = 'Secure Digital card (SD mode)' @@ -63,8 +63,6 @@ class Decoder(srd.Decoder): def __init__(self): self.state = 'GET COMMAND TOKEN' self.token = [] - self.oldpins = None - self.oldclk = 0 self.is_acmd = False # Indicates CMD vs. ACMD self.cmd = None self.arg = None @@ -403,19 +401,10 @@ class Decoder(srd.Decoder): self.token, self.state = [], 'GET COMMAND TOKEN' - def decode(self, ss, es, data): - for (self.samplenum, pins) in data: - - # Ignore identical samples early on (for performance reasons). - if self.oldpins == pins: - continue - self.oldpins, (cmd, clk, dat0, dat1, dat2, dat3) = pins, pins - + def decode(self): + while True: # Wait for a rising CLK edge. - if not (self.oldclk == 0 and clk == 1): - self.oldclk = clk - continue - self.oldclk = clk + (cmd, clk, dat0, dat1, dat2, dat3) = self.wait({1: 'r'}) # State machine. if self.state == 'GET COMMAND TOKEN': |