STM32L152D_EVAL BSP User Manual
|
Modules | |
STM32L152D_EVAL_AUDIO_OUT_Exported_Functions | |
STM32L152D_EVAL_AUDIO_IN_Exported_Functions | |
Functions | |
uint8_t | BSP_AUDIO_OUT_Init (uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq) |
Configure 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 I2S 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. | |
__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) |
Initialize wave recording. | |
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_Pause (void) |
This function Pauses the audio file stream. | |
uint8_t | BSP_AUDIO_IN_Resume (void) |
This function 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. | |
void | HAL_I2S_TxCpltCallback (I2S_HandleTypeDef *hi2s) |
Tx Transfer completed callbacks. | |
void | HAL_I2S_TxHalfCpltCallback (I2S_HandleTypeDef *hi2s) |
Tx Transfer Half completed callbacks. | |
void | HAL_I2S_ErrorCallback (I2S_HandleTypeDef *hi2s) |
I2S error callbacks. | |
void | HAL_ADC_ConvCpltCallback (ADC_HandleTypeDef *hadc) |
Conversion complete callback in non blocking mode. | |
void | HAL_ADC_ConvHalfCpltCallback (ADC_HandleTypeDef *hadc) |
Conversion DMA half-transfer callback in non blocking mode. | |
static void | ADCx_MspInit (ADC_HandleTypeDef *hadc) |
Initializes ADC MSP. | |
static void | OPAMPx_MspInit (OPAMP_HandleTypeDef *hopamp) |
Initializes the OPAMP BSP. | |
static void | TIMx_Base_MspInit (TIM_HandleTypeDef *htim) |
Initializes the TIM Base BSP. |
Function Documentation
static void ADCx_MspInit | ( | ADC_HandleTypeDef * | hadc | ) | [static] |
Initializes ADC MSP.
- Parameters:
-
hadc : ADC handle
- Return values:
-
None
Definition at line 833 of file stm32l152d_eval_audio.c.
References AUDIO_IN_ADC_GPIO_CLK_ENABLE, AUDIO_IN_ADC_PIN, AUDIO_IN_ADC_PORT, AUDIO_IN_DMAx_CHANNEL, AUDIO_IN_DMAx_CLK_ENABLE, AUDIO_IN_DMAx_IRQ, AUDIO_IN_DMAx_MEM_DATA_SIZE, AUDIO_IN_DMAx_PERIPH_DATA_SIZE, and AUDIO_IN_IRQ_PREPRIO.
Referenced by BSP_AUDIO_IN_Init().
__weak void BSP_AUDIO_IN_Error_Callback | ( | void | ) |
Audio IN Error callback function.
- Return values:
-
None
Definition at line 709 of file stm32l152d_eval_audio.c.
__weak void BSP_AUDIO_IN_HalfTransfer_CallBack | ( | void | ) |
Manages the DMA Half Transfer complete event.
- Return values:
-
None
Definition at line 698 of file stm32l152d_eval_audio.c.
Referenced by HAL_ADC_ConvHalfCpltCallback().
uint8_t BSP_AUDIO_IN_Init | ( | uint32_t | AudioFreq, |
uint32_t | BitRes, | ||
uint32_t | ChnlNbr | ||
) |
Initialize wave recording.
- Parameters:
-
AudioFreq Audio frequency acquisition. Note: On STM32L1 evaluation board, the microphone acquisition is done through an analong amplifier with a band-pass filter centered at 32kHz. Therefore, this parameter value should be set at maximum to 32kHz (value "32000"). BitRes Audio frequency to be configured for the I2S peripheral. Note: On STM32L1 evaluation board, this parameter is not used, but kept as parameter for compatibility with other STM32 BSP drivers. ChnlNbr Audio frequency to be configured for the I2S peripheral. Note: On STM32L1 evaluation board, this parameter is not used, but kept as parameter for compatibility with other STM32 BSP drivers.
- Return values:
-
AUDIO_OK if correct communication, else wrong communication
Definition at line 478 of file stm32l152d_eval_audio.c.
References ADCx_MspInit(), AUDIO_ERROR, AUDIO_IN_ADC_CHANNEL, AUDIO_OK, hAudioInAdc, hAudioInConfigAdc, hAudioInOpamp, hAudioInTim3, OPAMPx_MspInit(), and TIMx_Base_MspInit().
uint8_t BSP_AUDIO_IN_Pause | ( | void | ) |
This function Pauses the audio file stream.
- Return values:
-
AUDIO_OK if correct communication, else wrong communication
Definition at line 637 of file stm32l152d_eval_audio.c.
References AUDIO_ERROR, AUDIO_OK, and hAudioInTim3.
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_OK if correct communication, else wrong communication
Definition at line 578 of file stm32l152d_eval_audio.c.
References AUDIO_ERROR, AUDIO_OK, hAudioInAdc, and hAudioInTim3.
uint8_t BSP_AUDIO_IN_Resume | ( | void | ) |
This function Resumes the audio file stream.
- Return values:
-
AUDIO_OK if correct communication, else wrong communication
Definition at line 655 of file stm32l152d_eval_audio.c.
References AUDIO_ERROR, AUDIO_OK, and hAudioInTim3.
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_OK if correct communication, else wrong communication
Definition at line 675 of file stm32l152d_eval_audio.c.
References AUDIO_OK, and AudioInVolume.
uint8_t BSP_AUDIO_IN_Stop | ( | void | ) |
Stop audio recording.
- Return values:
-
None
Definition at line 608 of file stm32l152d_eval_audio.c.
References AUDIO_ERROR, AUDIO_OK, hAudioInAdc, hAudioInOpamp, and hAudioInTim3.
__weak void BSP_AUDIO_IN_TransferComplete_CallBack | ( | void | ) |
User callback when record buffer is filled.
- Return values:
-
None
Definition at line 687 of file stm32l152d_eval_audio.c.
Referenced by HAL_ADC_ConvCpltCallback().
uint8_t BSP_AUDIO_OUT_ChangeBuffer | ( | uint16_t * | pData, |
uint16_t | Size | ||
) |
Sends n-Bytes on the I2S interface.
- Parameters:
-
pData,: pointer on data address Size,: number of data to be written
- Return values:
-
None
Definition at line 276 of file stm32l152d_eval_audio.c.
References hAudioOutI2s.
__weak void BSP_AUDIO_OUT_Error_CallBack | ( | void | ) |
Manages the DMA FIFO error event.
- Return values:
-
None
Definition at line 456 of file stm32l152d_eval_audio.c.
Referenced by HAL_I2S_ErrorCallback().
__weak void BSP_AUDIO_OUT_HalfTransfer_CallBack | ( | void | ) |
Manages the DMA Half Transfer complete event.
- Return values:
-
None
Definition at line 448 of file stm32l152d_eval_audio.c.
Referenced by HAL_I2S_TxHalfCpltCallback().
uint8_t BSP_AUDIO_OUT_Init | ( | uint16_t | OutputDevice, |
uint8_t | Volume, | ||
uint32_t | AudioFreq | ||
) |
Configure 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:
-
0 if correct communication, else wrong communication
Definition at line 218 of file stm32l152d_eval_audio.c.
References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, I2SOUT_Init(), and pAudioDrv.
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_OK if correct communication, else wrong communication
Definition at line 289 of file stm32l152d_eval_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_OK if correct communication, else wrong communication
Definition at line 254 of file stm32l152d_eval_audio.c.
References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, DMA_MAX, hAudioOutI2s, and pAudioDrv.
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_OK if correct communication, else wrong communication
Definition at line 313 of file stm32l152d_eval_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.
- Return values:
-
None
- Note:
- This API should be called after the BSP_AUDIO_OUT_Init() to adjust the audio frequency.
Definition at line 430 of file stm32l152d_eval_audio.c.
References I2SOUT_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_OK if correct communication, else wrong communication
Definition at line 387 of file stm32l152d_eval_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_OK if correct communication, else wrong communication
Definition at line 409 of file stm32l152d_eval_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_OK if correct communication, else wrong communication
Definition at line 367 of file stm32l152d_eval_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_OK if correct communication, else wrong communication
Definition at line 336 of file stm32l152d_eval_audio.c.
References AUDIO_ERROR, AUDIO_I2C_ADDRESS, AUDIO_OK, AUDIO_RESET_GPIO, AUDIO_RESET_PIN, hAudioOutI2s, and pAudioDrv.
__weak void BSP_AUDIO_OUT_TransferComplete_CallBack | ( | void | ) |
Manages the DMA full Transfer complete event.
- Return values:
-
None
Definition at line 440 of file stm32l152d_eval_audio.c.
Referenced by HAL_I2S_TxCpltCallback().
void HAL_ADC_ConvCpltCallback | ( | ADC_HandleTypeDef * | hadc | ) |
Conversion complete callback in non blocking mode.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
None
Definition at line 975 of file stm32l152d_eval_audio.c.
References BSP_AUDIO_IN_TransferComplete_CallBack().
void HAL_ADC_ConvHalfCpltCallback | ( | ADC_HandleTypeDef * | hadc | ) |
Conversion DMA half-transfer callback in non blocking mode.
- Parameters:
-
hadc,: ADC handle
- Return values:
-
None
Definition at line 985 of file stm32l152d_eval_audio.c.
References BSP_AUDIO_IN_HalfTransfer_CallBack().
void HAL_I2S_ErrorCallback | ( | I2S_HandleTypeDef * | hi2s | ) |
I2S error callbacks.
- Parameters:
-
hi2s,: I2S handle
- Return values:
-
None
Definition at line 947 of file stm32l152d_eval_audio.c.
References BSP_AUDIO_OUT_Error_CallBack(), and I2SOUT.
void HAL_I2S_TxCpltCallback | ( | I2S_HandleTypeDef * | hi2s | ) |
Tx Transfer completed callbacks.
- Parameters:
-
hi2s,: I2S handle
- Return values:
-
None
Definition at line 918 of file stm32l152d_eval_audio.c.
References BSP_AUDIO_OUT_TransferComplete_CallBack(), and I2SOUT.
void HAL_I2S_TxHalfCpltCallback | ( | I2S_HandleTypeDef * | hi2s | ) |
Tx Transfer Half completed callbacks.
- Parameters:
-
hi2s,: I2S handle
- Return values:
-
None
Definition at line 932 of file stm32l152d_eval_audio.c.
References BSP_AUDIO_OUT_HalfTransfer_CallBack(), and I2SOUT.
void OPAMPx_MspInit | ( | OPAMP_HandleTypeDef * | hopamp | ) | [static] |
Initializes the OPAMP BSP.
- Parameters:
-
hopamp : OPAMP handle
- Return values:
-
None
Definition at line 894 of file stm32l152d_eval_audio.c.
References AUDIO_IN_OPAMP_GPIO_CLK_ENABLE, AUDIO_IN_OPAMP_PIN, and AUDIO_IN_OPAMP_PORT.
Referenced by BSP_AUDIO_IN_Init().
void TIMx_Base_MspInit | ( | TIM_HandleTypeDef * | htim | ) | [static] |
Initializes the TIM Base BSP.
- Parameters:
-
htim : Timer handle
- Return values:
-
None
Definition at line 962 of file stm32l152d_eval_audio.c.
Referenced by BSP_AUDIO_IN_Init().
Generated on Thu Aug 24 2017 17:57:47 for STM32L152D_EVAL BSP User Manual by
