AN2739 Implementation example
11/26
For more details, refer to the STM3210E-EVAL evaluation board user manual on
www.st.com.
2.3 Firmware description
This application note is based on:
● the STM32F10xxx firmware library
● the I2S_CODEC driver firmware (offering the main functions required to control the
codec and I
2
S environment for an audio application)
● a specific firmware to call the I2S_CODEC driver functions, as well as other functions
required for control and display (main.c and stm32f10x_it.c files).
The user may build any similar application using the same library and driver, and different
interfacing firmware/hardware.
2.3.1 I2S_CODEC driver firmware description
The user may interface the audio codec directly through the driver application layer. The
driver functions are summarized in the following sections. Table 1 presents the general
driver file organization.
High-level functions
These are the functions that can simply be called by the final application to execute all
needed configurations and perform high-end functionalities (like playing a wave sound,
pausing playing, configuring all the hardware components, etc.).
These functions are presented in Tab l e 2
.
Table 1. Driver library description
File Description
i2s_codec.h,
i2s_codec.c
–I
2
S and codec definitions, type definitions and function prototypes
– Basic functions (init, read, write, play, pause, stop, etc.).
Table 2. I2S_CODEC driver high-level functions
Function name Description
I2S_CODEC_Init
Initializes the entire application environment (I
2
S, I
2
C, codec,
memory)
I2S_CODEC_ReplayConfig
Sets the number of replays (number of stream playing loops ≥ 1 or
0 for infinite loop)
I2S_CODEC_Play
Causes the audio file to start playing (or to resume from Paused
state)
I2S_CODEC_Pause Pauses the audio stream playing and saves the current position
I2S_CODEC_Stop Causes the audio file to stop playing and resets all local pointers
I2S_CODEC_ControlVolume Increases/Decreases/Sets the digital volume
I2S_CODEC_Mute Causes the codec to mute the released sound.