STM32L476G_EVAL BSP User Manual: Exported Functions

STM32L476G_EVAL BSP

STM32L476G_EVAL BSP User Manual
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.
uint8_t BSP_AUDIO_OUT_ChangeBuffer (uint16_t *pData, uint16_t Size)
 Sends n-Bytes on the SAI interface.
uint8_t BSP_AUDIO_OUT_Pause (void)
 This function Pauses the audio file stream.
uint8_t BSP_AUDIO_OUT_Resume (void)
 This function Resumes the audio file stream.
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.
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_SetFrequency (uint32_t AudioFreq)
 Update the audio frequency.
void BSP_AUDIO_OUT_SetAudioFrameSlot (uint32_t AudioFrameSlot)
 Updates the Audio frame slot configuration.
void BSP_AUDIO_OUT_ChangeAudioConfig (uint32_t AudioOutOption)
 Changes the Audio Out Configuration.
void HAL_SAI_TxCpltCallback (SAI_HandleTypeDef *hsai)
 Tx Transfer completed callbacks.
void HAL_SAI_TxHalfCpltCallback (SAI_HandleTypeDef *hsai)
 Tx Half Transfer completed callbacks.
void HAL_SAI_ErrorCallback (SAI_HandleTypeDef *hsai)
 SAI error callbacks.
__weak void BSP_AUDIO_OUT_TransferComplete_CallBack (void)
 Manages the DMA full Transfer complete event.
__weak void BSP_AUDIO_OUT_HalfTransfer_CallBack (void)
 Manages the DMA Half Transfer complete event.
__weak void BSP_AUDIO_OUT_Error_CallBack (void)
 Manages the DMA FIFO error event.
