EasyManuals Logo

ST STM32F103 series Application Note

ST STM32F103 series
26 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #12 background imageLoading...
Page #12 background image
Implementation example AN2739
12/26
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
2
S, the codec and the
memory interfaces and peripherals.
This function calls some subfunctions related to each component:
NVIC_Config: Configures the I
2
S interrupt channel
GPIO_Config: Configures the I
2
S, I
2
C, memory- and codec-related GPIOs.
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
2
S peripheral according to the previous
parameters. Standard and MCLK output are configured using two constants:
I2S_STANDARD and I2S_MCLKOUTPUT, defined in the i2s_codec.c file.
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.
I2S_CODEC_ForwardPlay
Increments the audio file pointer by a fixed step (percentage of the
file length) then continues playing.
I2S_CODEC_RewindPlay
Decrements the audio file pointer by a fixed step (percentage of
the file length) then continues playing.
Table 3. I2S_CODEC_Init function
Function name I2S_CODEC_Init
Prototype u32 I2S_CODEC_Init(u32 OutputDevice, u32 Address)
Behavior description
Initializes the I
2
S and the I
2
C peripherals, the codec, the memory and the
audio file.
Input parameters
OutputDevice: used to set the output device, can be:
OutputDevice_SPEAKER
OutputDevice_HEADPHONE
Address: specifies the address of the audio file.
Output parameter None
Return value
0: if all initializations were successful
1: Memory initialization failure
2: Audio file failure (wrong file or wrong format)
–3: I
2
C communication failure
Required preconditions None
Called functions
NVIC_Config, GPIO_Config, AudioFile_Init, I2S_Config,
CODEC_Config
Table 2. I2S_CODEC driver high-level functions (continued)
Function name Description

Other manuals for ST STM32F103 series

Questions and Answers:

Question and Answer IconNeed help?

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

ST STM32F103 series Specifications

General IconGeneral
BrandST
ModelSTM32F103 series
CategoryMicrocontrollers
LanguageEnglish

Related product manuals