fix(audio): resolve ES7210 microphone popping sound by correcting OSR and clock division configuration
This commit is contained in:
@@ -34,6 +34,26 @@ audio_amp_pin = None
|
||||
audio_amp_active_level = 0 # 0 = Active Low, 1 = Active High
|
||||
audio_mic_codec = "ES8311" # "ES7210" or "ES8311"
|
||||
|
||||
def _i2c_recovery(sda_pin, scl_pin):
|
||||
import time
|
||||
scl = Pin(scl_pin, Pin.OUT)
|
||||
sda = Pin(sda_pin, Pin.OUT)
|
||||
scl.value(1)
|
||||
sda.value(1)
|
||||
time.sleep_ms(1)
|
||||
for _ in range(9):
|
||||
scl.value(0)
|
||||
time.sleep_ms(1)
|
||||
scl.value(1)
|
||||
time.sleep_ms(1)
|
||||
scl.value(0)
|
||||
sda.value(0)
|
||||
time.sleep_ms(1)
|
||||
scl.value(1)
|
||||
time.sleep_ms(1)
|
||||
sda.value(1)
|
||||
time.sleep_ms(1)
|
||||
|
||||
def detect_board():
|
||||
global BOARD_TYPE, DISPLAY_TYPE, DISPLAY_WIDTH, DISPLAY_HEIGHT
|
||||
global spi_bus, i2c_bus, display_instance, touch
|
||||
@@ -60,6 +80,7 @@ def detect_board():
|
||||
|
||||
# Setup Touch: FT6336U on I2C(1)
|
||||
try:
|
||||
_i2c_recovery(2, 3)
|
||||
touch_i2c = I2C(1, sda=Pin(2), scl=Pin(3), freq=400000)
|
||||
from ft6336u import FT6336U
|
||||
touch = FT6336U(touch_i2c, rst_pin=28, int_pin=25)
|
||||
@@ -73,6 +94,7 @@ def detect_board():
|
||||
|
||||
# Try scanning SDA=16, SCL=15 (Hosyond pins)
|
||||
try:
|
||||
_i2c_recovery(16, 15)
|
||||
test_i2c = SoftI2C(sda=Pin(16), scl=Pin(15))
|
||||
devices = test_i2c.scan()
|
||||
if 0x38 in devices:
|
||||
@@ -121,6 +143,7 @@ def detect_board():
|
||||
|
||||
# 3. Try scanning SDA=13, SCL=14 (Waveshare RLCD pins)
|
||||
try:
|
||||
_i2c_recovery(13, 14)
|
||||
test_i2c = SoftI2C(sda=Pin(13), scl=Pin(14))
|
||||
devices = test_i2c.scan()
|
||||
if 0x70 in devices or 0x51 in devices:
|
||||
|
||||
Reference in New Issue
Block a user