STM32H743I_EVAL BSP User Manual: AUDIO IN Exported Functions

STM32H743I_EVAL BSP

STM32H743I_EVAL BSP User Manual
AUDIO IN Exported Functions

Functions

uint8_t BSP_AUDIO_IN_Init (uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
 Initialize wave recording.
uint8_t BSP_AUDIO_IN_InitEx (uint16_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
 Initialize wave recording.
uint8_t BSP_AUDIO_IN_ConfigMicDefault (uint32_t InputDevice)
 Initializes default configuration of the Digital Filter for Sigma-Delta Modulators interface (DFSDM).
__weak uint8_t BSP_AUDIO_IN_ConfigDigitalMic (uint32_t InputDevice, void *Params)
 Initializes the Digital Filter for Sigma-Delta Modulators interface (DFSDM).
uint8_t BSP_AUDIO_IN_OUT_Init (uint32_t InputDevice, uint32_t OutputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
 Initializes wave recording and playback in parallel.
void BSP_AUDIO_IN_SelectInterface (uint32_t Interface)
 Link digital mic to specified source.
uint32_t BSP_AUDIO_IN_GetInterface (void)
 Get digital mic interface.
uint8_t BSP_AUDIO_IN_AllocScratch (int32_t *pScratch, uint32_t size)
 Allocate channel buffer scratch.
uint8_t BSP_AUDIO_IN_GetChannelNumber (void)
 Return audio in channel number.
uint8_t BSP_AUDIO_IN_Record (uint16_t *pBuf, uint32_t size)
 Start audio recording.
uint8_t BSP_AUDIO_IN_Stop (void)
 Stop audio recording.
uint8_t BSP_AUDIO_IN_StopEx (uint32_t InputDevice)
 Stops audio recording.
uint8_t BSP_AUDIO_IN_Pause (void)
 Pause the audio file stream.
uint8_t BSP_AUDIO_IN_PauseEx (uint32_t InputDevice)
 Pauses the audio file stream.
uint8_t BSP_AUDIO_IN_Resume (void)
 Resume the audio file stream.
uint8_t BSP_AUDIO_IN_ResumeEx (uint32_t *pBuf, uint32_t InputDevice)
 Resumes the audio file stream.
uint8_t BSP_AUDIO_IN_SetVolume (uint8_t Volume)
 Controls the audio in volume level.
void BSP_AUDIO_IN_DeInit (void)
 Deinit the audio IN peripherals.
uint8_t BSP_AUDIO_IN_PDMToPCM_Init (uint32_t AudioFreq, uint32_t ChnlNbrIn, uint32_t ChnlNbrOut)
 Initialize the PDM library.
uint8_t BSP_AUDIO_IN_PDMToPCM (uint16_t *PDMBuf, uint16_t *PCMBuf)
 Converts audio format from PDM to PCM.
__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_TransferComplete_CallBackEx (uint32_t InputDevice)
 User callback when record buffer is filled.
__weak void BSP_AUDIO_IN_HalfTransfer_CallBackEx (uint32_t InputDevice)
 User callback when record buffer is filled.
__weak void BSP_AUDIO_IN_Error_CallBack (void)
 Audio IN Error callback function.
__weak void BSP_AUDIO_IN_MspInit (void)
 Initialize BSP_AUDIO_IN MSP.
__weak void BSP_AUDIO_IN_MspDeInit (void)
 DeInitialize BSP_AUDIO_IN MSP.
__weak void BSP_AUDIO_IN_ClockConfig (uint32_t AudioFreq, void *Params)
 Clock Config.
uint8_t BSP_AUDIO_IN_RecordEx (uint32_t *pBuf, uint32_t Size)
uint8_t BSP_AUDIO_IN_SetFrequency (uint32_t AudioFreq)

Function Documentation

uint8_t BSP_AUDIO_IN_AllocScratch ( int32_t *  pScratch,
uint32_t  size 
)

Allocate channel buffer scratch.

Parameters:
pScratch: pointer to scratch tables.
sizeof scratch buffer

Definition at line 1243 of file stm32h743i_eval_audio.c.

References AUDIO_OK, AUDIOIN_ContextTypeDef::ChannelNbr, pScratchBuff, and ScratchSize.

void BSP_AUDIO_IN_ClockConfig ( uint32_t  AudioFreq,
void *  Params 
)

Clock Config.

Parameters:
AudioFreq,:Audio frequency used to play the audio stream.
Params,:pointer on additional configuration parameters, can be NULL.
Note:
This API is called by BSP_AUDIO_IN_Init() Being __weak it can be overwritten by the application
Return values:
None

Definition at line 1649 of file stm32h743i_eval_audio.c.

References AUDIO_IN_INTERFACE_PDM, and AUDIOIN_ContextTypeDef::Interface.

Referenced by BSP_AUDIO_IN_InitEx().

uint8_t BSP_AUDIO_IN_ConfigDigitalMic ( uint32_t  InputDevice,
void *  Params 
)

Initializes the Digital Filter for Sigma-Delta Modulators interface (DFSDM).

Parameters:
InputDevice,:The microphone to be configured. Can be INPUT_DEVICE_DIGITAL_MIC1..INPUT_DEVICE_DIGITAL_MIC5
Params,:pointer on additional configuration parameters, can be NULL.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1119 of file stm32h743i_eval_audio.c.

References BSP_AUDIO_IN_ConfigMicDefault().

Referenced by BSP_AUDIO_IN_InitEx().

uint8_t BSP_AUDIO_IN_ConfigMicDefault ( uint32_t  InputDevice)

Initializes default configuration of the Digital Filter for Sigma-Delta Modulators interface (DFSDM).

Parameters:
InputDevice,:The microphone to be configured. Can be INPUT_DEVICE_DIGITAL_MIC1..INPUT_DEVICE_DIGITAL_MIC5
Note:
Channel output Clock Divider and Filter Oversampling are calculated as follow:
  • Clock_Divider = CLK(input DFSDM)/CLK(micro) with 1MHZ < CLK(micro) < 3.2MHZ (TYP 2.4MHZ for MP34DT01TR)
  • Oversampling = CLK(input DFSDM)/(Clock_Divider * AudioFreq)
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1035 of file stm32h743i_eval_audio.c.

References AUDIO_DFSDMx_MIC1_CHANNEL, AUDIO_DFSDMx_MIC1_CHANNEL_FOR_FILTER, AUDIO_DFSDMx_MIC1_FILTER, AUDIO_DFSDMx_MIC2_CHANNEL, AUDIO_DFSDMx_MIC2_CHANNEL_FOR_FILTER, AUDIO_DFSDMx_MIC2_FILTER, AUDIO_ERROR, AUDIO_OK, AUDIOIN_ContextTypeDef::ChannelNbr, DFSDM_CLOCK_DIVIDER, DFSDM_FILTER_ORDER, DFSDM_MIC_BIT_SHIFT, DFSDM_MIC_NUMBER, DFSDM_OVER_SAMPLING, AUDIOIN_ContextTypeDef::Frequency, hAudioInDfsdmChannel, hAudioInDfsdmFilter, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, AUDIOIN_ContextTypeDef::InputDevice, and POS_VAL.

Referenced by BSP_AUDIO_IN_ConfigDigitalMic().

void BSP_AUDIO_IN_DeInit ( void  )

Deinit the audio IN peripherals.

Return values:
None

Definition at line 1481 of file stm32h743i_eval_audio.c.

References AUDIO_IN_INTERFACE_DFSDM, BSP_AUDIO_IN_MspDeInit(), DFSDMx_DeInit(), haudio_in_sai, AUDIOIN_ContextTypeDef::Interface, and SAIx_In_DeInit().

void BSP_AUDIO_IN_Error_CallBack ( void  )

Audio IN Error callback function.

Return values:
None

Definition at line 1596 of file stm32h743i_eval_audio.c.

Referenced by HAL_SAI_ErrorCallback().

uint8_t BSP_AUDIO_IN_GetChannelNumber ( void  )

Return audio in channel number.

Return values:
Numberof channel

Definition at line 1262 of file stm32h743i_eval_audio.c.

References AUDIOIN_ContextTypeDef::ChannelNbr.

uint32_t BSP_AUDIO_IN_GetInterface ( void  )

Get digital mic interface.

Return values:
Digitalmic interface.

Definition at line 1233 of file stm32h743i_eval_audio.c.

References AUDIOIN_ContextTypeDef::Interface.

Manages the DMA Half Transfer complete event.

Return values:
None

Definition at line 1563 of file stm32h743i_eval_audio.c.

Referenced by HAL_DFSDM_FilterRegConvCpltCallback(), HAL_DFSDM_FilterRegConvHalfCpltCallback(), and HAL_SAI_RxHalfCpltCallback().

void BSP_AUDIO_IN_HalfTransfer_CallBackEx ( uint32_t  InputDevice)

User callback when record buffer is filled.

Parameters:
InputDevice,:INPUT_DEVICE_DIGITAL_MIC1 or INPUT_DEVICE_DIGITAL_MIC2

Definition at line 1585 of file stm32h743i_eval_audio.c.

Referenced by HAL_DFSDM_FilterRegConvHalfCpltCallback().

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

Initialize wave recording.

Parameters:
AudioFreq,:Audio frequency to be configured for the DFSDM peripheral.
BitRes,:Audio frequency to be configured for the DFSDM peripheral.
ChnlNbr,:Audio frequency to be configured for the DFSDM peripheral.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 897 of file stm32h743i_eval_audio.c.

References AUDIO_IN_INTERFACE_DFSDM, BSP_AUDIO_IN_InitEx(), BSP_AUDIO_IN_SelectInterface(), and INPUT_DEVICE_DIGITAL_MIC.

uint8_t BSP_AUDIO_IN_InitEx ( uint16_t  InputDevice,
uint32_t  AudioFreq,
uint32_t  BitRes,
uint32_t  ChnlNbr 
)

Initialize wave recording.

Parameters:
InputDevice,:INPUT_DEVICE_DIGITAL_MIC or INPUT_DEVICE_ANALOG_MIC.
AudioFreq,:Audio frequency to be configured.
BitRes,:Audio bit resolution to be configured..
ChnlNbr,:Number of channel to be configured.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 912 of file stm32h743i_eval_audio.c.

References AUDIO_ERROR, AUDIO_IN_INTERFACE_DFSDM, AUDIO_IN_INTERFACE_PDM, AUDIO_IN_INTERFACE_SAI, AUDIO_IN_SAI_PDMx, AUDIO_IN_SAIx, AUDIO_OK, AUDIOIN_ContextTypeDef::BitResolution, BSP_AUDIO_IN_ClockConfig(), BSP_AUDIO_IN_ConfigDigitalMic(), BSP_AUDIO_IN_MspInit(), BSP_AUDIO_IN_PDMToPCM_Init(), AUDIOIN_ContextTypeDef::ChannelNbr, CODEC_AUDIOFRAME_SLOT_0, CODEC_AUDIOFRAME_SLOT_13, DFSDM_MIC_NUMBER, AUDIOIN_ContextTypeDef::Frequency, haudio_in_sai, INPUT_DEVICE_DIGITAL_MIC, INPUT_DEVICE_DIGITAL_MIC1, AUDIOIN_ContextTypeDef::InputDevice, AUDIOIN_ContextTypeDef::Interface, SAIx_In_DeInit(), and SAIx_In_Init().

Referenced by BSP_AUDIO_IN_Init().

void BSP_AUDIO_IN_MspDeInit ( void  )

DeInitialize BSP_AUDIO_IN MSP.

Return values:
None

Definition at line 1626 of file stm32h743i_eval_audio.c.

References AUDIO_IN_INTERFACE_DFSDM, DFSDMx_ChannelMspDeInit(), DFSDMx_FilterMspDeInit(), haudio_in_sai, AUDIOIN_ContextTypeDef::Interface, and SAIx_In_MspDeInit().

Referenced by BSP_AUDIO_IN_DeInit().

uint8_t BSP_AUDIO_IN_OUT_Init ( uint32_t  InputDevice,
uint32_t  OutputDevice,
uint32_t  AudioFreq,
uint32_t  BitRes,
uint32_t  ChnlNbr 
)

Initializes wave recording and playback in parallel.

Parameters:
InputDevice,:INPUT_DEVICE_DIGITAL_MICROPHONE_2
OutputDevice,:OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, or OUTPUT_DEVICE_BOTH.
AudioFreq,:Audio frequency to be configured for the SAI peripheral.
BitRes,:Audio frequency to be configured.
ChnlNbr,:Channel number.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1140 of file stm32h743i_eval_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_IN_SAIx, AUDIO_OK, AUDIO_OUT_SAIx, AUDIOIN_ContextTypeDef::BitResolution, BSP_AUDIO_IN_MspInit(), BSP_AUDIO_OUT_ClockConfig(), BSP_AUDIO_OUT_MspInit(), AUDIOIN_ContextTypeDef::ChannelNbr, CODEC_AUDIOFRAME_SLOT_02, CODEC_AUDIOFRAME_SLOT_13, AUDIOIN_ContextTypeDef::Frequency, haudio_in_sai, haudio_out_sai, AUDIOIN_ContextTypeDef::InputDevice, SAIx_In_Init(), and SAIx_Out_Init().

uint8_t BSP_AUDIO_IN_Pause ( void  )

Pause the audio file stream.

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1363 of file stm32h743i_eval_audio.c.

References AUDIO_ERROR, AUDIO_OK, hAudioInDfsdmFilter, INPUT_DEVICE_ANALOG_MIC, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, AUDIOIN_ContextTypeDef::InputDevice, and POS_VAL.

uint8_t BSP_AUDIO_IN_PauseEx ( uint32_t  InputDevice)

Pauses the audio file stream.

Parameters:
InputDevice,:Microphone to be paused. Can be INPUT_DEVICE_DIGITAL_MIC1 or INPUT_DEVICE_DIGITAL_MIC2.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1392 of file stm32h743i_eval_audio.c.

References AUDIO_ERROR, AUDIO_OK, hAudioInDfsdmFilter, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, and POS_VAL.

Referenced by BSP_AUDIO_IN_Stop(), and BSP_AUDIO_IN_StopEx().

uint8_t BSP_AUDIO_IN_PDMToPCM ( uint16_t *  PDMBuf,
uint16_t *  PCMBuf 
)

Converts audio format from PDM to PCM.

Parameters:
PDMBuf,:Pointer to PDM buffer data
PCMBuf,:Pointer to PCM buffer data
Return values:
AUDIO_OKin case of success, AUDIO_ERROR otherwise

Definition at line 1536 of file stm32h743i_eval_audio.c.

References AUDIO_OK, AUDIOIN_ContextTypeDef::ChannelNbr, and PDM_FilterHandler.

uint8_t BSP_AUDIO_IN_PDMToPCM_Init ( uint32_t  AudioFreq,
uint32_t  ChnlNbrIn,
uint32_t  ChnlNbrOut 
)

Initialize the PDM library.

Parameters:
AudioFreq,:Audio sampling frequency
ChnlNbrIn,:Number of input audio channels in the PDM buffer
ChnlNbrOut,:Number of desired output audio channels in the resulting PCM buffer
Return values:
None

Definition at line 1501 of file stm32h743i_eval_audio.c.

References AUDIO_OK, PDM_FilterConfig, and PDM_FilterHandler.

Referenced by BSP_AUDIO_IN_InitEx().

uint8_t BSP_AUDIO_IN_Record ( uint16_t *  pBuf,
uint32_t  size 
)

Start audio recording.

Parameters:
pBuf,:Main buffer pointer for the recorded data storing
size,:Current size of the recorded buffer
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1273 of file stm32h743i_eval_audio.c.

References AppBuffHalf, AppBuffTrigger, AUDIO_ERROR, AUDIO_IN_INTERFACE_DFSDM, AUDIO_OK, haudio_in_sai, hAudioInDfsdmFilter, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, AUDIOIN_ContextTypeDef::Interface, POS_VAL, AUDIOIN_ContextTypeDef::pRecBuf, pScratchBuff, AUDIOIN_ContextTypeDef::RecSize, and ScratchSize.

uint8_t BSP_AUDIO_IN_RecordEx ( uint32_t *  pBuf,
uint32_t  Size 
)
uint8_t BSP_AUDIO_IN_Resume ( void  )

Resume the audio file stream.

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1414 of file stm32h743i_eval_audio.c.

References AUDIO_ERROR, AUDIO_OK, hAudioInDfsdmFilter, INPUT_DEVICE_ANALOG_MIC, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, AUDIOIN_ContextTypeDef::InputDevice, POS_VAL, pScratchBuff, and ScratchSize.

uint8_t BSP_AUDIO_IN_ResumeEx ( uint32_t *  pBuf,
uint32_t  InputDevice 
)

Resumes the audio file stream.

Parameters:
pBuf,:Main buffer pointer for the recorded data storing
InputDevice,:Microphone to be paused. Can be INPUT_DEVICE_DIGITAL_MIC1 or INPUT_DEVICE_DIGITAL_MIC2.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1444 of file stm32h743i_eval_audio.c.

References AUDIO_ERROR, AUDIO_OK, hAudioInDfsdmFilter, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, MicBuff, POS_VAL, and AUDIOIN_ContextTypeDef::RecSize.

void BSP_AUDIO_IN_SelectInterface ( uint32_t  Interface)

Link digital mic to specified source.

Parameters:
Interface: Audio In interface for Digital mic. It can be: AUDIO_IN_INTERFACE_SAI AUDIO_IN_INTERFACE_PDM AUDIO_IN_INTERFACE_DFSDM
Return values:
None

Definition at line 1224 of file stm32h743i_eval_audio.c.

References AUDIOIN_ContextTypeDef::Interface.

Referenced by BSP_AUDIO_IN_Init().

uint8_t BSP_AUDIO_IN_SetFrequency ( uint32_t  AudioFreq)
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 1468 of file stm32h743i_eval_audio.c.

References AUDIO_OK, and AudioInVolume.

uint8_t BSP_AUDIO_IN_Stop ( void  )

Stop audio recording.

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1311 of file stm32h743i_eval_audio.c.

References AppBuffHalf, AppBuffTrigger, AUDIO_ERROR, AUDIO_IN_INTERFACE_DFSDM, AUDIO_OK, BSP_AUDIO_IN_PauseEx(), haudio_in_sai, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, and AUDIOIN_ContextTypeDef::Interface.

uint8_t BSP_AUDIO_IN_StopEx ( uint32_t  InputDevice)

Stops audio recording.

Parameters:
InputDevice,:Microphone to be stopped. Can be INPUT_DEVICE_DIGITAL_MIC1 or INPUT_DEVICE_DIGITAL_MIC2.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1344 of file stm32h743i_eval_audio.c.

References AUDIO_ERROR, AUDIO_OK, BSP_AUDIO_IN_PauseEx(), INPUT_DEVICE_DIGITAL_MIC1, and INPUT_DEVICE_DIGITAL_MIC2.

User callback when record buffer is filled.

Return values:
None

Definition at line 1552 of file stm32h743i_eval_audio.c.

Referenced by HAL_DFSDM_FilterRegConvCpltCallback(), HAL_DFSDM_FilterRegConvHalfCpltCallback(), and HAL_SAI_RxCpltCallback().

void BSP_AUDIO_IN_TransferComplete_CallBackEx ( uint32_t  InputDevice)

User callback when record buffer is filled.

Parameters:
InputDevice,:INPUT_DEVICE_DIGITAL_MIC1 or INPUT_DEVICE_DIGITAL_MIC2

Definition at line 1574 of file stm32h743i_eval_audio.c.

Referenced by HAL_DFSDM_FilterRegConvCpltCallback().

Generated on Wed Aug 23 2017 17:45:14 for STM32H743I_EVAL BSP User Manual by   doxygen 1.7.6.1