implement duplex I2S, add TE EP-2350 ting board def#11136
Conversation
tannewt
left a comment
There was a problem hiding this comment.
One question about the term "follower".
| //| :param ~microcontroller.Pin main_clock: The main clock pin | ||
| //| :param bool left_justified: True when data bits are aligned with the word select clock. False | ||
| //| when they are shifted by one to match classic I2S protocol. | ||
| //| :param bool clock_follower: True when this object follows an externally supplied clock: |
There was a problem hiding this comment.
Where does the term "follower" come from? I'm happy to avoid "master" and "slave" but maybe external_clock would be simpler.
There was a problem hiding this comment.
I did not take "follower" from any specific place. I actually did call this argument external_clock at first but ended up changing it. The NAU88L21 datasheet makes references to "internal clock" in a different context than what this argument is for if I understand it correctly. The CODEC can have the system clock set directly by MCLK or generated from a frequency locked loop FLL on MCLK, BCLK, or FS, and uses "internal clock" during sections of the datasheet detailing the operation.
I thought using external_clock for the argument name and the terms "external clock mode", "internal clock mode" might give someone the false impression that it was as in relation or opposite to the "internal clock" referenced in the datasheet.
I can change it back if you think external_clock is more clear.
I2S duplex supported by new argument
clock_followerforI2SOutandI2SIn. Defaults toFalsemeaning the object will be in "clock source" mode. Set it toTruefor "clock follower" mode. The NAU88L21 datasheet, and perhaps others, refer to these as master and slave modes. I changed them to follow the precedent set with I2C and aimed for the most descriptive names I could think of.This driver utilizes the new functionality: https://github.com/adafruit/Adafruit_CircuitPython_NAU88L21, all testing was performed with this and earlier versions of it.
The passthrough example shows the full API usage: https://github.com/adafruit/Adafruit_CircuitPython_NAU88L21/blob/main/examples/nau88l21_passthrough.py It uses I2SOut as the source and I2SIn as the follower.
I2SIn also gets a new argument
invert_bit_clockfor clock follower mode if the external clock drives data on the rising edge. And a new propertyoverflowa flag that can be checked to determine if samples where dropped.The new I2S functionality is only implemented in the rpi port currently.
Other changes in this PR: