Clone
Dependents: SignalProcessLab DigitalSignalAlgorithm_Lab DigitalSignal_Lab
Drivers/BSP/Components/wm8994/wm8994.c@0:fc80425b677a, 2019-08-26 (annotated)
- Committer:
- ngtkien
- Date:
- Mon Aug 26 16:33:09 2019 +0000
- Revision:
- 0:fc80425b677a
Library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ngtkien | 0:fc80425b677a | 1 | /** |
ngtkien | 0:fc80425b677a | 2 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 3 | * @file wm8994.c |
ngtkien | 0:fc80425b677a | 4 | * @author MCD Application Team |
ngtkien | 0:fc80425b677a | 5 | * @version V2.1.0 |
ngtkien | 0:fc80425b677a | 6 | * @date 22-February-2016 |
ngtkien | 0:fc80425b677a | 7 | * @brief This file provides the WM8994 Audio Codec driver. |
ngtkien | 0:fc80425b677a | 8 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 9 | * @attention |
ngtkien | 0:fc80425b677a | 10 | * |
ngtkien | 0:fc80425b677a | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
ngtkien | 0:fc80425b677a | 12 | * |
ngtkien | 0:fc80425b677a | 13 | * Redistribution and use in source and binary forms, with or without modification, |
ngtkien | 0:fc80425b677a | 14 | * are permitted provided that the following conditions are met: |
ngtkien | 0:fc80425b677a | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
ngtkien | 0:fc80425b677a | 16 | * this list of conditions and the following disclaimer. |
ngtkien | 0:fc80425b677a | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
ngtkien | 0:fc80425b677a | 18 | * this list of conditions and the following disclaimer in the documentation |
ngtkien | 0:fc80425b677a | 19 | * and/or other materials provided with the distribution. |
ngtkien | 0:fc80425b677a | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
ngtkien | 0:fc80425b677a | 21 | * may be used to endorse or promote products derived from this software |
ngtkien | 0:fc80425b677a | 22 | * without specific prior written permission. |
ngtkien | 0:fc80425b677a | 23 | * |
ngtkien | 0:fc80425b677a | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
ngtkien | 0:fc80425b677a | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
ngtkien | 0:fc80425b677a | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
ngtkien | 0:fc80425b677a | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
ngtkien | 0:fc80425b677a | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
ngtkien | 0:fc80425b677a | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
ngtkien | 0:fc80425b677a | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
ngtkien | 0:fc80425b677a | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
ngtkien | 0:fc80425b677a | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
ngtkien | 0:fc80425b677a | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ngtkien | 0:fc80425b677a | 34 | * |
ngtkien | 0:fc80425b677a | 35 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 36 | */ |
ngtkien | 0:fc80425b677a | 37 | |
ngtkien | 0:fc80425b677a | 38 | /* Includes ------------------------------------------------------------------*/ |
ngtkien | 0:fc80425b677a | 39 | #include "wm8994.h" |
ngtkien | 0:fc80425b677a | 40 | |
ngtkien | 0:fc80425b677a | 41 | /** @addtogroup BSP |
ngtkien | 0:fc80425b677a | 42 | * @{ |
ngtkien | 0:fc80425b677a | 43 | */ |
ngtkien | 0:fc80425b677a | 44 | |
ngtkien | 0:fc80425b677a | 45 | /** @addtogroup Components |
ngtkien | 0:fc80425b677a | 46 | * @{ |
ngtkien | 0:fc80425b677a | 47 | */ |
ngtkien | 0:fc80425b677a | 48 | |
ngtkien | 0:fc80425b677a | 49 | /** @addtogroup wm8994 |
ngtkien | 0:fc80425b677a | 50 | * @brief This file provides a set of functions needed to drive the |
ngtkien | 0:fc80425b677a | 51 | * WM8994 audio codec. |
ngtkien | 0:fc80425b677a | 52 | * @{ |
ngtkien | 0:fc80425b677a | 53 | */ |
ngtkien | 0:fc80425b677a | 54 | |
ngtkien | 0:fc80425b677a | 55 | /** @defgroup WM8994_Private_Types |
ngtkien | 0:fc80425b677a | 56 | * @{ |
ngtkien | 0:fc80425b677a | 57 | */ |
ngtkien | 0:fc80425b677a | 58 | |
ngtkien | 0:fc80425b677a | 59 | /** |
ngtkien | 0:fc80425b677a | 60 | * @} |
ngtkien | 0:fc80425b677a | 61 | */ |
ngtkien | 0:fc80425b677a | 62 | |
ngtkien | 0:fc80425b677a | 63 | /** @defgroup WM8994_Private_Defines |
ngtkien | 0:fc80425b677a | 64 | * @{ |
ngtkien | 0:fc80425b677a | 65 | */ |
ngtkien | 0:fc80425b677a | 66 | /* Uncomment this line to enable verifying data sent to codec after each write |
ngtkien | 0:fc80425b677a | 67 | operation (for debug purpose) */ |
ngtkien | 0:fc80425b677a | 68 | #if !defined (VERIFY_WRITTENDATA) |
ngtkien | 0:fc80425b677a | 69 | /*#define VERIFY_WRITTENDATA*/ |
ngtkien | 0:fc80425b677a | 70 | #endif /* VERIFY_WRITTENDATA */ |
ngtkien | 0:fc80425b677a | 71 | /** |
ngtkien | 0:fc80425b677a | 72 | * @} |
ngtkien | 0:fc80425b677a | 73 | */ |
ngtkien | 0:fc80425b677a | 74 | |
ngtkien | 0:fc80425b677a | 75 | /** @defgroup WM8994_Private_Macros |
ngtkien | 0:fc80425b677a | 76 | * @{ |
ngtkien | 0:fc80425b677a | 77 | */ |
ngtkien | 0:fc80425b677a | 78 | |
ngtkien | 0:fc80425b677a | 79 | /** |
ngtkien | 0:fc80425b677a | 80 | * @} |
ngtkien | 0:fc80425b677a | 81 | */ |
ngtkien | 0:fc80425b677a | 82 | |
ngtkien | 0:fc80425b677a | 83 | /** @defgroup WM8994_Private_Variables |
ngtkien | 0:fc80425b677a | 84 | * @{ |
ngtkien | 0:fc80425b677a | 85 | */ |
ngtkien | 0:fc80425b677a | 86 | |
ngtkien | 0:fc80425b677a | 87 | /* Audio codec driver structure initialization */ |
ngtkien | 0:fc80425b677a | 88 | AUDIO_DrvTypeDef wm8994_drv = |
ngtkien | 0:fc80425b677a | 89 | { |
ngtkien | 0:fc80425b677a | 90 | wm8994_Init, |
ngtkien | 0:fc80425b677a | 91 | wm8994_DeInit, |
ngtkien | 0:fc80425b677a | 92 | wm8994_ReadID, |
ngtkien | 0:fc80425b677a | 93 | |
ngtkien | 0:fc80425b677a | 94 | wm8994_Play, |
ngtkien | 0:fc80425b677a | 95 | wm8994_Pause, |
ngtkien | 0:fc80425b677a | 96 | wm8994_Resume, |
ngtkien | 0:fc80425b677a | 97 | wm8994_Stop, |
ngtkien | 0:fc80425b677a | 98 | |
ngtkien | 0:fc80425b677a | 99 | wm8994_SetFrequency, |
ngtkien | 0:fc80425b677a | 100 | wm8994_SetVolume, |
ngtkien | 0:fc80425b677a | 101 | wm8994_SetMute, |
ngtkien | 0:fc80425b677a | 102 | wm8994_SetOutputMode, |
ngtkien | 0:fc80425b677a | 103 | |
ngtkien | 0:fc80425b677a | 104 | wm8994_Reset |
ngtkien | 0:fc80425b677a | 105 | }; |
ngtkien | 0:fc80425b677a | 106 | |
ngtkien | 0:fc80425b677a | 107 | static uint32_t outputEnabled = 0; |
ngtkien | 0:fc80425b677a | 108 | static uint32_t inputEnabled = 0; |
ngtkien | 0:fc80425b677a | 109 | /** |
ngtkien | 0:fc80425b677a | 110 | * @} |
ngtkien | 0:fc80425b677a | 111 | */ |
ngtkien | 0:fc80425b677a | 112 | |
ngtkien | 0:fc80425b677a | 113 | /** @defgroup WM8994_Function_Prototypes |
ngtkien | 0:fc80425b677a | 114 | * @{ |
ngtkien | 0:fc80425b677a | 115 | */ |
ngtkien | 0:fc80425b677a | 116 | static uint8_t CODEC_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value); |
ngtkien | 0:fc80425b677a | 117 | /** |
ngtkien | 0:fc80425b677a | 118 | * @} |
ngtkien | 0:fc80425b677a | 119 | */ |
ngtkien | 0:fc80425b677a | 120 | |
ngtkien | 0:fc80425b677a | 121 | /** @defgroup WM8994_Private_Functions |
ngtkien | 0:fc80425b677a | 122 | * @{ |
ngtkien | 0:fc80425b677a | 123 | */ |
ngtkien | 0:fc80425b677a | 124 | |
ngtkien | 0:fc80425b677a | 125 | /** |
ngtkien | 0:fc80425b677a | 126 | * @brief Initializes the audio codec and the control interface. |
ngtkien | 0:fc80425b677a | 127 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 128 | * @param OutputInputDevice: can be OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, |
ngtkien | 0:fc80425b677a | 129 | * OUTPUT_DEVICE_BOTH, OUTPUT_DEVICE_AUTO, INPUT_DEVICE_DIGITAL_MICROPHONE_1, |
ngtkien | 0:fc80425b677a | 130 | * INPUT_DEVICE_DIGITAL_MICROPHONE_2, INPUT_DEVICE_DIGITAL_MIC1_MIC2, |
ngtkien | 0:fc80425b677a | 131 | * INPUT_DEVICE_INPUT_LINE_1 or INPUT_DEVICE_INPUT_LINE_2. |
ngtkien | 0:fc80425b677a | 132 | * @param Volume: Initial volume level (from 0 (Mute) to 100 (Max)) |
ngtkien | 0:fc80425b677a | 133 | * @param AudioFreq: Audio Frequency |
ngtkien | 0:fc80425b677a | 134 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 135 | */ |
ngtkien | 0:fc80425b677a | 136 | uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq) |
ngtkien | 0:fc80425b677a | 137 | { |
ngtkien | 0:fc80425b677a | 138 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 139 | uint16_t output_device = OutputInputDevice & 0xFF; |
ngtkien | 0:fc80425b677a | 140 | uint16_t input_device = OutputInputDevice & 0xFF00; |
ngtkien | 0:fc80425b677a | 141 | uint16_t power_mgnt_reg_1 = 0; |
ngtkien | 0:fc80425b677a | 142 | |
ngtkien | 0:fc80425b677a | 143 | /* Initialize the Control interface of the Audio Codec */ |
ngtkien | 0:fc80425b677a | 144 | AUDIO_IO_Init(); |
ngtkien | 0:fc80425b677a | 145 | /* wm8994 Errata Work-Arounds */ |
ngtkien | 0:fc80425b677a | 146 | counter += CODEC_IO_Write(DeviceAddr, 0x102, 0x0003); |
ngtkien | 0:fc80425b677a | 147 | counter += CODEC_IO_Write(DeviceAddr, 0x817, 0x0000); |
ngtkien | 0:fc80425b677a | 148 | counter += CODEC_IO_Write(DeviceAddr, 0x102, 0x0000); |
ngtkien | 0:fc80425b677a | 149 | |
ngtkien | 0:fc80425b677a | 150 | /* Enable VMID soft start (fast), Start-up Bias Current Enabled */ |
ngtkien | 0:fc80425b677a | 151 | counter += CODEC_IO_Write(DeviceAddr, 0x39, 0x006C); |
ngtkien | 0:fc80425b677a | 152 | |
ngtkien | 0:fc80425b677a | 153 | /* Enable bias generator, Enable VMID */ |
ngtkien | 0:fc80425b677a | 154 | if (input_device > 0) |
ngtkien | 0:fc80425b677a | 155 | { |
ngtkien | 0:fc80425b677a | 156 | counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x0013); |
ngtkien | 0:fc80425b677a | 157 | } |
ngtkien | 0:fc80425b677a | 158 | else |
ngtkien | 0:fc80425b677a | 159 | { |
ngtkien | 0:fc80425b677a | 160 | counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x0003); |
ngtkien | 0:fc80425b677a | 161 | } |
ngtkien | 0:fc80425b677a | 162 | |
ngtkien | 0:fc80425b677a | 163 | /* Add Delay */ |
ngtkien | 0:fc80425b677a | 164 | AUDIO_IO_Delay(50); |
ngtkien | 0:fc80425b677a | 165 | |
ngtkien | 0:fc80425b677a | 166 | /* Path Configurations for output */ |
ngtkien | 0:fc80425b677a | 167 | if (output_device > 0) |
ngtkien | 0:fc80425b677a | 168 | { |
ngtkien | 0:fc80425b677a | 169 | outputEnabled = 1; |
ngtkien | 0:fc80425b677a | 170 | switch (output_device) |
ngtkien | 0:fc80425b677a | 171 | { |
ngtkien | 0:fc80425b677a | 172 | case OUTPUT_DEVICE_SPEAKER: |
ngtkien | 0:fc80425b677a | 173 | /* Enable DAC1 (Left), Enable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 174 | Disable DAC2 (Left), Disable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 175 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0C0C); |
ngtkien | 0:fc80425b677a | 176 | |
ngtkien | 0:fc80425b677a | 177 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 178 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0000); |
ngtkien | 0:fc80425b677a | 179 | |
ngtkien | 0:fc80425b677a | 180 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 181 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0000); |
ngtkien | 0:fc80425b677a | 182 | |
ngtkien | 0:fc80425b677a | 183 | /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 184 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002); |
ngtkien | 0:fc80425b677a | 185 | |
ngtkien | 0:fc80425b677a | 186 | /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 187 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002); |
ngtkien | 0:fc80425b677a | 188 | break; |
ngtkien | 0:fc80425b677a | 189 | |
ngtkien | 0:fc80425b677a | 190 | case OUTPUT_DEVICE_HEADPHONE: |
ngtkien | 0:fc80425b677a | 191 | /* Disable DAC1 (Left), Disable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 192 | Enable DAC2 (Left), Enable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 193 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303); |
ngtkien | 0:fc80425b677a | 194 | |
ngtkien | 0:fc80425b677a | 195 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 196 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001); |
ngtkien | 0:fc80425b677a | 197 | |
ngtkien | 0:fc80425b677a | 198 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 199 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001); |
ngtkien | 0:fc80425b677a | 200 | |
ngtkien | 0:fc80425b677a | 201 | /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 202 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000); |
ngtkien | 0:fc80425b677a | 203 | |
ngtkien | 0:fc80425b677a | 204 | /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 205 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000); |
ngtkien | 0:fc80425b677a | 206 | break; |
ngtkien | 0:fc80425b677a | 207 | |
ngtkien | 0:fc80425b677a | 208 | case OUTPUT_DEVICE_BOTH: |
ngtkien | 0:fc80425b677a | 209 | if (input_device == INPUT_DEVICE_DIGITAL_MIC1_MIC2) |
ngtkien | 0:fc80425b677a | 210 | { |
ngtkien | 0:fc80425b677a | 211 | /* Enable DAC1 (Left), Enable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 212 | also Enable DAC2 (Left), Enable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 213 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303 | 0x0C0C); |
ngtkien | 0:fc80425b677a | 214 | |
ngtkien | 0:fc80425b677a | 215 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path |
ngtkien | 0:fc80425b677a | 216 | Enable the AIF1 Timeslot 1 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 217 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0003); |
ngtkien | 0:fc80425b677a | 218 | |
ngtkien | 0:fc80425b677a | 219 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path |
ngtkien | 0:fc80425b677a | 220 | Enable the AIF1 Timeslot 1 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 221 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0003); |
ngtkien | 0:fc80425b677a | 222 | |
ngtkien | 0:fc80425b677a | 223 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 2 (Left) mixer path |
ngtkien | 0:fc80425b677a | 224 | Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 225 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0003); |
ngtkien | 0:fc80425b677a | 226 | |
ngtkien | 0:fc80425b677a | 227 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 2 (Right) mixer path |
ngtkien | 0:fc80425b677a | 228 | Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 229 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0003); |
ngtkien | 0:fc80425b677a | 230 | } |
ngtkien | 0:fc80425b677a | 231 | else |
ngtkien | 0:fc80425b677a | 232 | { |
ngtkien | 0:fc80425b677a | 233 | /* Enable DAC1 (Left), Enable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 234 | also Enable DAC2 (Left), Enable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 235 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303 | 0x0C0C); |
ngtkien | 0:fc80425b677a | 236 | |
ngtkien | 0:fc80425b677a | 237 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 238 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001); |
ngtkien | 0:fc80425b677a | 239 | |
ngtkien | 0:fc80425b677a | 240 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 241 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001); |
ngtkien | 0:fc80425b677a | 242 | |
ngtkien | 0:fc80425b677a | 243 | /* Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 244 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002); |
ngtkien | 0:fc80425b677a | 245 | |
ngtkien | 0:fc80425b677a | 246 | /* Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 247 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002); |
ngtkien | 0:fc80425b677a | 248 | } |
ngtkien | 0:fc80425b677a | 249 | break; |
ngtkien | 0:fc80425b677a | 250 | |
ngtkien | 0:fc80425b677a | 251 | case OUTPUT_DEVICE_AUTO : |
ngtkien | 0:fc80425b677a | 252 | default: |
ngtkien | 0:fc80425b677a | 253 | /* Disable DAC1 (Left), Disable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 254 | Enable DAC2 (Left), Enable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 255 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303); |
ngtkien | 0:fc80425b677a | 256 | |
ngtkien | 0:fc80425b677a | 257 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 258 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001); |
ngtkien | 0:fc80425b677a | 259 | |
ngtkien | 0:fc80425b677a | 260 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 261 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001); |
ngtkien | 0:fc80425b677a | 262 | |
ngtkien | 0:fc80425b677a | 263 | /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 264 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000); |
ngtkien | 0:fc80425b677a | 265 | |
ngtkien | 0:fc80425b677a | 266 | /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 267 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000); |
ngtkien | 0:fc80425b677a | 268 | break; |
ngtkien | 0:fc80425b677a | 269 | } |
ngtkien | 0:fc80425b677a | 270 | } |
ngtkien | 0:fc80425b677a | 271 | else |
ngtkien | 0:fc80425b677a | 272 | { |
ngtkien | 0:fc80425b677a | 273 | outputEnabled = 0; |
ngtkien | 0:fc80425b677a | 274 | } |
ngtkien | 0:fc80425b677a | 275 | |
ngtkien | 0:fc80425b677a | 276 | /* Path Configurations for input */ |
ngtkien | 0:fc80425b677a | 277 | if (input_device > 0) |
ngtkien | 0:fc80425b677a | 278 | { |
ngtkien | 0:fc80425b677a | 279 | inputEnabled = 1; |
ngtkien | 0:fc80425b677a | 280 | switch (input_device) |
ngtkien | 0:fc80425b677a | 281 | { |
ngtkien | 0:fc80425b677a | 282 | case INPUT_DEVICE_DIGITAL_MICROPHONE_2 : |
ngtkien | 0:fc80425b677a | 283 | /* Enable AIF1ADC2 (Left), Enable AIF1ADC2 (Right) |
ngtkien | 0:fc80425b677a | 284 | * Enable DMICDAT2 (Left), Enable DMICDAT2 (Right) |
ngtkien | 0:fc80425b677a | 285 | * Enable Left ADC, Enable Right ADC */ |
ngtkien | 0:fc80425b677a | 286 | counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0C30); |
ngtkien | 0:fc80425b677a | 287 | |
ngtkien | 0:fc80425b677a | 288 | /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC2 Left/Right Timeslot 1 */ |
ngtkien | 0:fc80425b677a | 289 | counter += CODEC_IO_Write(DeviceAddr, 0x450, 0x00DB); |
ngtkien | 0:fc80425b677a | 290 | |
ngtkien | 0:fc80425b677a | 291 | /* Disable IN1L, IN1R, IN2L, IN2R, Enable Thermal sensor & shutdown */ |
ngtkien | 0:fc80425b677a | 292 | counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x6000); |
ngtkien | 0:fc80425b677a | 293 | |
ngtkien | 0:fc80425b677a | 294 | /* Enable the DMIC2(Left) to AIF1 Timeslot 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 295 | counter += CODEC_IO_Write(DeviceAddr, 0x608, 0x0002); |
ngtkien | 0:fc80425b677a | 296 | |
ngtkien | 0:fc80425b677a | 297 | /* Enable the DMIC2(Right) to AIF1 Timeslot 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 298 | counter += CODEC_IO_Write(DeviceAddr, 0x609, 0x0002); |
ngtkien | 0:fc80425b677a | 299 | |
ngtkien | 0:fc80425b677a | 300 | /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC2 signal detect */ |
ngtkien | 0:fc80425b677a | 301 | counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000E); |
ngtkien | 0:fc80425b677a | 302 | break; |
ngtkien | 0:fc80425b677a | 303 | |
ngtkien | 0:fc80425b677a | 304 | case INPUT_DEVICE_INPUT_LINE_1 : |
ngtkien | 0:fc80425b677a | 305 | /* IN1LN_TO_IN1L, IN1LP_TO_VMID, IN1RN_TO_IN1R, IN1RP_TO_VMID */ |
ngtkien | 0:fc80425b677a | 306 | counter += CODEC_IO_Write(DeviceAddr, 0x28, 0x0011); |
ngtkien | 0:fc80425b677a | 307 | |
ngtkien | 0:fc80425b677a | 308 | /* Disable mute on IN1L_TO_MIXINL and +30dB on IN1L PGA output */ |
ngtkien | 0:fc80425b677a | 309 | counter += CODEC_IO_Write(DeviceAddr, 0x29, 0x0035); |
ngtkien | 0:fc80425b677a | 310 | |
ngtkien | 0:fc80425b677a | 311 | /* Disable mute on IN1R_TO_MIXINL, Gain = +30dB */ |
ngtkien | 0:fc80425b677a | 312 | counter += CODEC_IO_Write(DeviceAddr, 0x2A, 0x0035); |
ngtkien | 0:fc80425b677a | 313 | |
ngtkien | 0:fc80425b677a | 314 | /* Enable AIF1ADC1 (Left), Enable AIF1ADC1 (Right) |
ngtkien | 0:fc80425b677a | 315 | * Enable Left ADC, Enable Right ADC */ |
ngtkien | 0:fc80425b677a | 316 | counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0303); |
ngtkien | 0:fc80425b677a | 317 | |
ngtkien | 0:fc80425b677a | 318 | /* Enable AIF1 DRC1 Signal Detect & DRC in AIF1ADC1 Left/Right Timeslot 0 */ |
ngtkien | 0:fc80425b677a | 319 | counter += CODEC_IO_Write(DeviceAddr, 0x440, 0x00DB); |
ngtkien | 0:fc80425b677a | 320 | |
ngtkien | 0:fc80425b677a | 321 | /* Enable IN1L and IN1R, Disable IN2L and IN2R, Enable Thermal sensor & shutdown */ |
ngtkien | 0:fc80425b677a | 322 | counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x6350); |
ngtkien | 0:fc80425b677a | 323 | |
ngtkien | 0:fc80425b677a | 324 | /* Enable the ADCL(Left) to AIF1 Timeslot 0 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 325 | counter += CODEC_IO_Write(DeviceAddr, 0x606, 0x0002); |
ngtkien | 0:fc80425b677a | 326 | |
ngtkien | 0:fc80425b677a | 327 | /* Enable the ADCR(Right) to AIF1 Timeslot 0 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 328 | counter += CODEC_IO_Write(DeviceAddr, 0x607, 0x0002); |
ngtkien | 0:fc80425b677a | 329 | |
ngtkien | 0:fc80425b677a | 330 | /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC1 signal detect */ |
ngtkien | 0:fc80425b677a | 331 | counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000D); |
ngtkien | 0:fc80425b677a | 332 | break; |
ngtkien | 0:fc80425b677a | 333 | |
ngtkien | 0:fc80425b677a | 334 | case INPUT_DEVICE_DIGITAL_MICROPHONE_1 : |
ngtkien | 0:fc80425b677a | 335 | /* Enable AIF1ADC1 (Left), Enable AIF1ADC1 (Right) |
ngtkien | 0:fc80425b677a | 336 | * Enable DMICDAT1 (Left), Enable DMICDAT1 (Right) |
ngtkien | 0:fc80425b677a | 337 | * Enable Left ADC, Enable Right ADC */ |
ngtkien | 0:fc80425b677a | 338 | counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x030C); |
ngtkien | 0:fc80425b677a | 339 | |
ngtkien | 0:fc80425b677a | 340 | /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC1 Left/Right Timeslot 0 */ |
ngtkien | 0:fc80425b677a | 341 | counter += CODEC_IO_Write(DeviceAddr, 0x440, 0x00DB); |
ngtkien | 0:fc80425b677a | 342 | |
ngtkien | 0:fc80425b677a | 343 | /* Disable IN1L, IN1R, IN2L, IN2R, Enable Thermal sensor & shutdown */ |
ngtkien | 0:fc80425b677a | 344 | counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x6350); |
ngtkien | 0:fc80425b677a | 345 | |
ngtkien | 0:fc80425b677a | 346 | /* Enable the DMIC2(Left) to AIF1 Timeslot 0 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 347 | counter += CODEC_IO_Write(DeviceAddr, 0x606, 0x0002); |
ngtkien | 0:fc80425b677a | 348 | |
ngtkien | 0:fc80425b677a | 349 | /* Enable the DMIC2(Right) to AIF1 Timeslot 0 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 350 | counter += CODEC_IO_Write(DeviceAddr, 0x607, 0x0002); |
ngtkien | 0:fc80425b677a | 351 | |
ngtkien | 0:fc80425b677a | 352 | /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC1 signal detect */ |
ngtkien | 0:fc80425b677a | 353 | counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000D); |
ngtkien | 0:fc80425b677a | 354 | break; |
ngtkien | 0:fc80425b677a | 355 | case INPUT_DEVICE_DIGITAL_MIC1_MIC2 : |
ngtkien | 0:fc80425b677a | 356 | /* Enable AIF1ADC1 (Left), Enable AIF1ADC1 (Right) |
ngtkien | 0:fc80425b677a | 357 | * Enable DMICDAT1 (Left), Enable DMICDAT1 (Right) |
ngtkien | 0:fc80425b677a | 358 | * Enable Left ADC, Enable Right ADC */ |
ngtkien | 0:fc80425b677a | 359 | counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0F3C); |
ngtkien | 0:fc80425b677a | 360 | |
ngtkien | 0:fc80425b677a | 361 | /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC2 Left/Right Timeslot 1 */ |
ngtkien | 0:fc80425b677a | 362 | counter += CODEC_IO_Write(DeviceAddr, 0x450, 0x00DB); |
ngtkien | 0:fc80425b677a | 363 | |
ngtkien | 0:fc80425b677a | 364 | /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC1 Left/Right Timeslot 0 */ |
ngtkien | 0:fc80425b677a | 365 | counter += CODEC_IO_Write(DeviceAddr, 0x440, 0x00DB); |
ngtkien | 0:fc80425b677a | 366 | |
ngtkien | 0:fc80425b677a | 367 | /* Disable IN1L, IN1R, Enable IN2L, IN2R, Thermal sensor & shutdown */ |
ngtkien | 0:fc80425b677a | 368 | counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x63A0); |
ngtkien | 0:fc80425b677a | 369 | |
ngtkien | 0:fc80425b677a | 370 | /* Enable the DMIC2(Left) to AIF1 Timeslot 0 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 371 | counter += CODEC_IO_Write(DeviceAddr, 0x606, 0x0002); |
ngtkien | 0:fc80425b677a | 372 | |
ngtkien | 0:fc80425b677a | 373 | /* Enable the DMIC2(Right) to AIF1 Timeslot 0 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 374 | counter += CODEC_IO_Write(DeviceAddr, 0x607, 0x0002); |
ngtkien | 0:fc80425b677a | 375 | |
ngtkien | 0:fc80425b677a | 376 | /* Enable the DMIC2(Left) to AIF1 Timeslot 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 377 | counter += CODEC_IO_Write(DeviceAddr, 0x608, 0x0002); |
ngtkien | 0:fc80425b677a | 378 | |
ngtkien | 0:fc80425b677a | 379 | /* Enable the DMIC2(Right) to AIF1 Timeslot 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 380 | counter += CODEC_IO_Write(DeviceAddr, 0x609, 0x0002); |
ngtkien | 0:fc80425b677a | 381 | |
ngtkien | 0:fc80425b677a | 382 | /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC1 signal detect */ |
ngtkien | 0:fc80425b677a | 383 | counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000D); |
ngtkien | 0:fc80425b677a | 384 | break; |
ngtkien | 0:fc80425b677a | 385 | case INPUT_DEVICE_INPUT_LINE_2 : |
ngtkien | 0:fc80425b677a | 386 | default: |
ngtkien | 0:fc80425b677a | 387 | /* Actually, no other input devices supported */ |
ngtkien | 0:fc80425b677a | 388 | counter++; |
ngtkien | 0:fc80425b677a | 389 | break; |
ngtkien | 0:fc80425b677a | 390 | } |
ngtkien | 0:fc80425b677a | 391 | } |
ngtkien | 0:fc80425b677a | 392 | else |
ngtkien | 0:fc80425b677a | 393 | { |
ngtkien | 0:fc80425b677a | 394 | inputEnabled = 0; |
ngtkien | 0:fc80425b677a | 395 | } |
ngtkien | 0:fc80425b677a | 396 | |
ngtkien | 0:fc80425b677a | 397 | /* Clock Configurations */ |
ngtkien | 0:fc80425b677a | 398 | switch (AudioFreq) |
ngtkien | 0:fc80425b677a | 399 | { |
ngtkien | 0:fc80425b677a | 400 | case AUDIO_FREQUENCY_8K: |
ngtkien | 0:fc80425b677a | 401 | /* AIF1 Sample Rate = 8 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 402 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0003); |
ngtkien | 0:fc80425b677a | 403 | break; |
ngtkien | 0:fc80425b677a | 404 | |
ngtkien | 0:fc80425b677a | 405 | case AUDIO_FREQUENCY_16K: |
ngtkien | 0:fc80425b677a | 406 | /* AIF1 Sample Rate = 16 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 407 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0033); |
ngtkien | 0:fc80425b677a | 408 | break; |
ngtkien | 0:fc80425b677a | 409 | |
ngtkien | 0:fc80425b677a | 410 | case AUDIO_FREQUENCY_32K: |
ngtkien | 0:fc80425b677a | 411 | /* AIF1 Sample Rate = 32 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 412 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0063); |
ngtkien | 0:fc80425b677a | 413 | break; |
ngtkien | 0:fc80425b677a | 414 | |
ngtkien | 0:fc80425b677a | 415 | case AUDIO_FREQUENCY_48K: |
ngtkien | 0:fc80425b677a | 416 | /* AIF1 Sample Rate = 48 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 417 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083); |
ngtkien | 0:fc80425b677a | 418 | break; |
ngtkien | 0:fc80425b677a | 419 | |
ngtkien | 0:fc80425b677a | 420 | case AUDIO_FREQUENCY_96K: |
ngtkien | 0:fc80425b677a | 421 | /* AIF1 Sample Rate = 96 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 422 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x00A3); |
ngtkien | 0:fc80425b677a | 423 | break; |
ngtkien | 0:fc80425b677a | 424 | |
ngtkien | 0:fc80425b677a | 425 | case AUDIO_FREQUENCY_11K: |
ngtkien | 0:fc80425b677a | 426 | /* AIF1 Sample Rate = 11.025 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 427 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0013); |
ngtkien | 0:fc80425b677a | 428 | break; |
ngtkien | 0:fc80425b677a | 429 | |
ngtkien | 0:fc80425b677a | 430 | case AUDIO_FREQUENCY_22K: |
ngtkien | 0:fc80425b677a | 431 | /* AIF1 Sample Rate = 22.050 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 432 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0043); |
ngtkien | 0:fc80425b677a | 433 | break; |
ngtkien | 0:fc80425b677a | 434 | |
ngtkien | 0:fc80425b677a | 435 | case AUDIO_FREQUENCY_44K: |
ngtkien | 0:fc80425b677a | 436 | /* AIF1 Sample Rate = 44.1 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 437 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0073); |
ngtkien | 0:fc80425b677a | 438 | break; |
ngtkien | 0:fc80425b677a | 439 | |
ngtkien | 0:fc80425b677a | 440 | default: |
ngtkien | 0:fc80425b677a | 441 | /* AIF1 Sample Rate = 48 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 442 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083); |
ngtkien | 0:fc80425b677a | 443 | break; |
ngtkien | 0:fc80425b677a | 444 | } |
ngtkien | 0:fc80425b677a | 445 | |
ngtkien | 0:fc80425b677a | 446 | if(input_device == INPUT_DEVICE_DIGITAL_MIC1_MIC2) |
ngtkien | 0:fc80425b677a | 447 | { |
ngtkien | 0:fc80425b677a | 448 | /* AIF1 Word Length = 16-bits, AIF1 Format = DSP mode */ |
ngtkien | 0:fc80425b677a | 449 | counter += CODEC_IO_Write(DeviceAddr, 0x300, 0x4018); |
ngtkien | 0:fc80425b677a | 450 | } |
ngtkien | 0:fc80425b677a | 451 | else |
ngtkien | 0:fc80425b677a | 452 | { |
ngtkien | 0:fc80425b677a | 453 | /* AIF1 Word Length = 16-bits, AIF1 Format = I2S (Default Register Value) */ |
ngtkien | 0:fc80425b677a | 454 | counter += CODEC_IO_Write(DeviceAddr, 0x300, 0x4010); |
ngtkien | 0:fc80425b677a | 455 | } |
ngtkien | 0:fc80425b677a | 456 | |
ngtkien | 0:fc80425b677a | 457 | /* slave mode */ |
ngtkien | 0:fc80425b677a | 458 | counter += CODEC_IO_Write(DeviceAddr, 0x302, 0x0000); |
ngtkien | 0:fc80425b677a | 459 | |
ngtkien | 0:fc80425b677a | 460 | /* Enable the DSP processing clock for AIF1, Enable the core clock */ |
ngtkien | 0:fc80425b677a | 461 | counter += CODEC_IO_Write(DeviceAddr, 0x208, 0x000A); |
ngtkien | 0:fc80425b677a | 462 | |
ngtkien | 0:fc80425b677a | 463 | /* Enable AIF1 Clock, AIF1 Clock Source = MCLK1 pin */ |
ngtkien | 0:fc80425b677a | 464 | counter += CODEC_IO_Write(DeviceAddr, 0x200, 0x0001); |
ngtkien | 0:fc80425b677a | 465 | |
ngtkien | 0:fc80425b677a | 466 | if (output_device > 0) /* Audio output selected */ |
ngtkien | 0:fc80425b677a | 467 | { |
ngtkien | 0:fc80425b677a | 468 | /* Analog Output Configuration */ |
ngtkien | 0:fc80425b677a | 469 | |
ngtkien | 0:fc80425b677a | 470 | /* Enable SPKRVOL PGA, Enable SPKMIXR, Enable SPKLVOL PGA, Enable SPKMIXL */ |
ngtkien | 0:fc80425b677a | 471 | counter += CODEC_IO_Write(DeviceAddr, 0x03, 0x0300); |
ngtkien | 0:fc80425b677a | 472 | |
ngtkien | 0:fc80425b677a | 473 | /* Left Speaker Mixer Volume = 0dB */ |
ngtkien | 0:fc80425b677a | 474 | counter += CODEC_IO_Write(DeviceAddr, 0x22, 0x0000); |
ngtkien | 0:fc80425b677a | 475 | |
ngtkien | 0:fc80425b677a | 476 | /* Speaker output mode = Class D, Right Speaker Mixer Volume = 0dB ((0x23, 0x0100) = class AB)*/ |
ngtkien | 0:fc80425b677a | 477 | counter += CODEC_IO_Write(DeviceAddr, 0x23, 0x0000); |
ngtkien | 0:fc80425b677a | 478 | |
ngtkien | 0:fc80425b677a | 479 | /* Unmute DAC2 (Left) to Left Speaker Mixer (SPKMIXL) path, |
ngtkien | 0:fc80425b677a | 480 | Unmute DAC2 (Right) to Right Speaker Mixer (SPKMIXR) path */ |
ngtkien | 0:fc80425b677a | 481 | counter += CODEC_IO_Write(DeviceAddr, 0x36, 0x0300); |
ngtkien | 0:fc80425b677a | 482 | |
ngtkien | 0:fc80425b677a | 483 | /* Enable bias generator, Enable VMID, Enable SPKOUTL, Enable SPKOUTR */ |
ngtkien | 0:fc80425b677a | 484 | counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x3003); |
ngtkien | 0:fc80425b677a | 485 | |
ngtkien | 0:fc80425b677a | 486 | /* Headphone/Speaker Enable */ |
ngtkien | 0:fc80425b677a | 487 | |
ngtkien | 0:fc80425b677a | 488 | if (input_device == INPUT_DEVICE_DIGITAL_MIC1_MIC2) |
ngtkien | 0:fc80425b677a | 489 | { |
ngtkien | 0:fc80425b677a | 490 | /* Enable Class W, Class W Envelope Tracking = AIF1 Timeslots 0 and 1 */ |
ngtkien | 0:fc80425b677a | 491 | counter += CODEC_IO_Write(DeviceAddr, 0x51, 0x0205); |
ngtkien | 0:fc80425b677a | 492 | } |
ngtkien | 0:fc80425b677a | 493 | else |
ngtkien | 0:fc80425b677a | 494 | { |
ngtkien | 0:fc80425b677a | 495 | /* Enable Class W, Class W Envelope Tracking = AIF1 Timeslot 0 */ |
ngtkien | 0:fc80425b677a | 496 | counter += CODEC_IO_Write(DeviceAddr, 0x51, 0x0005); |
ngtkien | 0:fc80425b677a | 497 | } |
ngtkien | 0:fc80425b677a | 498 | |
ngtkien | 0:fc80425b677a | 499 | /* Enable bias generator, Enable VMID, Enable HPOUT1 (Left) and Enable HPOUT1 (Right) input stages */ |
ngtkien | 0:fc80425b677a | 500 | /* idem for Speaker */ |
ngtkien | 0:fc80425b677a | 501 | power_mgnt_reg_1 |= 0x0303 | 0x3003; |
ngtkien | 0:fc80425b677a | 502 | counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1); |
ngtkien | 0:fc80425b677a | 503 | |
ngtkien | 0:fc80425b677a | 504 | /* Enable HPOUT1 (Left) and HPOUT1 (Right) intermediate stages */ |
ngtkien | 0:fc80425b677a | 505 | counter += CODEC_IO_Write(DeviceAddr, 0x60, 0x0022); |
ngtkien | 0:fc80425b677a | 506 | |
ngtkien | 0:fc80425b677a | 507 | /* Enable Charge Pump */ |
ngtkien | 0:fc80425b677a | 508 | counter += CODEC_IO_Write(DeviceAddr, 0x4C, 0x9F25); |
ngtkien | 0:fc80425b677a | 509 | |
ngtkien | 0:fc80425b677a | 510 | /* Add Delay */ |
ngtkien | 0:fc80425b677a | 511 | AUDIO_IO_Delay(15); |
ngtkien | 0:fc80425b677a | 512 | |
ngtkien | 0:fc80425b677a | 513 | /* Select DAC1 (Left) to Left Headphone Output PGA (HPOUT1LVOL) path */ |
ngtkien | 0:fc80425b677a | 514 | counter += CODEC_IO_Write(DeviceAddr, 0x2D, 0x0001); |
ngtkien | 0:fc80425b677a | 515 | |
ngtkien | 0:fc80425b677a | 516 | /* Select DAC1 (Right) to Right Headphone Output PGA (HPOUT1RVOL) path */ |
ngtkien | 0:fc80425b677a | 517 | counter += CODEC_IO_Write(DeviceAddr, 0x2E, 0x0001); |
ngtkien | 0:fc80425b677a | 518 | |
ngtkien | 0:fc80425b677a | 519 | /* Enable Left Output Mixer (MIXOUTL), Enable Right Output Mixer (MIXOUTR) */ |
ngtkien | 0:fc80425b677a | 520 | /* idem for SPKOUTL and SPKOUTR */ |
ngtkien | 0:fc80425b677a | 521 | counter += CODEC_IO_Write(DeviceAddr, 0x03, 0x0030 | 0x0300); |
ngtkien | 0:fc80425b677a | 522 | |
ngtkien | 0:fc80425b677a | 523 | /* Enable DC Servo and trigger start-up mode on left and right channels */ |
ngtkien | 0:fc80425b677a | 524 | counter += CODEC_IO_Write(DeviceAddr, 0x54, 0x0033); |
ngtkien | 0:fc80425b677a | 525 | |
ngtkien | 0:fc80425b677a | 526 | /* Add Delay */ |
ngtkien | 0:fc80425b677a | 527 | AUDIO_IO_Delay(250); |
ngtkien | 0:fc80425b677a | 528 | |
ngtkien | 0:fc80425b677a | 529 | /* Enable HPOUT1 (Left) and HPOUT1 (Right) intermediate and output stages. Remove clamps */ |
ngtkien | 0:fc80425b677a | 530 | counter += CODEC_IO_Write(DeviceAddr, 0x60, 0x00EE); |
ngtkien | 0:fc80425b677a | 531 | |
ngtkien | 0:fc80425b677a | 532 | /* Unmutes */ |
ngtkien | 0:fc80425b677a | 533 | |
ngtkien | 0:fc80425b677a | 534 | /* Unmute DAC 1 (Left) */ |
ngtkien | 0:fc80425b677a | 535 | counter += CODEC_IO_Write(DeviceAddr, 0x610, 0x00C0); |
ngtkien | 0:fc80425b677a | 536 | |
ngtkien | 0:fc80425b677a | 537 | /* Unmute DAC 1 (Right) */ |
ngtkien | 0:fc80425b677a | 538 | counter += CODEC_IO_Write(DeviceAddr, 0x611, 0x00C0); |
ngtkien | 0:fc80425b677a | 539 | |
ngtkien | 0:fc80425b677a | 540 | /* Unmute the AIF1 Timeslot 0 DAC path */ |
ngtkien | 0:fc80425b677a | 541 | counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0000); |
ngtkien | 0:fc80425b677a | 542 | |
ngtkien | 0:fc80425b677a | 543 | /* Unmute DAC 2 (Left) */ |
ngtkien | 0:fc80425b677a | 544 | counter += CODEC_IO_Write(DeviceAddr, 0x612, 0x00C0); |
ngtkien | 0:fc80425b677a | 545 | |
ngtkien | 0:fc80425b677a | 546 | /* Unmute DAC 2 (Right) */ |
ngtkien | 0:fc80425b677a | 547 | counter += CODEC_IO_Write(DeviceAddr, 0x613, 0x00C0); |
ngtkien | 0:fc80425b677a | 548 | |
ngtkien | 0:fc80425b677a | 549 | /* Unmute the AIF1 Timeslot 1 DAC2 path */ |
ngtkien | 0:fc80425b677a | 550 | counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0000); |
ngtkien | 0:fc80425b677a | 551 | |
ngtkien | 0:fc80425b677a | 552 | /* Volume Control */ |
ngtkien | 0:fc80425b677a | 553 | wm8994_SetVolume(DeviceAddr, Volume); |
ngtkien | 0:fc80425b677a | 554 | } |
ngtkien | 0:fc80425b677a | 555 | |
ngtkien | 0:fc80425b677a | 556 | if (input_device > 0) /* Audio input selected */ |
ngtkien | 0:fc80425b677a | 557 | { |
ngtkien | 0:fc80425b677a | 558 | if ((input_device == INPUT_DEVICE_DIGITAL_MICROPHONE_1) || (input_device == INPUT_DEVICE_DIGITAL_MICROPHONE_2)) |
ngtkien | 0:fc80425b677a | 559 | { |
ngtkien | 0:fc80425b677a | 560 | /* Enable Microphone bias 1 generator, Enable VMID */ |
ngtkien | 0:fc80425b677a | 561 | power_mgnt_reg_1 |= 0x0013; |
ngtkien | 0:fc80425b677a | 562 | counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1); |
ngtkien | 0:fc80425b677a | 563 | |
ngtkien | 0:fc80425b677a | 564 | /* ADC oversample enable */ |
ngtkien | 0:fc80425b677a | 565 | counter += CODEC_IO_Write(DeviceAddr, 0x620, 0x0002); |
ngtkien | 0:fc80425b677a | 566 | |
ngtkien | 0:fc80425b677a | 567 | /* AIF ADC2 HPF enable, HPF cut = voice mode 1 fc=127Hz at fs=8kHz */ |
ngtkien | 0:fc80425b677a | 568 | counter += CODEC_IO_Write(DeviceAddr, 0x411, 0x3800); |
ngtkien | 0:fc80425b677a | 569 | } |
ngtkien | 0:fc80425b677a | 570 | else if(input_device == INPUT_DEVICE_DIGITAL_MIC1_MIC2) |
ngtkien | 0:fc80425b677a | 571 | { |
ngtkien | 0:fc80425b677a | 572 | /* Enable Microphone bias 1 generator, Enable VMID */ |
ngtkien | 0:fc80425b677a | 573 | power_mgnt_reg_1 |= 0x0013; |
ngtkien | 0:fc80425b677a | 574 | counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1); |
ngtkien | 0:fc80425b677a | 575 | |
ngtkien | 0:fc80425b677a | 576 | /* ADC oversample enable */ |
ngtkien | 0:fc80425b677a | 577 | counter += CODEC_IO_Write(DeviceAddr, 0x620, 0x0002); |
ngtkien | 0:fc80425b677a | 578 | |
ngtkien | 0:fc80425b677a | 579 | /* AIF ADC1 HPF enable, HPF cut = voice mode 1 fc=127Hz at fs=8kHz */ |
ngtkien | 0:fc80425b677a | 580 | counter += CODEC_IO_Write(DeviceAddr, 0x410, 0x1800); |
ngtkien | 0:fc80425b677a | 581 | |
ngtkien | 0:fc80425b677a | 582 | /* AIF ADC2 HPF enable, HPF cut = voice mode 1 fc=127Hz at fs=8kHz */ |
ngtkien | 0:fc80425b677a | 583 | counter += CODEC_IO_Write(DeviceAddr, 0x411, 0x1800); |
ngtkien | 0:fc80425b677a | 584 | } |
ngtkien | 0:fc80425b677a | 585 | else if ((input_device == INPUT_DEVICE_INPUT_LINE_1) || (input_device == INPUT_DEVICE_INPUT_LINE_2)) |
ngtkien | 0:fc80425b677a | 586 | { |
ngtkien | 0:fc80425b677a | 587 | |
ngtkien | 0:fc80425b677a | 588 | /* Disable mute on IN1L, IN1L Volume = +0dB */ |
ngtkien | 0:fc80425b677a | 589 | counter += CODEC_IO_Write(DeviceAddr, 0x18, 0x000B); |
ngtkien | 0:fc80425b677a | 590 | |
ngtkien | 0:fc80425b677a | 591 | /* Disable mute on IN1R, IN1R Volume = +0dB */ |
ngtkien | 0:fc80425b677a | 592 | counter += CODEC_IO_Write(DeviceAddr, 0x1A, 0x000B); |
ngtkien | 0:fc80425b677a | 593 | |
ngtkien | 0:fc80425b677a | 594 | /* AIF ADC1 HPF enable, HPF cut = hifi mode fc=4Hz at fs=48kHz */ |
ngtkien | 0:fc80425b677a | 595 | counter += CODEC_IO_Write(DeviceAddr, 0x410, 0x1800); |
ngtkien | 0:fc80425b677a | 596 | } |
ngtkien | 0:fc80425b677a | 597 | /* Volume Control */ |
ngtkien | 0:fc80425b677a | 598 | wm8994_SetVolume(DeviceAddr, Volume); |
ngtkien | 0:fc80425b677a | 599 | } |
ngtkien | 0:fc80425b677a | 600 | /* Return communication control value */ |
ngtkien | 0:fc80425b677a | 601 | return counter; |
ngtkien | 0:fc80425b677a | 602 | } |
ngtkien | 0:fc80425b677a | 603 | |
ngtkien | 0:fc80425b677a | 604 | /** |
ngtkien | 0:fc80425b677a | 605 | * @brief Deinitializes the audio codec. |
ngtkien | 0:fc80425b677a | 606 | * @param None |
ngtkien | 0:fc80425b677a | 607 | * @retval None |
ngtkien | 0:fc80425b677a | 608 | */ |
ngtkien | 0:fc80425b677a | 609 | void wm8994_DeInit(void) |
ngtkien | 0:fc80425b677a | 610 | { |
ngtkien | 0:fc80425b677a | 611 | /* Deinitialize Audio Codec interface */ |
ngtkien | 0:fc80425b677a | 612 | AUDIO_IO_DeInit(); |
ngtkien | 0:fc80425b677a | 613 | } |
ngtkien | 0:fc80425b677a | 614 | |
ngtkien | 0:fc80425b677a | 615 | /** |
ngtkien | 0:fc80425b677a | 616 | * @brief Get the WM8994 ID. |
ngtkien | 0:fc80425b677a | 617 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 618 | * @retval The WM8994 ID |
ngtkien | 0:fc80425b677a | 619 | */ |
ngtkien | 0:fc80425b677a | 620 | uint32_t wm8994_ReadID(uint16_t DeviceAddr) |
ngtkien | 0:fc80425b677a | 621 | { |
ngtkien | 0:fc80425b677a | 622 | /* Initialize the Control interface of the Audio Codec */ |
ngtkien | 0:fc80425b677a | 623 | AUDIO_IO_Init(); |
ngtkien | 0:fc80425b677a | 624 | |
ngtkien | 0:fc80425b677a | 625 | return ((uint32_t)AUDIO_IO_Read(DeviceAddr, WM8994_CHIPID_ADDR)); |
ngtkien | 0:fc80425b677a | 626 | } |
ngtkien | 0:fc80425b677a | 627 | |
ngtkien | 0:fc80425b677a | 628 | /** |
ngtkien | 0:fc80425b677a | 629 | * @brief Start the audio Codec play feature. |
ngtkien | 0:fc80425b677a | 630 | * @note For this codec no Play options are required. |
ngtkien | 0:fc80425b677a | 631 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 632 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 633 | */ |
ngtkien | 0:fc80425b677a | 634 | uint32_t wm8994_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size) |
ngtkien | 0:fc80425b677a | 635 | { |
ngtkien | 0:fc80425b677a | 636 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 637 | |
ngtkien | 0:fc80425b677a | 638 | /* Resumes the audio file playing */ |
ngtkien | 0:fc80425b677a | 639 | /* Unmute the output first */ |
ngtkien | 0:fc80425b677a | 640 | counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF); |
ngtkien | 0:fc80425b677a | 641 | |
ngtkien | 0:fc80425b677a | 642 | return counter; |
ngtkien | 0:fc80425b677a | 643 | } |
ngtkien | 0:fc80425b677a | 644 | |
ngtkien | 0:fc80425b677a | 645 | /** |
ngtkien | 0:fc80425b677a | 646 | * @brief Pauses playing on the audio codec. |
ngtkien | 0:fc80425b677a | 647 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 648 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 649 | */ |
ngtkien | 0:fc80425b677a | 650 | uint32_t wm8994_Pause(uint16_t DeviceAddr) |
ngtkien | 0:fc80425b677a | 651 | { |
ngtkien | 0:fc80425b677a | 652 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 653 | |
ngtkien | 0:fc80425b677a | 654 | /* Pause the audio file playing */ |
ngtkien | 0:fc80425b677a | 655 | /* Mute the output first */ |
ngtkien | 0:fc80425b677a | 656 | counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON); |
ngtkien | 0:fc80425b677a | 657 | |
ngtkien | 0:fc80425b677a | 658 | /* Put the Codec in Power save mode */ |
ngtkien | 0:fc80425b677a | 659 | counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x01); |
ngtkien | 0:fc80425b677a | 660 | |
ngtkien | 0:fc80425b677a | 661 | return counter; |
ngtkien | 0:fc80425b677a | 662 | } |
ngtkien | 0:fc80425b677a | 663 | |
ngtkien | 0:fc80425b677a | 664 | /** |
ngtkien | 0:fc80425b677a | 665 | * @brief Resumes playing on the audio codec. |
ngtkien | 0:fc80425b677a | 666 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 667 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 668 | */ |
ngtkien | 0:fc80425b677a | 669 | uint32_t wm8994_Resume(uint16_t DeviceAddr) |
ngtkien | 0:fc80425b677a | 670 | { |
ngtkien | 0:fc80425b677a | 671 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 672 | |
ngtkien | 0:fc80425b677a | 673 | /* Resumes the audio file playing */ |
ngtkien | 0:fc80425b677a | 674 | /* Unmute the output first */ |
ngtkien | 0:fc80425b677a | 675 | counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF); |
ngtkien | 0:fc80425b677a | 676 | |
ngtkien | 0:fc80425b677a | 677 | return counter; |
ngtkien | 0:fc80425b677a | 678 | } |
ngtkien | 0:fc80425b677a | 679 | |
ngtkien | 0:fc80425b677a | 680 | /** |
ngtkien | 0:fc80425b677a | 681 | * @brief Stops audio Codec playing. It powers down the codec. |
ngtkien | 0:fc80425b677a | 682 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 683 | * @param CodecPdwnMode: selects the power down mode. |
ngtkien | 0:fc80425b677a | 684 | * - CODEC_PDWN_SW: only mutes the audio codec. When resuming from this |
ngtkien | 0:fc80425b677a | 685 | * mode the codec keeps the previous initialization |
ngtkien | 0:fc80425b677a | 686 | * (no need to re-Initialize the codec registers). |
ngtkien | 0:fc80425b677a | 687 | * - CODEC_PDWN_HW: Physically power down the codec. When resuming from this |
ngtkien | 0:fc80425b677a | 688 | * mode, the codec is set to default configuration |
ngtkien | 0:fc80425b677a | 689 | * (user should re-Initialize the codec in order to |
ngtkien | 0:fc80425b677a | 690 | * play again the audio stream). |
ngtkien | 0:fc80425b677a | 691 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 692 | */ |
ngtkien | 0:fc80425b677a | 693 | uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode) |
ngtkien | 0:fc80425b677a | 694 | { |
ngtkien | 0:fc80425b677a | 695 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 696 | |
ngtkien | 0:fc80425b677a | 697 | if (outputEnabled != 0) |
ngtkien | 0:fc80425b677a | 698 | { |
ngtkien | 0:fc80425b677a | 699 | /* Mute the output first */ |
ngtkien | 0:fc80425b677a | 700 | counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON); |
ngtkien | 0:fc80425b677a | 701 | |
ngtkien | 0:fc80425b677a | 702 | if (CodecPdwnMode == CODEC_PDWN_SW) |
ngtkien | 0:fc80425b677a | 703 | { |
ngtkien | 0:fc80425b677a | 704 | /* Only output mute required*/ |
ngtkien | 0:fc80425b677a | 705 | } |
ngtkien | 0:fc80425b677a | 706 | else /* CODEC_PDWN_HW */ |
ngtkien | 0:fc80425b677a | 707 | { |
ngtkien | 0:fc80425b677a | 708 | /* Mute the AIF1 Timeslot 0 DAC1 path */ |
ngtkien | 0:fc80425b677a | 709 | counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0200); |
ngtkien | 0:fc80425b677a | 710 | |
ngtkien | 0:fc80425b677a | 711 | /* Mute the AIF1 Timeslot 1 DAC2 path */ |
ngtkien | 0:fc80425b677a | 712 | counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0200); |
ngtkien | 0:fc80425b677a | 713 | |
ngtkien | 0:fc80425b677a | 714 | /* Disable DAC1L_TO_HPOUT1L */ |
ngtkien | 0:fc80425b677a | 715 | counter += CODEC_IO_Write(DeviceAddr, 0x2D, 0x0000); |
ngtkien | 0:fc80425b677a | 716 | |
ngtkien | 0:fc80425b677a | 717 | /* Disable DAC1R_TO_HPOUT1R */ |
ngtkien | 0:fc80425b677a | 718 | counter += CODEC_IO_Write(DeviceAddr, 0x2E, 0x0000); |
ngtkien | 0:fc80425b677a | 719 | |
ngtkien | 0:fc80425b677a | 720 | /* Disable DAC1 and DAC2 */ |
ngtkien | 0:fc80425b677a | 721 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0000); |
ngtkien | 0:fc80425b677a | 722 | |
ngtkien | 0:fc80425b677a | 723 | /* Reset Codec by writing in 0x0000 address register */ |
ngtkien | 0:fc80425b677a | 724 | counter += CODEC_IO_Write(DeviceAddr, 0x0000, 0x0000); |
ngtkien | 0:fc80425b677a | 725 | |
ngtkien | 0:fc80425b677a | 726 | outputEnabled = 0; |
ngtkien | 0:fc80425b677a | 727 | } |
ngtkien | 0:fc80425b677a | 728 | } |
ngtkien | 0:fc80425b677a | 729 | return counter; |
ngtkien | 0:fc80425b677a | 730 | } |
ngtkien | 0:fc80425b677a | 731 | |
ngtkien | 0:fc80425b677a | 732 | /** |
ngtkien | 0:fc80425b677a | 733 | * @brief Sets higher or lower the codec volume level. |
ngtkien | 0:fc80425b677a | 734 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 735 | * @param Volume: a byte value from 0 to 255 (refer to codec registers |
ngtkien | 0:fc80425b677a | 736 | * description for more details). |
ngtkien | 0:fc80425b677a | 737 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 738 | */ |
ngtkien | 0:fc80425b677a | 739 | uint32_t wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume) |
ngtkien | 0:fc80425b677a | 740 | { |
ngtkien | 0:fc80425b677a | 741 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 742 | uint8_t convertedvol = VOLUME_CONVERT(Volume); |
ngtkien | 0:fc80425b677a | 743 | |
ngtkien | 0:fc80425b677a | 744 | /* Output volume */ |
ngtkien | 0:fc80425b677a | 745 | if (outputEnabled != 0) |
ngtkien | 0:fc80425b677a | 746 | { |
ngtkien | 0:fc80425b677a | 747 | if(convertedvol > 0x3E) |
ngtkien | 0:fc80425b677a | 748 | { |
ngtkien | 0:fc80425b677a | 749 | /* Unmute audio codec */ |
ngtkien | 0:fc80425b677a | 750 | counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF); |
ngtkien | 0:fc80425b677a | 751 | |
ngtkien | 0:fc80425b677a | 752 | /* Left Headphone Volume */ |
ngtkien | 0:fc80425b677a | 753 | counter += CODEC_IO_Write(DeviceAddr, 0x1C, 0x3F | 0x140); |
ngtkien | 0:fc80425b677a | 754 | |
ngtkien | 0:fc80425b677a | 755 | /* Right Headphone Volume */ |
ngtkien | 0:fc80425b677a | 756 | counter += CODEC_IO_Write(DeviceAddr, 0x1D, 0x3F | 0x140); |
ngtkien | 0:fc80425b677a | 757 | |
ngtkien | 0:fc80425b677a | 758 | /* Left Speaker Volume */ |
ngtkien | 0:fc80425b677a | 759 | counter += CODEC_IO_Write(DeviceAddr, 0x26, 0x3F | 0x140); |
ngtkien | 0:fc80425b677a | 760 | |
ngtkien | 0:fc80425b677a | 761 | /* Right Speaker Volume */ |
ngtkien | 0:fc80425b677a | 762 | counter += CODEC_IO_Write(DeviceAddr, 0x27, 0x3F | 0x140); |
ngtkien | 0:fc80425b677a | 763 | } |
ngtkien | 0:fc80425b677a | 764 | else if (Volume == 0) |
ngtkien | 0:fc80425b677a | 765 | { |
ngtkien | 0:fc80425b677a | 766 | /* Mute audio codec */ |
ngtkien | 0:fc80425b677a | 767 | counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON); |
ngtkien | 0:fc80425b677a | 768 | } |
ngtkien | 0:fc80425b677a | 769 | else |
ngtkien | 0:fc80425b677a | 770 | { |
ngtkien | 0:fc80425b677a | 771 | /* Unmute audio codec */ |
ngtkien | 0:fc80425b677a | 772 | counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF); |
ngtkien | 0:fc80425b677a | 773 | |
ngtkien | 0:fc80425b677a | 774 | /* Left Headphone Volume */ |
ngtkien | 0:fc80425b677a | 775 | counter += CODEC_IO_Write(DeviceAddr, 0x1C, convertedvol | 0x140); |
ngtkien | 0:fc80425b677a | 776 | |
ngtkien | 0:fc80425b677a | 777 | /* Right Headphone Volume */ |
ngtkien | 0:fc80425b677a | 778 | counter += CODEC_IO_Write(DeviceAddr, 0x1D, convertedvol | 0x140); |
ngtkien | 0:fc80425b677a | 779 | |
ngtkien | 0:fc80425b677a | 780 | /* Left Speaker Volume */ |
ngtkien | 0:fc80425b677a | 781 | counter += CODEC_IO_Write(DeviceAddr, 0x26, convertedvol | 0x140); |
ngtkien | 0:fc80425b677a | 782 | |
ngtkien | 0:fc80425b677a | 783 | /* Right Speaker Volume */ |
ngtkien | 0:fc80425b677a | 784 | counter += CODEC_IO_Write(DeviceAddr, 0x27, convertedvol | 0x140); |
ngtkien | 0:fc80425b677a | 785 | } |
ngtkien | 0:fc80425b677a | 786 | } |
ngtkien | 0:fc80425b677a | 787 | |
ngtkien | 0:fc80425b677a | 788 | /* Input volume */ |
ngtkien | 0:fc80425b677a | 789 | if (inputEnabled != 0) |
ngtkien | 0:fc80425b677a | 790 | { |
ngtkien | 0:fc80425b677a | 791 | convertedvol = VOLUME_IN_CONVERT(Volume); |
ngtkien | 0:fc80425b677a | 792 | |
ngtkien | 0:fc80425b677a | 793 | /* Left AIF1 ADC1 volume */ |
ngtkien | 0:fc80425b677a | 794 | counter += CODEC_IO_Write(DeviceAddr, 0x400, convertedvol | 0x100); |
ngtkien | 0:fc80425b677a | 795 | |
ngtkien | 0:fc80425b677a | 796 | /* Right AIF1 ADC1 volume */ |
ngtkien | 0:fc80425b677a | 797 | counter += CODEC_IO_Write(DeviceAddr, 0x401, convertedvol | 0x100); |
ngtkien | 0:fc80425b677a | 798 | |
ngtkien | 0:fc80425b677a | 799 | /* Left AIF1 ADC2 volume */ |
ngtkien | 0:fc80425b677a | 800 | counter += CODEC_IO_Write(DeviceAddr, 0x404, convertedvol | 0x100); |
ngtkien | 0:fc80425b677a | 801 | |
ngtkien | 0:fc80425b677a | 802 | /* Right AIF1 ADC2 volume */ |
ngtkien | 0:fc80425b677a | 803 | counter += CODEC_IO_Write(DeviceAddr, 0x405, convertedvol | 0x100); |
ngtkien | 0:fc80425b677a | 804 | } |
ngtkien | 0:fc80425b677a | 805 | return counter; |
ngtkien | 0:fc80425b677a | 806 | } |
ngtkien | 0:fc80425b677a | 807 | |
ngtkien | 0:fc80425b677a | 808 | /** |
ngtkien | 0:fc80425b677a | 809 | * @brief Enables or disables the mute feature on the audio codec. |
ngtkien | 0:fc80425b677a | 810 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 811 | * @param Cmd: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the |
ngtkien | 0:fc80425b677a | 812 | * mute mode. |
ngtkien | 0:fc80425b677a | 813 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 814 | */ |
ngtkien | 0:fc80425b677a | 815 | uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd) |
ngtkien | 0:fc80425b677a | 816 | { |
ngtkien | 0:fc80425b677a | 817 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 818 | |
ngtkien | 0:fc80425b677a | 819 | if (outputEnabled != 0) |
ngtkien | 0:fc80425b677a | 820 | { |
ngtkien | 0:fc80425b677a | 821 | /* Set the Mute mode */ |
ngtkien | 0:fc80425b677a | 822 | if(Cmd == AUDIO_MUTE_ON) |
ngtkien | 0:fc80425b677a | 823 | { |
ngtkien | 0:fc80425b677a | 824 | /* Soft Mute the AIF1 Timeslot 0 DAC1 path L&R */ |
ngtkien | 0:fc80425b677a | 825 | counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0200); |
ngtkien | 0:fc80425b677a | 826 | |
ngtkien | 0:fc80425b677a | 827 | /* Soft Mute the AIF1 Timeslot 1 DAC2 path L&R */ |
ngtkien | 0:fc80425b677a | 828 | counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0200); |
ngtkien | 0:fc80425b677a | 829 | } |
ngtkien | 0:fc80425b677a | 830 | else /* AUDIO_MUTE_OFF Disable the Mute */ |
ngtkien | 0:fc80425b677a | 831 | { |
ngtkien | 0:fc80425b677a | 832 | /* Unmute the AIF1 Timeslot 0 DAC1 path L&R */ |
ngtkien | 0:fc80425b677a | 833 | counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0000); |
ngtkien | 0:fc80425b677a | 834 | |
ngtkien | 0:fc80425b677a | 835 | /* Unmute the AIF1 Timeslot 1 DAC2 path L&R */ |
ngtkien | 0:fc80425b677a | 836 | counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0000); |
ngtkien | 0:fc80425b677a | 837 | } |
ngtkien | 0:fc80425b677a | 838 | } |
ngtkien | 0:fc80425b677a | 839 | return counter; |
ngtkien | 0:fc80425b677a | 840 | } |
ngtkien | 0:fc80425b677a | 841 | |
ngtkien | 0:fc80425b677a | 842 | /** |
ngtkien | 0:fc80425b677a | 843 | * @brief Switch dynamically (while audio file is played) the output target |
ngtkien | 0:fc80425b677a | 844 | * (speaker or headphone). |
ngtkien | 0:fc80425b677a | 845 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 846 | * @param Output: specifies the audio output target: OUTPUT_DEVICE_SPEAKER, |
ngtkien | 0:fc80425b677a | 847 | * OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO |
ngtkien | 0:fc80425b677a | 848 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 849 | */ |
ngtkien | 0:fc80425b677a | 850 | uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output) |
ngtkien | 0:fc80425b677a | 851 | { |
ngtkien | 0:fc80425b677a | 852 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 853 | |
ngtkien | 0:fc80425b677a | 854 | switch (Output) |
ngtkien | 0:fc80425b677a | 855 | { |
ngtkien | 0:fc80425b677a | 856 | case OUTPUT_DEVICE_SPEAKER: |
ngtkien | 0:fc80425b677a | 857 | /* Enable DAC1 (Left), Enable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 858 | Disable DAC2 (Left), Disable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 859 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0C0C); |
ngtkien | 0:fc80425b677a | 860 | |
ngtkien | 0:fc80425b677a | 861 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 862 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0000); |
ngtkien | 0:fc80425b677a | 863 | |
ngtkien | 0:fc80425b677a | 864 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 865 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0000); |
ngtkien | 0:fc80425b677a | 866 | |
ngtkien | 0:fc80425b677a | 867 | /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 868 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002); |
ngtkien | 0:fc80425b677a | 869 | |
ngtkien | 0:fc80425b677a | 870 | /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 871 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002); |
ngtkien | 0:fc80425b677a | 872 | break; |
ngtkien | 0:fc80425b677a | 873 | |
ngtkien | 0:fc80425b677a | 874 | case OUTPUT_DEVICE_HEADPHONE: |
ngtkien | 0:fc80425b677a | 875 | /* Disable DAC1 (Left), Disable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 876 | Enable DAC2 (Left), Enable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 877 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303); |
ngtkien | 0:fc80425b677a | 878 | |
ngtkien | 0:fc80425b677a | 879 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 880 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001); |
ngtkien | 0:fc80425b677a | 881 | |
ngtkien | 0:fc80425b677a | 882 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 883 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001); |
ngtkien | 0:fc80425b677a | 884 | |
ngtkien | 0:fc80425b677a | 885 | /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 886 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000); |
ngtkien | 0:fc80425b677a | 887 | |
ngtkien | 0:fc80425b677a | 888 | /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 889 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000); |
ngtkien | 0:fc80425b677a | 890 | break; |
ngtkien | 0:fc80425b677a | 891 | |
ngtkien | 0:fc80425b677a | 892 | case OUTPUT_DEVICE_BOTH: |
ngtkien | 0:fc80425b677a | 893 | /* Enable DAC1 (Left), Enable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 894 | also Enable DAC2 (Left), Enable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 895 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303 | 0x0C0C); |
ngtkien | 0:fc80425b677a | 896 | |
ngtkien | 0:fc80425b677a | 897 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 898 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001); |
ngtkien | 0:fc80425b677a | 899 | |
ngtkien | 0:fc80425b677a | 900 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 901 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001); |
ngtkien | 0:fc80425b677a | 902 | |
ngtkien | 0:fc80425b677a | 903 | /* Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 904 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002); |
ngtkien | 0:fc80425b677a | 905 | |
ngtkien | 0:fc80425b677a | 906 | /* Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 907 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002); |
ngtkien | 0:fc80425b677a | 908 | break; |
ngtkien | 0:fc80425b677a | 909 | |
ngtkien | 0:fc80425b677a | 910 | default: |
ngtkien | 0:fc80425b677a | 911 | /* Disable DAC1 (Left), Disable DAC1 (Right), |
ngtkien | 0:fc80425b677a | 912 | Enable DAC2 (Left), Enable DAC2 (Right)*/ |
ngtkien | 0:fc80425b677a | 913 | counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303); |
ngtkien | 0:fc80425b677a | 914 | |
ngtkien | 0:fc80425b677a | 915 | /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 916 | counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001); |
ngtkien | 0:fc80425b677a | 917 | |
ngtkien | 0:fc80425b677a | 918 | /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 919 | counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001); |
ngtkien | 0:fc80425b677a | 920 | |
ngtkien | 0:fc80425b677a | 921 | /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */ |
ngtkien | 0:fc80425b677a | 922 | counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000); |
ngtkien | 0:fc80425b677a | 923 | |
ngtkien | 0:fc80425b677a | 924 | /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */ |
ngtkien | 0:fc80425b677a | 925 | counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000); |
ngtkien | 0:fc80425b677a | 926 | break; |
ngtkien | 0:fc80425b677a | 927 | } |
ngtkien | 0:fc80425b677a | 928 | return counter; |
ngtkien | 0:fc80425b677a | 929 | } |
ngtkien | 0:fc80425b677a | 930 | |
ngtkien | 0:fc80425b677a | 931 | /** |
ngtkien | 0:fc80425b677a | 932 | * @brief Sets new frequency. |
ngtkien | 0:fc80425b677a | 933 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 934 | * @param AudioFreq: Audio frequency used to play the audio stream. |
ngtkien | 0:fc80425b677a | 935 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 936 | */ |
ngtkien | 0:fc80425b677a | 937 | uint32_t wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq) |
ngtkien | 0:fc80425b677a | 938 | { |
ngtkien | 0:fc80425b677a | 939 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 940 | |
ngtkien | 0:fc80425b677a | 941 | /* Clock Configurations */ |
ngtkien | 0:fc80425b677a | 942 | switch (AudioFreq) |
ngtkien | 0:fc80425b677a | 943 | { |
ngtkien | 0:fc80425b677a | 944 | case AUDIO_FREQUENCY_8K: |
ngtkien | 0:fc80425b677a | 945 | /* AIF1 Sample Rate = 8 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 946 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0003); |
ngtkien | 0:fc80425b677a | 947 | break; |
ngtkien | 0:fc80425b677a | 948 | |
ngtkien | 0:fc80425b677a | 949 | case AUDIO_FREQUENCY_16K: |
ngtkien | 0:fc80425b677a | 950 | /* AIF1 Sample Rate = 16 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 951 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0033); |
ngtkien | 0:fc80425b677a | 952 | break; |
ngtkien | 0:fc80425b677a | 953 | |
ngtkien | 0:fc80425b677a | 954 | case AUDIO_FREQUENCY_48K: |
ngtkien | 0:fc80425b677a | 955 | /* AIF1 Sample Rate = 48 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 956 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083); |
ngtkien | 0:fc80425b677a | 957 | break; |
ngtkien | 0:fc80425b677a | 958 | |
ngtkien | 0:fc80425b677a | 959 | case AUDIO_FREQUENCY_96K: |
ngtkien | 0:fc80425b677a | 960 | /* AIF1 Sample Rate = 96 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 961 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x00A3); |
ngtkien | 0:fc80425b677a | 962 | break; |
ngtkien | 0:fc80425b677a | 963 | |
ngtkien | 0:fc80425b677a | 964 | case AUDIO_FREQUENCY_11K: |
ngtkien | 0:fc80425b677a | 965 | /* AIF1 Sample Rate = 11.025 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 966 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0013); |
ngtkien | 0:fc80425b677a | 967 | break; |
ngtkien | 0:fc80425b677a | 968 | |
ngtkien | 0:fc80425b677a | 969 | case AUDIO_FREQUENCY_22K: |
ngtkien | 0:fc80425b677a | 970 | /* AIF1 Sample Rate = 22.050 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 971 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0043); |
ngtkien | 0:fc80425b677a | 972 | break; |
ngtkien | 0:fc80425b677a | 973 | |
ngtkien | 0:fc80425b677a | 974 | case AUDIO_FREQUENCY_44K: |
ngtkien | 0:fc80425b677a | 975 | /* AIF1 Sample Rate = 44.1 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 976 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0073); |
ngtkien | 0:fc80425b677a | 977 | break; |
ngtkien | 0:fc80425b677a | 978 | |
ngtkien | 0:fc80425b677a | 979 | default: |
ngtkien | 0:fc80425b677a | 980 | /* AIF1 Sample Rate = 48 (KHz), ratio=256 */ |
ngtkien | 0:fc80425b677a | 981 | counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083); |
ngtkien | 0:fc80425b677a | 982 | break; |
ngtkien | 0:fc80425b677a | 983 | } |
ngtkien | 0:fc80425b677a | 984 | return counter; |
ngtkien | 0:fc80425b677a | 985 | } |
ngtkien | 0:fc80425b677a | 986 | |
ngtkien | 0:fc80425b677a | 987 | /** |
ngtkien | 0:fc80425b677a | 988 | * @brief Resets wm8994 registers. |
ngtkien | 0:fc80425b677a | 989 | * @param DeviceAddr: Device address on communication Bus. |
ngtkien | 0:fc80425b677a | 990 | * @retval 0 if correct communication, else wrong communication |
ngtkien | 0:fc80425b677a | 991 | */ |
ngtkien | 0:fc80425b677a | 992 | uint32_t wm8994_Reset(uint16_t DeviceAddr) |
ngtkien | 0:fc80425b677a | 993 | { |
ngtkien | 0:fc80425b677a | 994 | uint32_t counter = 0; |
ngtkien | 0:fc80425b677a | 995 | |
ngtkien | 0:fc80425b677a | 996 | /* Reset Codec by writing in 0x0000 address register */ |
ngtkien | 0:fc80425b677a | 997 | counter = CODEC_IO_Write(DeviceAddr, 0x0000, 0x0000); |
ngtkien | 0:fc80425b677a | 998 | outputEnabled = 0; |
ngtkien | 0:fc80425b677a | 999 | inputEnabled=0; |
ngtkien | 0:fc80425b677a | 1000 | |
ngtkien | 0:fc80425b677a | 1001 | return counter; |
ngtkien | 0:fc80425b677a | 1002 | } |
ngtkien | 0:fc80425b677a | 1003 | |
ngtkien | 0:fc80425b677a | 1004 | /** |
ngtkien | 0:fc80425b677a | 1005 | * @brief Writes/Read a single data. |
ngtkien | 0:fc80425b677a | 1006 | * @param Addr: I2C address |
ngtkien | 0:fc80425b677a | 1007 | * @param Reg: Reg address |
ngtkien | 0:fc80425b677a | 1008 | * @param Value: Data to be written |
ngtkien | 0:fc80425b677a | 1009 | * @retval None |
ngtkien | 0:fc80425b677a | 1010 | */ |
ngtkien | 0:fc80425b677a | 1011 | static uint8_t CODEC_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value) |
ngtkien | 0:fc80425b677a | 1012 | { |
ngtkien | 0:fc80425b677a | 1013 | uint32_t result = 0; |
ngtkien | 0:fc80425b677a | 1014 | |
ngtkien | 0:fc80425b677a | 1015 | AUDIO_IO_Write(Addr, Reg, Value); |
ngtkien | 0:fc80425b677a | 1016 | |
ngtkien | 0:fc80425b677a | 1017 | #ifdef VERIFY_WRITTENDATA |
ngtkien | 0:fc80425b677a | 1018 | /* Verify that the data has been correctly written */ |
ngtkien | 0:fc80425b677a | 1019 | result = (AUDIO_IO_Read(Addr, Reg) == Value)? 0:1; |
ngtkien | 0:fc80425b677a | 1020 | #endif /* VERIFY_WRITTENDATA */ |
ngtkien | 0:fc80425b677a | 1021 | |
ngtkien | 0:fc80425b677a | 1022 | return result; |
ngtkien | 0:fc80425b677a | 1023 | } |
ngtkien | 0:fc80425b677a | 1024 | |
ngtkien | 0:fc80425b677a | 1025 | /** |
ngtkien | 0:fc80425b677a | 1026 | * @} |
ngtkien | 0:fc80425b677a | 1027 | */ |
ngtkien | 0:fc80425b677a | 1028 | |
ngtkien | 0:fc80425b677a | 1029 | /** |
ngtkien | 0:fc80425b677a | 1030 | * @} |
ngtkien | 0:fc80425b677a | 1031 | */ |
ngtkien | 0:fc80425b677a | 1032 | |
ngtkien | 0:fc80425b677a | 1033 | /** |
ngtkien | 0:fc80425b677a | 1034 | * @} |
ngtkien | 0:fc80425b677a | 1035 | */ |
ngtkien | 0:fc80425b677a | 1036 | |
ngtkien | 0:fc80425b677a | 1037 | /** |
ngtkien | 0:fc80425b677a | 1038 | * @} |
ngtkien | 0:fc80425b677a | 1039 | */ |
ngtkien | 0:fc80425b677a | 1040 | |
ngtkien | 0:fc80425b677a | 1041 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |