Support for I2S Audio Protocol with different bit-depth, samplerate options Allows for master or slave, as well as freedom of selecting direction, and other behavior for each peripheral, and block.
DMA Transfer commands must use buffers located within non-cached memory or use cache maintenance To declare an unitialized global element in the DMA memory section: int32_t DSY_DMA_BUFFER_SECTOR my_buffer[96];
Callback functions will be called once per half of the buffer. In the above example, the callback function would be called once for every 48 samples.
Use SAI Handle like this:
SaiHandle::Config sai_config; sai_config.periph = SaiHandle::Config::Peripheral::SAI_1; sai_config.sr = SaiHandle::Config::SampleRate::SAI_48KHZ; sai_config.bit_depth = SaiHandle::Config::BitDepth::SAI_24BIT; sai_config.a_sync = SaiHandle::Config::Sync::MASTER; sai_config.b_sync = SaiHandle::Config::Sync::SLAVE; sai_config.a_dir = SaiHandle::Config::Direction::RECEIVE; sai_config.b_dir = SaiHandle::Config::Direction::TRANSMIT; sai_config.pin_config.fs = {DSY_GPIOE, 4}; sai_config.pin_config.mclk = {DSY_GPIOE, 2}; sai_config.pin_config.sck = {DSY_GPIOE, 5}; sai_config.pin_config.sa = {DSY_GPIOE, 6}; sai_config.pin_config.sb = {DSY_GPIOE, 3}; // Then Initialize SaiHandle sai; sai.Init(sai_config); // Now you can use it: sai.StartDma(. . .);
| void(*) daisy::SaiHandle::CallbackFunctionPtr(int32_t *in, int32_t *out, size_t size) |
Callback Function to be called when DMA transfer is complete and half complete. This callback is prepared however the data is transmitted/received from the device. For example, using an AK4556 the data will be interleaved 24bit MSB Justified
The hid/audio class will be allow for type conversions, de-interleaving, etc.