Implementation example AN2739
14/26
● I2S_CODEC_Play function
This function starts playing the audio file from a programmable position.
● I2S_CODEC_ControlVolume function
This function controls the digital volume level in accordance with the input parameters
(increases, decreases or sets a volume level).
Table 6. I2S_CODEC_Play function
Function name I2S_CODEC_Play
Prototype u32 I2S_CODEC_Play(u32 AudioStartPosition)
Behavior description
Sets the memory read address to AudioStartPosition and enables the I
2
S
interrupt to begin sending audio data to the codec. (Update the status of
the current audio file to playing).
Input parameter
AudioStartPosition: first address of the audio data to be played in the
current stream (relatively to the audio file, after the end of the audio file
header, and not relatively to the memory).
Output parameter None
Required preconditions None
Called functions None.
Table 7. I2S_CODEC_ControlVolume function
Function name I2S_CODEC_ControlVolume
Prototype u32 I2S_CODEC_ControlVolume(u32 direction, u8 volume)
Behavior description
Depending on the direction value, increases, decreases or sets a volume
level defined by the volume variable.
Input parameter
– direction: VolumeDirection_HIGH or VolumeDirection_LOW,
respectively to increment/decrement the current volume by a step:
“volume” value. Or VolumeDirection_LEVEL to set the volume value
to “volume“.
– volume: any step value (from 0xFF and 0x01) or any level value from
0xFF (Mute) and 0x00 (Max volume)
Output parameter None
Required preconditions None
Called functions None.