STM32F413H-Discovery BSP User Manual: STM32F413H DISCOVERY AudioIN Exported Functions

STM32F413H-Discovery BSP Drivers

STM32F413H-Discovery BSP User Manual
STM32F413H DISCOVERY AudioIN Exported Functions

Functions

uint8_t BSP_AUDIO_IN_Init (uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
 Initializes wave recording.
uint8_t BSP_AUDIO_IN_InitEx (uint32_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
 Initializes wave recording.
uint8_t BSP_AUDIO_IN_ConfigMicDefault (uint32_t InputDevice)
 Initializes default configuration of the Digital Filter for Sigma-Delta Modulators interface (DFSDM).
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_AllocScratch (int32_t *pScratch, uint32_t size)
 Allocate channel buffer scratch.
uint8_t BSP_AUDIO_IN_Record (uint16_t *pBuf, uint32_t Size)
 Starts audio recording.
uint8_t BSP_AUDIO_IN_RecordEx (uint32_t *pBuf, uint32_t Size)
 Starts audio recording.
uint8_t BSP_AUDIO_IN_SetFrequency (uint32_t AudioFreq)
uint8_t BSP_AUDIO_IN_Stop (void)
 Stops audio recording.
uint8_t BSP_AUDIO_IN_StopEx (uint32_t InputDevice)
 Stops audio recording.
uint8_t BSP_AUDIO_IN_Pause (void)
 Pauses 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)
 Resumes 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)
 DeInitializes the audio peripheral.
void BSP_AUDIO_IN_TransferComplete_CallBack (void)
 User callback when record buffer is filled.
void BSP_AUDIO_IN_HalfTransfer_CallBack (void)
 Manages the DMA Half Transfer complete event.
void BSP_AUDIO_IN_TransferComplete_CallBackEx (uint32_t InputDevice)
 User callback when record buffer is filled.
void BSP_AUDIO_IN_HalfTransfer_CallBackEx (uint32_t InputDevice)
 User callback when record buffer is filled.
void BSP_AUDIO_IN_Error_Callback (void)
 Audio IN Error callback function.
uint8_t BSP_AUDIO_IN_ClockConfig (uint32_t AudioFreq, void *Params)
 Clock Config.
void BSP_AUDIO_IN_MspInit (void *Params)
 Initializes BSP_AUDIO_IN MSP.
void BSP_AUDIO_IN_MspDeInit (void *Params)
 De-Initializes BSP_AUDIO_IN MSP.

Function Documentation

uint8_t BSP_AUDIO_IN_AllocScratch ( int32_t *  pScratch,
uint32_t  size 
)

Allocate channel buffer scratch.

Parameters:
pScratch: pointer to scratch tables.
size,:size of scratch buffer

Definition at line 1033 of file stm32f413h_discovery_audio.c.

References AUDIO_OK, DEFAULT_AUDIO_IN_CHANNEL_NBR, pScratchBuff, and ScratchSize.

uint8_t 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_OUT_Init() and BSP_AUDIO_OUT_SetFrequency() Being __weak it can be overwritten by the application
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1314 of file stm32f413h_discovery_audio.c.

References AUDIO_OK, INPUT_DEVICE_ANALOG_MIC, and AUDIOIN_ContextTypeDef::InputDevice.

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 1017 of file stm32f413h_discovery_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 922 of file stm32f413h_discovery_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_DFSDMx_MIC3_CHANNEL, AUDIO_DFSDMx_MIC3_CHANNEL_FOR_FILTER, AUDIO_DFSDMx_MIC3_FILTER, AUDIO_DFSDMx_MIC4_CHANNEL, AUDIO_DFSDMx_MIC4_CHANNEL_FOR_FILTER, AUDIO_DFSDMx_MIC4_FILTER, AUDIO_DFSDMx_MIC5_CHANNEL, AUDIO_DFSDMx_MIC5_CHANNEL_FOR_FILTER, AUDIO_DFSDMx_MIC5_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, INPUT_DEVICE_DIGITAL_MIC3, INPUT_DEVICE_DIGITAL_MIC4, INPUT_DEVICE_DIGITAL_MIC5, and POS_VAL.

Referenced by BSP_AUDIO_IN_ConfigDigitalMic().

void BSP_AUDIO_IN_DeInit ( void  )
void BSP_AUDIO_IN_Error_Callback ( void  )

Audio IN Error callback function.

Definition at line 1778 of file stm32f413h_discovery_audio.c.

Manages the DMA Half Transfer complete event.

Definition at line 1746 of file stm32f413h_discovery_audio.c.

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

void BSP_AUDIO_IN_HalfTransfer_CallBackEx ( uint32_t  InputDevice)

User callback when record buffer is filled.

Parameters:
InputDevice,:INPUT_DEVICE_DIGITAL_MIC1 .. INPUT_DEVICE_DIGITAL_MIC5.

Definition at line 1768 of file stm32f413h_discovery_audio.c.

Referenced by HAL_DFSDM_FilterRegConvHalfCpltCallback().

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

Initializes wave recording.

Parameters:
AudioFreq,:Audio frequency to be configured for the audio in peripheral.
BitRes,:Audio bit resolution.
ChnlNbr,:Audio channel number.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 785 of file stm32f413h_discovery_audio.c.

References BSP_AUDIO_IN_InitEx(), and INPUT_DEVICE_DIGITAL_MIC.

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

Initializes wave recording.

