testing-script/26pingpio-script/26pingpio-script.sh
2025-04-15 14:12:57 +08:00

98 lines
2.3 KiB
Bash
Executable File

#/bin/bash
### GPIO 17 - LED high, light on ###
### GPIO 18 - LED high, light on ###
### GPIO 20 - LED high, light on ###
RET=0
EXP_GPIO17=17
EXP_GPIO18=18
EXP_GPIO20=20
sleep 2
echo " "
echo " "
echo " "
echo "######################################################################################"
source `pwd`/mt_gpio.sh
####################################################################################################
if [ ! -f /sys/class/gpio/gpio488/direction ]; then
mt_gpio_export ${EXP_GPIO17} ### EXP_GPIO17 471 + 17 = 488
fi
if [ ! -f /sys/class/gpio/gpio489/direction ]; then
mt_gpio_export ${EXP_GPIO18} ### EXP_GPIO18 471 + 18 = 489
fi
if [ ! -f /sys/class/gpio/gpio491/direction ]; then
mt_gpio_export ${EXP_GPIO20} ### EXP_GPIO20 471 + 20 = 491
fi
####################################################################################################
mt_gpio_dir ${EXP_GPIO17} out
mt_gpio_dir ${EXP_GPIO18} out
mt_gpio_dir ${EXP_GPIO20} out
####################################################################################################
echo "########################## 26PIN GPIO Expand Board Testing Start ##########################"
echo "### 26PIN Expand Board's all LED turn on about 10s ###"
mt_gpio_out ${EXP_GPIO17} 1
mt_gpio_out ${EXP_GPIO18} 1
mt_gpio_out ${EXP_GPIO20} 1
sleep 10
echo "### 26PIN Expand Board's all LED turn off about 5s ###"
mt_gpio_out ${EXP_GPIO17} 0
mt_gpio_out ${EXP_GPIO18} 0
mt_gpio_out ${EXP_GPIO20} 0
sleep 5
echo "### 26PIN Expand Board's all LED turn on ###"
mt_gpio_out ${EXP_GPIO17} 1
mt_gpio_out ${EXP_GPIO18} 1
mt_gpio_out ${EXP_GPIO20} 1
sleep 2
while true
do
read -t20 -s -n1 -p "### Please confirm if Expand Board's LED can work fine, enter y or n. "y" is good, "n" is for bad. ###" keypress
if [ $? -eq 0 ]; then
if [ ${keypress} == 'y' ]; then
echo " "
echo " "
echo "### Expand Board's LED can work fine, 26PIN GPIO feature is good ### "
break
fi
if [ ${keypress} == 'n' ]; then
RET=1
echo " "
echo " "
echo "Error Notice: Expand Board'sLED can not work fine, 26PIN GPIO feature is bad"
break
fi
fi
echo " "
done
echo "######################################################################################"
echo " "
echo " "
echo " "
sleep 2
return ${RET}