Skip to content

Commit 15cce0e

Browse files
CopilotRohansi
andauthored
Set ES8311 ADC gain register (0x16) to 24dB default on init
Agent-Logs-Url: https://github.com/Rohansi/MicroPythonOS/sessions/3892e4a9-cf11-4d5f-b05e-be7714d5fbab Co-authored-by: Rohansi <[email protected]>
1 parent 69f1db5 commit 15cce0e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • internal_filesystem/lib/drivers/codec

internal_filesystem/lib/drivers/codec/es8311.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def const(x): return x
4444
_REG12_DAC_EN = const(0x12) # system: power-up DAC
4545
_REG13_SYS = const(0x13) # system: enable HP output driver
4646
_REG14_MIC = const(0x14) # microphone: DMIC select, analog PGA gain
47+
_REG16_ADC_GAIN = const(0x16) # ADC digital gain (separate from volume; default 4 = 24 dB)
4748
_REG17_ADC_VOL = const(0x17) # ADC volume / gain
4849
_REG1C_ADC_EQ = const(0x1C) # ADC equalizer bypass + DC-offset cancel
4950
_REG31_DAC_MUTE = const(0x31) # DAC soft-mute control (bits[6:5] = 11 → muted)
@@ -117,6 +118,7 @@ def _init(self):
117118
self._wr(_REG14_MIC, 0x1A) # enable analog mic input, max PGA gain
118119

119120
# --- ADC (microphone) ---
121+
self._wr(_REG16_ADC_GAIN, 0x04) # ADC digital gain = 24 dB (default)
120122
self._wr(_REG17_ADC_VOL, 0xC8) # ADC gain/volume (Espressif default)
121123
self._wr(_REG1C_ADC_EQ, 0x6A) # ADC equalizer bypass, cancel DC offset
122124

0 commit comments

Comments
 (0)