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