Skip to content

Comments

Microphone gain control#164

Open
JakeSW wants to merge 5 commits intoOpenEarable:mainfrom
JakeSW:feature/microphone-gain-control
Open

Microphone gain control#164
JakeSW wants to merge 5 commits intoOpenEarable:mainfrom
JakeSW:feature/microphone-gain-control

Conversation

@JakeSW
Copy link

@JakeSW JakeSW commented Feb 17, 2026

Summary

Add Bluetooth control for ADAU1860 digital microphone gain with 0.375 dB
step resolution across +24 dB to mute range.

Changes Made

  • Add BT_UUID_DMIC_GAIN characteristic (0x1410df99)
  • Add ADAU1860 driver methods for DMIC_VOL0/1 registers
  • Implement hw_codec abstraction layer
  • Add BLE read/write handlers
  • Added RST documentation, this can be removed if not in the style of the repo
  • Add comprehensive RST documentation

To do

  • Verify gain control via BLE on hardware
  • Test left/right channel independence
  • Confirm full range: +24 dB → 0 dB → -70 dB then mute/off
  • Check for audio artifacts during gain transitions
  • Check left/right match with external internal mics
  • Update app to transmit gain characteristic.

Notes

  • Replaces deprecated PDM terminology with DMIC
  • Default gain: +12 dB (0x20) for both channels, maybe reduce this to 0 dB as discussed
  • Check whether it works with developing audio modes (Normal/Transparency/ANC)

Define UUID 0x1410df99 for DMIC gain control characteristic.
This allows BLE clients to adjust the ADAU1860 digital microphone
gain over Bluetooth.
Add public methods mic_gain_write() and mic_gain_read() to safely
access DMIC_VOL0 and DMIC_VOL1 registers. These methods encapsulate
the private register access functions and allow external code to
control microphone gain for channels 0 and 1.
Implement hw_codec_mic_gain_set(), hw_codec_mic_gain_get_left(),
and hw_codec_mic_gain_get_right() functions. These provide a
hardware abstraction layer for controlling ADAU186x DMIC_VOL
registers with 0.375 dB step resolution across a +24 dB to mute
range.
Add read_dmic_gain() and write_dmic_gain() handlers for the
BT_UUID_DMIC_GAIN characteristic. This allows BLE clients to
read and adjust DMIC gain for left and right channels using
a 2-byte payload [left_reg, right_reg].
Add comprehensive documentation for DMIC microphone gain control
including:
- Hardware register mapping and gain calculations
- BLE protocol specification
- Usage examples
- C/C++ API reference
- Implementation details

Replaces deprecated PDM terminology with DMIC to accurately
reflect the ADAU1860 digital microphone interface.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant