From 963579d82a281e15d3038fcb81d19b3833506352 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Tue, 18 Jul 2017 10:53:08 -0700 Subject: [PATCH] AK4951: Adjust initial microphone gain. --- firmware/common/ak4951.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/firmware/common/ak4951.cpp b/firmware/common/ak4951.cpp index 66061315..0567bf0b 100644 --- a/firmware/common/ak4951.cpp +++ b/firmware/common/ak4951.cpp @@ -210,10 +210,11 @@ void AK4951::microphone_enable() { // map.r.digital_mic.DMIC = 0; // update(Register::DigitalMic); - map.r.signal_select_1.MGAIN20 = 0b110; + const uint_fast8_t mgain = 0b0111; + map.r.signal_select_1.MGAIN20 = mgain & 7; map.r.signal_select_1.PMMP = 1; map.r.signal_select_1.MPSEL = 1; // MPWR2 pin - map.r.signal_select_1.MGAIN3 = 0b0; + map.r.signal_select_1.MGAIN3 = (mgain >> 3) & 1; update(Register::SignalSelect1); map.r.signal_select_2.INL = 0b01; // Lch input signal = LIN2