STM32F413H-Discovery BSP User Manual
|
stm32f413h_discovery_audio.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f413h_discovery_audio.h 00004 * @author MCD Application Team 00005 * @version V1.0.0 00006 * @date 27-January-2017 00007 * @brief This file contains the common defines and functions prototypes for 00008 * the stm32f413h_discovery_audio.c driver. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00033 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00034 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************** 00037 */ 00038 00039 /* Define to prevent recursive inclusion -------------------------------------*/ 00040 #ifndef __STM32F413H_DISCOVERY_AUDIO_H 00041 #define __STM32F413H_DISCOVERY_AUDIO_H 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 /* Includes ------------------------------------------------------------------*/ 00048 /* Include audio component Driver */ 00049 #include "../Components/wm8994/wm8994.h" 00050 #include "stm32f413h_discovery.h" 00051 00052 /** @addtogroup BSP 00053 * @{ 00054 */ 00055 00056 /** @addtogroup STM32F413H_DISCOVERY 00057 * @{ 00058 */ 00059 00060 /** @addtogroup STM32F413H_DISCOVERY_AUDIO 00061 * @{ 00062 */ 00063 00064 /** @defgroup STM32F413H_DISCOVERY_AUDIO_Exported_Types STM32F413H DISCOVERY Audio Exported Types 00065 * @{ 00066 */ 00067 00068 typedef struct 00069 { 00070 uint32_t Frequency; /* Record Frequency */ 00071 uint32_t BitResolution; /* Record bit resolution */ 00072 uint32_t ChannelNbr; /* Record Channel Number */ 00073 uint16_t *pRecBuf; /* Pointer to record user buffer */ 00074 uint32_t RecSize; /* Size to record in mono, double size to record in stereo */ 00075 uint32_t InputDevice; /* Audio Input Device */ 00076 uint32_t MultiBuffMode; /* Multi buffer mode selection */ 00077 }AUDIOIN_ContextTypeDef; 00078 00079 /** 00080 * @} 00081 */ 00082 00083 /** @defgroup STM32F413H_DISCOVERY_AUDIO_Exported_Constants STM32F413H DISCOVERY Audio Exported Constants 00084 * @{ 00085 */ 00086 00087 /*------------------------------------------------------------------------------ 00088 AUDIO OUT CONFIGURATION 00089 ------------------------------------------------------------------------------*/ 00090 /* SPI Configuration defines */ 00091 #define AUDIO_OUT_I2Sx SPI2 00092 #define AUDIO_OUT_I2Sx_CLK_ENABLE() __HAL_RCC_SPI2_CLK_ENABLE() 00093 #define AUDIO_OUT_I2Sx_CLK_DISABLE() __HAL_RCC_SPI2_CLK_DISABLE() 00094 00095 #define AUDIO_OUT_I2Sx_MCK_PIN GPIO_PIN_3 00096 #define AUDIO_OUT_I2Sx_MCK_GPIO_PORT GPIOA 00097 #define AUDIO_OUT_I2Sx_MCK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00098 #define AUDIO_OUT_I2Sx_MCK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE() 00099 #define AUDIO_OUT_I2Sx_MCK_AF GPIO_AF5_SPI2 00100 00101 #define AUDIO_OUT_I2Sx_SCK_PIN GPIO_PIN_3 00102 #define AUDIO_OUT_I2Sx_SCK_GPIO_PORT GPIOD 00103 #define AUDIO_OUT_I2Sx_SCK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() 00104 #define AUDIO_OUT_I2Sx_SCK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE() 00105 #define AUDIO_OUT_I2Sx_SCK_AF GPIO_AF5_SPI2 00106 00107 #define AUDIO_OUT_I2Sx_WS_PIN GPIO_PIN_9 00108 #define AUDIO_OUT_I2Sx_WS_GPIO_PORT GPIOB 00109 #define AUDIO_OUT_I2Sx_WS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00110 #define AUDIO_OUT_I2Sx_WS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00111 #define AUDIO_OUT_I2Sx_WS_AF GPIO_AF5_SPI2 00112 00113 #define AUDIO_OUT_I2Sx_SD_PIN GPIO_PIN_3 00114 #define AUDIO_OUT_I2Sx_SD_GPIO_PORT GPIOC 00115 #define AUDIO_OUT_I2Sx_SD_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE() 00116 #define AUDIO_OUT_I2Sx_SD_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE() 00117 #define AUDIO_OUT_I2Sx_SD_AF GPIO_AF5_SPI2 00118 00119 /* I2S DMA Stream Tx definitions */ 00120 #define AUDIO_OUT_I2Sx_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() 00121 #define AUDIO_OUT_I2Sx_DMAx_CLK_DISABLE() __HAL_RCC_DMA1_CLK_DISABLE() 00122 #define AUDIO_OUT_I2Sx_DMAx_STREAM DMA1_Stream4 00123 #define AUDIO_OUT_I2Sx_DMAx_CHANNEL DMA_CHANNEL_0 00124 #define AUDIO_OUT_I2Sx_DMAx_IRQ DMA1_Stream4_IRQn 00125 #define AUDIO_OUT_I2Sx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_HALFWORD 00126 #define AUDIO_OUT_I2Sx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_HALFWORD 00127 #define DMA_MAX_SIZE 0xFFFF 00128 00129 #define AUDIO_OUT_I2Sx_DMAx_IRQHandler DMA1_Stream4_IRQHandler 00130 00131 /* Select the interrupt preemption priority for the DMA interrupt */ 00132 #define AUDIO_OUT_IRQ_PREPRIO ((uint32_t)0x0E) /* Select the preemption priority level(0 is the highest) */ 00133 00134 00135 /*------------------------------------------------------------------------------ 00136 AUDIO IN CONFIGURATION 00137 ------------------------------------------------------------------------------*/ 00138 /* DFSDM Configuration defines */ 00139 #define AUDIO_DFSDMx_MIC1_CHANNEL DFSDM1_Channel1 /* MP34DT01TR U1 microphone on PCB top side */ 00140 #define AUDIO_DFSDMx_MIC2_CHANNEL DFSDM2_Channel1 /* MP34DT01TR U2 microphone on PCB top side */ 00141 #define AUDIO_DFSDMx_MIC3_CHANNEL DFSDM2_Channel0 /* MP34DT01TR U3 microphone on PCB top side */ 00142 #define AUDIO_DFSDMx_MIC4_CHANNEL DFSDM2_Channel7 /* MP34DT01TR U4 microphone on PCB top side */ 00143 #define AUDIO_DFSDMx_MIC5_CHANNEL DFSDM2_Channel6 /* MP34DT01TR U5 microphone on PCB top side */ 00144 00145 #define AUDIO_DFSDMx_MIC1_CHANNEL_FOR_FILTER DFSDM_CHANNEL_1 00146 #define AUDIO_DFSDMx_MIC2_CHANNEL_FOR_FILTER DFSDM_CHANNEL_1 00147 #define AUDIO_DFSDMx_MIC3_CHANNEL_FOR_FILTER DFSDM_CHANNEL_0 00148 #define AUDIO_DFSDMx_MIC4_CHANNEL_FOR_FILTER DFSDM_CHANNEL_7 00149 #define AUDIO_DFSDMx_MIC5_CHANNEL_FOR_FILTER DFSDM_CHANNEL_6 00150 00151 #define AUDIO_DFSDMx_MIC1_FILTER DFSDM1_Filter0 /* Common MIC1 filter for MP34DT01TR (U1) microphone input */ 00152 #define AUDIO_DFSDMx_MIC2_FILTER DFSDM2_Filter0 /* Common MIC2 filter for MP34DT01TR(U2) microphone input */ 00153 #define AUDIO_DFSDMx_MIC3_FILTER DFSDM2_Filter1 /* Common MIC2 filter for MP34DT01TR(U3) microphone input */ 00154 #define AUDIO_DFSDMx_MIC4_FILTER DFSDM2_Filter2 /* Common MIC2 filter for MP34DT01TR(U4) microphone input */ 00155 #define AUDIO_DFSDMx_MIC5_FILTER DFSDM2_Filter3 /* Common MIC2 filter for MP34DT01TR(U5) microphone input */ 00156 00157 #define AUDIO_DFSDMx_MIC2_5_CLK_ENABLE() __HAL_RCC_DFSDM2_CLK_ENABLE() 00158 #define AUDIO_DFSDMx_MIC1_CLK_ENABLE() __HAL_RCC_DFSDM1_CLK_ENABLE() 00159 00160 #define AUDIO_DFSDMx_MIC1_CKOUT_PIN GPIO_PIN_8 00161 #define AUDIO_DFSDMx_MIC1_CKOUT_DMIC_GPIO_PORT GPIOA 00162 #define AUDIO_DFSDMx_MIC1_CKOUT_DMIC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00163 #define AUDIO_DFSDMx_MIC1_CKOUT_DMIC_AF GPIO_AF6_DFSDM1 00164 00165 #define AUDIO_DFSDMx_MIC1_DMIC_PIN GPIO_PIN_6 00166 #define AUDIO_DFSDMx_MIC1_DMIC_GPIO_PORT GPIOD 00167 #define AUDIO_DFSDMx_MIC1_DMIC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() 00168 #define AUDIO_DFSDMx_MIC1_DMIC_AF GPIO_AF6_DFSDM1 00169 00170 #define AUDIO_DFSDMx_MIC2_5_CKOUT_PIN GPIO_PIN_2 00171 #define AUDIO_DFSDMx_MIC2_5_CKOUT_DMIC_GPIO_PORT GPIOD 00172 #define AUDIO_DFSDMx_MIC2_5_CKOUT_DMIC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE() 00173 #define AUDIO_DFSDMx_MIC2_5_CKOUT_DMIC_AF GPIO_AF3_DFSDM2 00174 00175 #define AUDIO_DFSDMx_MIC23_DMIC_PIN GPIO_PIN_7 00176 #define AUDIO_DFSDMx_MIC23_DMIC_GPIO_PORT GPIOA 00177 #define AUDIO_DFSDMx_MIC23_DMIC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE() 00178 #define AUDIO_DFSDMx_MIC23_DMIC_AF GPIO_AF7_DFSDM2 00179 00180 #define AUDIO_DFSDMx_MIC45_DMIC_PIN GPIO_PIN_7 00181 #define AUDIO_DFSDMx_MIC45_DMIC_GPIO_PORT GPIOB 00182 #define AUDIO_DFSDMx_MIC45_DMIC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00183 #define AUDIO_DFSDMx_MIC45_DMIC_AF GPIO_AF6_DFSDM2 00184 00185 /* DFSDM DMA Right and Left channels definitions */ 00186 #define AUDIO_DFSDMx_DMAx_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE() 00187 #define AUDIO_DFSDMx_DMAx_MIC1_STREAM DMA2_Stream6 00188 #define AUDIO_DFSDMx_DMAx_MIC1_CHANNEL DMA_CHANNEL_3 00189 #define AUDIO_DFSDMx_DMAx_MIC2_STREAM DMA2_Stream0 00190 #define AUDIO_DFSDMx_DMAx_MIC2_CHANNEL DMA_CHANNEL_8 00191 #define AUDIO_DFSDMx_DMAx_MIC3_STREAM DMA2_Stream1 00192 #define AUDIO_DFSDMx_DMAx_MIC3_CHANNEL DMA_CHANNEL_8 00193 #define AUDIO_DFSDMx_DMAx_MIC4_STREAM DMA2_Stream2 00194 #define AUDIO_DFSDMx_DMAx_MIC4_CHANNEL DMA_CHANNEL_8 00195 #define AUDIO_DFSDMx_DMAx_MIC5_STREAM DMA2_Stream7 00196 #define AUDIO_DFSDMx_DMAx_MIC5_CHANNEL DMA_CHANNEL_8 00197 #define AUDIO_DFSDMx_DMAx_MIC1_IRQ DMA2_Stream6_IRQn 00198 #define AUDIO_DFSDMx_DMAx_MIC2_IRQ DMA2_Stream0_IRQn 00199 #define AUDIO_DFSDMx_DMAx_MIC3_IRQ DMA2_Stream1_IRQn 00200 #define AUDIO_DFSDMx_DMAx_MIC4_IRQ DMA2_Stream2_IRQn 00201 #define AUDIO_DFSDMx_DMAx_MIC5_IRQ DMA2_Stream7_IRQn 00202 00203 #define AUDIO_DFSDMx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_WORD 00204 #define AUDIO_DFSDMx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_WORD 00205 00206 #define AUDIO_DFSDM_DMAx_MIC1_IRQHandler DMA2_Stream6_IRQHandler 00207 #define AUDIO_DFSDM_DMAx_MIC2_IRQHandler DMA2_Stream0_IRQHandler 00208 #define AUDIO_DFSDM_DMAx_MIC3_IRQHandler DMA2_Stream1_IRQHandler 00209 #define AUDIO_DFSDM_DMAx_MIC4_IRQHandler DMA2_Stream2_IRQHandler 00210 #define AUDIO_DFSDM_DMAx_MIC5_IRQHandler DMA2_Stream7_IRQHandler 00211 00212 00213 /* Select the interrupt preemption priority and subpriority for the IT/DMA interrupt */ 00214 #define AUDIO_IN_IRQ_PREPRIO 0x0F /* Select the preemption priority level(0 is the highest) */ 00215 00216 /* HW defines for Analog mic configuration */ 00217 #define AUDIO_IN_I2Sx SPI3 00218 #define AUDIO_IN_I2Sx_CLK_ENABLE() __HAL_RCC_SPI3_CLK_ENABLE() 00219 #define AUDIO_IN_I2Sx_CLK_DISABLE() __HAL_RCC_SPI3_CLK_DISABLE() 00220 00221 #define AUDIO_IN_I2Sx_EXT_SD_PIN GPIO_PIN_4 00222 #define AUDIO_IN_I2Sx_EXT_SD_GPIO_PORT GPIOB 00223 #define AUDIO_IN_I2Sx_EXT_SD_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE() 00224 #define AUDIO_IN_I2Sx_EXT_SD_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE() 00225 #define AUDIO_IN_I2Sx_EXT_SD_AF GPIO_AF7_SPI3 00226 00227 #define AUDIO_IN_CODEC_INT_PIN GPIO_PIN_2 00228 #define AUDIO_IN_CODEC_INT_GPIO_PORT GPIOG 00229 #define AUDIO_IN_CODEC_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE() 00230 #define AUDIO_IN_CODEC_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE() 00231 #define AUDIO_IN_CODEC_INT_IRQ EXTI2_IRQn 00232 00233 /* I2S DMA Stream Rx definitions */ 00234 #define AUDIO_IN_I2Sx_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() 00235 #define AUDIO_IN_I2Sx_DMAx_CLK_DISABLE() __HAL_RCC_DMA1_CLK_DISABLE() 00236 #define AUDIO_IN_I2Sx_DMAx_STREAM DMA1_Stream0 00237 #define AUDIO_IN_I2Sx_DMAx_CHANNEL DMA_CHANNEL_3 00238 #define AUDIO_IN_I2Sx_DMAx_IRQ DMA1_Stream0_IRQn 00239 #define AUDIO_IN_I2Sx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_HALFWORD 00240 #define AUDIO_IN_I2Sx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_HALFWORD 00241 00242 #define AUDIO_IN_I2Sx_DMAx_IRQHandler DMA1_Stream0_IRQHandler 00243 #define AUDIO_IN_I2Sx_DMAx_IRQ DMA1_Stream0_IRQn 00244 00245 /*------------------------------------------------------------------------------ 00246 CONFIGURATION: Audio Driver Configuration parameters 00247 ------------------------------------------------------------------------------*/ 00248 00249 #define AUDIODATA_SIZE 2 /* 16-bits audio data size */ 00250 00251 /* Audio status definition */ 00252 #define AUDIO_OK ((uint8_t)0) 00253 #define AUDIO_ERROR ((uint8_t)1) 00254 #define AUDIO_TIMEOUT ((uint8_t)2) 00255 00256 /* Audio out parameters */ 00257 #define DEFAULT_AUDIO_OUT_FREQ I2S_AUDIOFREQ_48K 00258 #define DEFAULT_AUDIO_OUT_BIT_RESOLUTION ((uint8_t)16) 00259 #define DEFAULT_AUDIO_OUT_CHANNEL_NBR ((uint8_t)2) /* Mono = 1, Stereo = 2 */ 00260 #define DEFAULT_AUDIO_OUT_VOLUME ((uint16_t)64) 00261 00262 /* Audio in parameters */ 00263 #define DEFAULT_AUDIO_IN_FREQ I2S_AUDIOFREQ_16K 00264 #define DEFAULT_AUDIO_IN_BIT_RESOLUTION ((uint8_t)16) 00265 #define DEFAULT_AUDIO_IN_CHANNEL_NBR ((uint8_t)2) /* Mono = 1, Stereo = 2 */ 00266 #define DEFAULT_AUDIO_IN_VOLUME ((uint16_t)64) 00267 00268 /*------------------------------------------------------------------------------ 00269 OUTPUT DEVICES definition 00270 ------------------------------------------------------------------------------*/ 00271 00272 /* Alias on existing output devices to adapt for 2 headphones output */ 00273 #define OUTPUT_DEVICE_HEADPHONE1 OUTPUT_DEVICE_HEADPHONE 00274 #define OUTPUT_DEVICE_HEADPHONE2 OUTPUT_DEVICE_SPEAKER /* Headphone2 is connected to Speaker output of the wm8994 */ 00275 00276 /*------------------------------------------------------------------------------ 00277 INPUT DEVICES definition 00278 ------------------------------------------------------------------------------*/ 00279 /* Analog microphone input from 3.5 audio jack connector */ 00280 #define INPUT_DEVICE_ANALOG_MIC ((uint32_t)0x00000001) 00281 /* MP34DT01TR digital microphone on PCB top side */ 00282 #define INPUT_DEVICE_DIGITAL_MIC1 ((uint32_t)0x00000010) 00283 #define INPUT_DEVICE_DIGITAL_MIC2 ((uint32_t)0x00000020) 00284 #define INPUT_DEVICE_DIGITAL_MIC3 ((uint32_t)0x00000040) 00285 #define INPUT_DEVICE_DIGITAL_MIC4 ((uint32_t)0x00000080) 00286 #define INPUT_DEVICE_DIGITAL_MIC5 ((uint32_t)0x00000100) 00287 #define INPUT_DEVICE_DIGITAL_MIC ((uint32_t)(INPUT_DEVICE_DIGITAL_MIC1 | INPUT_DEVICE_DIGITAL_MIC2)) 00288 #define INPUT_DEVICE_DIGITAL_MIC_ALL ((uint32_t)(INPUT_DEVICE_DIGITAL_MIC1 | INPUT_DEVICE_DIGITAL_MIC2 |\ 00289 INPUT_DEVICE_DIGITAL_MIC3 | INPUT_DEVICE_DIGITAL_MIC4 |\ 00290 INPUT_DEVICE_DIGITAL_MIC5)) 00291 00292 #define DFSDM_MIC_NUMBER (5) 00293 00294 /** 00295 * @} 00296 */ 00297 00298 /** @defgroup STM32F413H_DISCOVERY_AUDIO_Exported_Variables STM32F413H DISCOVERY Audio Exported Variables 00299 * @{ 00300 */ 00301 extern __IO uint16_t AudioInVolume; 00302 /** 00303 * @} 00304 */ 00305 00306 /** @defgroup STM32F413H_DISCOVERY_AUDIO_Exported_Macros STM32F413H DISCOVERY Audio Exported Macros 00307 * @{ 00308 */ 00309 #define DMA_MAX(x) (((x) <= DMA_MAX_SIZE)? (x):DMA_MAX_SIZE) 00310 #define POS_VAL(VAL) (POSITION_VAL(VAL) - 4) 00311 /** 00312 * @} 00313 */ 00314 00315 /** @defgroup STM32F413H_DISCOVERY_AUDIO_OUT_Exported_Functions STM32F413H DISCOVERY Audio OUT Exported Functions 00316 * @{ 00317 */ 00318 uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); 00319 uint8_t BSP_AUDIO_OUT_Play(uint16_t* pBuffer, uint32_t Size); 00320 void BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size); 00321 uint8_t BSP_AUDIO_OUT_Pause(void); 00322 uint8_t BSP_AUDIO_OUT_Resume(void); 00323 uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option); 00324 uint8_t BSP_AUDIO_OUT_SetVolume(uint8_t Volume); 00325 void BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq); 00326 uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Cmd); 00327 uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output); 00328 void BSP_AUDIO_OUT_DeInit(void); 00329 00330 /* User Callbacks: user has to implement these functions in his code if they are needed. */ 00331 /* This function is called when the requested data has been completely transferred.*/ 00332 void BSP_AUDIO_OUT_TransferComplete_CallBack(void); 00333 00334 /* This function is called when half of the requested buffer has been transferred. */ 00335 void BSP_AUDIO_OUT_HalfTransfer_CallBack(void); 00336 00337 /* This function is called when an Interrupt due to transfer error on or peripheral 00338 error occurs. */ 00339 void BSP_AUDIO_OUT_Error_CallBack(void); 00340 00341 /* These function can be modified in case the current settings (e.g. DMA stream) 00342 need to be changed for specific application needs */ 00343 void BSP_AUDIO_OUT_ClockConfig(I2S_HandleTypeDef *hi2s, uint32_t AudioFreq, void *Params); 00344 void BSP_AUDIO_OUT_MspInit(I2S_HandleTypeDef *hi2s, void *Params); 00345 void BSP_AUDIO_OUT_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params); 00346 00347 /** 00348 * @} 00349 */ 00350 00351 /** @defgroup STM32F413H_DISCOVERY_AUDIO_IN_Exported_Functions STM32F413H DISCOVERY AudioIN Exported Functions 00352 * @{ 00353 */ 00354 uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr); 00355 uint8_t BSP_AUDIO_IN_InitEx(uint32_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr); 00356 uint8_t BSP_AUDIO_IN_ConfigMicDefault(uint32_t InputDevice); 00357 uint8_t BSP_AUDIO_IN_ConfigDigitalMic(uint32_t InputDevice, void *Params); 00358 uint8_t BSP_AUDIO_IN_AllocScratch (int32_t *pScratch, uint32_t size); 00359 uint8_t BSP_AUDIO_IN_Record(uint16_t *pBuf, uint32_t Size); 00360 uint8_t BSP_AUDIO_IN_RecordEx(uint32_t *pBuf, uint32_t Size); 00361 uint8_t BSP_AUDIO_IN_SetFrequency(uint32_t AudioFreq); 00362 uint8_t BSP_AUDIO_IN_Stop(void); 00363 uint8_t BSP_AUDIO_IN_StopEx(uint32_t InputDevice); 00364 uint8_t BSP_AUDIO_IN_Pause(void); 00365 uint8_t BSP_AUDIO_IN_PauseEx(uint32_t InputDevice); 00366 uint8_t BSP_AUDIO_IN_Resume(void); 00367 uint8_t BSP_AUDIO_IN_ResumeEx(uint32_t *pBuf, uint32_t InputDevice); 00368 uint8_t BSP_AUDIO_IN_SetVolume(uint8_t Volume); 00369 void BSP_AUDIO_IN_DeInit(void); 00370 00371 /* User Callbacks: user has to implement these functions in his code if they are needed. */ 00372 /* This function should be implemented by the user application. 00373 It is called into this driver when the current buffer is filled to prepare the next 00374 buffer pointer and its size. */ 00375 void BSP_AUDIO_IN_TransferComplete_CallBack(void); 00376 void BSP_AUDIO_IN_HalfTransfer_CallBack(void); 00377 void BSP_AUDIO_IN_TransferComplete_CallBackEx(uint32_t InputDevice); 00378 void BSP_AUDIO_IN_HalfTransfer_CallBackEx(uint32_t InputDevice); 00379 00380 /* This function is called when an Interrupt due to transfer error on or peripheral 00381 error occurs. */ 00382 void BSP_AUDIO_IN_Error_Callback(void); 00383 00384 /* These function can be modified in case the current settings (e.g. DMA stream) 00385 need to be changed for specific application needs */ 00386 uint8_t BSP_AUDIO_IN_ClockConfig(uint32_t AudioFreq, void *Params); 00387 void BSP_AUDIO_IN_MspInit(void *Params); 00388 void BSP_AUDIO_IN_MspDeInit(void *Params); 00389 00390 /** 00391 * @} 00392 */ 00393 00394 /** 00395 * @} 00396 */ 00397 00398 /** 00399 * @} 00400 */ 00401 00402 /** 00403 * @} 00404 */ 00405 00406 #ifdef __cplusplus 00407 } 00408 #endif 00409 00410 #endif /* __STM32F413H_DISCOVERY_AUDIO_H */ 00411 00412 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Thu Jan 26 2017 16:30:37 for STM32F413H-Discovery BSP User Manual by 1.7.6.1