Implementation example AN2739
18/26
2.3.2 Demo firmware description
The demo uses the i2s_codec driver functions to control the audio stream. Other functions
are implemented to make the application interactive.
Two main functions are handled by the application:
● Joystick and push-button input control
● LCD display output (all LCD-related functionalities are enabled only when the USE_LCD
constant is defined in the main.h file by uncommenting the following line:
#define USE_LCD).
Joystick_Config function
The push-button-related GPIO and EXTI configuration is performed by the
Joystick_Config function (instantiated in the main.c file).
The functionalities allowed by this configuration are explained in Table 11.
Table 10. Joystick_Config function
Function name Joystick_Config
Prototype u32 Joystick_Config(void)
Behavior description
Configures and initializes the EXTI, NVIC and GPIOs related to the
Joystick and the Key push-buttons.
Input parameter None
Output parameter None
Required preconditions None
Called functions None.
Table 11. Description of the Joystick functionalities
Button Function
Pin
location
EXTI
line
Key button
– Play: if the stream is paused.
– Pause: if the stream is Playing.
PG8 EXTI8
Joystick Up button
– Set Speaker as audio output device and begin
playing the file: if the stream is Paused or Stopped.
– Increase volume: if the stream is Playing.
PG15 EXTI15
Joystick Down button
– Set Headphone as audio output device and begin
playing the stream: if the stream is Paused or
Stopped.
– Decrease volume: if the stream is Playing.
PD3 EXTI3
Joystick Left button Forward and play: if the stream is Playing. PG14 EXTI14
Joystick Right button Rewind and play: if the stream is Playing. PG13 EXTI13
Joystick Select
button
Stop: if the stream is Playing. PG7 EXTI7