[RPI] Add Mark-1 detection support to ovos-i2csound

It checks for i2c address of the sound hat first
If found it can be a WM8960 (2-mic) or WM8731 (Mark1) based hat.

It then checks if the right Arduino is connected to the right pins.
If so it assumes a Mark1 device and configures the device.
This commit is contained in:
j1nx 2023-12-14 11:47:01 +00:00
parent 603061f49c
commit e34033bff1
1 changed files with 27 additions and 3 deletions

View File

@ -16,10 +16,17 @@
##########################################################################
# Scanning the I2C bus for know addresses
is_1a=$(i2cdetect -y 1 0x1a 0x1a | grep -E "(1a|UU)" | awk '{print $2}') # ReSpeaker 2-mic / WM8960 based
is_1a=$(i2cdetect -y 1 0x1a 0x1a | grep -E "(1a|UU)" | awk '{print $2}') # WM8xxx based
if [ "${is_1a}" == "1a" ] || [ "${is_1a}" == "UU" ] ; then
WM8960=found
echo "WM8960 based 2-mic $WM8960"
echo "WM8xxx based HAT found"
atmega328p=$(avrdude -p atmega328p -C /etc/avrdude-gpio.conf -c linuxgpio -U signature:r:-:i -F 2>/dev/null | head -n1)
if [ "${atmega328p}" == ":030000001E950F3B" ] ; then
MARK1=found
echo "Mark-1 enclosure $MARK1"
else
WM8960=found
echo "WM8960 based 2-mic $WM8960"
fi
fi
is_35=$(i2cdetect -y 1 0x35 0x35 | grep -E "(35|UU)" | awk '{print $2}') # ReSpeaker 4-mic squared
@ -88,6 +95,23 @@ if [ "$WM8960" == "found" ] && [ "$RESPEAKER4" != "found" ] ; then
dtoverlay wm8960-button-overlay
fi
if [ "$MARK1" == "found" ] ; then
echo "Installing and configuring WM8731 based sound HAT"
dtoverlay proto-codec
echo "Configuring board"
sleep 3 # Allow some time to fully initialise the hardware / driver
amixer -c "sndrpiproto" cset numid=1 107,107
amixer -c "sndrpiproto" cset numid=2 on
amixer -c "sndrpiproto" cset numid=6 on
amixer -c "sndrpiproto" cset numid=10 on
amixer -c "sndrpiproto" cset numid=14 1
amixer -c "sndrpiproto" cset numid=13 on
amixer -c "sndrpiproto" cset numid=9 on
echo "Resetting Mark-1 faceplate"
echo "eyes.color=7365993" > /dev/ttyAMA0 # color=soft gray, #706569
echo "mouth.text=" > /dev/ttyAMA0
fi
if [ "${RESPEAKER6}" == "found" ] && [ "${RESPEAKER4}" != "found" ] ; then
echo "Installing and configuring ReSpeaker 4-mic HAT"
dtoverlay seeed-4mic-voicecard