AN2739 Implementation example
15/26
Medium-level functions
Medium-level functions are used to better control some basic functionality and the audio
stream. Ta ble 8 presents these functions.
Table 8. I2S_CODEC medium-level driver functions
Function name Description
I2S_CODEC_DataTransfer
Sends the audio data using the SPI2 peripheral and checks
the audio play status (if a (Pause/Stop) command is pending)
by calling the I2S_CODEC_UpdateStatus function.
This function should be called in the SPI2 TXE interrupt
subroutine when the interrupt mode is used.
I2S_CODEC_UpdateStatus
Checks if the current status (through a local variable:
AudioPlayStatus) is Playing, Paused or Stopped. If the
commanded status is Stopped or Paused the function
performs the requested command and updates the local
variables.
GetVar_DataStartAddr
Returns the current audio Data Start Address value for the
current stream (depends on the audio file type and the file
header length).
GetVar_AudioDataIndex
AudioDataIndex is the virtual audio data pointer for the audio
file being played. This function returns the current value of the
AudioDataIndex.
ResetVar_AudioDataIndex
Resets the AudioDataIndex to the current audio file Data Start
Address value.
IncrementVar_AudioDataIndex
Increments the AudioDataIndex of the current audio file by a
programmable value step (input of the function).
GetVar_AudioPlayStatus
Returns the current AudioPlayStatus variable value (Playing,
Stopped, Paused).