uint8_t BSP_AUDIO_IN_Init (uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
 Initializes wave recording.
void BSP_AUDIO_IN_DeInit (void)
 DeInitializes the audio peripheral.
uint8_t BSP_AUDIO_IN_Record (uint16_t *pbuf, uint32_t size)
 Starts audio recording.
uint8_t BSP_AUDIO_IN_SetFrequency (uint32_t AudioFreq)
 Updates the audio frequency.
void HAL_DFSDM_FilterRegConvCpltCallback (DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
 Regular conversion complete callback.
void HAL_DFSDM_FilterRegConvHalfCpltCallback (DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
 Half regular conversion complete callback.
uint8_t BSP_AUDIO_IN_Stop (void)
 Stops audio recording.
uint8_t BSP_AUDIO_IN_Pause (void)
 Pauses the audio file stream.
uint8_t BSP_AUDIO_IN_Resume (void)
 Resumes the audio file stream.
uint8_t BSP_AUDIO_IN_SetVolume (uint8_t Volume)
 Controls the audio in volume level.
__weak void BSP_AUDIO_IN_TransferComplete_CallBack (void)
 User callback when record buffer is filled.
__weak void BSP_AUDIO_IN_HalfTransfer_CallBack (void)
 Manages the DMA Half Transfer complete event.
__weak void BSP_AUDIO_IN_Error_Callback (void)
 Audio IN Error callback function.

Function Documentation

void BSP_AUDIO_IN_DeInit ( void  )

DeInitializes the audio peripheral.

Return values:
None

Definition at line 936 of file stm32l476g_eval_audio.c.

References DFSDMx_DeInit().

void BSP_AUDIO_IN_Error_Callback ( void  )

Audio IN Error callback function.

Return values:
None

Definition at line 1295 of file stm32l476g_eval_audio.c.

Manages the DMA Half Transfer complete event.

Return values:
None

Definition at line 1284 of file stm32l476g_eval_audio.c.

Referenced by HAL_DFSDM_FilterRegConvCpltCallback(), and HAL_DFSDM_FilterRegConvHalfCpltCallback().

uint8_t BSP_AUDIO_IN_Init ( uint32_t  AudioFreq,
uint32_t  BitRes,
uint32_t  ChnlNbr 
)

Initializes wave recording.

Note:
This function assumes that the SAI input clock (through PLL_M) is already configured and ready to be used.
Parameters:
AudioFreq,:Audio frequency to be configured for the SAI peripheral.
BitRes,:Audio frequency to be configured for the SAI peripheral.
ChnlNbr,:Audio frequency to be configured for the SAI peripheral.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 887 of file stm32l476g_eval_audio.c.

References AUDIO_ERROR, AUDIOIN_TypeDef::BitResolution, AUDIOIN_TypeDef::ChannelNbr, DFSDMx_Init(), and AUDIOIN_TypeDef::Frequency.

uint8_t BSP_AUDIO_IN_Pause ( void  )

Pauses the audio file stream.

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1205 of file stm32l476g_eval_audio.c.

References AUDIO_ERROR, AUDIO_OK, AUDIOIN_TypeDef::ChannelNbr, haudio_in_dfsdm_leftfilter, and haudio_in_dfsdm_rightfilter.

uint8_t BSP_AUDIO_IN_Record ( uint16_t *  pbuf,
uint32_t  size 
)

Starts audio recording.

Parameters:
pbuf,:Main buffer pointer for the recorded data storing
size,:Current size of the recorded buffer
Note:
The Right channel is start at first with synchro on start of Left channel
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 948 of file stm32l476g_eval_audio.c.

References AppBuffHalf, AppBuffTrigger, AUDIO_ERROR, AUDIO_OK, AUDIOIN_TypeDef::ChannelNbr, haudio_in_dfsdm_leftfilter, haudio_in_dfsdm_rightfilter, INTERNAL_BUFF_SIZE, LeftRecBuff, AUDIOIN_TypeDef::pRecBuf, AUDIOIN_TypeDef::RecSize, and RightRecBuff.

uint8_t BSP_AUDIO_IN_Resume ( void  )

Resumes the audio file stream.

Note:
The Right channel is start a first with synchro on start Left channel
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1231 of file stm32l476g_eval_audio.c.

References AUDIO_ERROR, AUDIO_OK, AUDIOIN_TypeDef::ChannelNbr, DEFAULT_AUDIO_IN_CHANNEL_NBR, haudio_in_dfsdm_leftfilter, haudio_in_dfsdm_rightfilter, LeftRecBuff, AUDIOIN_TypeDef::RecSize, and RightRecBuff.

uint8_t BSP_AUDIO_IN_SetFrequency ( uint32_t  AudioFreq)

Updates the audio frequency.

Parameters:
AudioFreq,:Audio frequency used to record the audio stream.
Note:
This API should be called after the BSP_AUDIO_IN_Init() to adjust the audio frequency.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 986 of file stm32l476g_eval_audio.c.

References AUDIO_ERROR, AUDIO_OK, DFSDMx_DeInit(), and DFSDMx_Init().

uint8_t BSP_AUDIO_IN_SetVolume ( uint8_t  Volume)

Controls the audio in 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 1260 of file stm32l476g_eval_audio.c.

References AUDIO_OK, and AudioInVolume.

uint8_t BSP_AUDIO_IN_Stop ( void  )

Stops audio recording.

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1173 of file stm32l476g_eval_audio.c.

References AppBuffHalf, AppBuffTrigger, AUDIO_ERROR, AUDIO_OK, AUDIOIN_TypeDef::ChannelNbr, haudio_in_dfsdm_leftfilter, and haudio_in_dfsdm_rightfilter.

User callback when record buffer is filled.

Return values:
None

Definition at line 1273 of file stm32l476g_eval_audio.c.

Referenced by HAL_DFSDM_FilterRegConvCpltCallback(), and HAL_DFSDM_FilterRegConvHalfCpltCallback().

void BSP_AUDIO_OUT_ChangeAudioConfig ( uint32_t  AudioOutOption)

Changes the Audio Out Configuration.

Parameters:
AudioOutOption,:specifies the audio out new configuration This parameter can be any value of BSP Audio Out Option
Note:
This API should be called after the BSP_AUDIO_OUT_Init() to adjust the audio out configuration.
Return values:
None

Definition at line 617 of file stm32l476g_eval_audio.c.

References BSP_AUDIO_OUT_CIRCULARMODE, BSP_AUDIO_OUT_STEREOMODE, and haudio_out_sai.

uint8_t BSP_AUDIO_OUT_ChangeBuffer ( uint16_t *  pData,
uint16_t  Size 
)

Sends n-Bytes on the SAI interface.

Parameters:
pData,:pointer on data address
Size,:number of data to be written
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 388 of file stm32l476g_eval_audio.c.

References haudio_out_sai.

Manages the DMA FIFO error event.

Return values:
None

Definition at line 724 of file stm32l476g_eval_audio.c.

Referenced by HAL_SAI_ErrorCallback().

Manages the DMA Half Transfer complete event.

Return values:
None

Definition at line 716 of file stm32l476g_eval_audio.c.

Referenced by HAL_SAI_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, or OUTPUT_DEVICE_BOTH.
Volume,:Initial volume level (from 0 (Mute) to 100 (Max))
AudioFreq,:Audio 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 294 of file stm32l476g_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, BSP_AUDIO_OUT_SetVolume(), CODEC_Reset(), and SAIx_Init().

uint8_t BSP_AUDIO_OUT_Pause ( void  )

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 401 of file stm32l476g_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, and haudio_out_sai.

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 366 of file stm32l476g_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, DMA_MAX, and haudio_out_sai.

uint8_t BSP_AUDIO_OUT_Resume ( void  )

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 425 of file stm32l476g_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, and haudio_out_sai.

void BSP_AUDIO_OUT_SetAudioFrameSlot ( uint32_t  AudioFrameSlot)

Updates the Audio frame slot configuration.

Parameters:
AudioFrameSlot,:specifies the audio Frame slot This parameter can be any value of Codex Audio frame slot in TDM mode
Note:
This API should be called after the BSP_AUDIO_OUT_Init() to adjust the audio frame slot.
Return values:
None

Definition at line 596 of file stm32l476g_eval_audio.c.

References haudio_out_sai.

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.
Return values:
None

Definition at line 545 of file stm32l476g_eval_audio.c.

References haudio_out_sai, and SAIClockDivider.

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 503 of file stm32l476g_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, and AUDIO_OK.

uint8_t BSP_AUDIO_OUT_SetOutputMode ( uint8_t  Output)

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

Parameters:
Output,:The audio output target: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE or OUTPUT_DEVICE_BOTH
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 524 of file stm32l476g_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, and AUDIO_OK.

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 483 of file stm32l476g_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, and AUDIO_OK.

Referenced by BSP_AUDIO_OUT_Init().

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_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 451 of file stm32l476g_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, and haudio_out_sai.

Manages the DMA full Transfer complete event.

Return values:
None

Definition at line 708 of file stm32l476g_eval_audio.c.

Referenced by HAL_SAI_TxCpltCallback().

void HAL_DFSDM_FilterRegConvCpltCallback ( DFSDM_Filter_HandleTypeDef *  hdfsdm_filter)

Regular conversion complete callback.

Note:
In interrupt mode, user has to read conversion value in this function using HAL_DFSDM_FilterGetRegularValue.
Parameters:
hdfsdm_filter: DFSDM filter handle.
Return values:
None

Definition at line 1042 of file stm32l476g_eval_audio.c.

References AppBuffHalf, AppBuffTrigger, BSP_AUDIO_IN_HalfTransfer_CallBack(), BSP_AUDIO_IN_TransferComplete_CallBack(), AUDIOIN_TypeDef::ChannelNbr, DmaLeftRecBuffCplt, DmaRightRecBuffCplt, haudio_in_dfsdm_leftfilter, INTERNAL_BUFF_SIZE, LeftRecBuff, AUDIOIN_TypeDef::pRecBuf, AUDIOIN_TypeDef::RecSize, RightRecBuff, and SaturaLH.

void HAL_SAI_ErrorCallback ( SAI_HandleTypeDef *  hsai)

SAI error callbacks.

Parameters:
hsai,:SAI handle
Return values:
None

Definition at line 699 of file stm32l476g_eval_audio.c.

References BSP_AUDIO_OUT_Error_CallBack().

void HAL_SAI_TxCpltCallback ( SAI_HandleTypeDef *  hsai)

Tx Transfer completed callbacks.

Parameters:
hsai,:SAI handle
Return values:
None

Definition at line 675 of file stm32l476g_eval_audio.c.

References BSP_AUDIO_OUT_TransferComplete_CallBack().

void HAL_SAI_TxHalfCpltCallback ( SAI_HandleTypeDef *  hsai)

Tx Half Transfer completed callbacks.

Parameters:
hsai,:SAI handle
Return values:
None

Definition at line 687 of file stm32l476g_eval_audio.c.

References BSP_AUDIO_OUT_HalfTransfer_CallBack().

Generated on Sun Jun 21 2015 23:46:42 for STM32L476G_EVAL BSP User Manual by   doxygen 1.7.6.1