Skip to content

Commit

Permalink
i2s: Fix 2 issues.
Browse files Browse the repository at this point in the history
1. WS = 0, Left Channel; WS = 1, Right Channel
2. Data start and end at falling edge of SCK
  • Loading branch information
waveletboy committed Nov 21, 2018
1 parent 2eb6af3 commit c78c8f6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions decoders/i2s/pd.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,12 @@ def decode(self):

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),
Expand All @@ -161,6 +163,8 @@ def decode(self):
'word' % (self.bitcount, self.wordlength)]])

self.wordlength = self.bitcount
else:
sck = self.wait({0: 'f'})

# Reset decoder state.
self.data = 0
Expand Down

0 comments on commit c78c8f6

Please sign in to comment.