AudioRecord
Dependencies: STM32L4xx_HAL_Driver CMSIS_DSP_401
stm32l476g_discovery_audio.h@3:ec7e3c37fe80, 2015-11-26 (annotated)
- Committer:
- EricLew
- Date:
- Thu Nov 26 22:32:56 2015 +0000
- Revision:
- 3:ec7e3c37fe80
- Parent:
- 0:d4e5ad7ad71c
FFT is currently not working and commented out
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EricLew | 0:d4e5ad7ad71c | 1 | /** |
EricLew | 0:d4e5ad7ad71c | 2 | ****************************************************************************** |
EricLew | 0:d4e5ad7ad71c | 3 | * @file stm32l476g_discovery_audio.h |
EricLew | 0:d4e5ad7ad71c | 4 | * @author MCD Application Team |
EricLew | 0:d4e5ad7ad71c | 5 | * @version V1.0.1 |
EricLew | 0:d4e5ad7ad71c | 6 | * @date 16-September-2015 |
EricLew | 0:d4e5ad7ad71c | 7 | * @brief This file contains the common defines and functions prototypes for |
EricLew | 0:d4e5ad7ad71c | 8 | * the stm32l476g_discovery_audio.c driver. |
EricLew | 0:d4e5ad7ad71c | 9 | ****************************************************************************** |
EricLew | 0:d4e5ad7ad71c | 10 | * @attention |
EricLew | 0:d4e5ad7ad71c | 11 | * |
EricLew | 0:d4e5ad7ad71c | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
EricLew | 0:d4e5ad7ad71c | 13 | * |
EricLew | 0:d4e5ad7ad71c | 14 | * Redistribution and use in source and binary forms, with or without modification, |
EricLew | 0:d4e5ad7ad71c | 15 | * are permitted provided that the following conditions are met: |
EricLew | 0:d4e5ad7ad71c | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
EricLew | 0:d4e5ad7ad71c | 17 | * this list of conditions and the following disclaimer. |
EricLew | 0:d4e5ad7ad71c | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
EricLew | 0:d4e5ad7ad71c | 19 | * this list of conditions and the following disclaimer in the documentation |
EricLew | 0:d4e5ad7ad71c | 20 | * and/or other materials provided with the distribution. |
EricLew | 0:d4e5ad7ad71c | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
EricLew | 0:d4e5ad7ad71c | 22 | * may be used to endorse or promote products derived from this software |
EricLew | 0:d4e5ad7ad71c | 23 | * without specific prior written permission. |
EricLew | 0:d4e5ad7ad71c | 24 | * |
EricLew | 0:d4e5ad7ad71c | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
EricLew | 0:d4e5ad7ad71c | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
EricLew | 0:d4e5ad7ad71c | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
EricLew | 0:d4e5ad7ad71c | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
EricLew | 0:d4e5ad7ad71c | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
EricLew | 0:d4e5ad7ad71c | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
EricLew | 0:d4e5ad7ad71c | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
EricLew | 0:d4e5ad7ad71c | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
EricLew | 0:d4e5ad7ad71c | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
EricLew | 0:d4e5ad7ad71c | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
EricLew | 0:d4e5ad7ad71c | 35 | * |
EricLew | 0:d4e5ad7ad71c | 36 | ****************************************************************************** |
EricLew | 0:d4e5ad7ad71c | 37 | */ |
EricLew | 0:d4e5ad7ad71c | 38 | |
EricLew | 0:d4e5ad7ad71c | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 40 | #ifndef __STM32L476G_DISCOVERY_AUDIO_H |
EricLew | 0:d4e5ad7ad71c | 41 | #define __STM32L476G_DISCOVERY_AUDIO_H |
EricLew | 0:d4e5ad7ad71c | 42 | |
EricLew | 0:d4e5ad7ad71c | 43 | #ifdef __cplusplus |
EricLew | 0:d4e5ad7ad71c | 44 | extern "C" { |
EricLew | 0:d4e5ad7ad71c | 45 | #endif |
EricLew | 0:d4e5ad7ad71c | 46 | |
EricLew | 0:d4e5ad7ad71c | 47 | /* Includes ------------------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 48 | #if defined(BSP_AUDIO_USE_RTOS) |
EricLew | 0:d4e5ad7ad71c | 49 | #include "k_mem.h" |
EricLew | 0:d4e5ad7ad71c | 50 | #else |
EricLew | 0:d4e5ad7ad71c | 51 | #include <stdlib.h> |
EricLew | 0:d4e5ad7ad71c | 52 | #endif |
EricLew | 0:d4e5ad7ad71c | 53 | /* Include audio component Driver */ |
EricLew | 0:d4e5ad7ad71c | 54 | |
EricLew | 0:d4e5ad7ad71c | 55 | #include "stm32l476g_discovery.h" |
EricLew | 0:d4e5ad7ad71c | 56 | |
EricLew | 0:d4e5ad7ad71c | 57 | /** @addtogroup BSP |
EricLew | 0:d4e5ad7ad71c | 58 | * @{ |
EricLew | 0:d4e5ad7ad71c | 59 | */ |
EricLew | 0:d4e5ad7ad71c | 60 | |
EricLew | 0:d4e5ad7ad71c | 61 | /** @addtogroup STM32L476G_DISCOVERY |
EricLew | 0:d4e5ad7ad71c | 62 | * @{ |
EricLew | 0:d4e5ad7ad71c | 63 | */ |
EricLew | 0:d4e5ad7ad71c | 64 | |
EricLew | 0:d4e5ad7ad71c | 65 | /** @addtogroup STM32L476G_DISCOVERY_AUDIO |
EricLew | 0:d4e5ad7ad71c | 66 | * @{ |
EricLew | 0:d4e5ad7ad71c | 67 | */ |
EricLew | 0:d4e5ad7ad71c | 68 | |
EricLew | 0:d4e5ad7ad71c | 69 | /** @defgroup STM32L476G_DISCOVERY_AUDIO_Exported_Types Exported Types |
EricLew | 0:d4e5ad7ad71c | 70 | * @{ |
EricLew | 0:d4e5ad7ad71c | 71 | */ |
EricLew | 0:d4e5ad7ad71c | 72 | typedef void (*Audio_CallbackTypeDef)(void); |
EricLew | 0:d4e5ad7ad71c | 73 | |
EricLew | 0:d4e5ad7ad71c | 74 | /** |
EricLew | 0:d4e5ad7ad71c | 75 | * @} |
EricLew | 0:d4e5ad7ad71c | 76 | */ |
EricLew | 0:d4e5ad7ad71c | 77 | |
EricLew | 0:d4e5ad7ad71c | 78 | /** @defgroup STM32L476G_DISCOVERY_AUDIO_Exported_Constants Exported Constants |
EricLew | 0:d4e5ad7ad71c | 79 | * @{ |
EricLew | 0:d4e5ad7ad71c | 80 | */ |
EricLew | 0:d4e5ad7ad71c | 81 | /** @defgroup BSP_Audio_Out_Option BSP Audio Out Option |
EricLew | 0:d4e5ad7ad71c | 82 | * @{ |
EricLew | 0:d4e5ad7ad71c | 83 | */ |
EricLew | 0:d4e5ad7ad71c | 84 | #define BSP_AUDIO_OUT_CIRCULARMODE ((uint32_t)0x00000001) /* BUFFER CIRCULAR MODE */ |
EricLew | 0:d4e5ad7ad71c | 85 | #define BSP_AUDIO_OUT_NORMALMODE ((uint32_t)0x00000002) /* BUFFER NORMAL MODE */ |
EricLew | 0:d4e5ad7ad71c | 86 | #define BSP_AUDIO_OUT_STEREOMODE ((uint32_t)0x00000004) /* STEREO MODE */ |
EricLew | 0:d4e5ad7ad71c | 87 | #define BSP_AUDIO_OUT_MONOMODE ((uint32_t)0x00000008) /* MONO MODE */ |
EricLew | 0:d4e5ad7ad71c | 88 | /** |
EricLew | 0:d4e5ad7ad71c | 89 | * @} |
EricLew | 0:d4e5ad7ad71c | 90 | */ |
EricLew | 0:d4e5ad7ad71c | 91 | |
EricLew | 0:d4e5ad7ad71c | 92 | /** @defgroup BSP_Audio_Sample_Rate BSP Audio Sample Rate |
EricLew | 0:d4e5ad7ad71c | 93 | * @{ |
EricLew | 0:d4e5ad7ad71c | 94 | */ |
EricLew | 0:d4e5ad7ad71c | 95 | #define BSP_AUDIO_FREQUENCY_96K SAI_AUDIO_FREQUENCY_96K |
EricLew | 0:d4e5ad7ad71c | 96 | #define BSP_AUDIO_FREQUENCY_48K SAI_AUDIO_FREQUENCY_48K |
EricLew | 0:d4e5ad7ad71c | 97 | #define BSP_AUDIO_FREQUENCY_44K SAI_AUDIO_FREQUENCY_44K |
EricLew | 0:d4e5ad7ad71c | 98 | #define BSP_AUDIO_FREQUENCY_32K SAI_AUDIO_FREQUENCY_32K |
EricLew | 0:d4e5ad7ad71c | 99 | #define BSP_AUDIO_FREQUENCY_22K SAI_AUDIO_FREQUENCY_22K |
EricLew | 0:d4e5ad7ad71c | 100 | #define BSP_AUDIO_FREQUENCY_16K SAI_AUDIO_FREQUENCY_16K |
EricLew | 0:d4e5ad7ad71c | 101 | #define BSP_AUDIO_FREQUENCY_11K SAI_AUDIO_FREQUENCY_11K |
EricLew | 0:d4e5ad7ad71c | 102 | #define BSP_AUDIO_FREQUENCY_8K SAI_AUDIO_FREQUENCY_8K |
EricLew | 0:d4e5ad7ad71c | 103 | /** |
EricLew | 0:d4e5ad7ad71c | 104 | * @} |
EricLew | 0:d4e5ad7ad71c | 105 | */ |
EricLew | 0:d4e5ad7ad71c | 106 | |
EricLew | 0:d4e5ad7ad71c | 107 | /* AUDIO FREQUENCY */ |
EricLew | 0:d4e5ad7ad71c | 108 | #define AUDIO_FREQUENCY_192K ((uint32_t)192000) |
EricLew | 0:d4e5ad7ad71c | 109 | #define AUDIO_FREQUENCY_96K ((uint32_t)96000) |
EricLew | 0:d4e5ad7ad71c | 110 | #define AUDIO_FREQUENCY_48K ((uint32_t)48000) |
EricLew | 0:d4e5ad7ad71c | 111 | #define AUDIO_FREQUENCY_44K ((uint32_t)44100) |
EricLew | 0:d4e5ad7ad71c | 112 | #define AUDIO_FREQUENCY_32K ((uint32_t)32000) |
EricLew | 0:d4e5ad7ad71c | 113 | #define AUDIO_FREQUENCY_22K ((uint32_t)22050) |
EricLew | 0:d4e5ad7ad71c | 114 | #define AUDIO_FREQUENCY_16K ((uint32_t)16000) |
EricLew | 0:d4e5ad7ad71c | 115 | #define AUDIO_FREQUENCY_11K ((uint32_t)11025) |
EricLew | 0:d4e5ad7ad71c | 116 | #define AUDIO_FREQUENCY_8K ((uint32_t)8000) |
EricLew | 0:d4e5ad7ad71c | 117 | |
EricLew | 0:d4e5ad7ad71c | 118 | /*------------------------------------------------------------------------------ |
EricLew | 0:d4e5ad7ad71c | 119 | USER SAI defines parameters |
EricLew | 0:d4e5ad7ad71c | 120 | -----------------------------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 121 | /* SAI peripheral configuration defines */ |
EricLew | 0:d4e5ad7ad71c | 122 | #define AUDIO_SAIx SAI1_Block_A |
EricLew | 0:d4e5ad7ad71c | 123 | #define AUDIO_SAIx_CLK_ENABLE() __HAL_RCC_SAI1_CLK_ENABLE() |
EricLew | 0:d4e5ad7ad71c | 124 | #define AUDIO_SAIx_CLK_DISABLE() __HAL_RCC_SAI1_CLK_DISABLE() |
EricLew | 0:d4e5ad7ad71c | 125 | #define AUDIO_SAIx_MCK_SCK_SD_FS_AF GPIO_AF13_SAI1 |
EricLew | 0:d4e5ad7ad71c | 126 | |
EricLew | 0:d4e5ad7ad71c | 127 | #define AUDIO_SAIx_MCK_SCK_SD_FS_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() |
EricLew | 0:d4e5ad7ad71c | 128 | #define AUDIO_SAIx_MCK_SCK_SD_FS_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() |
EricLew | 0:d4e5ad7ad71c | 129 | #define AUDIO_SAIx_FS_PIN GPIO_PIN_4 |
EricLew | 0:d4e5ad7ad71c | 130 | #define AUDIO_SAIx_SCK_PIN GPIO_PIN_5 |
EricLew | 0:d4e5ad7ad71c | 131 | #define AUDIO_SAIx_SD_PIN GPIO_PIN_6 |
EricLew | 0:d4e5ad7ad71c | 132 | #define AUDIO_SAIx_MCK_PIN GPIO_PIN_2 |
EricLew | 0:d4e5ad7ad71c | 133 | #define AUDIO_SAIx_MCK_SCK_SD_FS_GPIO_PORT GPIOE |
EricLew | 0:d4e5ad7ad71c | 134 | |
EricLew | 0:d4e5ad7ad71c | 135 | /* SAI DMA Channel definitions */ |
EricLew | 0:d4e5ad7ad71c | 136 | #define AUDIO_SAIx_DMAx_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE() |
EricLew | 0:d4e5ad7ad71c | 137 | #define AUDIO_SAIx_DMAx_CLK_DISABLE() __HAL_RCC_DMA2_CLK_DISABLE() |
EricLew | 0:d4e5ad7ad71c | 138 | #define AUDIO_SAIx_DMAx_CHANNEL DMA2_Channel1 |
EricLew | 0:d4e5ad7ad71c | 139 | #define AUDIO_SAIx_DMAx_IRQ DMA2_Channel1_IRQn |
EricLew | 0:d4e5ad7ad71c | 140 | #define AUDIO_SAIx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_HALFWORD |
EricLew | 0:d4e5ad7ad71c | 141 | #define AUDIO_SAIx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_HALFWORD |
EricLew | 0:d4e5ad7ad71c | 142 | #define DMA_MAX_SZE (uint32_t)0xFFFF |
EricLew | 0:d4e5ad7ad71c | 143 | |
EricLew | 0:d4e5ad7ad71c | 144 | #define AUDIO_SAIx_DMAx_IRQHandler DMA2_Channel1_IRQHandler |
EricLew | 0:d4e5ad7ad71c | 145 | |
EricLew | 0:d4e5ad7ad71c | 146 | /* Select the interrupt preemption priority for the DMA interrupt */ |
EricLew | 0:d4e5ad7ad71c | 147 | #define AUDIO_OUT_IRQ_PREPRIO 5 /* Select the preemption priority level(0 is the highest) */ |
EricLew | 0:d4e5ad7ad71c | 148 | |
EricLew | 0:d4e5ad7ad71c | 149 | /* Disable SAIx PLL */ |
EricLew | 0:d4e5ad7ad71c | 150 | #define AUDIO_SAIx_PLL_DISABLE() HAL_RCCEx_DisablePLLSAI1() |
EricLew | 0:d4e5ad7ad71c | 151 | |
EricLew | 0:d4e5ad7ad71c | 152 | /*------------------------------------------------------------------------------ |
EricLew | 0:d4e5ad7ad71c | 153 | AUDIO IN CONFIGURATION |
EricLew | 0:d4e5ad7ad71c | 154 | ------------------------------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 155 | /* DFSDM Configuration defines */ |
EricLew | 0:d4e5ad7ad71c | 156 | #define AUDIO_DFSDMx_LEFT_CHANNEL DFSDM_Channel2 |
EricLew | 0:d4e5ad7ad71c | 157 | #define AUDIO_DFSDMx_LEFT_FILTER DFSDM_Filter0 |
EricLew | 0:d4e5ad7ad71c | 158 | #define AUDIO_DFSDMx_CLK_ENABLE() __HAL_RCC_DFSDM_CLK_ENABLE() |
EricLew | 0:d4e5ad7ad71c | 159 | #define AUDIO_DFSDMx_CLK_DISABLE() __HAL_RCC_DFSDM_CLK_DISABLE() |
EricLew | 0:d4e5ad7ad71c | 160 | #define AUDIO_DFSDMx_CKOUT_PIN GPIO_PIN_9 |
EricLew | 0:d4e5ad7ad71c | 161 | #define AUDIO_DFSDMx_DMIC_DATIN_PIN GPIO_PIN_7 |
EricLew | 0:d4e5ad7ad71c | 162 | #define AUDIO_DFSDMx_CKOUT_DMIC_DATIN_GPIO_PORT GPIOE |
EricLew | 0:d4e5ad7ad71c | 163 | #define AUDIO_DFSDMx_CKOUT_DMIC_DATIN_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE() |
EricLew | 0:d4e5ad7ad71c | 164 | #define AUDIO_DFSDMx_CKOUT_DMIC_DATIN_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE() |
EricLew | 0:d4e5ad7ad71c | 165 | #define AUDIO_DFSDMx_CKOUT_DMIC_DATIN_AF GPIO_AF6_DFSDM |
EricLew | 0:d4e5ad7ad71c | 166 | |
EricLew | 0:d4e5ad7ad71c | 167 | /* DFSDM DMA Right and Left channels definitions */ |
EricLew | 0:d4e5ad7ad71c | 168 | #define AUDIO_DFSDMx_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE() |
EricLew | 0:d4e5ad7ad71c | 169 | #define AUDIO_DFSDMx_DMAx_CLK_DISABLE() __HAL_RCC_DMA1_CLK_DISABLE() |
EricLew | 0:d4e5ad7ad71c | 170 | #define AUDIO_DFSDMx_DMAx_LEFT_CHANNEL DMA1_Channel4 |
EricLew | 0:d4e5ad7ad71c | 171 | #define AUDIO_DFSDMx_DMAx_LEFT_IRQ DMA1_Channel4_IRQn |
EricLew | 0:d4e5ad7ad71c | 172 | #define AUDIO_DFSDMx_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_WORD |
EricLew | 0:d4e5ad7ad71c | 173 | #define AUDIO_DFSDMx_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_WORD |
EricLew | 0:d4e5ad7ad71c | 174 | |
EricLew | 0:d4e5ad7ad71c | 175 | #define AUDIO_DFSDM_DMAx_LEFT_IRQHandler DMA1_Channel4_IRQHandler |
EricLew | 0:d4e5ad7ad71c | 176 | |
EricLew | 0:d4e5ad7ad71c | 177 | /* Select the interrupt preemption priority and subpriority for the IT/DMA interrupt */ |
EricLew | 0:d4e5ad7ad71c | 178 | #define AUDIO_IN_IRQ_PREPRIO 6 /* Select the preemption priority level(0 is the highest) */ |
EricLew | 0:d4e5ad7ad71c | 179 | |
EricLew | 0:d4e5ad7ad71c | 180 | /*------------------------------------------------------------------------------ |
EricLew | 0:d4e5ad7ad71c | 181 | CONFIGURATION: Audio Driver Configuration parameters |
EricLew | 0:d4e5ad7ad71c | 182 | ------------------------------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 183 | |
EricLew | 0:d4e5ad7ad71c | 184 | #define AUDIODATA_SIZE 2 /* 16-bits audio data size */ |
EricLew | 0:d4e5ad7ad71c | 185 | |
EricLew | 0:d4e5ad7ad71c | 186 | /* Audio status definition */ |
EricLew | 0:d4e5ad7ad71c | 187 | #define AUDIO_OK 0 |
EricLew | 0:d4e5ad7ad71c | 188 | #define AUDIO_ERROR 1 |
EricLew | 0:d4e5ad7ad71c | 189 | #define AUDIO_TIMEOUT 2 |
EricLew | 0:d4e5ad7ad71c | 190 | |
EricLew | 0:d4e5ad7ad71c | 191 | /* AudioFreq * DataSize (2 bytes) * NumChannels (Stereo: 2) */ |
EricLew | 0:d4e5ad7ad71c | 192 | #define DEFAULT_AUDIO_IN_FREQ BSP_AUDIO_FREQUENCY_16K |
EricLew | 0:d4e5ad7ad71c | 193 | #define DEFAULT_AUDIO_IN_BIT_RESOLUTION 16 |
EricLew | 0:d4e5ad7ad71c | 194 | #define DEFAULT_AUDIO_IN_CHANNEL_NBR 1 /* Mono = 1, Stereo = 2 */ |
EricLew | 0:d4e5ad7ad71c | 195 | #define DEFAULT_AUDIO_IN_VOLUME 64 |
EricLew | 0:d4e5ad7ad71c | 196 | |
EricLew | 0:d4e5ad7ad71c | 197 | /*------------------------------------------------------------------------------ |
EricLew | 0:d4e5ad7ad71c | 198 | OPTIONAL Configuration defines parameters |
EricLew | 0:d4e5ad7ad71c | 199 | ------------------------------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 200 | |
EricLew | 0:d4e5ad7ad71c | 201 | /* Delay for the Codec to be correctly reset */ |
EricLew | 0:d4e5ad7ad71c | 202 | #define CODEC_RESET_DELAY 5 |
EricLew | 0:d4e5ad7ad71c | 203 | |
EricLew | 0:d4e5ad7ad71c | 204 | /** |
EricLew | 0:d4e5ad7ad71c | 205 | * @} |
EricLew | 0:d4e5ad7ad71c | 206 | */ |
EricLew | 0:d4e5ad7ad71c | 207 | |
EricLew | 0:d4e5ad7ad71c | 208 | /** @defgroup STM32L476G_DISCOVERY_AUDIO_Exported_Variables Exported Variables |
EricLew | 0:d4e5ad7ad71c | 209 | * @{ |
EricLew | 0:d4e5ad7ad71c | 210 | */ |
EricLew | 0:d4e5ad7ad71c | 211 | extern SAI_HandleTypeDef BSP_AUDIO_hSai; |
EricLew | 0:d4e5ad7ad71c | 212 | extern DFSDM_Filter_HandleTypeDef BSP_AUDIO_hDfsdmLeftFilter; |
EricLew | 0:d4e5ad7ad71c | 213 | |
EricLew | 0:d4e5ad7ad71c | 214 | /** |
EricLew | 0:d4e5ad7ad71c | 215 | * @} |
EricLew | 0:d4e5ad7ad71c | 216 | */ |
EricLew | 0:d4e5ad7ad71c | 217 | |
EricLew | 0:d4e5ad7ad71c | 218 | /** @defgroup STM32L476G_DISCOVERY_AUDIO_Exported_Macros Exported Macros |
EricLew | 0:d4e5ad7ad71c | 219 | * @{ |
EricLew | 0:d4e5ad7ad71c | 220 | */ |
EricLew | 0:d4e5ad7ad71c | 221 | #define DMA_MAX(_X_) (((_X_) <= DMA_MAX_SZE)? (_X_):DMA_MAX_SZE) |
EricLew | 0:d4e5ad7ad71c | 222 | |
EricLew | 0:d4e5ad7ad71c | 223 | /** |
EricLew | 0:d4e5ad7ad71c | 224 | * @} |
EricLew | 0:d4e5ad7ad71c | 225 | */ |
EricLew | 0:d4e5ad7ad71c | 226 | |
EricLew | 0:d4e5ad7ad71c | 227 | /* Exported functions --------------------------------------------------------*/ |
EricLew | 0:d4e5ad7ad71c | 228 | /** @defgroup STM32L476G_DISCOVERY_AUDIO_Exported_Functions Exported Functions |
EricLew | 0:d4e5ad7ad71c | 229 | * @{ |
EricLew | 0:d4e5ad7ad71c | 230 | */ |
EricLew | 0:d4e5ad7ad71c | 231 | uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); |
EricLew | 0:d4e5ad7ad71c | 232 | uint8_t BSP_AUDIO_OUT_DeInit(void); |
EricLew | 0:d4e5ad7ad71c | 233 | uint8_t BSP_AUDIO_OUT_Play(uint16_t* pData, uint32_t Size); |
EricLew | 0:d4e5ad7ad71c | 234 | uint8_t BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size); |
EricLew | 0:d4e5ad7ad71c | 235 | uint8_t BSP_AUDIO_OUT_Pause(void); |
EricLew | 0:d4e5ad7ad71c | 236 | uint8_t BSP_AUDIO_OUT_Resume(void); |
EricLew | 0:d4e5ad7ad71c | 237 | uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option); |
EricLew | 0:d4e5ad7ad71c | 238 | uint8_t BSP_AUDIO_OUT_SetVolume(uint8_t Volume); |
EricLew | 0:d4e5ad7ad71c | 239 | uint8_t BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq); |
EricLew | 0:d4e5ad7ad71c | 240 | void BSP_AUDIO_OUT_ChangeAudioConfig(uint32_t AudioOutOption); |
EricLew | 0:d4e5ad7ad71c | 241 | uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Cmd); |
EricLew | 0:d4e5ad7ad71c | 242 | uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output); |
EricLew | 0:d4e5ad7ad71c | 243 | void BSP_AUDIO_OUT_RegisterCallbacks(Audio_CallbackTypeDef ErrorCallback, |
EricLew | 0:d4e5ad7ad71c | 244 | Audio_CallbackTypeDef HalfTransferCallback, |
EricLew | 0:d4e5ad7ad71c | 245 | Audio_CallbackTypeDef TransferCompleteCallback); |
EricLew | 0:d4e5ad7ad71c | 246 | |
EricLew | 0:d4e5ad7ad71c | 247 | uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr); |
EricLew | 0:d4e5ad7ad71c | 248 | uint8_t BSP_AUDIO_IN_DeInit(void); |
EricLew | 0:d4e5ad7ad71c | 249 | uint8_t BSP_AUDIO_IN_Record(uint16_t *pData, uint32_t Size); |
EricLew | 0:d4e5ad7ad71c | 250 | uint8_t BSP_AUDIO_IN_SetFrequency(uint32_t AudioFreq); |
EricLew | 0:d4e5ad7ad71c | 251 | uint8_t BSP_AUDIO_IN_Stop(void); |
EricLew | 0:d4e5ad7ad71c | 252 | uint8_t BSP_AUDIO_IN_Pause(void); |
EricLew | 0:d4e5ad7ad71c | 253 | uint8_t BSP_AUDIO_IN_Resume(void); |
EricLew | 0:d4e5ad7ad71c | 254 | void BSP_AUDIO_IN_RegisterCallbacks(Audio_CallbackTypeDef ErrorCallback, |
EricLew | 0:d4e5ad7ad71c | 255 | Audio_CallbackTypeDef HalfTransferCallback, |
EricLew | 0:d4e5ad7ad71c | 256 | Audio_CallbackTypeDef TransferCompleteCallback); |
EricLew | 0:d4e5ad7ad71c | 257 | /** |
EricLew | 0:d4e5ad7ad71c | 258 | * @} |
EricLew | 0:d4e5ad7ad71c | 259 | */ |
EricLew | 0:d4e5ad7ad71c | 260 | |
EricLew | 0:d4e5ad7ad71c | 261 | /** |
EricLew | 0:d4e5ad7ad71c | 262 | * @} |
EricLew | 0:d4e5ad7ad71c | 263 | */ |
EricLew | 0:d4e5ad7ad71c | 264 | |
EricLew | 0:d4e5ad7ad71c | 265 | /** |
EricLew | 0:d4e5ad7ad71c | 266 | * @} |
EricLew | 0:d4e5ad7ad71c | 267 | */ |
EricLew | 0:d4e5ad7ad71c | 268 | |
EricLew | 0:d4e5ad7ad71c | 269 | /** |
EricLew | 0:d4e5ad7ad71c | 270 | * @} |
EricLew | 0:d4e5ad7ad71c | 271 | */ |
EricLew | 0:d4e5ad7ad71c | 272 | |
EricLew | 0:d4e5ad7ad71c | 273 | #ifdef __cplusplus |
EricLew | 0:d4e5ad7ad71c | 274 | } |
EricLew | 0:d4e5ad7ad71c | 275 | #endif |
EricLew | 0:d4e5ad7ad71c | 276 | |
EricLew | 0:d4e5ad7ad71c | 277 | #endif /* __STM32L476G_DISCOVERY_AUDIO_H */ |
EricLew | 0:d4e5ad7ad71c | 278 | |
EricLew | 0:d4e5ad7ad71c | 279 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
EricLew | 0:d4e5ad7ad71c | 280 |