Browse Source

add select_boards function

pull/8/head
leeboby 5 years ago
parent
commit
d054e73f5d
  1. 35
      build
  2. 3
      wiringPi/OrangePi.c

35
build

@ -1,4 +1,4 @@
#!/bin/sh -e
#!/bin/bash -e
# build
# Simple wiringPi build and install script
@ -43,6 +43,37 @@ check_make_ok() {
fi
}
select_boards()
{
local cnt=0
local choice
local call=${1}
boards=("OrangePi_PC2" "OrangePi_A64" "OrangePi_ZERO" "OrangePi_H3" "OrangePi_LITE2" "OrangePi_H3_ZEROPLUS2" "OrangePi_3")
printf "All available boards:\n"
for var in ${boards[@]} ; do
printf "%4d. %s\n" $cnt ${boards[$cnt]}
((cnt+=1))
done
while true ; do
read -p "Choice: " choice
if [ -z "${choice}" ] ; then
continue
fi
if [ -z "${choice//[0-9]/}" ] ; then
if [ $choice -ge 0 -a $choice -lt $cnt ] ; then
export PLATFORM="${boards[$choice]}"
echo $PLATFORM
break
fi
fi
printf "Invalid input ...\n"
done
}
sudo=${WIRINGPI_SUDO-sudo}
if [ x$1 = "xclean" ]; then
@ -103,6 +134,8 @@ if [ x$1 != "x" ]; then
exit 1
fi
select_boards
echo "wiringPi Build script"
echo "====================="
echo

3
wiringPi/OrangePi.c

@ -1574,6 +1574,9 @@ int isOrangePi(void)
/* Non-support */
char *OrangePi_string = "none";
#endif
//printf("OrangePi String is %s\n", OrangePi_string);
return 1;
if ((cpuFd = fopen("/proc/cpuinfo", "r")) == NULL)
piGpioLayoutOops ("Unable to open /proc/cpuinfo") ;

Loading…
Cancel
Save