Parameters:
InputDevice,:INPUT_DEVICE_DIGITAL_MICx or INPUT_DEVICE_ANALOG_MIC.
AudioFreq,:Audio frequency to be configured for the audio in peripheral.
BitRes,:Audio bit resolution.
ChnlNbr,:Audio channel number.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 798 of file stm32f413h_discovery_audio.c.

References audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_IN_I2Sx, AUDIO_IO_Init(), AUDIO_OK, AUDIOIN_ContextTypeDef::BitResolution, BSP_AUDIO_IN_ClockConfig(), BSP_AUDIO_IN_ConfigDigitalMic(), BSP_AUDIO_IN_MspInit(), BSP_AUDIO_OUT_MspInit(), AUDIOIN_ContextTypeDef::ChannelNbr, DFSDM_MIC_NUMBER, AUDIOIN_ContextTypeDef::Frequency, haudio_i2s, I2Sx_In_DeInit(), I2Sx_In_Init(), INPUT_DEVICE_ANALOG_MIC, INPUT_DEVICE_DIGITAL_MIC1, and AUDIOIN_ContextTypeDef::InputDevice.

Referenced by BSP_AUDIO_IN_Init().

void BSP_AUDIO_IN_MspDeInit ( void *  Params)

De-Initializes BSP_AUDIO_IN MSP.

Parameters:
Params: pointer on additional configuration parameters, can be NULL.

Definition at line 1287 of file stm32f413h_discovery_audio.c.

References DFSDMx_ChannelMspDeInit(), DFSDMx_FilterMspDeInit(), I2Sx_In_MspDeInit(), INPUT_DEVICE_ANALOG_MIC, and AUDIOIN_ContextTypeDef::InputDevice.

Referenced by BSP_AUDIO_IN_DeInit().

void BSP_AUDIO_IN_MspInit ( void *  Params)

Initializes BSP_AUDIO_IN MSP.

Parameters:
Params: pointer on additional configuration parameters, can be NULL.

Definition at line 1264 of file stm32f413h_discovery_audio.c.

References DFSDMx_ChannelMspInit(), DFSDMx_FilterMspInit(), I2Sx_In_MspInit(), INPUT_DEVICE_ANALOG_MIC, and AUDIOIN_ContextTypeDef::InputDevice.

Referenced by BSP_AUDIO_IN_InitEx().

uint8_t BSP_AUDIO_IN_Pause ( void  )

Pauses the audio file stream.

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1619 of file stm32f413h_discovery_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 .. INPUT_DEVICE_DIGITAL_MIC5.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1648 of file stm32f413h_discovery_audio.c.

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

Referenced by BSP_AUDIO_IN_Stop(), and BSP_AUDIO_IN_StopEx().

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
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1054 of file stm32f413h_discovery_audio.c.

References AppBuffHalf, AppBuffTrigger, AUDIO_ERROR, AUDIO_OK, haudio_i2s, hAudioInDfsdmFilter, INPUT_DEVICE_DIGITAL_MIC, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, AUDIOIN_ContextTypeDef::InputDevice, POS_VAL, AUDIOIN_ContextTypeDef::pRecBuf, pScratchBuff, AUDIOIN_ContextTypeDef::RecSize, and ScratchSize.

uint8_t BSP_AUDIO_IN_RecordEx ( uint32_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
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1094 of file stm32f413h_discovery_audio.c.

References AUDIO_ERROR, AUDIO_OK, AUDIOIN_ContextTypeDef::ChannelNbr, DFSDM_MIC_NUMBER, hAudioInDfsdmFilter, INPUT_DEVICE_ANALOG_MIC, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, INPUT_DEVICE_DIGITAL_MIC3, INPUT_DEVICE_DIGITAL_MIC4, INPUT_DEVICE_DIGITAL_MIC5, AUDIOIN_ContextTypeDef::InputDevice, MicBuff, AUDIOIN_ContextTypeDef::MultiBuffMode, POS_VAL, and AUDIOIN_ContextTypeDef::RecSize.

uint8_t BSP_AUDIO_IN_Resume ( void  )

Resumes the audio file stream.

Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1670 of file stm32f413h_discovery_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 .. INPUT_DEVICE_DIGITAL_MIC5.
Return values:
AUDIO_OKif correct communication, else wrong communication

Definition at line 1700 of file stm32f413h_discovery_audio.c.

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

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 1724 of file stm32f413h_discovery_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 1556 of file stm32f413h_discovery_audio.c.

References AppBuffHalf, AppBuffTrigger, audio_drv, AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, BSP_AUDIO_IN_PauseEx(), haudio_i2s, INPUT_DEVICE_ANALOG_MIC, INPUT_DEVICE_DIGITAL_MIC1, INPUT_DEVICE_DIGITAL_MIC2, and AUDIOIN_ContextTypeDef::InputDevice.

uint8_t BSP_AUDIO_IN_StopEx ( uint32_t  InputDevice)

Stops audio recording.

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

Definition at line 1600 of file stm32f413h_discovery_audio.c.

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

User callback when record buffer is filled.

Definition at line 1736 of file stm32f413h_discovery_audio.c.

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

void BSP_AUDIO_IN_TransferComplete_CallBackEx ( uint32_t  InputDevice)

User callback when record buffer is filled.

Parameters:
InputDevice,:INPUT_DEVICE_DIGITAL_MIC1 .. INPUT_DEVICE_DIGITAL_MIC5.

Definition at line 1757 of file stm32f413h_discovery_audio.c.

Referenced by HAL_DFSDM_FilterRegConvCpltCallback().

Generated on Thu Jan 26 2017 16:30:37 for STM32F413H-Discovery BSP User Manual by   doxygen 1.7.6.1