STM32F4-Discovery BSP User Manual: STM32F4 DISCOVERY AUDIO OUT Exported Functions

STM32F4-Discovery BSP

STM32F4-Discovery BSP User Manual
STM32F4 DISCOVERY AUDIO OUT Exported Functions

Functions

uint8_t BSP_AUDIO_OUT_Init (uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
 Configures the audio peripherals.
uint8_t BSP_AUDIO_OUT_Play (uint16_t *pBuffer, uint32_t Size)
 Starts playing audio stream from a data buffer for a determined size.
void BSP_AUDIO_OUT_ChangeBuffer (uint16_t *pData, uint16_t Size)
 Sends n-Bytes on the I2S interface.
uint8_t BSP_AUDIO_OUT_Pause (void)
 Pauses the audio file stream.
uint8_t BSP_AUDIO_OUT_Resume (void)
 Resumes the audio file streaming.
uint8_t BSP_AUDIO_OUT_Stop (uint32_t Option)
 Stops audio playing and Power down the Audio Codec.
uint8_t BSP_AUDIO_OUT_SetVolume (uint8_t Volume)
 Controls the current audio volume level.
void BSP_AUDIO_OUT_SetFrequency (uint32_t AudioFreq)
 Update the audio frequency.
uint8_t BSP_AUDIO_OUT_SetMute (uint32_t Cmd)
 Enables or disables the MUTE mode by software.
uint8_t BSP_AUDIO_OUT_SetOutputMode (uint8_t Output)
 Switch dynamically (while audio file is played) the output target (speaker or headphone).
void BSP_AUDIO_OUT_TransferComplete_CallBack (void)
 Manages the DMA full Transfer complete event.
void BSP_AUDIO_OUT_HalfTransfer_CallBack (void)
 Manages the DMA Half Transfer complete event.
void BSP_AUDIO_OUT_Error_CallBack (void)
 Manages the DMA FIFO error event.
void BSP_AUDIO_OUT_ClockConfig (I2S_HandleTypeDef *hi2s, uint32_t AudioFreq, void *Params)
 Clock Config.
void BSP_AUDIO_OUT_MspInit (I2S_HandleTypeDef *hi2s, void *Params)
 AUDIO OUT I2S MSP Init.
void BSP_AUDIO_OUT_MspDeInit (I2S_HandleTypeDef *hi2s, void *Params)
 De-Initializes BSP_AUDIO_OUT MSP.

Function Documentation

void BSP_AUDIO_OUT_ChangeBuffer ( uint16_t *  pData,
uint16_t  Size 
)

Sends n-Bytes on the I2S interface.

Parameters:
pData,:Pointer to data address
Size,:Number of data to be written

Definition at line 287 of file stm32f4_discovery_audio.c.

References hAudioOutI2s.

void BSP_AUDIO_OUT_ClockConfig ( I2S_HandleTypeDef *  hi2s,
uint32_t  AudioFreq,
void *  Params 
)

Clock Config.

Parameters:
hi2s,:might be required to set audio peripheral predivider if any.
AudioFreq,:Audio frequency used to play the audio stream.
Note:
This API is called by BSP_AUDIO_OUT_Init() and BSP_AUDIO_OUT_SetFrequency() Being __weak it can be overwritten by the application
Parameters:
Params: pointer on additional configuration parameters, can be NULL.

Definition at line 486 of file stm32f4_discovery_audio.c.

References I2SFreq, I2SPLLN, and I2SPLLR.

Referenced by BSP_AUDIO_OUT_Init(), and BSP_AUDIO_OUT_SetFrequency().

Manages the DMA FIFO error event.

Definition at line 650 of file stm32f4_discovery_audio.c.

Referenced by HAL_I2S_ErrorCallback().

Manages the DMA Half Transfer complete event.

Definition at line 643 of file stm32f4_discovery_audio.c.

Referenced by HAL_I2S_TxHalfCpltCallback().

uint8_t BSP_AUDIO_OUT_Init ( uint16_t  OutputDevice,
uint8_t  Volume,
uint32_t  AudioFreq 
)

Configures the audio peripherals.

Parameters:
OutputDevice,:OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO .
Volume,:Initial volume level (from 0 (Mute) to 100 (Max))
AudioFreq,:Audio frequency used to play the audio stream.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 213 of file stm32f4_discovery_audio.c.

References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, BSP_AUDIO_OUT_ClockConfig(), BSP_AUDIO_OUT_MspInit(), hAudioOutI2s, I2S3, I2S3_Init(), and pAudioDrv.

void BSP_AUDIO_OUT_MspDeInit ( I2S_HandleTypeDef *  hi2s,
void *  Params 
)

De-Initializes BSP_AUDIO_OUT MSP.

Parameters:
hi2s,:might be required to set audio peripheral predivider if any.
Params: pointer on additional configuration parameters, can be NULL.

Definition at line 598 of file stm32f4_discovery_audio.c.

References I2S3, I2S3_CLK_DISABLE, I2S3_DMAx_IRQ, I2S3_MCK_GPIO_PORT, I2S3_MCK_PIN, I2S3_SCK_PIN, I2S3_SCK_SD_GPIO_PORT, I2S3_SD_PIN, I2S3_WS_GPIO_PORT, and I2S3_WS_PIN.

void BSP_AUDIO_OUT_MspInit ( I2S_HandleTypeDef *  hi2s,
void *  Params 
)

AUDIO OUT I2S MSP Init.

Parameters:
hi2s,:might be required to set audio peripheral predivider if any.
Params: pointer on additional configuration parameters, can be NULL.

Definition at line 528 of file stm32f4_discovery_audio.c.

References AUDIO_OUT_IRQ_PREPRIO, I2S3, I2S3_CLK_ENABLE, I2S3_DMAx_CHANNEL, I2S3_DMAx_CLK_ENABLE, I2S3_DMAx_IRQ, I2S3_DMAx_MEM_DATA_SIZE, I2S3_DMAx_PERIPH_DATA_SIZE, I2S3_DMAx_STREAM, I2S3_MCK_CLK_ENABLE, I2S3_MCK_GPIO_PORT, I2S3_MCK_PIN, I2S3_SCK_PIN, I2S3_SCK_SD_CLK_ENABLE, I2S3_SCK_SD_GPIO_PORT, I2S3_SCK_SD_WS_AF, I2S3_SD_PIN, I2S3_WS_CLK_ENABLE, I2S3_WS_GPIO_PORT, and I2S3_WS_PIN.

Referenced by BSP_AUDIO_OUT_Init().

uint8_t BSP_AUDIO_OUT_Pause ( void  )

Pauses the audio file stream.

In case of using DMA, the DMA Pause feature is used. WARNING: When calling BSP_AUDIO_OUT_Pause() function for pause, only the BSP_AUDIO_OUT_Resume() function should be called for resume (use of BSP_AUDIO_OUT_Play() function for resume could lead to unexpected behavior).

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 300 of file stm32f4_discovery_audio.c.

References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, hAudioOutI2s, and pAudioDrv.

uint8_t BSP_AUDIO_OUT_Play ( uint16_t *  pBuffer,
uint32_t  Size 
)

Starts playing audio stream from a data buffer for a determined size.

Parameters:
pBuffer,:Pointer to the buffer
Size,:Number of audio data BYTES.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 265 of file stm32f4_discovery_audio.c.

References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, AUDIODATA_SIZE, DMA_MAX, hAudioOutI2s, and pAudioDrv.

uint8_t BSP_AUDIO_OUT_Resume ( void  )

Resumes the audio file streaming.

WARNING: When calling BSP_AUDIO_OUT_Pause() function for pause, only BSP_AUDIO_OUT_Resume() function should be called for resume (use of BSP_AUDIO_OUT_Play() function for resume could lead to unexpected behavior).

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 324 of file stm32f4_discovery_audio.c.

References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, hAudioOutI2s, and pAudioDrv.

void BSP_AUDIO_OUT_SetFrequency ( uint32_t  AudioFreq)

Update the audio frequency.

Parameters:
AudioFreq,:Audio frequency used to play the audio stream.
Note:
This API should be called after the BSP_AUDIO_OUT_Init() to adjust the audio frequency.

Definition at line 442 of file stm32f4_discovery_audio.c.

References BSP_AUDIO_OUT_ClockConfig(), hAudioOutI2s, and I2S3_Init().

uint8_t BSP_AUDIO_OUT_SetMute ( uint32_t  Cmd)

Enables or disables the MUTE mode by software.

Parameters:
Cmd,:could be AUDIO_MUTE_ON to mute sound or AUDIO_MUTE_OFF to unmute the codec and restore previous volume level.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 400 of file stm32f4_discovery_audio.c.

References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, and pAudioDrv.

uint8_t BSP_AUDIO_OUT_SetOutputMode ( uint8_t  Output)

Switch dynamically (while audio file is played) the output target (speaker or headphone).

Note:
This function modifies a global variable of the audio codec driver: OutputDev.
Parameters:
Output,:specifies the audio output target: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 422 of file stm32f4_discovery_audio.c.

References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, and pAudioDrv.

uint8_t BSP_AUDIO_OUT_SetVolume ( uint8_t  Volume)

Controls the current audio volume level.

Parameters:
Volume,:Volume level to be set in percentage from 0% to 100% (0 for Mute and 100 for Max volume level).
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 380 of file stm32f4_discovery_audio.c.

References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, and pAudioDrv.

uint8_t BSP_AUDIO_OUT_Stop ( uint32_t  Option)

Stops audio playing and Power down the Audio Codec.

Parameters:
Option,:could be one of the following parameters
  • CODEC_PDWN_HW: completely shut down the codec (physically). Then need to reconfigure the Codec after power on.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 348 of file stm32f4_discovery_audio.c.

References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, AUDIO_RESET_GPIO, AUDIO_RESET_PIN, hAudioOutI2s, and pAudioDrv.

Manages the DMA full Transfer complete event.

Definition at line 636 of file stm32f4_discovery_audio.c.

Referenced by HAL_I2S_TxCpltCallback().

Generated on Thu Jan 19 2017 15:34:14 for STM32F4-Discovery BSP User Manual by   doxygen 1.7.6.1