diff options
author | Weixiao Zhang <waveletboy@gmail.com> | 2018-11-20 21:41:45 -0600 |
---|---|---|
committer | Weixiao Zhang <waveletboy@gmail.com> | 2018-11-20 21:41:45 -0600 |
commit | c78c8f6faf51eb5fa66dd2ca94439b40ad1047b0 (patch) | |
tree | ab22361864c8966df09b38f9aef9c73bbfe99c29 /decoders/i2s | |
parent | 2eb6af30c323a8e3f692f1030f2726b661745f6d (diff) | |
download | libsigrokdecode-c78c8f6faf51eb5fa66dd2ca94439b40ad1047b0.tar.gz libsigrokdecode-c78c8f6faf51eb5fa66dd2ca94439b40ad1047b0.zip |
i2s: Fix 2 issues.
1. WS = 0, Left Channel; WS = 1, Right Channel
2. Data start and end at falling edge of SCK
Diffstat (limited to 'decoders/i2s')
-rw-r--r-- | decoders/i2s/pd.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/decoders/i2s/pd.py b/decoders/i2s/pd.py index bfb2c9e..e32fe6f 100644 --- a/decoders/i2s/pd.py +++ b/decoders/i2s/pd.py @@ -145,10 +145,12 @@ class Decoder(srd.Decoder): self.samplesreceived += 1 - idx = 0 if self.oldws else 1 - c1 = 'Left channel' if self.oldws else 'Right channel' - c2 = 'Left' if self.oldws else 'Right' - c3 = 'L' if self.oldws else 'R' + sck = self.wait({0: 'f'}) + + idx = 0 if not self.oldws else 1 + c1 = 'Left channel' if not self.oldws else 'Right channel' + c2 = 'Left' if not self.oldws else 'Right' + c3 = 'L' if not self.oldws else 'R' v = '%08x' % self.data self.putpb(['DATA', [c3, self.data]]) self.putb([idx, ['%s: %s' % (c1, v), '%s: %s' % (c2, v), @@ -161,6 +163,8 @@ class Decoder(srd.Decoder): 'word' % (self.bitcount, self.wordlength)]]) self.wordlength = self.bitcount + else: + sck = self.wait({0: 'f'}) # Reset decoder state. self.data = 0 |