Projet
Dependents: DISCO-F746NG_Scope_copy
Fork of BSP_DISCO_F746NG by
stm32746g_discovery_audio.h@10:32ce84f82a72, 2018-06-05 (annotated)
- Committer:
- 1536082
- Date:
- Tue Jun 05 19:44:28 2018 +0000
- Revision:
- 10:32ce84f82a72
- Parent:
- 1:ee089790cdbb
- Child:
- 5:5a395e126678
Projet
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 1:ee089790cdbb | 1 | /** |
bcostm | 1:ee089790cdbb | 2 | ****************************************************************************** |
bcostm | 1:ee089790cdbb | 3 | * @file stm32746g_discovery_audio.h |
bcostm | 1:ee089790cdbb | 4 | * @author MCD Application Team |
bcostm | 1:ee089790cdbb | 5 | * @version V1.0.0 |
bcostm | 1:ee089790cdbb | 6 | * @date 25-June-2015 |
bcostm | 1:ee089790cdbb | 7 | * @brief This file contains the common defines and functions prototypes for |
bcostm | 1:ee089790cdbb | 8 | * the stm32746g_discovery_audio.c driver. |
bcostm | 1:ee089790cdbb | 9 | ****************************************************************************** |
bcostm | 1:ee089790cdbb | 10 | * @attention |
bcostm | 1:ee089790cdbb | 11 | * |
bcostm | 1:ee089790cdbb | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
bcostm | 1:ee089790cdbb | 13 | * |
bcostm | 1:ee089790cdbb | 14 | * Redistribution and use in source and binary forms, with or without modification, |
bcostm | 1:ee089790cdbb | 15 | * are permitted provided that the following conditions are met: |
bcostm | 1:ee089790cdbb | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
bcostm | 1:ee089790cdbb | 17 | * this list of conditions and the following disclaimer. |
bcostm | 1:ee089790cdbb | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
bcostm | 1:ee089790cdbb | 19 | * this list of conditions and the following disclaimer in the documentation |
bcostm | 1:ee089790cdbb | 20 | * and/or other materials provided with the distribution. |
bcostm | 1:ee089790cdbb | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
bcostm | 1:ee089790cdbb | 22 | * may be used to endorse or promote products derived from this software |
bcostm | 1:ee089790cdbb | 23 | * without specific prior written permission. |
bcostm | 1:ee089790cdbb | 24 | * |
bcostm | 1:ee089790cdbb | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
bcostm | 1:ee089790cdbb | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
bcostm | 1:ee089790cdbb | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
bcostm | 1:ee089790cdbb | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
bcostm | 1:ee089790cdbb | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
bcostm | 1:ee089790cdbb | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
bcostm | 1:ee089790cdbb | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
bcostm | 1:ee089790cdbb | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
bcostm | 1:ee089790cdbb | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
bcostm | 1:ee089790cdbb | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
bcostm | 1:ee089790cdbb | 35 | * |
bcostm | 1:ee089790cdbb | 36 | ****************************************************************************** |
bcostm | 1:ee089790cdbb | 37 | */ |
bcostm | 1:ee089790cdbb | 38 | |
bcostm | 1:ee089790cdbb | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bcostm | 1:ee089790cdbb | 40 | #ifndef __STM32746G_DISCOVERY_AUDIO_H |
bcostm | 1:ee089790cdbb | 41 | #define __STM32746G_DISCOVERY_AUDIO_H |
bcostm | 1:ee089790cdbb | 42 | |
bcostm | 1:ee089790cdbb | 43 | #ifdef __cplusplus |
bcostm | 1:ee089790cdbb | 44 | extern "C" { |
bcostm | 1:ee089790cdbb | 45 | #endif |
bcostm | 1:ee089790cdbb | 46 | |
bcostm | 1:ee089790cdbb | 47 | /* Includes ------------------------------------------------------------------*/ |
bcostm | 1:ee089790cdbb | 48 | /* Include audio component Driver */ |
bcostm | 1:ee089790cdbb | 49 | #include "wm8994.h" |
bcostm | 1:ee089790cdbb | 50 | #include "stm32746g_discovery.h" |
bcostm | 1:ee089790cdbb | 51 | |
bcostm | 1:ee089790cdbb | 52 | /** @addtogroup BSP |
bcostm | 1:ee089790cdbb | 53 | * @{ |
bcostm | 1:ee089790cdbb | 54 | */ |
bcostm | 1:ee089790cdbb | 55 | |
bcostm | 1:ee089790cdbb | 56 | /** @addtogroup STM32746G_DISCOVERY |
bcostm | 1:ee089790cdbb | 57 | * @{ |
bcostm | 1:ee089790cdbb | 58 | */ |
bcostm | 1:ee089790cdbb | 59 | |
bcostm | 1:ee089790cdbb | 60 | /** @defgroup STM32746G_DISCOVERY_AUDIO STM32746G_DISCOVERY_AUDIO |
bcostm | 1:ee089790cdbb | 61 | * @{ |
bcostm | 1:ee089790cdbb | 62 | */ |
bcostm | 1:ee089790cdbb | 63 | |
bcostm | 1:ee089790cdbb | 64 | /** @defgroup STM32746G_DISCOVERY_AUDIO_Exported_Types STM32746G_DISCOVERY_AUDIO Exported Types |
bcostm | 1:ee089790cdbb | 65 | * @{ |
bcostm | 1:ee089790cdbb | 66 | */ |
bcostm | 1:ee089790cdbb | 67 | /** |
bcostm | 1:ee089790cdbb | 68 | * @} |
bcostm | 1:ee089790cdbb | 69 | */ |
bcostm | 1:ee089790cdbb | 70 | |
bcostm | 1:ee089790cdbb | 71 | /** @defgroup STM32746G_DISCOVERY_AUDIO_Exported_Constants STM32746G_DISCOVERY_AUDIO Exported Constants |
bcostm | 1:ee089790cdbb | 72 | * @{ |
bcostm | 1:ee089790cdbb | 73 | */ |
bcostm | 1:ee089790cdbb | 74 | |
bcostm | 1:ee089790cdbb | 75 | /*------------------------------------------------------------------------------ |
bcostm | 1:ee089790cdbb | 76 | USER SAI defines parameters |
bcostm | 1:ee089790cdbb | 77 | -----------------------------------------------------------------------------*/ |
bcostm | 1:ee089790cdbb | 78 | /* CODEC_AudioFrame_SLOT_TDMMode |
bcostm | 1:ee089790cdbb | 79 | In W8994 codec the Audio frame contains 4 slots : TDM Mode |
bcostm | 1:ee089790cdbb | 80 | TDM format : |
bcostm | 1:ee089790cdbb | 81 | +------------------|------------------|--------------------|-------------------+ |
bcostm | 1:ee089790cdbb | 82 | | CODEC_SLOT0 Left | CODEC_SLOT1 Left | CODEC_SLOT0 Right | CODEC_SLOT1 Right | |
bcostm | 1:ee089790cdbb | 83 | +------------------------------------------------------------------------------+ |
bcostm | 1:ee089790cdbb | 84 | */ |
bcostm | 1:ee089790cdbb | 85 | /* To have 2 separate audio stream in Both headphone and speaker the 4 slot must be activated */ |
bcostm | 1:ee089790cdbb | 86 | #define CODEC_AUDIOFRAME_SLOT_0123 SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_1 | SAI_SLOTACTIVE_2 | SAI_SLOTACTIVE_3 |
bcostm | 1:ee089790cdbb | 87 | /* To have an audio stream in headphone only SAI Slot 0 and Slot 2 must be activated */ |
bcostm | 1:ee089790cdbb | 88 | #define CODEC_AUDIOFRAME_SLOT_02 SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_2 |
bcostm | 1:ee089790cdbb | 89 | /* To have an audio stream in speaker only SAI Slot 1 and Slot 3 must be activated */ |
bcostm | 1:ee089790cdbb | 90 | #define CODEC_AUDIOFRAME_SLOT_13 SAI_SLOTACTIVE_1 | SAI_SLOTACTIVE_3 |
bcostm | 1:ee089790cdbb | 91 | |
bcostm | 1:ee089790cdbb | 92 | /* SAI OUT peripheral configuration defines */ |
bcostm | 1:ee089790cdbb | 93 | #define AUDIO_OUT_SAIx SAI2_Block_A |
bcostm | 1:ee089790cdbb | 94 | #define AUDIO_OUT_SAIx_CLK_ENABLE() __HAL_RCC_SAI2_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 95 | #define AUDIO_OUT_SAIx_CLK_DISABLE() __HAL_RCC_SAI2_CLK_DISABLE() |
bcostm | 1:ee089790cdbb | 96 | #define AUDIO_OUT_SAIx_SCK_AF GPIO_AF10_SAI2 |
bcostm | 1:ee089790cdbb | 97 | #define AUDIO_OUT_SAIx_FS_SD_MCLK_AF GPIO_AF10_SAI2 |
bcostm | 1:ee089790cdbb | 98 | |
bcostm | 1:ee089790cdbb | 99 | #define AUDIO_OUT_SAIx_MCLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 100 | #define AUDIO_OUT_SAIx_MCLK_GPIO_PORT GPIOI |
bcostm | 1:ee089790cdbb | 101 | #define AUDIO_OUT_SAIx_MCLK_PIN GPIO_PIN_4 |
bcostm | 1:ee089790cdbb | 102 | #define AUDIO_OUT_SAIx_SCK_SD_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 103 | #define AUDIO_OUT_SAIx_SCK_SD_GPIO_PORT GPIOI |
bcostm | 1:ee089790cdbb | 104 | #define AUDIO_OUT_SAIx_SCK_PIN GPIO_PIN_5 |
bcostm | 1:ee089790cdbb | 105 | #define AUDIO_OUT_SAIx_SD_PIN GPIO_PIN_6 |
bcostm | 1:ee089790cdbb | 106 | #define AUDIO_OUT_SAIx_FS_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 107 | #define AUDIO_OUT_SAIx_FS_GPIO_PORT GPIOI |
bcostm | 1:ee089790cdbb | 108 | #define AUDIO_OUT_SAIx_FS_PIN GPIO_PIN_7 |
bcostm | 1:ee089790cdbb | 109 | |
bcostm | 1:ee089790cdbb | 110 | /* SAI DMA Stream definitions */ |
bcostm | 1:ee089790cdbb | 111 | #define AUDIO_OUT_SAIx_DMAx_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 112 | #define AUDIO_OUT_SAIx_DMAx_STREAM DMA2_Stream4 |
bcostm | 1:ee089790cdbb | 113 | #define AUDIO_OUT_SAIx_DMAx_CHANNEL DMA_CHANNEL_3 |
bcostm | 1:ee089790cdbb | 114 | #define AUDIO_OUT_SAIx_DMAx_IRQ DMA2_Stream4_IRQn |
bcostm | 1:ee089790cdbb | 115 | #define AUDIO_OUT_SAIx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_HALFWORD |
bcostm | 1:ee089790cdbb | 116 | #define AUDIO_OUT_SAIx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_HALFWORD |
bcostm | 1:ee089790cdbb | 117 | #define DMA_MAX_SZE ((uint16_t)0xFFFF) |
bcostm | 1:ee089790cdbb | 118 | |
bcostm | 1:ee089790cdbb | 119 | #define AUDIO_OUT_SAIx_DMAx_IRQHandler DMA2_Stream4_IRQHandler |
bcostm | 1:ee089790cdbb | 120 | |
bcostm | 1:ee089790cdbb | 121 | /* Select the interrupt preemption priority for the DMA interrupt */ |
bcostm | 1:ee089790cdbb | 122 | #define AUDIO_OUT_IRQ_PREPRIO ((uint32_t)5) /* Select the preemption priority level(0 is the highest) */ |
bcostm | 1:ee089790cdbb | 123 | |
bcostm | 1:ee089790cdbb | 124 | /*------------------------------------------------------------------------------ |
bcostm | 1:ee089790cdbb | 125 | AUDIO IN CONFIGURATION |
bcostm | 1:ee089790cdbb | 126 | ------------------------------------------------------------------------------*/ |
bcostm | 1:ee089790cdbb | 127 | /* SAI IN peripheral configuration defines */ |
bcostm | 1:ee089790cdbb | 128 | #define AUDIO_IN_SAIx SAI2_Block_B |
bcostm | 1:ee089790cdbb | 129 | #define AUDIO_IN_SAIx_CLK_ENABLE() __HAL_RCC_SAI2_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 130 | #define AUDIO_IN_SAIx_CLK_DISABLE() __HAL_RCC_SAI2_CLK_DISABLE() |
bcostm | 1:ee089790cdbb | 131 | #define AUDIO_IN_SAIx_SD_AF GPIO_AF10_SAI2 |
bcostm | 1:ee089790cdbb | 132 | |
bcostm | 1:ee089790cdbb | 133 | #define AUDIO_IN_SAIx_SD_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 134 | #define AUDIO_IN_SAIx_SD_GPIO_PORT GPIOG |
bcostm | 1:ee089790cdbb | 135 | #define AUDIO_IN_SAIx_SD_PIN GPIO_PIN_10 |
bcostm | 1:ee089790cdbb | 136 | |
bcostm | 1:ee089790cdbb | 137 | #define AUDIO_IN_INT_GPIO_ENABLE() __HAL_RCC_GPIOH_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 138 | #define AUDIO_IN_INT_GPIO_PORT GPIOH |
bcostm | 1:ee089790cdbb | 139 | #define AUDIO_IN_INT_GPIO_PIN GPIO_PIN_15 |
bcostm | 1:ee089790cdbb | 140 | #define AUDIO_IN_INT_IRQ EXTI15_10_IRQn |
bcostm | 1:ee089790cdbb | 141 | |
bcostm | 1:ee089790cdbb | 142 | /* SAI DMA Stream definitions */ |
bcostm | 1:ee089790cdbb | 143 | #define AUDIO_IN_SAIx_DMAx_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE() |
bcostm | 1:ee089790cdbb | 144 | #define AUDIO_IN_SAIx_DMAx_STREAM DMA2_Stream7 |
bcostm | 1:ee089790cdbb | 145 | #define AUDIO_IN_SAIx_DMAx_CHANNEL DMA_CHANNEL_0 |
bcostm | 1:ee089790cdbb | 146 | #define AUDIO_IN_SAIx_DMAx_IRQ DMA2_Stream7_IRQn |
bcostm | 1:ee089790cdbb | 147 | #define AUDIO_IN_SAIx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_HALFWORD |
bcostm | 1:ee089790cdbb | 148 | #define AUDIO_IN_SAIx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_HALFWORD |
bcostm | 1:ee089790cdbb | 149 | |
bcostm | 1:ee089790cdbb | 150 | #define AUDIO_IN_SAIx_DMAx_IRQHandler DMA2_Stream7_IRQHandler |
bcostm | 1:ee089790cdbb | 151 | #define AUDIO_IN_INT_IRQHandler EXTI15_10_IRQHandler |
bcostm | 1:ee089790cdbb | 152 | |
bcostm | 1:ee089790cdbb | 153 | /* Select the interrupt preemption priority and subpriority for the IT/DMA interrupt */ |
bcostm | 1:ee089790cdbb | 154 | #define AUDIO_IN_IRQ_PREPRIO ((uint32_t)6) /* Select the preemption priority level(0 is the highest) */ |
bcostm | 1:ee089790cdbb | 155 | |
bcostm | 1:ee089790cdbb | 156 | /*------------------------------------------------------------------------------ |
bcostm | 1:ee089790cdbb | 157 | CONFIGURATION: Audio Driver Configuration parameters |
bcostm | 1:ee089790cdbb | 158 | ------------------------------------------------------------------------------*/ |
bcostm | 1:ee089790cdbb | 159 | |
bcostm | 1:ee089790cdbb | 160 | #define AUDIODATA_SIZE ((uint16_t)2) /* 16-bits audio data size */ |
bcostm | 1:ee089790cdbb | 161 | |
bcostm | 1:ee089790cdbb | 162 | /* Audio status definition */ |
bcostm | 1:ee089790cdbb | 163 | #define AUDIO_OK ((uint8_t)0) |
bcostm | 1:ee089790cdbb | 164 | #define AUDIO_ERROR ((uint8_t)1) |
bcostm | 1:ee089790cdbb | 165 | #define AUDIO_TIMEOUT ((uint8_t)2) |
bcostm | 1:ee089790cdbb | 166 | |
bcostm | 1:ee089790cdbb | 167 | /* AudioFreq * DataSize (2 bytes) * NumChannels (Stereo: 2) */ |
bcostm | 1:ee089790cdbb | 168 | #define DEFAULT_AUDIO_IN_FREQ I2S_AUDIOFREQ_16K |
bcostm | 1:ee089790cdbb | 169 | #define DEFAULT_AUDIO_IN_BIT_RESOLUTION ((uint8_t)16) |
bcostm | 1:ee089790cdbb | 170 | #define DEFAULT_AUDIO_IN_CHANNEL_NBR ((uint8_t)2) /* Mono = 1, Stereo = 2 */ |
bcostm | 1:ee089790cdbb | 171 | #define DEFAULT_AUDIO_IN_VOLUME ((uint16_t)64) |
bcostm | 1:ee089790cdbb | 172 | |
bcostm | 1:ee089790cdbb | 173 | /*------------------------------------------------------------------------------ |
bcostm | 1:ee089790cdbb | 174 | OPTIONAL Configuration defines parameters |
bcostm | 1:ee089790cdbb | 175 | ------------------------------------------------------------------------------*/ |
bcostm | 1:ee089790cdbb | 176 | |
bcostm | 1:ee089790cdbb | 177 | /* Delay for the Codec to be correctly reset */ |
bcostm | 1:ee089790cdbb | 178 | #define CODEC_RESET_DELAY ((uint8_t)5) |
bcostm | 1:ee089790cdbb | 179 | |
bcostm | 1:ee089790cdbb | 180 | |
bcostm | 1:ee089790cdbb | 181 | /*------------------------------------------------------------------------------ |
bcostm | 1:ee089790cdbb | 182 | OUTPUT DEVICES definition |
bcostm | 1:ee089790cdbb | 183 | ------------------------------------------------------------------------------*/ |
bcostm | 1:ee089790cdbb | 184 | |
bcostm | 1:ee089790cdbb | 185 | /* Alias on existing output devices to adapt to Birdie discovery board 2 headphones output */ |
bcostm | 1:ee089790cdbb | 186 | #define OUTPUT_DEVICE_HEADPHONE1 OUTPUT_DEVICE_HEADPHONE |
bcostm | 1:ee089790cdbb | 187 | #define OUTPUT_DEVICE_HEADPHONE2 OUTPUT_DEVICE_SPEAKER /* Headphone2 is connected to Speaker output of the wm8994 */ |
bcostm | 1:ee089790cdbb | 188 | |
bcostm | 1:ee089790cdbb | 189 | /** |
bcostm | 1:ee089790cdbb | 190 | * @} |
bcostm | 1:ee089790cdbb | 191 | */ |
bcostm | 1:ee089790cdbb | 192 | |
bcostm | 1:ee089790cdbb | 193 | /** @defgroup STM32746G_DISCOVERY_AUDIO_Exported_Variables STM32746G_DISCOVERY_AUDIO Exported Variables |
bcostm | 1:ee089790cdbb | 194 | * @{ |
bcostm | 1:ee089790cdbb | 195 | */ |
bcostm | 1:ee089790cdbb | 196 | extern __IO uint16_t AudioInVolume; |
bcostm | 1:ee089790cdbb | 197 | /** |
bcostm | 1:ee089790cdbb | 198 | * @} |
bcostm | 1:ee089790cdbb | 199 | */ |
bcostm | 1:ee089790cdbb | 200 | |
bcostm | 1:ee089790cdbb | 201 | /** @defgroup STM32746G_DISCOVERY_AUDIO_Exported_Macros STM32746G_DISCOVERY_AUDIO Exported Macros |
bcostm | 1:ee089790cdbb | 202 | * @{ |
bcostm | 1:ee089790cdbb | 203 | */ |
bcostm | 1:ee089790cdbb | 204 | #define DMA_MAX(x) (((x) <= DMA_MAX_SZE)? (x):DMA_MAX_SZE) |
bcostm | 1:ee089790cdbb | 205 | /** |
bcostm | 1:ee089790cdbb | 206 | * @} |
bcostm | 1:ee089790cdbb | 207 | */ |
bcostm | 1:ee089790cdbb | 208 | |
bcostm | 1:ee089790cdbb | 209 | /** @addtogroup STM32746G_DISCOVERY_AUDIO_OUT_Exported_Functions |
bcostm | 1:ee089790cdbb | 210 | * @{ |
bcostm | 1:ee089790cdbb | 211 | */ |
bcostm | 1:ee089790cdbb | 212 | uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); |
bcostm | 1:ee089790cdbb | 213 | uint8_t BSP_AUDIO_OUT_Play(uint16_t* pBuffer, uint32_t Size); |
bcostm | 1:ee089790cdbb | 214 | void BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size); |
bcostm | 1:ee089790cdbb | 215 | uint8_t BSP_AUDIO_OUT_Pause(void); |
bcostm | 1:ee089790cdbb | 216 | uint8_t BSP_AUDIO_OUT_Resume(void); |
bcostm | 1:ee089790cdbb | 217 | uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option); |
bcostm | 1:ee089790cdbb | 218 | uint8_t BSP_AUDIO_OUT_SetVolume(uint8_t Volume); |
bcostm | 1:ee089790cdbb | 219 | void BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq); |
bcostm | 1:ee089790cdbb | 220 | void BSP_AUDIO_OUT_SetAudioFrameSlot(uint32_t AudioFrameSlot); |
bcostm | 1:ee089790cdbb | 221 | uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Cmd); |
bcostm | 1:ee089790cdbb | 222 | uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output); |
bcostm | 1:ee089790cdbb | 223 | void BSP_AUDIO_OUT_DeInit(void); |
bcostm | 1:ee089790cdbb | 224 | |
bcostm | 1:ee089790cdbb | 225 | /* User Callbacks: user has to implement these functions in his code if they are needed. */ |
bcostm | 1:ee089790cdbb | 226 | /* This function is called when the requested data has been completely transferred.*/ |
bcostm | 1:ee089790cdbb | 227 | void BSP_AUDIO_OUT_TransferComplete_CallBack(void); |
bcostm | 1:ee089790cdbb | 228 | |
bcostm | 1:ee089790cdbb | 229 | /* This function is called when half of the requested buffer has been transferred. */ |
bcostm | 1:ee089790cdbb | 230 | void BSP_AUDIO_OUT_HalfTransfer_CallBack(void); |
bcostm | 1:ee089790cdbb | 231 | |
bcostm | 1:ee089790cdbb | 232 | /* This function is called when an Interrupt due to transfer error on or peripheral |
bcostm | 1:ee089790cdbb | 233 | error occurs. */ |
bcostm | 1:ee089790cdbb | 234 | void BSP_AUDIO_OUT_Error_CallBack(void); |
bcostm | 1:ee089790cdbb | 235 | |
bcostm | 1:ee089790cdbb | 236 | /* These function can be modified in case the current settings (e.g. DMA stream) |
bcostm | 1:ee089790cdbb | 237 | need to be changed for specific application needs */ |
bcostm | 1:ee089790cdbb | 238 | void BSP_AUDIO_OUT_ClockConfig(SAI_HandleTypeDef *hsai, uint32_t AudioFreq, void *Params); |
bcostm | 1:ee089790cdbb | 239 | void BSP_AUDIO_OUT_MspInit(SAI_HandleTypeDef *hsai, void *Params); |
bcostm | 1:ee089790cdbb | 240 | void BSP_AUDIO_OUT_MspDeInit(SAI_HandleTypeDef *hsai, void *Params); |
bcostm | 1:ee089790cdbb | 241 | |
bcostm | 1:ee089790cdbb | 242 | /** |
bcostm | 1:ee089790cdbb | 243 | * @} |
bcostm | 1:ee089790cdbb | 244 | */ |
bcostm | 1:ee089790cdbb | 245 | |
bcostm | 1:ee089790cdbb | 246 | /** @defgroup STM32746G_DISCOVERY_AUDIO_IN_Exported_Functions STM32746G_DISCOVERY_AUDIO_IN Exported Functions |
bcostm | 1:ee089790cdbb | 247 | * @{ |
bcostm | 1:ee089790cdbb | 248 | */ |
bcostm | 1:ee089790cdbb | 249 | uint8_t BSP_AUDIO_IN_Init(uint16_t InputDevice, uint8_t Volume, uint32_t AudioFreq); |
bcostm | 1:ee089790cdbb | 250 | uint8_t BSP_AUDIO_IN_OUT_Init(uint16_t InputDevice, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); |
bcostm | 1:ee089790cdbb | 251 | uint8_t BSP_AUDIO_IN_Record(uint16_t *pData, uint32_t Size); |
bcostm | 1:ee089790cdbb | 252 | uint8_t BSP_AUDIO_IN_Stop(uint32_t Option); |
bcostm | 1:ee089790cdbb | 253 | uint8_t BSP_AUDIO_IN_Pause(void); |
bcostm | 1:ee089790cdbb | 254 | uint8_t BSP_AUDIO_IN_Resume(void); |
bcostm | 1:ee089790cdbb | 255 | uint8_t BSP_AUDIO_IN_SetVolume(uint8_t Volume); |
bcostm | 1:ee089790cdbb | 256 | void BSP_AUDIO_IN_DeInit(void); |
bcostm | 1:ee089790cdbb | 257 | /* User Callbacks: user has to implement these functions in his code if they are needed. */ |
bcostm | 1:ee089790cdbb | 258 | /* This function should be implemented by the user application. |
bcostm | 1:ee089790cdbb | 259 | It is called into this driver when the current buffer is filled to prepare the next |
bcostm | 1:ee089790cdbb | 260 | buffer pointer and its size. */ |
bcostm | 1:ee089790cdbb | 261 | void BSP_AUDIO_IN_TransferComplete_CallBack(void); |
bcostm | 1:ee089790cdbb | 262 | void BSP_AUDIO_IN_HalfTransfer_CallBack(void); |
bcostm | 1:ee089790cdbb | 263 | |
bcostm | 1:ee089790cdbb | 264 | /* This function is called when an Interrupt due to transfer error on or peripheral |
bcostm | 1:ee089790cdbb | 265 | error occurs. */ |
bcostm | 1:ee089790cdbb | 266 | void BSP_AUDIO_IN_Error_CallBack(void); |
bcostm | 1:ee089790cdbb | 267 | |
bcostm | 1:ee089790cdbb | 268 | /* These function can be modified in case the current settings (e.g. DMA stream) |
bcostm | 1:ee089790cdbb | 269 | need to be changed for specific application needs */ |
bcostm | 1:ee089790cdbb | 270 | void BSP_AUDIO_IN_MspInit(SAI_HandleTypeDef *hsai, void *Params); |
bcostm | 1:ee089790cdbb | 271 | void BSP_AUDIO_IN_MspDeInit(SAI_HandleTypeDef *hsai, void *Params); |
bcostm | 1:ee089790cdbb | 272 | |
bcostm | 1:ee089790cdbb | 273 | /** |
bcostm | 1:ee089790cdbb | 274 | * @} |
bcostm | 1:ee089790cdbb | 275 | */ |
bcostm | 1:ee089790cdbb | 276 | |
bcostm | 1:ee089790cdbb | 277 | /** |
bcostm | 1:ee089790cdbb | 278 | * @} |
bcostm | 1:ee089790cdbb | 279 | */ |
bcostm | 1:ee089790cdbb | 280 | |
bcostm | 1:ee089790cdbb | 281 | /** |
bcostm | 1:ee089790cdbb | 282 | * @} |
bcostm | 1:ee089790cdbb | 283 | */ |
bcostm | 1:ee089790cdbb | 284 | |
bcostm | 1:ee089790cdbb | 285 | /** |
bcostm | 1:ee089790cdbb | 286 | * @} |
bcostm | 1:ee089790cdbb | 287 | */ |
bcostm | 1:ee089790cdbb | 288 | |
bcostm | 1:ee089790cdbb | 289 | #ifdef __cplusplus |
bcostm | 1:ee089790cdbb | 290 | } |
bcostm | 1:ee089790cdbb | 291 | #endif |
bcostm | 1:ee089790cdbb | 292 | |
bcostm | 1:ee089790cdbb | 293 | #endif /* __STM32746G_DISCOVERY_AUDIO_H */ |
bcostm | 1:ee089790cdbb | 294 | |
bcostm | 1:ee089790cdbb | 295 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |