nguyen nam
/
BSP-DISCO_F746NG
Nam
Diff: Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_audio.c
- Revision:
- 8:56384bddaba5
- Parent:
- 6:e1d9da7fe856
- Child:
- 9:df2ea349c37a
--- a/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_audio.c Thu Nov 10 10:05:52 2016 +0100 +++ b/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_audio.c Thu Feb 23 14:14:09 2017 +0100 @@ -2,8 +2,8 @@ ****************************************************************************** * @file stm32746g_discovery_audio.c * @author MCD Application Team - * @version V1.1.1 - * @date 02-June-2016 + * @version V2.0.0 + * @date 30-December-2016 * @brief This file provides the Audio driver for the STM32746G-Discovery board. @verbatim How To use this driver: @@ -790,15 +790,28 @@ /** @defgroup STM32746G_DISCOVERY_AUDIO_Out_Private_Functions STM32746G_DISCOVERY_AUDIO Out Private Functions * @{ */ - + +/** + * @brief Initializes wave recording. + * @param AudioFreq: Audio frequency to be configured for the SAI peripheral. + * @param BitRes: Audio frequency to be configured. + * @param ChnlNbr: Channel number. + * @retval AUDIO_OK if correct communication, else wrong communication + */ +uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr) +{ + return BSP_AUDIO_IN_InitEx(INPUT_DEVICE_DIGITAL_MICROPHONE_2, AudioFreq, BitRes, ChnlNbr); +} + /** * @brief Initializes wave recording. * @param InputDevice: INPUT_DEVICE_DIGITAL_MICROPHONE_2 or INPUT_DEVICE_INPUT_LINE_1 - * @param Volume: Initial volume level (in range 0(Mute)..80(+0dB)..100(+17.625dB)) * @param AudioFreq: Audio frequency to be configured for the SAI peripheral. + * @param BitRes: Audio frequency to be configured. + * @param ChnlNbr: Channel number. * @retval AUDIO_OK if correct communication, else wrong communication */ -uint8_t BSP_AUDIO_IN_Init(uint16_t InputDevice, uint8_t Volume, uint32_t AudioFreq) +uint8_t BSP_AUDIO_IN_InitEx(uint16_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr) { uint8_t ret = AUDIO_ERROR; uint32_t deviceid = 0x00; @@ -860,7 +873,7 @@ if(ret == AUDIO_OK) { /* Initialize the codec internal registers */ - audio_drv->Init(AUDIO_I2C_ADDRESS, InputDevice, Volume, AudioFreq); + audio_drv->Init(AUDIO_I2C_ADDRESS, InputDevice, 100, AudioFreq); } } return ret; @@ -871,11 +884,12 @@ * @param InputDevice: INPUT_DEVICE_DIGITAL_MICROPHONE_2 * @param OutputDevice: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, * or OUTPUT_DEVICE_BOTH. - * @param Volume: Initial volume level (in range 0(Mute)..80(+0dB)..100(+17.625dB)) * @param AudioFreq: Audio frequency to be configured for the SAI peripheral. + * @param BitRes: Audio frequency to be configured. + * @param ChnlNbr: Channel number. * @retval AUDIO_OK if correct communication, else wrong communication */ -uint8_t BSP_AUDIO_IN_OUT_Init(uint16_t InputDevice, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq) +uint8_t BSP_AUDIO_IN_OUT_Init(uint16_t InputDevice, uint16_t OutputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr) { uint8_t ret = AUDIO_ERROR; uint32_t deviceid = 0x00; @@ -945,7 +959,7 @@ if(ret == AUDIO_OK) { /* Initialize the codec internal registers */ - audio_drv->Init(AUDIO_I2C_ADDRESS, InputDevice | OutputDevice, Volume, AudioFreq); + audio_drv->Init(AUDIO_I2C_ADDRESS, InputDevice | OutputDevice, 100, AudioFreq); } } return ret;