Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAI can be modeled like a UART in some regards where there are a Tx/Rx pair. Unlike a UART though SAI in iMXRT can have multiple data channels connected to the same peripheral. While each channel has its own fifo and pin they are still part of the same peripheral instance. Meaning the clock, status, FIFO watermark, and more are all the shared. This adds some complications. Use of the Tx and Rx together is also optional, its quite possible only Tx or Rx in use. So modeling this API requires some interesting use of generics, but in effect the Sai struct is a builder that enables building a SaiTx/SaiRx pair given pins and builder like options. From there a SaiTx/SaiRx need to provide functionality for writing frames of audio samples per channel in some sensible manner, catching events (interrupts) notifying of errors and FIFO watermarks perhaps, as well as in the end providing ideally a connection to an edma channel per tx and rx channel in use.
- Loading branch information