26 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG00_RESET, 0x1F));
27 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG00_RESET, 0x00));
37 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG0D_SYSTEM, 0x01));
39 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG0E_SYSTEM, 0x02));
41 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG12_SYSTEM, 0x00));
43 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG13_SYSTEM, 0x10));
45 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG1C_ADC, 0x6A));
47 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG37_DAC, 0x08));
49 ES8311_ERROR_FAILED(this->
write_byte(ES8311_REG00_RESET, 0x80));
116 uint8_t reg01 = 0x3F;
126 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG01_CLK_MANAGER, reg01));
130 if (coefficient ==
nullptr) {
131 ESP_LOGE(TAG,
"Unable to configure sample rate %" PRIu32
"Hz with %" PRIu32
"Hz MCLK", this->
sample_frequency_,
138 ES8311_ERROR_CHECK(this->
read_byte(ES8311_REG02_CLK_MANAGER, ®02));
140 reg02 |= (coefficient->pre_div - 1) << 5;
141 reg02 |= encode_pre_mult(coefficient->pre_mult) << 3;
142 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG02_CLK_MANAGER, reg02));
145 const uint8_t reg03 = (coefficient->fs_mode << 6) | coefficient->adc_osr;
146 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG03_CLK_MANAGER, reg03));
149 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG04_CLK_MANAGER, coefficient->dac_osr));
152 const uint8_t reg05 = ((coefficient->adc_div - 1) << 4) | (coefficient->dac_div - 1);
153 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG05_CLK_MANAGER, reg05));
157 ES8311_ERROR_CHECK(this->
read_byte(ES8311_REG06_CLK_MANAGER, ®06));
160 if (coefficient->bclk_div < 19) {
161 reg06 |= (coefficient->bclk_div - 1) << 0;
163 reg06 |= (coefficient->bclk_div) << 0;
165 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG06_CLK_MANAGER, reg06));
169 ES8311_ERROR_CHECK(this->
read_byte(ES8311_REG07_CLK_MANAGER, ®07));
171 reg07 |= coefficient->lrck_h << 0;
172 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG07_CLK_MANAGER, reg07));
175 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG08_CLK_MANAGER, coefficient->lrck_l));
184 ES8311_ERROR_CHECK(this->
read_byte(ES8311_REG00_RESET, ®00));
186 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG00_RESET, reg00));
190 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG09_SDPIN, reg09));
194 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG0A_SDPOUT, reg0a));
201 uint8_t reg14 = 0x1A;
205 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG14_SYSTEM, reg14));
208 ES8311_ERROR_CHECK(this->
write_byte(ES8311_REG17_ADC, 0xC8));