I2S_Codec_Init Function; Table 2 - ST STM32F103 Series Application Note

How to use the high-density microcontroller to play audio files with an external i2s audio codec
Hide thumbs Also See for STM32F103 Series:
Table of Contents

Advertisement

Implementation example

Table 2.

Function name
I2S_CODEC_ForwardPlay
I2S_CODEC_RewindPlay
Only the most relevant functions will be detailed in the following sections.

I2S_CODEC_Init function

This function implements all the needed initialization for the I
memory interfaces and peripherals.
Table 3.
Function name
Prototype
Behavior description
Input parameters
Output parameter
Return value
Required preconditions None
Called functions
This function calls some subfunctions related to each component:
12/26
I2S_CODEC driver high-level functions (continued)
Increments the audio file pointer by a fixed step (percentage of the
file length) then continues playing.
Decrements the audio file pointer by a fixed step (percentage of
the file length) then continues playing.
I2S_CODEC_Init function
u32 I2S_CODEC_Init(u32 OutputDevice, u32 Address)
Initializes the I
audio file.
OutputDevice: used to set the output device, can be:
– OutputDevice_SPEAKER
– OutputDevice_HEADPHONE
Address: specifies the address of the audio file.
None
– 0: if all initializations were successful
– 1: Memory initialization failure
– 2: Audio file failure (wrong file or wrong format)
2
– 3: I
C communication failure
NVIC_Config, GPIO_Config, AudioFile_Init, I2S_Config,
CODEC_Config
NVIC_Config: Configures the I
GPIO_Config: Configures the I
AudioFile_Init: Initializes the memory then reads the audio file header,
checks if it is compliant with the supported audio format and sets the related
parameters (audio file length and frequency) used to configure the other
peripherals.
I2S_Config: Configures the I
parameters. Standard and MCLK output are configured using two constants:
and
I2S_STANDARD
I2S_MCLKOUTPUT
CODEC_Config: Configures the codec using the same configuration parameters
as I2S_Config, and using the OutputDevice input parameter (from
I2S_CODEC_Init), that is either OutputDevice_SPEAKER or
OutputDevice_HEADPHONE. The digital volume is set at a default level defined in
the i2s_codec.h file as DEFAULT_VOL.
Description
I2S_CODEC_Init
2
2
S and the I
C peripherals, the codec, the memory and the
2
S interrupt channel
2
2
S, I
C, memory- and codec-related GPIOs.
2
S peripheral according to the previous
, defined in the i2s_codec.c file.
AN2739
2
S, the codec and the

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F103 Series and is the answer not in the manual?

Questions and answers

Table of Contents