stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c
Go to the documentation of this file.
1 
36 /* Includes ------------------------------------------------------------------*/
37 #include "wm8994.h"
38 
64 /* Uncomment this line to enable verifying data sent to codec after each write
65  operation (for debug purpose) */
66 #if !defined (VERIFY_WRITTENDATA)
67 /*#define VERIFY_WRITTENDATA*/
68 #endif /* VERIFY_WRITTENDATA */
69 
85 /* Audio codec driver structure initialization */
87 {
91 
95  wm8994_Stop,
96 
101 
103 };
104 
105 static uint32_t outputEnabled = 0;
106 static uint32_t inputEnabled = 0;
107 static uint8_t ColdStartup = 1;
108 
116 static uint8_t CODEC_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
137 uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq)
138 {
139  uint32_t counter = 0;
140  uint16_t output_device = OutputInputDevice & 0xFF;
141  uint16_t input_device = OutputInputDevice & 0xFF00;
142  uint16_t power_mgnt_reg_1 = 0;
143 
144  /* Initialize the Control interface of the Audio Codec */
145  AUDIO_IO_Init();
146  /* wm8994 Errata Work-Arounds */
147  counter += CODEC_IO_Write(DeviceAddr, 0x102, 0x0003);
148  counter += CODEC_IO_Write(DeviceAddr, 0x817, 0x0000);
149  counter += CODEC_IO_Write(DeviceAddr, 0x102, 0x0000);
150 
151  /* Enable VMID soft start (fast), Start-up Bias Current Enabled */
152  counter += CODEC_IO_Write(DeviceAddr, 0x39, 0x006C);
153 
154  /* Enable bias generator, Enable VMID */
155  if (input_device > 0)
156  {
157  counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x0013);
158  }
159  else
160  {
161  counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x0003);
162  }
163 
164  /* Add Delay */
165  AUDIO_IO_Delay(50);
166 
167  /* Path Configurations for output */
168  if (output_device > 0)
169  {
170  outputEnabled = 1;
171 
172  switch (output_device)
173  {
175  /* Enable DAC1 (Left), Enable DAC1 (Right),
176  Disable DAC2 (Left), Disable DAC2 (Right)*/
177  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0C0C);
178 
179  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
180  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0000);
181 
182  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
183  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0000);
184 
185  /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
186  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002);
187 
188  /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
189  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002);
190  break;
191 
193  /* Disable DAC1 (Left), Disable DAC1 (Right),
194  Enable DAC2 (Left), Enable DAC2 (Right)*/
195  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303);
196 
197  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
198  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
199 
200  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
201  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
202 
203  /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
204  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000);
205 
206  /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
207  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000);
208  break;
209 
210  case OUTPUT_DEVICE_BOTH:
211  if (input_device == INPUT_DEVICE_DIGITAL_MIC1_MIC2)
212  {
213  /* Enable DAC1 (Left), Enable DAC1 (Right),
214  also Enable DAC2 (Left), Enable DAC2 (Right)*/
215  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303 | 0x0C0C);
216 
217  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path
218  Enable the AIF1 Timeslot 1 (Left) to DAC 1 (Left) mixer path */
219  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0003);
220 
221  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path
222  Enable the AIF1 Timeslot 1 (Right) to DAC 1 (Right) mixer path */
223  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0003);
224 
225  /* Enable the AIF1 Timeslot 0 (Left) to DAC 2 (Left) mixer path
226  Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
227  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0003);
228 
229  /* Enable the AIF1 Timeslot 0 (Right) to DAC 2 (Right) mixer path
230  Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
231  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0003);
232  }
233  else
234  {
235  /* Enable DAC1 (Left), Enable DAC1 (Right),
236  also Enable DAC2 (Left), Enable DAC2 (Right)*/
237  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303 | 0x0C0C);
238 
239  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
240  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
241 
242  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
243  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
244 
245  /* Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
246  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002);
247 
248  /* Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
249  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002);
250  }
251  break;
252 
253  case OUTPUT_DEVICE_AUTO :
254  default:
255  /* Disable DAC1 (Left), Disable DAC1 (Right),
256  Enable DAC2 (Left), Enable DAC2 (Right)*/
257  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303);
258 
259  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
260  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
261 
262  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
263  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
264 
265  /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
266  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000);
267 
268  /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
269  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000);
270  break;
271  }
272  }
273  else
274  {
275  outputEnabled = 0;
276  }
277 
278  /* Path Configurations for input */
279  if (input_device > 0)
280  {
281  inputEnabled = 1;
282  switch (input_device)
283  {
285  /* Enable AIF1ADC2 (Left), Enable AIF1ADC2 (Right)
286  * Enable DMICDAT2 (Left), Enable DMICDAT2 (Right)
287  * Enable Left ADC, Enable Right ADC */
288  counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0C30);
289 
290  /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC2 Left/Right Timeslot 1 */
291  counter += CODEC_IO_Write(DeviceAddr, 0x450, 0x00DB);
292 
293  /* Disable IN1L, IN1R, IN2L, IN2R, Enable Thermal sensor & shutdown */
294  counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x6000);
295 
296  /* Enable the DMIC2(Left) to AIF1 Timeslot 1 (Left) mixer path */
297  counter += CODEC_IO_Write(DeviceAddr, 0x608, 0x0002);
298 
299  /* Enable the DMIC2(Right) to AIF1 Timeslot 1 (Right) mixer path */
300  counter += CODEC_IO_Write(DeviceAddr, 0x609, 0x0002);
301 
302  /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC2 signal detect */
303  counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000E);
304  break;
305 
307  /* IN1LN_TO_IN1L, IN1LP_TO_VMID, IN1RN_TO_IN1R, IN1RP_TO_VMID */
308  counter += CODEC_IO_Write(DeviceAddr, 0x28, 0x0011);
309 
310  /* Disable mute on IN1L_TO_MIXINL and +30dB on IN1L PGA output */
311  counter += CODEC_IO_Write(DeviceAddr, 0x29, 0x0035);
312 
313  /* Disable mute on IN1R_TO_MIXINL, Gain = +30dB */
314  counter += CODEC_IO_Write(DeviceAddr, 0x2A, 0x0035);
315 
316  /* Enable AIF1ADC1 (Left), Enable AIF1ADC1 (Right)
317  * Enable Left ADC, Enable Right ADC */
318  counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0303);
319 
320  /* Enable AIF1 DRC1 Signal Detect & DRC in AIF1ADC1 Left/Right Timeslot 0 */
321  counter += CODEC_IO_Write(DeviceAddr, 0x440, 0x00DB);
322 
323  /* Enable IN1L and IN1R, Disable IN2L and IN2R, Enable Thermal sensor & shutdown */
324  counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x6350);
325 
326  /* Enable the ADCL(Left) to AIF1 Timeslot 0 (Left) mixer path */
327  counter += CODEC_IO_Write(DeviceAddr, 0x606, 0x0002);
328 
329  /* Enable the ADCR(Right) to AIF1 Timeslot 0 (Right) mixer path */
330  counter += CODEC_IO_Write(DeviceAddr, 0x607, 0x0002);
331 
332  /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC1 signal detect */
333  counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000D);
334  break;
335 
337  /* Enable AIF1ADC1 (Left), Enable AIF1ADC1 (Right)
338  * Enable DMICDAT1 (Left), Enable DMICDAT1 (Right)
339  * Enable Left ADC, Enable Right ADC */
340  counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x030C);
341 
342  /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC1 Left/Right Timeslot 0 */
343  counter += CODEC_IO_Write(DeviceAddr, 0x440, 0x00DB);
344 
345  /* Disable IN1L, IN1R, IN2L, IN2R, Enable Thermal sensor & shutdown */
346  counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x6350);
347 
348  /* Enable the DMIC2(Left) to AIF1 Timeslot 0 (Left) mixer path */
349  counter += CODEC_IO_Write(DeviceAddr, 0x606, 0x0002);
350 
351  /* Enable the DMIC2(Right) to AIF1 Timeslot 0 (Right) mixer path */
352  counter += CODEC_IO_Write(DeviceAddr, 0x607, 0x0002);
353 
354  /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC1 signal detect */
355  counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000D);
356  break;
358  /* Enable AIF1ADC1 (Left), Enable AIF1ADC1 (Right)
359  * Enable DMICDAT1 (Left), Enable DMICDAT1 (Right)
360  * Enable Left ADC, Enable Right ADC */
361  counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0F3C);
362 
363  /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC2 Left/Right Timeslot 1 */
364  counter += CODEC_IO_Write(DeviceAddr, 0x450, 0x00DB);
365 
366  /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC1 Left/Right Timeslot 0 */
367  counter += CODEC_IO_Write(DeviceAddr, 0x440, 0x00DB);
368 
369  /* Disable IN1L, IN1R, Enable IN2L, IN2R, Thermal sensor & shutdown */
370  counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x63A0);
371 
372  /* Enable the DMIC2(Left) to AIF1 Timeslot 0 (Left) mixer path */
373  counter += CODEC_IO_Write(DeviceAddr, 0x606, 0x0002);
374 
375  /* Enable the DMIC2(Right) to AIF1 Timeslot 0 (Right) mixer path */
376  counter += CODEC_IO_Write(DeviceAddr, 0x607, 0x0002);
377 
378  /* Enable the DMIC2(Left) to AIF1 Timeslot 1 (Left) mixer path */
379  counter += CODEC_IO_Write(DeviceAddr, 0x608, 0x0002);
380 
381  /* Enable the DMIC2(Right) to AIF1 Timeslot 1 (Right) mixer path */
382  counter += CODEC_IO_Write(DeviceAddr, 0x609, 0x0002);
383 
384  /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC1 signal detect */
385  counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000D);
386  break;
388  default:
389  /* Actually, no other input devices supported */
390  counter++;
391  break;
392  }
393  }
394  else
395  {
396  inputEnabled = 0;
397  }
398 
399  /* Clock Configurations */
400  switch (AudioFreq)
401  {
402  case AUDIO_FREQUENCY_8K:
403  /* AIF1 Sample Rate = 8 (KHz), ratio=256 */
404  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0003);
405  break;
406 
407  case AUDIO_FREQUENCY_16K:
408  /* AIF1 Sample Rate = 16 (KHz), ratio=256 */
409  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0033);
410  break;
411 
412  case AUDIO_FREQUENCY_32K:
413  /* AIF1 Sample Rate = 32 (KHz), ratio=256 */
414  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0063);
415  break;
416 
417  case AUDIO_FREQUENCY_48K:
418  /* AIF1 Sample Rate = 48 (KHz), ratio=256 */
419  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083);
420  break;
421 
422  case AUDIO_FREQUENCY_96K:
423  /* AIF1 Sample Rate = 96 (KHz), ratio=256 */
424  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x00A3);
425  break;
426 
427  case AUDIO_FREQUENCY_11K:
428  /* AIF1 Sample Rate = 11.025 (KHz), ratio=256 */
429  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0013);
430  break;
431 
432  case AUDIO_FREQUENCY_22K:
433  /* AIF1 Sample Rate = 22.050 (KHz), ratio=256 */
434  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0043);
435  break;
436 
437  case AUDIO_FREQUENCY_44K:
438  /* AIF1 Sample Rate = 44.1 (KHz), ratio=256 */
439  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0073);
440  break;
441 
442  default:
443  /* AIF1 Sample Rate = 48 (KHz), ratio=256 */
444  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083);
445  break;
446  }
447 
448  if(input_device == INPUT_DEVICE_DIGITAL_MIC1_MIC2)
449  {
450  /* AIF1 Word Length = 16-bits, AIF1 Format = DSP mode */
451  counter += CODEC_IO_Write(DeviceAddr, 0x300, 0x4018);
452  }
453  else
454  {
455  /* AIF1 Word Length = 16-bits, AIF1 Format = I2S (Default Register Value) */
456  counter += CODEC_IO_Write(DeviceAddr, 0x300, 0x4010);
457  }
458 
459  /* slave mode */
460  counter += CODEC_IO_Write(DeviceAddr, 0x302, 0x0000);
461 
462  /* Enable the DSP processing clock for AIF1, Enable the core clock */
463  counter += CODEC_IO_Write(DeviceAddr, 0x208, 0x000A);
464 
465  /* Enable AIF1 Clock, AIF1 Clock Source = MCLK1 pin */
466  counter += CODEC_IO_Write(DeviceAddr, 0x200, 0x0001);
467 
468  if (output_device > 0) /* Audio output selected */
469  {
470  if (output_device == OUTPUT_DEVICE_HEADPHONE)
471  {
472  /* Select DAC1 (Left) to Left Headphone Output PGA (HPOUT1LVOL) path */
473  counter += CODEC_IO_Write(DeviceAddr, 0x2D, 0x0100);
474 
475  /* Select DAC1 (Right) to Right Headphone Output PGA (HPOUT1RVOL) path */
476  counter += CODEC_IO_Write(DeviceAddr, 0x2E, 0x0100);
477 
478  /* Startup sequence for Headphone */
479  if(ColdStartup)
480  {
481  counter += CODEC_IO_Write(DeviceAddr,0x110,0x8100);
482 
483  ColdStartup=0;
484  /* Add Delay */
485  AUDIO_IO_Delay(300);
486  }
487  else /* Headphone Warm Start-Up */
488  {
489  counter += CODEC_IO_Write(DeviceAddr,0x110,0x8108);
490  /* Add Delay */
491  AUDIO_IO_Delay(50);
492  }
493 
494  /* Soft un-Mute the AIF1 Timeslot 0 DAC1 path L&R */
495  counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0000);
496  }
497  /* Analog Output Configuration */
498 
499  /* Enable SPKRVOL PGA, Enable SPKMIXR, Enable SPKLVOL PGA, Enable SPKMIXL */
500  counter += CODEC_IO_Write(DeviceAddr, 0x03, 0x0300);
501 
502  /* Left Speaker Mixer Volume = 0dB */
503  counter += CODEC_IO_Write(DeviceAddr, 0x22, 0x0000);
504 
505  /* Speaker output mode = Class D, Right Speaker Mixer Volume = 0dB ((0x23, 0x0100) = class AB)*/
506  counter += CODEC_IO_Write(DeviceAddr, 0x23, 0x0000);
507 
508  /* Unmute DAC2 (Left) to Left Speaker Mixer (SPKMIXL) path,
509  Unmute DAC2 (Right) to Right Speaker Mixer (SPKMIXR) path */
510  counter += CODEC_IO_Write(DeviceAddr, 0x36, 0x0300);
511 
512  /* Enable bias generator, Enable VMID, Enable SPKOUTL, Enable SPKOUTR */
513  counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x3003);
514 
515  /* Headphone/Speaker Enable */
516 
517  if (input_device == INPUT_DEVICE_DIGITAL_MIC1_MIC2)
518  {
519  /* Enable Class W, Class W Envelope Tracking = AIF1 Timeslots 0 and 1 */
520  counter += CODEC_IO_Write(DeviceAddr, 0x51, 0x0205);
521  }
522  else
523  {
524  /* Enable Class W, Class W Envelope Tracking = AIF1 Timeslot 0 */
525  counter += CODEC_IO_Write(DeviceAddr, 0x51, 0x0005);
526  }
527 
528  /* Enable bias generator, Enable VMID, Enable HPOUT1 (Left) and Enable HPOUT1 (Right) input stages */
529  /* idem for Speaker */
530  power_mgnt_reg_1 |= 0x0303 | 0x3003;
531  counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1);
532 
533  /* Enable HPOUT1 (Left) and HPOUT1 (Right) intermediate stages */
534  counter += CODEC_IO_Write(DeviceAddr, 0x60, 0x0022);
535 
536  /* Enable Charge Pump */
537  counter += CODEC_IO_Write(DeviceAddr, 0x4C, 0x9F25);
538 
539  /* Add Delay */
540  AUDIO_IO_Delay(15);
541 
542  /* Select DAC1 (Left) to Left Headphone Output PGA (HPOUT1LVOL) path */
543  counter += CODEC_IO_Write(DeviceAddr, 0x2D, 0x0001);
544 
545  /* Select DAC1 (Right) to Right Headphone Output PGA (HPOUT1RVOL) path */
546  counter += CODEC_IO_Write(DeviceAddr, 0x2E, 0x0001);
547 
548  /* Enable Left Output Mixer (MIXOUTL), Enable Right Output Mixer (MIXOUTR) */
549  /* idem for SPKOUTL and SPKOUTR */
550  counter += CODEC_IO_Write(DeviceAddr, 0x03, 0x0030 | 0x0300);
551 
552  /* Enable DC Servo and trigger start-up mode on left and right channels */
553  counter += CODEC_IO_Write(DeviceAddr, 0x54, 0x0033);
554 
555  /* Add Delay */
556  AUDIO_IO_Delay(257);
557 
558  /* Enable HPOUT1 (Left) and HPOUT1 (Right) intermediate and output stages. Remove clamps */
559  counter += CODEC_IO_Write(DeviceAddr, 0x60, 0x00EE);
560 
561  /* Unmutes */
562 
563  /* Unmute DAC 1 (Left) */
564  counter += CODEC_IO_Write(DeviceAddr, 0x610, 0x00C0);
565 
566  /* Unmute DAC 1 (Right) */
567  counter += CODEC_IO_Write(DeviceAddr, 0x611, 0x00C0);
568 
569  /* Unmute the AIF1 Timeslot 0 DAC path */
570  counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0010);
571 
572  /* Unmute DAC 2 (Left) */
573  counter += CODEC_IO_Write(DeviceAddr, 0x612, 0x00C0);
574 
575  /* Unmute DAC 2 (Right) */
576  counter += CODEC_IO_Write(DeviceAddr, 0x613, 0x00C0);
577 
578  /* Unmute the AIF1 Timeslot 1 DAC2 path */
579  counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0010);
580 
581  /* Volume Control */
582  wm8994_SetVolume(DeviceAddr, Volume);
583  }
584 
585  if (input_device > 0) /* Audio input selected */
586  {
587  if ((input_device == INPUT_DEVICE_DIGITAL_MICROPHONE_1) || (input_device == INPUT_DEVICE_DIGITAL_MICROPHONE_2))
588  {
589  /* Enable Microphone bias 1 generator, Enable VMID */
590  power_mgnt_reg_1 |= 0x0013;
591  counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1);
592 
593  /* ADC oversample enable */
594  counter += CODEC_IO_Write(DeviceAddr, 0x620, 0x0002);
595 
596  /* AIF ADC2 HPF enable, HPF cut = voice mode 1 fc=127Hz at fs=8kHz */
597  counter += CODEC_IO_Write(DeviceAddr, 0x411, 0x3800);
598  }
599  else if(input_device == INPUT_DEVICE_DIGITAL_MIC1_MIC2)
600  {
601  /* Enable Microphone bias 1 generator, Enable VMID */
602  power_mgnt_reg_1 |= 0x0013;
603  counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1);
604 
605  /* ADC oversample enable */
606  counter += CODEC_IO_Write(DeviceAddr, 0x620, 0x0002);
607 
608  /* AIF ADC1 HPF enable, HPF cut = voice mode 1 fc=127Hz at fs=8kHz */
609  counter += CODEC_IO_Write(DeviceAddr, 0x410, 0x1800);
610 
611  /* AIF ADC2 HPF enable, HPF cut = voice mode 1 fc=127Hz at fs=8kHz */
612  counter += CODEC_IO_Write(DeviceAddr, 0x411, 0x1800);
613  }
614  else if ((input_device == INPUT_DEVICE_INPUT_LINE_1) || (input_device == INPUT_DEVICE_INPUT_LINE_2))
615  {
616 
617  /* Disable mute on IN1L, IN1L Volume = +0dB */
618  counter += CODEC_IO_Write(DeviceAddr, 0x18, 0x000B);
619 
620  /* Disable mute on IN1R, IN1R Volume = +0dB */
621  counter += CODEC_IO_Write(DeviceAddr, 0x1A, 0x000B);
622 
623  /* AIF ADC1 HPF enable, HPF cut = hifi mode fc=4Hz at fs=48kHz */
624  counter += CODEC_IO_Write(DeviceAddr, 0x410, 0x1800);
625  }
626  /* Volume Control */
627  wm8994_SetVolume(DeviceAddr, Volume);
628  }
629  /* Return communication control value */
630  return counter;
631 }
632 
638 void wm8994_DeInit(void)
639 {
640  /* Deinitialize Audio Codec interface */
641  AUDIO_IO_DeInit();
642 }
643 
649 uint32_t wm8994_ReadID(uint16_t DeviceAddr)
650 {
651  /* Initialize the Control interface of the Audio Codec */
652  AUDIO_IO_Init();
653 
654  return ((uint32_t)AUDIO_IO_Read(DeviceAddr, WM8994_CHIPID_ADDR));
655 }
656 
663 uint32_t wm8994_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size)
664 {
665  uint32_t counter = 0;
666 
667  /* Resumes the audio file playing */
668  /* Unmute the output first */
669  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
670 
671  return counter;
672 }
673 
679 uint32_t wm8994_Pause(uint16_t DeviceAddr)
680 {
681  uint32_t counter = 0;
682 
683  /* Pause the audio file playing */
684  /* Mute the output first */
685  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON);
686 
687  /* Put the Codec in Power save mode */
688  counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x01);
689 
690  return counter;
691 }
692 
698 uint32_t wm8994_Resume(uint16_t DeviceAddr)
699 {
700  uint32_t counter = 0;
701 
702  /* Resumes the audio file playing */
703  /* Unmute the output first */
704  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
705 
706  return counter;
707 }
708 
722 uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
723 {
724  uint32_t counter = 0;
725 
726  if (outputEnabled != 0)
727  {
728  /* Mute the output first */
729  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON);
730 
731  if (CodecPdwnMode == CODEC_PDWN_SW)
732  {
733  /* Only output mute required*/
734  }
735  else /* CODEC_PDWN_HW */
736  {
737  /* Mute the AIF1 Timeslot 0 DAC1 path */
738  counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0200);
739 
740  /* Mute the AIF1 Timeslot 1 DAC2 path */
741  counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0200);
742 
743  /* Disable DAC1L_TO_HPOUT1L */
744  counter += CODEC_IO_Write(DeviceAddr, 0x2D, 0x0000);
745 
746  /* Disable DAC1R_TO_HPOUT1R */
747  counter += CODEC_IO_Write(DeviceAddr, 0x2E, 0x0000);
748 
749  /* Disable DAC1 and DAC2 */
750  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0000);
751 
752  /* Reset Codec by writing in 0x0000 address register */
753  counter += CODEC_IO_Write(DeviceAddr, 0x0000, 0x0000);
754 
755  outputEnabled = 0;
756  }
757  }
758  return counter;
759 }
760 
768 uint32_t wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
769 {
770  uint32_t counter = 0;
771  uint8_t convertedvol = VOLUME_CONVERT(Volume);
772 
773  /* Output volume */
774  if (outputEnabled != 0)
775  {
776  if(convertedvol > 0x3E)
777  {
778  /* Unmute audio codec */
779  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
780 
781  /* Left Headphone Volume */
782  counter += CODEC_IO_Write(DeviceAddr, 0x1C, 0x3F | 0x140);
783 
784  /* Right Headphone Volume */
785  counter += CODEC_IO_Write(DeviceAddr, 0x1D, 0x3F | 0x140);
786 
787  /* Left Speaker Volume */
788  counter += CODEC_IO_Write(DeviceAddr, 0x26, 0x3F | 0x140);
789 
790  /* Right Speaker Volume */
791  counter += CODEC_IO_Write(DeviceAddr, 0x27, 0x3F | 0x140);
792  }
793  else if (Volume == 0)
794  {
795  /* Mute audio codec */
796  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON);
797  }
798  else
799  {
800  /* Unmute audio codec */
801  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
802 
803  /* Left Headphone Volume */
804  counter += CODEC_IO_Write(DeviceAddr, 0x1C, convertedvol | 0x140);
805 
806  /* Right Headphone Volume */
807  counter += CODEC_IO_Write(DeviceAddr, 0x1D, convertedvol | 0x140);
808 
809  /* Left Speaker Volume */
810  counter += CODEC_IO_Write(DeviceAddr, 0x26, convertedvol | 0x140);
811 
812  /* Right Speaker Volume */
813  counter += CODEC_IO_Write(DeviceAddr, 0x27, convertedvol | 0x140);
814  }
815  }
816 
817  /* Input volume */
818  if (inputEnabled != 0)
819  {
820  convertedvol = VOLUME_IN_CONVERT(Volume);
821 
822  /* Left AIF1 ADC1 volume */
823  counter += CODEC_IO_Write(DeviceAddr, 0x400, convertedvol | 0x100);
824 
825  /* Right AIF1 ADC1 volume */
826  counter += CODEC_IO_Write(DeviceAddr, 0x401, convertedvol | 0x100);
827 
828  /* Left AIF1 ADC2 volume */
829  counter += CODEC_IO_Write(DeviceAddr, 0x404, convertedvol | 0x100);
830 
831  /* Right AIF1 ADC2 volume */
832  counter += CODEC_IO_Write(DeviceAddr, 0x405, convertedvol | 0x100);
833  }
834  return counter;
835 }
836 
844 uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
845 {
846  uint32_t counter = 0;
847 
848  if (outputEnabled != 0)
849  {
850  /* Set the Mute mode */
851  if(Cmd == AUDIO_MUTE_ON)
852  {
853  /* Soft Mute the AIF1 Timeslot 0 DAC1 path L&R */
854  counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0200);
855 
856  /* Soft Mute the AIF1 Timeslot 1 DAC2 path L&R */
857  counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0200);
858  }
859  else /* AUDIO_MUTE_OFF Disable the Mute */
860  {
861  /* Unmute the AIF1 Timeslot 0 DAC1 path L&R */
862  counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0010);
863 
864  /* Unmute the AIF1 Timeslot 1 DAC2 path L&R */
865  counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0010);
866  }
867  }
868  return counter;
869 }
870 
879 uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
880 {
881  uint32_t counter = 0;
882 
883  switch (Output)
884  {
886  /* Enable DAC1 (Left), Enable DAC1 (Right),
887  Disable DAC2 (Left), Disable DAC2 (Right)*/
888  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0C0C);
889 
890  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
891  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0000);
892 
893  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
894  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0000);
895 
896  /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
897  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002);
898 
899  /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
900  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002);
901  break;
902 
904  /* Disable DAC1 (Left), Disable DAC1 (Right),
905  Enable DAC2 (Left), Enable DAC2 (Right)*/
906  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303);
907 
908  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
909  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
910 
911  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
912  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
913 
914  /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
915  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000);
916 
917  /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
918  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000);
919  break;
920 
921  case OUTPUT_DEVICE_BOTH:
922  /* Enable DAC1 (Left), Enable DAC1 (Right),
923  also Enable DAC2 (Left), Enable DAC2 (Right)*/
924  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303 | 0x0C0C);
925 
926  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
927  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
928 
929  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
930  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
931 
932  /* Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
933  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002);
934 
935  /* Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
936  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002);
937  break;
938 
939  default:
940  /* Disable DAC1 (Left), Disable DAC1 (Right),
941  Enable DAC2 (Left), Enable DAC2 (Right)*/
942  counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303);
943 
944  /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
945  counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
946 
947  /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
948  counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
949 
950  /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
951  counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000);
952 
953  /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
954  counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000);
955  break;
956  }
957  return counter;
958 }
959 
966 uint32_t wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
967 {
968  uint32_t counter = 0;
969 
970  /* Clock Configurations */
971  switch (AudioFreq)
972  {
973  case AUDIO_FREQUENCY_8K:
974  /* AIF1 Sample Rate = 8 (KHz), ratio=256 */
975  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0003);
976  break;
977 
978  case AUDIO_FREQUENCY_16K:
979  /* AIF1 Sample Rate = 16 (KHz), ratio=256 */
980  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0033);
981  break;
982 
983  case AUDIO_FREQUENCY_32K:
984  /* AIF1 Sample Rate = 32 (KHz), ratio=256 */
985  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0063);
986  break;
987 
988  case AUDIO_FREQUENCY_48K:
989  /* AIF1 Sample Rate = 48 (KHz), ratio=256 */
990  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083);
991  break;
992 
993  case AUDIO_FREQUENCY_96K:
994  /* AIF1 Sample Rate = 96 (KHz), ratio=256 */
995  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x00A3);
996  break;
997 
998  case AUDIO_FREQUENCY_11K:
999  /* AIF1 Sample Rate = 11.025 (KHz), ratio=256 */
1000  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0013);
1001  break;
1002 
1003  case AUDIO_FREQUENCY_22K:
1004  /* AIF1 Sample Rate = 22.050 (KHz), ratio=256 */
1005  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0043);
1006  break;
1007 
1008  case AUDIO_FREQUENCY_44K:
1009  /* AIF1 Sample Rate = 44.1 (KHz), ratio=256 */
1010  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0073);
1011  break;
1012 
1013  default:
1014  /* AIF1 Sample Rate = 48 (KHz), ratio=256 */
1015  counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083);
1016  break;
1017  }
1018  return counter;
1019 }
1020 
1026 uint32_t wm8994_Reset(uint16_t DeviceAddr)
1027 {
1028  uint32_t counter = 0;
1029 
1030  /* Reset Codec by writing in 0x0000 address register */
1031  counter = CODEC_IO_Write(DeviceAddr, 0x0000, 0x0000);
1032  outputEnabled = 0;
1033  inputEnabled=0;
1034 
1035  return counter;
1036 }
1037 
1045 static uint8_t CODEC_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value)
1046 {
1047  uint32_t result = 0;
1048 
1049  AUDIO_IO_Write(Addr, Reg, Value);
1050 
1051 #ifdef VERIFY_WRITTENDATA
1052  /* Verify that the data has been correctly written */
1053  result = (AUDIO_IO_Read(Addr, Reg) == Value)? 0:1;
1054 #endif /* VERIFY_WRITTENDATA */
1055 
1056  return result;
1057 }
1058 
1075 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
AUDIO_FREQUENCY_11K
#define AUDIO_FREQUENCY_11K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:100
AUDIO_MUTE_ON
#define AUDIO_MUTE_ON
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:89
AUDIO_MUTE_OFF
#define AUDIO_MUTE_OFF
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:90
INPUT_DEVICE_DIGITAL_MICROPHONE_2
#define INPUT_DEVICE_DIGITAL_MICROPHONE_2
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.h:77
OUTPUT_DEVICE_AUTO
#define OUTPUT_DEVICE_AUTO
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:74
wm8994_drv
AUDIO_DrvTypeDef wm8994_drv
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:86
wm8994_Reset
uint32_t wm8994_Reset(uint16_t DeviceAddr)
Resets wm8994 registers.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:1026
AUDIO_FREQUENCY_16K
#define AUDIO_FREQUENCY_16K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:99
AUDIO_IO_Delay
void AUDIO_IO_Delay(uint32_t Delay)
AUDIO Codec delay.
Definition: stm32469i_discovery.c:783
VOLUME_CONVERT
#define VOLUME_CONVERT(Volume)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.c:64
AUDIO_FREQUENCY_32K
#define AUDIO_FREQUENCY_32K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:97
wm8994_Init
uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq)
Initializes the audio codec and the control interface.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:137
INPUT_DEVICE_DIGITAL_MIC1_MIC2
#define INPUT_DEVICE_DIGITAL_MIC1_MIC2
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.h:80
AUDIO_IO_Read
uint8_t AUDIO_IO_Read(uint8_t Addr, uint8_t Reg)
Reads a single data.
Definition: stm32f4_discovery.c:680
CODEC_IO_Write
static uint8_t CODEC_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value)
Writes/Read a single data.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:1045
INPUT_DEVICE_INPUT_LINE_2
#define INPUT_DEVICE_INPUT_LINE_2
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.h:79
wm8994_SetOutputMode
uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
Switch dynamically (while audio file is played) the output target (speaker or headphone).
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:879
AUDIO_IO_Write
void AUDIO_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
Writes a single data.
Definition: stm32f4_discovery.c:669
INPUT_DEVICE_DIGITAL_MICROPHONE_1
#define INPUT_DEVICE_DIGITAL_MICROPHONE_1
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.h:76
wm8994_SetFrequency
uint32_t wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
Sets new frequency.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:966
inputEnabled
static uint32_t inputEnabled
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:106
AUDIO_FREQUENCY_8K
#define AUDIO_FREQUENCY_8K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:101
AUDIO_FREQUENCY_22K
#define AUDIO_FREQUENCY_22K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:98
wm8994_Resume
uint32_t wm8994_Resume(uint16_t DeviceAddr)
Resumes playing on the audio codec.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:698
outputEnabled
static uint32_t outputEnabled
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:105
AUDIO_FREQUENCY_44K
#define AUDIO_FREQUENCY_44K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:96
wm8994_Play
uint32_t wm8994_Play(uint16_t DeviceAddr, uint16_t *pBuffer, uint16_t Size)
Start the audio Codec play feature.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:663
VOLUME_IN_CONVERT
#define VOLUME_IN_CONVERT(Volume)
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.h:110
OUTPUT_DEVICE_SPEAKER
#define OUTPUT_DEVICE_SPEAKER
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:71
OUTPUT_DEVICE_BOTH
#define OUTPUT_DEVICE_BOTH
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:73
wm8994_ReadID
uint32_t wm8994_ReadID(uint16_t DeviceAddr)
Get the WM8994 ID.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:649
WM8994_CHIPID_ADDR
#define WM8994_CHIPID_ADDR
Device ID Register: Reading from this register will indicate device family ID 8994h.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.h:124
AUDIO_DrvTypeDef
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:81
INPUT_DEVICE_INPUT_LINE_1
#define INPUT_DEVICE_INPUT_LINE_1
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.h:78
ColdStartup
static uint8_t ColdStartup
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:107
wm8994_Stop
uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
Stops audio Codec playing. It powers down the codec.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:722
wm8994_SetVolume
uint32_t wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
Sets higher or lower the codec volume level.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:768
CODEC_PDWN_SW
#define CODEC_PDWN_SW
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:86
wm8994_DeInit
void wm8994_DeInit(void)
Deinitializes the audio codec.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:638
Output
Output
AUDIO_FREQUENCY_48K
#define AUDIO_FREQUENCY_48K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:95
wm8994.h
This file contains all the functions prototypes for the wm8994.c driver.
OUTPUT_DEVICE_HEADPHONE
#define OUTPUT_DEVICE_HEADPHONE
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:72
AUDIO_FREQUENCY_96K
#define AUDIO_FREQUENCY_96K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:94
AUDIO_IO_Init
void AUDIO_IO_Init(void)
Initializes Audio low level.
Definition: stm32f4_discovery.c:626
AUDIO_IO_DeInit
void AUDIO_IO_DeInit(void)
DeInitializes Audio low level.
Definition: stm32f4_discovery.c:658
wm8994_Pause
uint32_t wm8994_Pause(uint16_t DeviceAddr)
Pauses playing on the audio codec.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:679
wm8994_SetMute
uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
Enables or disables the mute feature on the audio codec.
Definition: stm32f769/stm32f769i-disco/Drivers/BSP/Components/wm8994/wm8994.c:844


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:55