STSW-STLKT01: SENSORTILE_AUDIO_OUT Exported Functions

STSW-STLKT01

STSW-STLKT01
SENSORTILE_AUDIO_OUT Exported Functions

Functions

uint8_t BSP_AUDIO_OUT_Init (CODEX_ID_t id, void **handle, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
 Configures the audio peripherals. More...
 
uint8_t BSP_AUDIO_OUT_Play (void *handle, uint16_t *pBuffer, uint32_t Size)
 Starts playing audio stream from a data buffer for a determined size. More...
 
uint8_t BSP_AUDIO_OUT_Pause (void *handle)
 This function Pauses the audio file stream. In case of using DMA, the DMA Pause feature is used. More...
 
uint8_t BSP_AUDIO_OUT_Resume (void *handle)
 This function Resumes the audio file stream. More...
 
uint8_t BSP_AUDIO_OUT_Stop (void *handle, uint32_t Option)
 Stops audio playing and Power down the Audio Codec. More...
 
uint8_t BSP_AUDIO_OUT_SetVolume (void *handle, uint8_t Volume)
 Controls the current audio volume level. More...
 
uint8_t BSP_AUDIO_OUT_SetMute (void *handle, uint32_t Cmd)
 Enables or disables the MUTE mode by software. More...
 
__weak uint8_t BSP_AUDIO_OUT_ClockConfig (uint32_t AudioFreq, void *Params)
 Clock Config. More...
 
uint8_t BSP_AUDIO_OUT_SetFrequency (void *handle, uint32_t AudioFreq)
 Update the audio frequency. More...
 
void HAL_SAI_TxCpltCallback (SAI_HandleTypeDef *hsai)
 Tx Transfer completed callbacks. More...
 
void HAL_SAI_TxHalfCpltCallback (SAI_HandleTypeDef *hsai)
 Tx Half Transfer completed callbacks. More...
 
void HAL_SAI_ErrorCallback (SAI_HandleTypeDef *hsai)
 SAI error callbacks. More...
 
__weak void BSP_AUDIO_OUT_TransferComplete_CallBack (void)
 Manages the DMA full Transfer complete event. More...
 
__weak void BSP_AUDIO_OUT_HalfTransfer_CallBack (void)
 Manages the DMA Half Transfer complete event. More...
 
__weak void BSP_AUDIO_OUT_Error_CallBack (void)
 Manages the DMA FIFO error event. More...
 
uint8_t BSP_AUDIO_OUT_SetOutputMode (void *handle, uint8_t Output)
 

Detailed Description

Function Documentation

◆ BSP_AUDIO_OUT_ClockConfig()

uint8_t BSP_AUDIO_OUT_ClockConfig ( uint32_t  AudioFreq,
void *  Params 
)

Clock Config.

Parameters
Paramsadditional parameters where required
AudioFreqAudio frequency used to play the audio stream.
Note
This API is called by BSP_AUDIO_OUT_Init() Being __weak it can be overwritten by the application
Return values
AUDIO_OKif no problem during execution, AUDIO_ERROR otherwise

Definition at line 382 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_Error_CallBack()

void BSP_AUDIO_OUT_Error_CallBack ( void  )

Manages the DMA FIFO error event.

Return values
None

Definition at line 478 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_HalfTransfer_CallBack()

void BSP_AUDIO_OUT_HalfTransfer_CallBack ( void  )

Manages the DMA Half Transfer complete event.

Return values
None

Definition at line 470 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_Init()

uint8_t BSP_AUDIO_OUT_Init ( CODEX_ID_t  id,
void **  handle,
uint16_t  OutputDevice,
uint8_t  Volume,
uint32_t  AudioFreq 
)

Configures the audio peripherals.

Parameters
OutputDeviceOUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, or OUTPUT_DEVICE_BOTH.
VolumeInitial volume level (from 0 (Mute) to 63 (Max))
AudioFreqAudio frequency used to play the audio stream.
Note
The SAI PLL input clock must be done in the user application.
Return values
AUDIO_OKif correct communication, else wrong communication

Definition at line 129 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_Pause()

uint8_t BSP_AUDIO_OUT_Pause ( void *  handle)

This function Pauses the audio file stream. In case of using DMA, the DMA Pause feature is used.

Note
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 241 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_Play()

uint8_t BSP_AUDIO_OUT_Play ( void *  handle,
uint16_t *  pBuffer,
uint32_t  Size 
)

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

Parameters
pBufferPointer to the buffer
SizeNumber of audio data BYTES.
Return values
AUDIO_OKif correct communication, else wrong communication

Definition at line 221 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_Resume()

uint8_t BSP_AUDIO_OUT_Resume ( void *  handle)

This function Resumes the audio file stream.

Note
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 260 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_SetFrequency()

uint8_t BSP_AUDIO_OUT_SetFrequency ( void *  handle,
uint32_t  AudioFreq 
)

Update the audio frequency.

Parameters
AudioFreqAudio frequency used to play the audio stream.
Note
This API should be called after the BSP_AUDIO_OUT_Init() to adjust the audio frequency.
Return values
None

Definition at line 408 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_SetMute()

uint8_t BSP_AUDIO_OUT_SetMute ( void *  handle,
uint32_t  Cmd 
)

Enables or disables the MUTE mode by software.

Parameters
CmdCould 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 348 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_SetVolume()

uint8_t BSP_AUDIO_OUT_SetVolume ( void *  handle,
uint8_t  Volume 
)

Controls the current audio volume level.

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

Definition at line 317 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_Stop()

uint8_t BSP_AUDIO_OUT_Stop ( void *  handle,
uint32_t  Option 
)

Stops audio playing and Power down the Audio Codec.

Parameters
Optioncould be one of the following parameters
  • CODEC_PDWN_SW: for software power off (by writing registers). Then no need to reconfigure the Codec after power on.
  • 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 280 of file SensorTile_audio_out.c.

◆ BSP_AUDIO_OUT_TransferComplete_CallBack()

void BSP_AUDIO_OUT_TransferComplete_CallBack ( void  )

Manages the DMA full Transfer complete event.

Return values
None

Definition at line 462 of file SensorTile_audio_out.c.

◆ HAL_SAI_ErrorCallback()

void HAL_SAI_ErrorCallback ( SAI_HandleTypeDef *  hsai)

SAI error callbacks.

Parameters
hsaiSAI handle
Return values
None

Definition at line 453 of file SensorTile_audio_out.c.

◆ HAL_SAI_TxCpltCallback()

void HAL_SAI_TxCpltCallback ( SAI_HandleTypeDef *  hsai)

Tx Transfer completed callbacks.

Parameters
hsaiSAI handle
Return values
None

Definition at line 429 of file SensorTile_audio_out.c.

◆ HAL_SAI_TxHalfCpltCallback()

void HAL_SAI_TxHalfCpltCallback ( SAI_HandleTypeDef *  hsai)

Tx Half Transfer completed callbacks.

Parameters
hsaiSAI handle
Return values
None

Definition at line 441 of file SensorTile_audio_out.c.

Generated by   doxygen 1.8.13