arduino-audio-driver
Loading...
Searching...
No Matches
AC101.h
Go to the documentation of this file.
1// code from
2// https://github.com/donny681/esp-adf/blob/master/components/audio_Codecs/AC101/AC101.h
3
4#pragma once
5
7#include "DriverCommon.h"
9#include "Platforms/API_I2C.h"
10#include "stdbool.h"
11#include <string.h>
12
13namespace audio_driver {
14
28
46
54
61
68
77
83
94
102
108class AC101 {
109 public:
110 static constexpr int AC101_ADDR = 0x1A;
111 static constexpr int I2C_MASTER_WRITE = 0;
112 static constexpr int I2C_MASTER_READ = 1;
113 static constexpr int WRITE_BIT = 0;
114 static constexpr int READ_BIT = 1;
115 static constexpr int ACK_CHECK_EN = 0x1;
116 static constexpr int ACK_CHECK_DIS = 0x0;
117 static constexpr int ACK_VAL = 0x0;
118 static constexpr int NACK_VAL = 0x1;
119 static constexpr uint8_t CHIP_AUDIO_RS = 0x00;
120 static constexpr uint8_t PLL_CTRL1 = 0x01;
121 static constexpr uint8_t PLL_CTRL2 = 0x02;
122 static constexpr uint8_t SYSCLK_CTRL = 0x03;
123 static constexpr uint8_t MOD_CLK_ENA = 0x04;
124 static constexpr uint8_t MOD_RST_CTRL = 0x05;
125 static constexpr uint8_t I2S_SR_CTRL = 0x06;
126 static constexpr uint8_t I2S1LCK_CTRL = 0x10;
127 static constexpr uint8_t I2S1_SDOUT_CTRL = 0x11;
128 static constexpr uint8_t I2S1_SDIN_CTRL = 0x12;
129 static constexpr uint8_t I2S1_MXR_SRC = 0x13;
130 static constexpr uint8_t I2S1_VOL_CTRL1 = 0x14;
131 static constexpr uint8_t I2S1_VOL_CTRL2 = 0x15;
132 static constexpr uint8_t I2S1_VOL_CTRL3 = 0x16;
133 static constexpr uint8_t I2S1_VOL_CTRL4 = 0x17;
134 static constexpr uint8_t I2S1_MXR_GAIN = 0x18;
135 static constexpr uint8_t ADC_DIG_CTRL = 0x40;
136 static constexpr uint8_t ADC_VOL_CTRL = 0x41;
137 static constexpr uint8_t HMIC_CTRL1 = 0x44;
138 static constexpr uint8_t HMIC_CTRL2 = 0x45;
139 static constexpr uint8_t HMIC_STATUS = 0x46;
140 static constexpr uint8_t DAC_DIG_CTRL = 0x48;
141 static constexpr uint8_t DAC_VOL_CTRL = 0x49;
142 static constexpr uint8_t DAC_MXR_SRC = 0x4c;
143 static constexpr uint8_t DAC_MXR_GAIN = 0x4d;
144 static constexpr uint8_t ADC_APC_CTRL = 0x50;
145 static constexpr uint8_t ADC_SRC = 0x51;
146 static constexpr uint8_t ADC_SRCBST_CTRL = 0x52;
147 static constexpr uint8_t OMIXER_DACA_CTRL = 0x53;
148 static constexpr uint8_t OMIXER_SR = 0x54;
149 static constexpr uint8_t OMIXER_BST1_CTRL = 0x55;
150 static constexpr uint8_t HPOUT_CTRL = 0x56;
151 static constexpr uint8_t SPKOUT_CTRL = 0x58;
152 static constexpr uint8_t AC_DAC_DAPCTRL = 0xa0;
153 static constexpr uint8_t AC_DAC_DAPHHPFC = 0xa1;
154 static constexpr uint8_t AC_DAC_DAPLHPFC = 0xa2;
155 static constexpr uint8_t AC_DAC_DAPLHAVC = 0xa3;
156 static constexpr uint8_t AC_DAC_DAPLLAVC = 0xa4;
157 static constexpr uint8_t AC_DAC_DAPRHAVC = 0xa5;
158 static constexpr uint8_t AC_DAC_DAPRLAVC = 0xa6;
159 static constexpr uint8_t AC_DAC_DAPHGDEC = 0xa7;
160 static constexpr uint8_t AC_DAC_DAPLGDEC = 0xa8;
161 static constexpr uint8_t AC_DAC_DAPHGATC = 0xa9;
162 static constexpr uint8_t AC_DAC_DAPLGATC = 0xaa;
163 static constexpr uint8_t AC_DAC_DAPHETHD = 0xab;
164 static constexpr uint8_t AC_DAC_DAPLETHD = 0xac;
165 static constexpr uint8_t AC_DAC_DAPHGKPA = 0xad;
166 static constexpr uint8_t AC_DAC_DAPLGKPA = 0xae;
167 static constexpr uint8_t AC_DAC_DAPHGOPA = 0xaf;
168 static constexpr uint8_t AC_DAC_DAPLGOPA = 0xb0;
169 static constexpr uint8_t AC_DAC_DAPOPT = 0xb1;
170 static constexpr uint8_t DAC_DAP_ENA = 0xb5;
171 AC101() = default;
172
174 void setWire(i2c_bus_handle_t handle) { i2c_handle = handle; }
175
177 void setAddress(int addr) {
178 if (addr > 0) i2c_addr = addr;
179 }
180
182 error_t res = RESULT_OK;
183
184 res = writeReg(CHIP_AUDIO_RS, 0x123);
185 delayMs(1000);
186 if (res != RESULT_OK) {
187 AD_LOGE("reset failed!");
188 return res;
189 } else {
190 AD_LOGI("reset");
191 }
192 res |= writeReg(SPKOUT_CTRL, 0xe880);
193
194 // Enable the PLL from 256*44.1KHz MCLK source
195 res |= writeReg(PLL_CTRL1, 0x014f);
196 // res |= writeReg(PLL_CTRL2, 0x83c0);
197 res |= writeReg(PLL_CTRL2, 0x8600);
198
199 // Clocking system
200 res |= writeReg(SYSCLK_CTRL, 0x8b08);
201 res |= writeReg(MOD_CLK_ENA, 0x800c);
202 res |= writeReg(MOD_RST_CTRL, 0x800c);
203 res |= writeReg(I2S_SR_CTRL, 0x7000); // sample rate
204 // AIF config
205 res |= writeReg(I2S1LCK_CTRL, 0x8850); // BCLK/LRCK
206 res |= writeReg(I2S1_SDOUT_CTRL, 0xc000); //
207 res |= writeReg(I2S1_SDIN_CTRL, 0xc000);
208 res |= writeReg(I2S1_MXR_SRC, 0x2200); //
209
210 res |= writeReg(ADC_SRCBST_CTRL, 0xccc4);
211
212 res |= writeReg(ADC_SRC, getSrcValue(codec_cfg->input_device));
213 res |= writeReg(ADC_DIG_CTRL, 0x8000);
214 res |= writeReg(ADC_APC_CTRL, 0xbbc3);
215
216 // Path Configuration
217 res |= writeReg(DAC_MXR_SRC, 0xcc00);
218 res |= writeReg(DAC_DIG_CTRL, 0x8000);
219 res |= writeReg(OMIXER_SR, 0x0081);
220 res |= writeReg(OMIXER_DACA_CTRL, 0xf080); //}
221
222 //* Enable Speaker output
223 res |= writeReg(0x58, 0xeabd);
224
225 AD_LOGI("init done");
226 return res;
227 }
228
230 return writeReg(CHIP_AUDIO_RS, 0x123); // soft reset
231 }
232
234 int res = 0;
235 int es_mode_t = 0;
236
237 switch (mode) {
239 es_mode_t = AC_MODULE_ADC;
240 break;
242 es_mode_t = AC_MODULE_LINE;
243 break;
245 es_mode_t = AC_MODULE_DAC;
246 break;
247 case CODEC_MODE_BOTH:
248 es_mode_t = AC_MODULE_ADC_DAC;
249 break;
250 default:
251 es_mode_t = AC_MODULE_DAC;
252 AD_LOGW("Codec mode not support, default is decode mode");
253 break;
254 }
255 if (!ctrlStateActive) {
256 res = stop((ac_module_t)es_mode_t);
257 } else {
258 res = start((ac_module_t)es_mode_t);
259 }
260 return res;
261 }
262
264 error_t res = 0;
265 int bits = 0;
266 int fmat = 0;
267 int sample_fre = 0;
268 uint16_t regval;
269 switch (iface->bits) // 0x10
270 {
271 // case BIT_LENGTH_8BITS:
272 // bits = BIT_LENGTH_8_BITS;
273 // break;
275 bits = BIT_LENGTH_16_BITS;
276 break;
278 bits = BIT_LENGTH_24_BITS;
279 break;
280 default:
281 bits = BIT_LENGTH_16_BITS;
282 }
283
284 switch (iface->fmt) // 0x10
285 {
286 case I2S_NORMAL:
287 fmat = 0x0;
288 break;
289 case I2S_LEFT:
290 fmat = 0x01;
291 break;
292 case I2S_RIGHT:
293 fmat = 0x02;
294 break;
295 case I2S_DSP:
296 fmat = 0x03;
297 break;
298 default:
299 fmat = 0x00;
300 break;
301 }
302
303 switch (iface->rate) {
304 case RATE_8K:
305 sample_fre = 8000;
306 break;
307 case RATE_11K:
308 sample_fre = 11025;
309 break;
310 case RATE_16K:
311 sample_fre = 16000;
312 break;
313 case RATE_22K:
314 sample_fre = 22050;
315 break;
316 case RATE_24K:
317 sample_fre = 24000;
318 break;
319 case RATE_32K:
320 sample_fre = 32000;
321 break;
322 case RATE_44K:
323 sample_fre = 44100;
324 break;
325 case RATE_48K:
326 sample_fre = 48000;
327 break;
328 default:
329 sample_fre = 44100;
330 }
331 regval = readReg(I2S1LCK_CTRL);
332 regval &= 0xffc3;
333 regval |= (iface->mode << 15);
334 regval |= (bits << 4);
335 regval |= (fmat << 2);
336 res |= writeReg(I2S1LCK_CTRL, regval);
337 res |= writeReg(I2S_SR_CTRL, sample_fre);
338 return res;
339 }
340
342 error_t res = 0;
343 uint16_t regval = 0;
344 regval = readReg(I2S1LCK_CTRL);
345 regval &= 0xe03f;
346 regval |= (cfg->bclk_div << 9);
347 regval |= (cfg->lclk_div << 6);
348 res = writeReg(I2S1LCK_CTRL, regval);
349 return res;
350 }
351
353 int res;
354 res = readReg(SPKOUT_CTRL);
355 res &= 0x1f;
356 return res * 2;
357 }
358
359 error_t setSpkVolume(uint8_t volume) {
360 if (volume > 0x3f) volume = 0x3f;
361 volume = volume / 2;
362
363 uint16_t res;
364 error_t ret;
365
366 res = readReg(SPKOUT_CTRL);
367 res &= (~0x1f);
368 volume &= 0x1f;
369 res |= volume;
370 ret = writeReg(SPKOUT_CTRL, res);
371 return ret;
372 }
373
375 int res;
376 res = readReg(HPOUT_CTRL);
377 return (res >> 4) & 0x3f;
378 }
379
380 error_t setEarphVolume(uint8_t volume) {
381 if (volume > 0x3f) volume = 0x3f;
382
383 uint16_t res, tmp;
384 error_t ret;
385 res = readReg(HPOUT_CTRL);
386 tmp = ~(0x3f << 4);
387 res &= tmp;
388 volume &= 0x3f;
389 res |= (volume << 4);
390 ret = writeReg(HPOUT_CTRL, res);
391 return ret;
392 }
393
396 uint16_t regval, temp, clrbit;
397 error_t ret;
398 regval = readReg(OMIXER_BST1_CTRL);
399 switch (source) {
400 case SRC_MIC1:
401 temp = (gain & 0x7) << 6;
402 clrbit = ~(0x7 << 6);
403 break;
404 case SRC_MIC2:
405 temp = (gain & 0x7) << 3;
406 clrbit = ~(0x7 << 3);
407 break;
408 case SRC_LINEIN:
409 temp = (gain & 0x7);
410 clrbit = ~0x7;
411 break;
412 default:
413 return -1;
414 }
415 regval &= clrbit;
416 regval |= temp;
417 ret = writeReg(OMIXER_BST1_CTRL, regval);
418 return ret;
419 }
420
421 error_t setVoiceMute(bool enable) {
422 error_t res = 0;
423
424 if (enable) {
425 res = setEarphVolume(0);
426 res |= setSpkVolume(0);
427 }
428 return res;
429 }
430
432 error_t res;
433 res = setEarphVolume(volume);
434 res |= setSpkVolume(volume);
435 return res;
436 }
437
438 error_t getVoiceVolume(int* volume) {
439 *volume = getEarphVolume();
440 return 0;
441 }
442 error_t writeReg(uint8_t reg_add, uint16_t data) {
443 uint8_t send_buff[2];
444 send_buff[0] = (data >> 8) & 0xff;
445 send_buff[1] = data & 0xff;
446 return i2c_bus_write_bytes(i2c_handle, i2c_addr, &reg_add,
447 sizeof(reg_add), (uint8_t*)send_buff,
448 sizeof(send_buff));
449 }
450
451 error_t readI2C(uint8_t devAddr, uint8_t reg_add, uint8_t* p_data,
452 size_t size) {
453 return i2c_bus_read_bytes(i2c_handle, devAddr, &reg_add, sizeof(reg_add),
454 p_data, size);
455 }
456
457 uint16_t readReg(uint8_t reg_addr) {
458 uint16_t val = 0;
459 uint8_t data_rd[2];
460 readI2C(i2c_addr, reg_addr, data_rd, 2);
461 val = (data_rd[0] << 8) + data_rd[1];
462 return val;
463 }
464
465 void setCodecClk(samplerate_t sampledata) {
466 uint16_t sample_fre;
467 switch (sampledata) {
468 case RATE_8K:
469 sample_fre = 8000;
470 break;
471 case RATE_11K:
472 sample_fre = 11025;
473 break;
474 case RATE_16K:
475 sample_fre = 16000;
476 break;
477 case RATE_22K:
478 sample_fre = 22050;
479 break;
480 case RATE_24K:
481 sample_fre = 24000;
482 break;
483 case RATE_32K:
484 sample_fre = 32000;
485 break;
486 case RATE_44K:
487 sample_fre = 44100;
488 break;
489 case RATE_48K:
490 sample_fre = 48000;
491 break;
492 default:
493 sample_fre = 44100;
494 }
495 writeReg(I2S_SR_CTRL, sample_fre);
496 }
497
499 uint16_t getSrcValue(input_device_t input_device) {
500 uint16_t src_value = 0;
501 switch (input_device) {
502 // microphone
503 case ADC_INPUT_LINE1:
504 src_value = 0x2020;
505 break;
506 // linein
507 case ADC_INPUT_LINE2:
508 src_value = 0x0408;
509 break;
510 // right mic in & left line in
511 case ADC_INPUT_LINE3:
512 src_value = 0x0420;
513 break;
514 // both
515 case ADC_INPUT_ALL:
516 default:
517 src_value = 0x0408 | 0x2020;
518 break;
519 }
520 return src_value;
521 }
522
524 error_t res = 0;
525 if (mode == AC_MODULE_LINE) {
526 res |= writeReg(0x51, 0x0408);
527 res |= writeReg(0x40, 0x8000);
528 res |= writeReg(0x50, 0x3bc0);
529 }
530 if (mode == AC_MODULE_ADC || mode == AC_MODULE_ADC_DAC ||
531 mode == AC_MODULE_LINE) {
532 // I2S1_SDOUT_CTRL
533 // res |= writeReg(PLL_CTRL2, 0x8120);
534 res |= writeReg(0x04, 0x800c);
535 res |= writeReg(0x05, 0x800c);
536 // res |= writeReg(0x06, 0x3000);
537 }
538 if (mode == AC_MODULE_DAC || mode == AC_MODULE_ADC_DAC ||
539 mode == AC_MODULE_LINE) {
540 //* Enable Headphoe output
541 res |= writeReg(OMIXER_DACA_CTRL, 0xff80);
542 res |= writeReg(HPOUT_CTRL, 0xc3c1);
543 res |= writeReg(HPOUT_CTRL, 0xcb00);
544 delayMs(100);
545 res |= writeReg(HPOUT_CTRL, 0xfbc0);
546
547 //* Enable Speaker output
548 res |= writeReg(SPKOUT_CTRL, 0xeabd);
549 delayMs(10);
550 setVoiceVolume(30);
551 }
552
553 return res;
554 }
555
557 error_t res = 0;
558 res |= writeReg(HPOUT_CTRL, 0x01); // disable earphone
559 res |= writeReg(SPKOUT_CTRL, 0xe880); // disable speaker
560 return res;
561 }
562
563 protected:
566};
567
568} // namespace audio_driver
#define RESULT_OK
Definition DriverCommon.h:74
#define AD_LOGI(...)
Definition Logger.h:13
#define AD_LOGE(...)
Definition Logger.h:15
#define AD_LOGW(...)
Definition Logger.h:14
Header-only driver class for the AC101 codec chip.
Definition AC101.h:108
static constexpr uint8_t I2S1_MXR_GAIN
Definition AC101.h:134
static constexpr int NACK_VAL
Definition AC101.h:118
error_t deinit()
Definition AC101.h:229
static constexpr uint8_t HMIC_STATUS
Definition AC101.h:139
static constexpr uint8_t DAC_MXR_SRC
Definition AC101.h:142
error_t i2sConfigClock(ac_i2s_clock_t *cfg)
Definition AC101.h:341
static constexpr uint8_t ADC_VOL_CTRL
Definition AC101.h:136
static constexpr uint8_t I2S1_SDIN_CTRL
Definition AC101.h:128
static constexpr uint8_t AC_DAC_DAPCTRL
Definition AC101.h:152
static constexpr uint8_t AC_DAC_DAPRLAVC
Definition AC101.h:158
static constexpr int ACK_CHECK_DIS
Definition AC101.h:116
static constexpr uint8_t I2S1_VOL_CTRL2
Definition AC101.h:131
static constexpr uint8_t AC_DAC_DAPHHPFC
Definition AC101.h:153
static constexpr uint8_t I2S1_VOL_CTRL4
Definition AC101.h:133
static constexpr uint8_t ADC_SRC
Definition AC101.h:145
static constexpr uint8_t HPOUT_CTRL
Definition AC101.h:150
void setAddress(int addr)
Defines the I2C device address.
Definition AC101.h:177
error_t ctrlStateActive(codec_mode_t mode, bool ctrlStateActive)
Definition AC101.h:233
static constexpr uint8_t I2S1_MXR_SRC
Definition AC101.h:129
static constexpr uint8_t CHIP_AUDIO_RS
Definition AC101.h:119
static constexpr uint8_t AC_DAC_DAPLLAVC
Definition AC101.h:156
static constexpr uint8_t OMIXER_DACA_CTRL
Definition AC101.h:147
error_t setVoiceMute(bool enable)
Definition AC101.h:421
error_t setOutputMixerGain(ac_output_mixer_gain_t gain, ac_output_mixer_source_t source)
Definition AC101.h:394
static constexpr uint8_t DAC_VOL_CTRL
Definition AC101.h:141
error_t writeReg(uint8_t reg_add, uint16_t data)
Definition AC101.h:442
static constexpr uint8_t PLL_CTRL2
Definition AC101.h:121
static constexpr uint8_t HMIC_CTRL1
Definition AC101.h:137
static constexpr int WRITE_BIT
Definition AC101.h:113
static constexpr uint8_t AC_DAC_DAPLETHD
Definition AC101.h:164
static constexpr int ACK_VAL
Definition AC101.h:117
static constexpr uint8_t AC_DAC_DAPHGKPA
Definition AC101.h:165
static constexpr uint8_t AC_DAC_DAPLHPFC
Definition AC101.h:154
static constexpr uint8_t MOD_CLK_ENA
Definition AC101.h:123
static constexpr uint8_t I2S_SR_CTRL
Definition AC101.h:125
static constexpr uint8_t I2S1_VOL_CTRL1
Definition AC101.h:130
int i2c_addr
Definition AC101.h:565
static constexpr uint8_t AC_DAC_DAPOPT
Definition AC101.h:169
static constexpr uint8_t ADC_SRCBST_CTRL
Definition AC101.h:146
error_t configI2S(codec_mode_t mode, I2SDefinition *iface)
Definition AC101.h:263
static constexpr uint8_t AC_DAC_DAPLGATC
Definition AC101.h:162
static constexpr uint8_t AC_DAC_DAPHETHD
Definition AC101.h:163
static constexpr uint8_t AC_DAC_DAPLGOPA
Definition AC101.h:168
static constexpr int I2C_MASTER_WRITE
Definition AC101.h:111
static constexpr uint8_t SPKOUT_CTRL
Definition AC101.h:151
error_t stop(ac_module_t mode)
Definition AC101.h:556
static constexpr uint8_t ADC_APC_CTRL
Definition AC101.h:144
static constexpr uint8_t ADC_DIG_CTRL
Definition AC101.h:135
void setCodecClk(samplerate_t sampledata)
Definition AC101.h:465
static constexpr int ACK_CHECK_EN
Definition AC101.h:115
error_t readI2C(uint8_t devAddr, uint8_t reg_add, uint8_t *p_data, size_t size)
Definition AC101.h:451
static constexpr int AC101_ADDR
Definition AC101.h:110
static constexpr uint8_t AC_DAC_DAPHGOPA
Definition AC101.h:167
static constexpr uint8_t PLL_CTRL1
Definition AC101.h:120
static constexpr int I2C_MASTER_READ
Definition AC101.h:112
void setWire(i2c_bus_handle_t handle)
Defines the I2C bus instance to be used.
Definition AC101.h:174
static constexpr uint8_t AC_DAC_DAPLHAVC
Definition AC101.h:155
int getEarphVolume()
Definition AC101.h:374
static constexpr uint8_t MOD_RST_CTRL
Definition AC101.h:124
static constexpr uint8_t DAC_DAP_ENA
Definition AC101.h:170
int getSpkVolume()
Definition AC101.h:352
uint16_t readReg(uint8_t reg_addr)
Definition AC101.h:457
i2c_bus_handle_t i2c_handle
Definition AC101.h:564
static constexpr uint8_t HMIC_CTRL2
Definition AC101.h:138
static constexpr uint8_t SYSCLK_CTRL
Definition AC101.h:122
error_t start(ac_module_t mode)
Definition AC101.h:523
static constexpr uint8_t I2S1LCK_CTRL
Definition AC101.h:126
static constexpr uint8_t OMIXER_BST1_CTRL
Definition AC101.h:149
static constexpr int READ_BIT
Definition AC101.h:114
error_t setVoiceVolume(int volume)
Definition AC101.h:431
static constexpr uint8_t OMIXER_SR
Definition AC101.h:148
static constexpr uint8_t DAC_DIG_CTRL
Definition AC101.h:140
static constexpr uint8_t AC_DAC_DAPHGDEC
Definition AC101.h:159
static constexpr uint8_t I2S1_VOL_CTRL3
Definition AC101.h:132
static constexpr uint8_t AC_DAC_DAPLGKPA
Definition AC101.h:166
uint16_t getSrcValue(input_device_t input_device)
Determines the value for the SRC register based on the selected input_device.
Definition AC101.h:499
static constexpr uint8_t AC_DAC_DAPLGDEC
Definition AC101.h:160
static constexpr uint8_t DAC_MXR_GAIN
Definition AC101.h:143
error_t setEarphVolume(uint8_t volume)
Definition AC101.h:380
static constexpr uint8_t I2S1_SDOUT_CTRL
Definition AC101.h:127
error_t getVoiceVolume(int *volume)
Definition AC101.h:438
static constexpr uint8_t AC_DAC_DAPRHAVC
Definition AC101.h:157
error_t setSpkVolume(uint8_t volume)
Definition AC101.h:359
error_t init(codec_config_t *codec_cfg)
Definition AC101.h:181
static constexpr uint8_t AC_DAC_DAPHGATC
Definition AC101.h:161
Namespace for audio driver components.
Definition AudioBoard.h:5
ac_adda_fs_i2s1_t
Definition AC101.h:15
@ SAMPLE_RATE_48000
Definition AC101.h:24
@ SAMPLE_RATE_8000
Definition AC101.h:16
@ SAMPLE_RATE_16000
Definition AC101.h:19
@ SAMPLE_RATE_24000
Definition AC101.h:21
@ SAMPLE_RATE_96000
Definition AC101.h:25
@ SAMPLE_RATE_12000
Definition AC101.h:18
@ SAMPLE_RATE_22050
Definition AC101.h:20
@ SAMPLE_RATE_32000
Definition AC101.h:22
@ SAMPLE_RATE_44100
Definition AC101.h:23
@ SAMPLE_RATE_192000
Definition AC101.h:26
@ SAMPLE_RATE_11052
Definition AC101.h:17
input_device_t
Definition DriverCommon.h:170
@ ADC_INPUT_ALL
Definition DriverCommon.h:175
@ ADC_INPUT_LINE1
Definition DriverCommon.h:172
@ ADC_INPUT_LINE3
Definition DriverCommon.h:174
@ ADC_INPUT_LINE2
Definition DriverCommon.h:173
void delayMs(unsigned long ms)
Definition API_Delay.h:19
@ BIT_LENGTH_24BITS
Definition DriverCommon.h:240
@ BIT_LENGTH_16BITS
Definition DriverCommon.h:237
ac_i2s1_lrck_div_t
Definition AC101.h:47
@ LRCK_DIV_256
Definition AC101.h:52
@ LRCK_DIV_32
Definition AC101.h:49
@ LRCK_DIV_128
Definition AC101.h:51
@ LRCK_DIV_64
Definition AC101.h:50
@ LRCK_DIV_16
Definition AC101.h:48
codec_mode_t
Definition DriverCommon.h:290
@ CODEC_MODE_ENCODE
Definition DriverCommon.h:293
@ CODEC_MODE_BOTH
Definition DriverCommon.h:295
@ CODEC_MODE_DECODE
Definition DriverCommon.h:294
@ CODEC_MODE_LINE_IN
Definition DriverCommon.h:296
int error_t
Definition DriverCommon.h:150
ac_bits_length_t
Definition AC101.h:55
@ BIT_LENGTH_8_BITS
Definition AC101.h:56
@ BIT_LENGTH_20_BITS
Definition AC101.h:58
@ BIT_LENGTH_24_BITS
Definition AC101.h:59
@ BIT_LENGTH_16_BITS
Definition AC101.h:57
samplerate_t
Definition DriverCommon.h:213
@ RATE_44K
Definition DriverCommon.h:220
@ RATE_24K
Definition DriverCommon.h:218
@ RATE_22K
Definition DriverCommon.h:217
@ RATE_8K
Definition DriverCommon.h:214
@ RATE_32K
Definition DriverCommon.h:219
@ RATE_11K
Definition DriverCommon.h:215
@ RATE_16K
Definition DriverCommon.h:216
@ RATE_48K
Definition DriverCommon.h:221
ac_module_t
Definition AC101.h:69
@ AC_MODULE_ADC
Definition AC101.h:71
@ AC_MODULE_MIN
Definition AC101.h:70
@ AC_MODULE_LINE
Definition AC101.h:74
@ AC_MODULE_DAC
Definition AC101.h:72
@ AC_MODULE_MAX
Definition AC101.h:75
@ AC_MODULE_ADC_DAC
Definition AC101.h:73
ac_output_mixer_source_t
Definition AC101.h:78
@ SRC_MIC1
Definition AC101.h:79
@ SRC_LINEIN
Definition AC101.h:81
@ SRC_MIC2
Definition AC101.h:80
ac_i2s1_bclk_div_t
Definition AC101.h:29
@ BCLK_DIV_96
Definition AC101.h:41
@ BCLK_DIV_32
Definition AC101.h:38
@ BCLK_DIV_6
Definition AC101.h:33
@ BCLK_DIV_12
Definition AC101.h:35
@ BCLK_DIV_48
Definition AC101.h:39
@ BCLK_DIV_4
Definition AC101.h:32
@ BCLK_DIV_64
Definition AC101.h:40
@ BCLK_DIV_24
Definition AC101.h:37
@ BCLK_DIV_16
Definition AC101.h:36
@ BCLK_DIV_1
Definition AC101.h:30
@ BCLK_DIV_128
Definition AC101.h:42
@ BCLK_DIV_192
Definition AC101.h:43
@ BCLK_DIV_2
Definition AC101.h:31
@ BCLK_DIV_8
Definition AC101.h:34
ac_output_mixer_gain_t
Definition AC101.h:84
@ GAIN_45DB
Definition AC101.h:91
@ GAIN_30DB
Definition AC101.h:90
@ GAIN_60DB
Definition AC101.h:92
@ GAIN_N15DB
Definition AC101.h:87
@ GAIN_0DB
Definition AC101.h:88
@ GAIN_N45DB
Definition AC101.h:85
@ GAIN_15DB
Definition AC101.h:89
@ GAIN_N30DB
Definition AC101.h:86
@ I2S_RIGHT
Definition DriverCommon.h:253
@ I2S_DSP
Definition DriverCommon.h:254
@ I2S_LEFT
Definition DriverCommon.h:252
@ I2S_NORMAL
Definition DriverCommon.h:251
ac_mode_sm_t
Definition AC101.h:62
@ AC_MODE_MASTER
Definition AC101.h:65
@ AC_MODE_SLAVE
Definition AC101.h:64
@ AC_MODE_MAX
Definition AC101.h:66
@ AC_MODE_MIN
Definition AC101.h:63
void * i2c_bus_handle_t
Definition DriverCommon.h:155
I2S interface parameters for the audio codec.
Definition DriverCommon.h:384
i2s_format_t fmt
Definition DriverCommon.h:386
samplerate_t rate
Definition DriverCommon.h:387
i2s_master_slave_t mode
Definition DriverCommon.h:385
sample_bits_t bits
Definition DriverCommon.h:388
Configure AC101 clock.
Definition AC101.h:98
ac_i2s1_lrck_div_t lclk_div
Definition AC101.h:100
ac_i2s1_bclk_div_t bclk_div
Definition AC101.h:99
Top-level codec configuration passed to the audio driver at init.
Definition DriverCommon.h:397
input_device_t input_device
Definition DriverCommon.h:398