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