uni project for eq system
Fork of AUDIO_DISCO_F746NG by
AUDIO_DISCO_F746NG.h@0:6f035eff38e4, 2016-03-24 (annotated)
- Committer:
- adustm
- Date:
- Thu Mar 24 20:23:54 2016 +0000
- Revision:
- 0:6f035eff38e4
- Child:
- 1:7046ce26b7ed
DISCO_F746NG: AUDIO class to use BSP code.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adustm | 0:6f035eff38e4 | 1 | /* Copyright (c) 2010-2016 mbed.org, MIT License |
adustm | 0:6f035eff38e4 | 2 | * |
adustm | 0:6f035eff38e4 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
adustm | 0:6f035eff38e4 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
adustm | 0:6f035eff38e4 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
adustm | 0:6f035eff38e4 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
adustm | 0:6f035eff38e4 | 7 | * Software is furnished to do so, subject to the following conditions: |
adustm | 0:6f035eff38e4 | 8 | * |
adustm | 0:6f035eff38e4 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
adustm | 0:6f035eff38e4 | 10 | * substantial portions of the Software. |
adustm | 0:6f035eff38e4 | 11 | * |
adustm | 0:6f035eff38e4 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
adustm | 0:6f035eff38e4 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
adustm | 0:6f035eff38e4 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
adustm | 0:6f035eff38e4 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
adustm | 0:6f035eff38e4 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
adustm | 0:6f035eff38e4 | 17 | */ |
adustm | 0:6f035eff38e4 | 18 | |
adustm | 0:6f035eff38e4 | 19 | #ifndef __AUDIO_DISCO_F746NG_H |
adustm | 0:6f035eff38e4 | 20 | #define __AUDIO_DISCO_F746NG_H |
adustm | 0:6f035eff38e4 | 21 | |
adustm | 0:6f035eff38e4 | 22 | #ifdef TARGET_DISCO_F746NG |
adustm | 0:6f035eff38e4 | 23 | |
adustm | 0:6f035eff38e4 | 24 | #include "mbed.h" |
adustm | 0:6f035eff38e4 | 25 | #include "stm32746g_discovery_audio.h" |
adustm | 0:6f035eff38e4 | 26 | |
adustm | 0:6f035eff38e4 | 27 | /* |
adustm | 0:6f035eff38e4 | 28 | This class drives the uSD card driver mounted on DISCO_F746NG board. |
adustm | 0:6f035eff38e4 | 29 | |
adustm | 0:6f035eff38e4 | 30 | Usage: |
adustm | 0:6f035eff38e4 | 31 | |
adustm | 0:6f035eff38e4 | 32 | #include "mbed.h" |
adustm | 0:6f035eff38e4 | 33 | #include "AUDIO_DISCO_F746NG.h" |
adustm | 0:6f035eff38e4 | 34 | |
adustm | 0:6f035eff38e4 | 35 | AUDIO_DISCO_F746NG audio; |
adustm | 0:6f035eff38e4 | 36 | |
adustm | 0:6f035eff38e4 | 37 | int main() |
adustm | 0:6f035eff38e4 | 38 | { |
adustm | 0:6f035eff38e4 | 39 | audio.IN_OUT_Init(INPUT_DEVICE_DIGITAL_MICROPHONE_2, OUTPUT_DEVICE_HEADPHONE, 90, DEFAULT_AUDIO_IN_FREQ): |
adustm | 0:6f035eff38e4 | 40 | audio.IN_Record((uint16_t*)AUDIO_BUFFER_IN, AUDIO_BLOCK_SIZE); |
adustm | 0:6f035eff38e4 | 41 | audio.OUT_SetAudioFrameSlot(CODEC_AUDIOFRAME_SLOT_02); |
adustm | 0:6f035eff38e4 | 42 | audio.OUT_Play((uint16_t*)AUDIO_BUFFER_OUT, AUDIO_BLOCK_SIZE * 2); |
adustm | 0:6f035eff38e4 | 43 | while 1 {} |
adustm | 0:6f035eff38e4 | 44 | |
adustm | 0:6f035eff38e4 | 45 | } |
adustm | 0:6f035eff38e4 | 46 | */ |
adustm | 0:6f035eff38e4 | 47 | class AUDIO_DISCO_F746NG |
adustm | 0:6f035eff38e4 | 48 | { |
adustm | 0:6f035eff38e4 | 49 | |
adustm | 0:6f035eff38e4 | 50 | public: |
adustm | 0:6f035eff38e4 | 51 | //! Constructor |
adustm | 0:6f035eff38e4 | 52 | AUDIO_DISCO_F746NG(); |
adustm | 0:6f035eff38e4 | 53 | |
adustm | 0:6f035eff38e4 | 54 | //! Destructor |
adustm | 0:6f035eff38e4 | 55 | ~AUDIO_DISCO_F746NG(); |
adustm | 0:6f035eff38e4 | 56 | |
adustm | 0:6f035eff38e4 | 57 | /** |
adustm | 0:6f035eff38e4 | 58 | * @brief Configures the audio peripherals. |
adustm | 0:6f035eff38e4 | 59 | * @param OutputDevice: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, |
adustm | 0:6f035eff38e4 | 60 | * or OUTPUT_DEVICE_BOTH. |
adustm | 0:6f035eff38e4 | 61 | * @param Volume: Initial volume level (from 0 (Mute); to 100 (Max)) |
adustm | 0:6f035eff38e4 | 62 | * @param AudioFreq: Audio frequency used to play the audio stream. |
adustm | 0:6f035eff38e4 | 63 | * @note The I2S PLL input clock must be done in the user application. |
adustm | 0:6f035eff38e4 | 64 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 65 | */ |
adustm | 0:6f035eff38e4 | 66 | uint8_t OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); |
adustm | 0:6f035eff38e4 | 67 | |
adustm | 0:6f035eff38e4 | 68 | /** |
adustm | 0:6f035eff38e4 | 69 | * @brief Starts playing audio stream from a data buffer for a determined size. |
adustm | 0:6f035eff38e4 | 70 | * @param pBuffer: Pointer to the buffer |
adustm | 0:6f035eff38e4 | 71 | * @param Size: Number of audio data in BYTES unit. |
adustm | 0:6f035eff38e4 | 72 | * In memory, first element is for left channel, second element is for right channel |
adustm | 0:6f035eff38e4 | 73 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 74 | */ |
adustm | 0:6f035eff38e4 | 75 | uint8_t OUT_Play(uint16_t* pBuffer, uint32_t Size); |
adustm | 0:6f035eff38e4 | 76 | |
adustm | 0:6f035eff38e4 | 77 | /** |
adustm | 0:6f035eff38e4 | 78 | * @brief Sends n-Bytes on the SAI interface. |
adustm | 0:6f035eff38e4 | 79 | * @param pData: pointer on data address |
adustm | 0:6f035eff38e4 | 80 | * @param Size: number of data to be written |
adustm | 0:6f035eff38e4 | 81 | * @retval None |
adustm | 0:6f035eff38e4 | 82 | */ |
adustm | 0:6f035eff38e4 | 83 | void OUT_ChangeBuffer(uint16_t *pData, uint16_t Size); |
adustm | 0:6f035eff38e4 | 84 | |
adustm | 0:6f035eff38e4 | 85 | /** |
adustm | 0:6f035eff38e4 | 86 | * @brief This function Pauses the audio file stream. In case |
adustm | 0:6f035eff38e4 | 87 | * of using DMA, the DMA Pause feature is used. |
adustm | 0:6f035eff38e4 | 88 | * @note When calling OUT_Pause(); function for pause, only |
adustm | 0:6f035eff38e4 | 89 | * OUT_Resume(); function should be called for resume (use of BSP_AUDIO_OUT_Play() |
adustm | 0:6f035eff38e4 | 90 | * function for resume could lead to unexpected behaviour);. |
adustm | 0:6f035eff38e4 | 91 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 92 | */ |
adustm | 0:6f035eff38e4 | 93 | uint8_t OUT_Pause(void); |
adustm | 0:6f035eff38e4 | 94 | |
adustm | 0:6f035eff38e4 | 95 | /** |
adustm | 0:6f035eff38e4 | 96 | * @brief This function Resumes the audio file stream. |
adustm | 0:6f035eff38e4 | 97 | * @note When calling OUT_Pause(); function for pause, only |
adustm | 0:6f035eff38e4 | 98 | * OUT_Resume(); function should be called for resume (use of BSP_AUDIO_OUT_Play() |
adustm | 0:6f035eff38e4 | 99 | * function for resume could lead to unexpected behaviour);. |
adustm | 0:6f035eff38e4 | 100 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 101 | */ |
adustm | 0:6f035eff38e4 | 102 | uint8_t OUT_Resume(void); |
adustm | 0:6f035eff38e4 | 103 | |
adustm | 0:6f035eff38e4 | 104 | /** |
adustm | 0:6f035eff38e4 | 105 | * @brief Stops audio playing and Power down the Audio Codec. |
adustm | 0:6f035eff38e4 | 106 | * @param Option: could be one of the following parameters |
adustm | 0:6f035eff38e4 | 107 | * - CODEC_PDWN_SW: for software power off (by writing registers);. |
adustm | 0:6f035eff38e4 | 108 | * Then no need to reconfigure the Codec after power on. |
adustm | 0:6f035eff38e4 | 109 | * - CODEC_PDWN_HW: completely shut down the codec (physically);. |
adustm | 0:6f035eff38e4 | 110 | * Then need to reconfigure the Codec after power on. |
adustm | 0:6f035eff38e4 | 111 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 112 | */ |
adustm | 0:6f035eff38e4 | 113 | uint8_t OUT_Stop(uint32_t Option); |
adustm | 0:6f035eff38e4 | 114 | |
adustm | 0:6f035eff38e4 | 115 | /** |
adustm | 0:6f035eff38e4 | 116 | * @brief Controls the current audio volume level. |
adustm | 0:6f035eff38e4 | 117 | * @param Volume: Volume level to be set in percentage from 0% to 100% (0 for |
adustm | 0:6f035eff38e4 | 118 | * Mute and 100 for Max volume level);. |
adustm | 0:6f035eff38e4 | 119 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 120 | */ |
adustm | 0:6f035eff38e4 | 121 | uint8_t OUT_SetVolume(uint8_t Volume); |
adustm | 0:6f035eff38e4 | 122 | |
adustm | 0:6f035eff38e4 | 123 | /** |
adustm | 0:6f035eff38e4 | 124 | * @brief Enables or disables the MUTE mode by software |
adustm | 0:6f035eff38e4 | 125 | * @param Cmd: Could be AUDIO_MUTE_ON to mute sound or AUDIO_MUTE_OFF to |
adustm | 0:6f035eff38e4 | 126 | * unmute the codec and restore previous volume level. |
adustm | 0:6f035eff38e4 | 127 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 128 | */ |
adustm | 0:6f035eff38e4 | 129 | uint8_t OUT_SetMute(uint32_t Cmd); |
adustm | 0:6f035eff38e4 | 130 | |
adustm | 0:6f035eff38e4 | 131 | /** |
adustm | 0:6f035eff38e4 | 132 | * @brief Switch dynamically (while audio file is played); the output target |
adustm | 0:6f035eff38e4 | 133 | * (speaker or headphone);. |
adustm | 0:6f035eff38e4 | 134 | * @param Output: The audio output target: OUTPUT_DEVICE_SPEAKER, |
adustm | 0:6f035eff38e4 | 135 | * OUTPUT_DEVICE_HEADPHONE or OUTPUT_DEVICE_BOTH |
adustm | 0:6f035eff38e4 | 136 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 137 | */ |
adustm | 0:6f035eff38e4 | 138 | uint8_t OUT_SetOutputMode(uint8_t Output); |
adustm | 0:6f035eff38e4 | 139 | |
adustm | 0:6f035eff38e4 | 140 | /** |
adustm | 0:6f035eff38e4 | 141 | * @brief Updates the audio frequency. |
adustm | 0:6f035eff38e4 | 142 | * @param AudioFreq: Audio frequency used to play the audio stream. |
adustm | 0:6f035eff38e4 | 143 | * @note This API should be called after the OUT_Init(); to adjust the |
adustm | 0:6f035eff38e4 | 144 | * audio frequency. |
adustm | 0:6f035eff38e4 | 145 | * @retval None |
adustm | 0:6f035eff38e4 | 146 | */ |
adustm | 0:6f035eff38e4 | 147 | void OUT_SetFrequency(uint32_t AudioFreq); |
adustm | 0:6f035eff38e4 | 148 | |
adustm | 0:6f035eff38e4 | 149 | /** |
adustm | 0:6f035eff38e4 | 150 | * @brief Updates the Audio frame slot configuration. |
adustm | 0:6f035eff38e4 | 151 | * @param AudioFrameSlot: specifies the audio Frame slot |
adustm | 0:6f035eff38e4 | 152 | * This parameter can be one of the following values |
adustm | 0:6f035eff38e4 | 153 | * @arg CODEC_AUDIOFRAME_SLOT_0123 |
adustm | 0:6f035eff38e4 | 154 | * @arg CODEC_AUDIOFRAME_SLOT_02 |
adustm | 0:6f035eff38e4 | 155 | * @arg CODEC_AUDIOFRAME_SLOT_13 |
adustm | 0:6f035eff38e4 | 156 | * @note This API should be called after the OUT_Init(); to adjust the |
adustm | 0:6f035eff38e4 | 157 | * audio frame slot. |
adustm | 0:6f035eff38e4 | 158 | * @retval None |
adustm | 0:6f035eff38e4 | 159 | */ |
adustm | 0:6f035eff38e4 | 160 | void OUT_SetAudioFrameSlot(uint32_t AudioFrameSlot); |
adustm | 0:6f035eff38e4 | 161 | |
adustm | 0:6f035eff38e4 | 162 | /** |
adustm | 0:6f035eff38e4 | 163 | * @brief Deinit the audio peripherals. |
adustm | 0:6f035eff38e4 | 164 | * @retval None |
adustm | 0:6f035eff38e4 | 165 | */ |
adustm | 0:6f035eff38e4 | 166 | void OUT_DeInit(void); |
adustm | 0:6f035eff38e4 | 167 | |
adustm | 0:6f035eff38e4 | 168 | /** |
adustm | 0:6f035eff38e4 | 169 | * @brief Tx Transfer completed callbacks. |
adustm | 0:6f035eff38e4 | 170 | * @param hsai: SAI handle |
adustm | 0:6f035eff38e4 | 171 | * @retval None |
adustm | 0:6f035eff38e4 | 172 | */ |
adustm | 0:6f035eff38e4 | 173 | void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai); |
adustm | 0:6f035eff38e4 | 174 | |
adustm | 0:6f035eff38e4 | 175 | /** |
adustm | 0:6f035eff38e4 | 176 | * @brief Tx Half Transfer completed callbacks. |
adustm | 0:6f035eff38e4 | 177 | * @param hsai: SAI handle |
adustm | 0:6f035eff38e4 | 178 | * @retval None |
adustm | 0:6f035eff38e4 | 179 | */ |
adustm | 0:6f035eff38e4 | 180 | void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai); |
adustm | 0:6f035eff38e4 | 181 | |
adustm | 0:6f035eff38e4 | 182 | /** |
adustm | 0:6f035eff38e4 | 183 | * @brief SAI error callbacks. |
adustm | 0:6f035eff38e4 | 184 | * @param hsai: SAI handle |
adustm | 0:6f035eff38e4 | 185 | * @retval None |
adustm | 0:6f035eff38e4 | 186 | */ |
adustm | 0:6f035eff38e4 | 187 | void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai); |
adustm | 0:6f035eff38e4 | 188 | |
adustm | 0:6f035eff38e4 | 189 | /** |
adustm | 0:6f035eff38e4 | 190 | * @brief Initializes the output Audio Codec audio interface (SAI);. |
adustm | 0:6f035eff38e4 | 191 | * @param AudioFreq: Audio frequency to be configured for the SAI peripheral. |
adustm | 0:6f035eff38e4 | 192 | * @note The default SlotActive configuration is set to CODEC_AUDIOFRAME_SLOT_0123 |
adustm | 0:6f035eff38e4 | 193 | * and user can update this configuration using |
adustm | 0:6f035eff38e4 | 194 | * @retval None |
adustm | 0:6f035eff38e4 | 195 | */ |
adustm | 0:6f035eff38e4 | 196 | static void SAIx_Out_Init(uint32_t AudioFreq); |
adustm | 0:6f035eff38e4 | 197 | |
adustm | 0:6f035eff38e4 | 198 | /** |
adustm | 0:6f035eff38e4 | 199 | * @brief Deinitializes the output Audio Codec audio interface (SAI);. |
adustm | 0:6f035eff38e4 | 200 | * @retval None |
adustm | 0:6f035eff38e4 | 201 | */ |
adustm | 0:6f035eff38e4 | 202 | static void SAIx_Out_DeInit(void); |
adustm | 0:6f035eff38e4 | 203 | |
adustm | 0:6f035eff38e4 | 204 | /** |
adustm | 0:6f035eff38e4 | 205 | * @brief Initializes wave recording. |
adustm | 0:6f035eff38e4 | 206 | * @param InputDevice: INPUT_DEVICE_DIGITAL_MICROPHONE_2 or INPUT_DEVICE_INPUT_LINE_1 |
adustm | 0:6f035eff38e4 | 207 | * @param Volume: Initial volume level (in range 0(Mute);..80(+0dB)..100(+17.625dB)) |
adustm | 0:6f035eff38e4 | 208 | * @param AudioFreq: Audio frequency to be configured for the SAI peripheral. |
adustm | 0:6f035eff38e4 | 209 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 210 | */ |
adustm | 0:6f035eff38e4 | 211 | uint8_t IN_Init(uint16_t InputDevice, uint8_t Volume, uint32_t AudioFreq); |
adustm | 0:6f035eff38e4 | 212 | |
adustm | 0:6f035eff38e4 | 213 | /** |
adustm | 0:6f035eff38e4 | 214 | * @brief Initializes wave recording and playback in parallel. |
adustm | 0:6f035eff38e4 | 215 | * @param InputDevice: INPUT_DEVICE_DIGITAL_MICROPHONE_2 |
adustm | 0:6f035eff38e4 | 216 | * @param OutputDevice: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, |
adustm | 0:6f035eff38e4 | 217 | * or OUTPUT_DEVICE_BOTH. |
adustm | 0:6f035eff38e4 | 218 | * @param Volume: Initial volume level (in range 0(Mute);..80(+0dB)..100(+17.625dB)) |
adustm | 0:6f035eff38e4 | 219 | * @param AudioFreq: Audio frequency to be configured for the SAI peripheral. |
adustm | 0:6f035eff38e4 | 220 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 221 | */ |
adustm | 0:6f035eff38e4 | 222 | uint8_t IN_OUT_Init(uint16_t InputDevice, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); |
adustm | 0:6f035eff38e4 | 223 | |
adustm | 0:6f035eff38e4 | 224 | /** |
adustm | 0:6f035eff38e4 | 225 | * @brief Starts audio recording. |
adustm | 0:6f035eff38e4 | 226 | * @param pbuf: Main buffer pointer for the recorded data storing |
adustm | 0:6f035eff38e4 | 227 | * @param size: size of the recorded buffer in number of elements (typically number of half-words); |
adustm | 0:6f035eff38e4 | 228 | * Be careful that it is not the same unit than OUT_Play function |
adustm | 0:6f035eff38e4 | 229 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 230 | */ |
adustm | 0:6f035eff38e4 | 231 | uint8_t IN_Record(uint16_t* pbuf, uint32_t size); |
adustm | 0:6f035eff38e4 | 232 | |
adustm | 0:6f035eff38e4 | 233 | /** |
adustm | 0:6f035eff38e4 | 234 | * @brief Stops audio recording. |
adustm | 0:6f035eff38e4 | 235 | * @param Option: could be one of the following parameters |
adustm | 0:6f035eff38e4 | 236 | * - CODEC_PDWN_SW: for software power off (by writing registers);. |
adustm | 0:6f035eff38e4 | 237 | * Then no need to reconfigure the Codec after power on. |
adustm | 0:6f035eff38e4 | 238 | * - CODEC_PDWN_HW: completely shut down the codec (physically);. |
adustm | 0:6f035eff38e4 | 239 | * Then need to reconfigure the Codec after power on. |
adustm | 0:6f035eff38e4 | 240 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 241 | */ |
adustm | 0:6f035eff38e4 | 242 | uint8_t IN_Stop(uint32_t Option); |
adustm | 0:6f035eff38e4 | 243 | |
adustm | 0:6f035eff38e4 | 244 | /** |
adustm | 0:6f035eff38e4 | 245 | * @brief Pauses the audio file stream. |
adustm | 0:6f035eff38e4 | 246 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 247 | */ |
adustm | 0:6f035eff38e4 | 248 | uint8_t IN_Pause(void); |
adustm | 0:6f035eff38e4 | 249 | |
adustm | 0:6f035eff38e4 | 250 | /** |
adustm | 0:6f035eff38e4 | 251 | * @brief Resumes the audio file stream. |
adustm | 0:6f035eff38e4 | 252 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 253 | */ |
adustm | 0:6f035eff38e4 | 254 | uint8_t IN_Resume(void); |
adustm | 0:6f035eff38e4 | 255 | |
adustm | 0:6f035eff38e4 | 256 | /** |
adustm | 0:6f035eff38e4 | 257 | * @brief Controls the audio in volume level. |
adustm | 0:6f035eff38e4 | 258 | * @param Volume: Volume level in range 0(Mute);..80(+0dB)..100(+17.625dB) |
adustm | 0:6f035eff38e4 | 259 | * @retval AUDIO_OK if correct communication, else wrong communication |
adustm | 0:6f035eff38e4 | 260 | */ |
adustm | 0:6f035eff38e4 | 261 | uint8_t IN_SetVolume(uint8_t Volume); |
adustm | 0:6f035eff38e4 | 262 | |
adustm | 0:6f035eff38e4 | 263 | /** |
adustm | 0:6f035eff38e4 | 264 | * @brief Deinit the audio IN peripherals. |
adustm | 0:6f035eff38e4 | 265 | * @retval None |
adustm | 0:6f035eff38e4 | 266 | */ |
adustm | 0:6f035eff38e4 | 267 | void IN_DeInit(void); |
adustm | 0:6f035eff38e4 | 268 | |
adustm | 0:6f035eff38e4 | 269 | /** |
adustm | 0:6f035eff38e4 | 270 | * @brief Rx Transfer completed callbacks. |
adustm | 0:6f035eff38e4 | 271 | * @param hsai: SAI handle |
adustm | 0:6f035eff38e4 | 272 | * @retval None |
adustm | 0:6f035eff38e4 | 273 | */ |
adustm | 0:6f035eff38e4 | 274 | void HAL_SAI_RxCpltCallback(SAI_HandleTypeDef *hsai); |
adustm | 0:6f035eff38e4 | 275 | |
adustm | 0:6f035eff38e4 | 276 | /** |
adustm | 0:6f035eff38e4 | 277 | * @brief Rx Half Transfer completed callbacks. |
adustm | 0:6f035eff38e4 | 278 | * @param hsai: SAI handle |
adustm | 0:6f035eff38e4 | 279 | * @retval None |
adustm | 0:6f035eff38e4 | 280 | */ |
adustm | 0:6f035eff38e4 | 281 | void HAL_SAI_RxHalfCpltCallback(SAI_HandleTypeDef *hsai); |
adustm | 0:6f035eff38e4 | 282 | |
adustm | 0:6f035eff38e4 | 283 | /** |
adustm | 0:6f035eff38e4 | 284 | * @brief Initializes the input Audio Codec audio interface (SAI);. |
adustm | 0:6f035eff38e4 | 285 | * @param SaiOutMode: SAI_MODEMASTER_TX (for record and playback in parallel); |
adustm | 0:6f035eff38e4 | 286 | * or SAI_MODEMASTER_RX (for record only);. |
adustm | 0:6f035eff38e4 | 287 | * @param SlotActive: CODEC_AUDIOFRAME_SLOT_02 or CODEC_AUDIOFRAME_SLOT_13 |
adustm | 0:6f035eff38e4 | 288 | * @param AudioFreq: Audio frequency to be configured for the SAI peripheral. |
adustm | 0:6f035eff38e4 | 289 | * @retval None |
adustm | 0:6f035eff38e4 | 290 | */ |
adustm | 0:6f035eff38e4 | 291 | static void SAIx_In_Init(uint32_t SaiOutMode, uint32_t SlotActive, uint32_t AudioFreq); |
adustm | 0:6f035eff38e4 | 292 | |
adustm | 0:6f035eff38e4 | 293 | /** |
adustm | 0:6f035eff38e4 | 294 | * @brief Deinitializes the output Audio Codec audio interface (SAI);. |
adustm | 0:6f035eff38e4 | 295 | * @retval None |
adustm | 0:6f035eff38e4 | 296 | */ |
adustm | 0:6f035eff38e4 | 297 | static void SAIx_In_DeInit(void); |
adustm | 0:6f035eff38e4 | 298 | |
adustm | 0:6f035eff38e4 | 299 | private: |
adustm | 0:6f035eff38e4 | 300 | |
adustm | 0:6f035eff38e4 | 301 | }; |
adustm | 0:6f035eff38e4 | 302 | |
adustm | 0:6f035eff38e4 | 303 | #else |
adustm | 0:6f035eff38e4 | 304 | #error "This class must be used with DISCO_F746NG board only." |
adustm | 0:6f035eff38e4 | 305 | #endif // TARGET_DISCO_F746NG |
adustm | 0:6f035eff38e4 | 306 | |
adustm | 0:6f035eff38e4 | 307 | #endif |