test scripts
This commit is contained in:
parent
e377ff799b
commit
315acbcdd1
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Load I2C modules
|
||||
modprobe i2c-dev
|
||||
modprobe i2c-mv64xxx
|
||||
|
||||
# Look for U1 (PCAL6416 GPIO expander)
|
||||
U1=$(i2cdetect -y 0 20 20 | grep 20: | cut -d ':' -f 2)
|
||||
let U1=U1+0
|
||||
if [ ${U1} -ne 20 ]; then
|
||||
echo "ERROR BATTERY CHIP"
|
||||
else
|
||||
|
||||
# Wait for the battery detected and charging for 10s
|
||||
timeout=10
|
||||
while [ ${timeout} -ne 0 ]; do
|
||||
value=$(i2cget -y 0 34 1)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR BATTERY I2C"
|
||||
break
|
||||
fi
|
||||
if [ "${value}" = "0x74" ]; then
|
||||
echo "OK"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
let timeout=timeout-1
|
||||
done
|
||||
if [ ${timeout} -eq 0 ]; then
|
||||
echo "ERROR BATTERY TIMEOUT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Unload I2C modules
|
||||
modprobe -r i2c_mv64xxx i2c_dev >/dev/null 2>&1
|
|
@ -1,18 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "ERROR Wrong number of arguments $#"
|
||||
echo "ERROR GPIO ARGS"
|
||||
exit 1
|
||||
fi
|
||||
pin=$(gpiofind "${1}")
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR Unknown GPIO ${1}"
|
||||
echo "ERROR GPIO PIN"
|
||||
exit 1
|
||||
fi
|
||||
case ${2} in
|
||||
0) value=${2};;
|
||||
1) value=${2};;
|
||||
*) echo "ERROR Bad value ${2}"; exit 1;;
|
||||
*) echo "ERROR GPIO VALUE"; exit 1;;
|
||||
esac
|
||||
gpioset ${pin}=${value}
|
||||
echo "OK"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR GPIO I2C"
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
modprobe i2c-dev
|
||||
modprobe i2c-mv64xxx
|
||||
|
||||
# Look for PCF6416 GPIO expander
|
||||
PCF6416=$(i2cdetect -y 0 20 20 | grep 20: | cut -d ':' -f 2)
|
||||
let PCF6416=PCF6416+0
|
||||
if [ ${PCF6416} -ne 20 ]; then
|
||||
echo "ERROR PCF6416"
|
||||
# Look for U1 (PCAL6416 GPIO expander)
|
||||
U1=$(i2cdetect -y 0 20 20 | grep 20: | cut -d ':' -f 2)
|
||||
let U1=U1+0
|
||||
if [ ${U1} -ne 20 ]; then
|
||||
echo "ERROR I2C U1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Look for AXP209 PMIC
|
||||
AXP209=$(i2cdetect -y 0 34 34 | grep 30: | cut -d ':' -f 2)
|
||||
let AXP2090=AXP209+0
|
||||
if [ ${AXP209} -ne 34 ]; then
|
||||
echo "ERROR AXP209"
|
||||
# Look for U5 (AXP209 PMIC)
|
||||
U5=$(i2cdetect -y 0 34 34 | grep 30: | cut -d ':' -f 2)
|
||||
let U5=U5+0
|
||||
if [ ${U5} -ne 34 ]; then
|
||||
echo "ERROR I2C U5"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ $# -ne 1 ];then
|
||||
echo "ERROR Wrong number of arguments $#"
|
||||
echo "ERROR LED ARGS"
|
||||
exit;
|
||||
fi
|
||||
case ${1} in
|
||||
0) value=0x0a;;
|
||||
1) value=0x3a;;
|
||||
*) echo "ERROR Bad argument ${1}"; exit 1;;
|
||||
*) echo "ERROR LED VALUE"; exit 1;;
|
||||
esac
|
||||
|
||||
# Load I2C modules
|
||||
|
@ -16,7 +16,11 @@ modprobe i2c-mv64xxx
|
|||
|
||||
# Turn on/off the LED
|
||||
i2cset -y 0 0x34 0x32 ${value}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR LED I2C"
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
|
||||
# Unload I2C modules
|
||||
modprobe -r i2c_mv64xxx i2c_dev >/dev/null 2>&1
|
||||
echo "OK"
|
||||
|
|
|
@ -2,11 +2,23 @@
|
|||
|
||||
# Turn on Power Amplifier
|
||||
gpioset $(gpiofind "PA")=1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR SPEAKER ON"
|
||||
else
|
||||
|
||||
# Play 1kHz sine wave
|
||||
speaker-test -t sine -s 1 -f 1000 >/dev/null 2>&1
|
||||
# Play 1kHz sine wave
|
||||
speaker-test -t sine -s 1 -f 1000 >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR SPEAKER SINE"
|
||||
gpioset $(gpiofind "PA")=0
|
||||
else
|
||||
|
||||
# Turn off Power Amplifier
|
||||
gpioset $(gpiofind "PA")=0
|
||||
|
||||
echo "OK"
|
||||
# Turn off Power Amplifier
|
||||
gpioset $(gpiofind "PA")=0
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR SPEAKER OFF"
|
||||
else
|
||||
echo "OK"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue