Update components/es8388/es8388.cpp
This commit is contained in:
1 parent
93bc9a4a5d
commit
002503259c
1 file changed
+26
-26
@@ -42,8 +42,8 @@ void ES8388::setup() {
|
|||||||
// sample freq 256
|
// sample freq 256
|
||||||
// DACFsMode,SINGLE SPEED; DACFsRatio,256
|
// DACFsMode,SINGLE SPEED; DACFsRatio,256
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL2, 0x02));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL2, 0x02));
|
||||||
// 0x00 audio on LIN1&RIN1, 0x09 LIN2&RIN2
|
// 0x00 audio on LIN1&RIN1, 0x09 LIN2&RIN2, 0x1B LADCIN&RADCIN
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL16, 0x00));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL16, 0x1B));
|
||||||
// only left DAC to left mixer enable 0db
|
// only left DAC to left mixer enable 0db
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL17, 0x90));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL17, 0x90));
|
||||||
// only right DAC to right mixer enable 0db
|
// only right DAC to right mixer enable 0db
|
||||||
@@ -52,42 +52,42 @@ void ES8388::setup() {
|
|||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL21, 0x80));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL21, 0x80));
|
||||||
// vroi=0 - 1.5k VREF to analog output resistance (default)
|
// vroi=0 - 1.5k VREF to analog output resistance (default)
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL23, 0x00));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL23, 0x00));
|
||||||
|
// DAC left volume control 0dB
|
||||||
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL4, 0x00));
|
||||||
|
// DAC right volume control 0dB
|
||||||
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL5, 0x00));
|
||||||
|
|
||||||
// power down adc and line in
|
// power down adc and line in
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCPOWER, 0xFF));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCPOWER, 0xFF));
|
||||||
|
// ADC mic amp PGA gain
|
||||||
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL1, 0x88)); // +24dB
|
||||||
|
|
||||||
//@nightdav
|
// set to L-R differential
|
||||||
ES8388_ERROR_FAILED(
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL2, 0xF0));
|
||||||
this->write_byte(ES8388_ADCCONTROL1, 0x00)); // +21dB : recommended value for ALC & voice recording
|
// set to Stereo LIN2+RIN2, tri-state
|
||||||
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL3, 0x80));
|
||||||
// set to Mono Right
|
// I2S 16 Bits length and right justified I2S serial audio data format
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL3, 0x02));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL4, 0x0E));
|
||||||
|
// ADCFsMode,single SPEED,RATIO=256
|
||||||
// I2S 16 Bits length and I2S serial audio data format
|
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL4, 0x0d));
|
|
||||||
// ADCFsMode,singel SPEED,RATIO=256
|
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL5, 0x02));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL5, 0x02));
|
||||||
|
|
||||||
// ADC Volume
|
// ADC Volume
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL8, 0x00));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL8, 0x20));
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL9, 0x00));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL9, 0x20));
|
||||||
|
|
||||||
//@nightDav
|
|
||||||
// ALC Config (as recommended by ES8388 user guide for voice recording)
|
// ALC Config (as recommended by ES8388 user guide for voice recording)
|
||||||
|
// ADC mic amp PGA gain
|
||||||
// Reg 0x12 = 0xe2 (ALC enable, PGA Max. Gain=23.5dB, Min. Gain=0dB)
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL1, 0x77)); // +21dB
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL10, 0xe2));
|
// Reg 0x12 = 0xEA (ALC stereo, PGA Max. Gain=23.5dB, Min. Gain=0dB)
|
||||||
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL10, 0xEA));
|
||||||
// Reg 0x13 = 0xa0 (ALC Target=-1.5dB, ALC Hold time =0 mS)
|
// Reg 0x13 = 0x80 (ALC Target=-4.5dB, ALC Hold time =0 mS)
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL11, 0xa0));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL11, 0x80));
|
||||||
// Reg 0x14 = 0x12 (Decay time =820uS , Attack time = 416 uS)
|
// Reg 0x14 = 0x12 (Decay time =820uS , Attack time = 416 uS)
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL12, 0x12));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL12, 0x12));
|
||||||
|
// Reg 0x15 = 0x06 (ALC mode, no zero cross detection, 96 sample window size)
|
||||||
// Reg 0x15 = 0x06(ALC mode)
|
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL13, 0x06));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL13, 0x06));
|
||||||
|
// Reg 0x16 = 0xC3(nose gate = -40.5dB, NGG = 0x01(mute ADC))
|
||||||
// Reg 0x16 = 0xc3(nose gate = -40.5dB, NGG = 0x01(mute ADC))
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL14, 0xC3));
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_ADCCONTROL14, 0xc3));
|
|
||||||
|
|
||||||
// Power on ADC
|
// Power on ADC
|
||||||
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL21, 0x80));
|
ES8388_ERROR_FAILED(this->write_byte(ES8388_DACCONTROL21, 0x80));
|
||||||
|
|||||||
Reference in new issue
Block a user