初步修改源码适配蓝莓派

This commit is contained in:
aixiao 2023-11-30 11:12:06 +08:00
parent 359f5f9b7e
commit d6e6b3b2d2
3 changed files with 120 additions and 289 deletions

61
build
View File

@ -145,29 +145,30 @@ select_boards()
[[ $BOARD == orangepir1plus-lts ]] && BOARD=orangepir1plus-rk3328 [[ $BOARD == orangepir1plus-lts ]] && BOARD=orangepir1plus-rk3328
export BOARD="${BOARD}" export BOARD="${BOARD}"
export BOARD=orangepizero2-h616
} }
sudo=${WIRINGPI_SUDO-sudo} sudo=${WIRINGPI_SUDO-sudo}
if [ x$1 = "xclean" ]; then if [ x$1 = "xclean" ]; then
cd wiringPi cd wiringPi
echo -n "wiringPi: " ; make clean echo -n "wiringPi: " ; make V=1 clean
cd ../devLib cd ../devLib
echo -n "DevLib: " ; make clean echo -n "DevLib: " ; make V=1 clean
cd ../gpio cd ../gpio
echo -n "gpio: " ; make clean echo -n "gpio: " ; make V=1 clean
cd ../examples cd ../examples
echo -n "Examples: " ; make clean echo -n "Examples: " ; make V=1 clean
cd Gertboard cd Gertboard
echo -n "Gertboard: " ; make clean echo -n "Gertboard: " ; make V=1 clean
cd ../PiFace cd ../PiFace
echo -n "PiFace: " ; make clean echo -n "PiFace: " ; make V=1 clean
cd ../q2w cd ../q2w
echo -n "Quick2Wire: " ; make clean echo -n "Quick2Wire: " ; make V=1 clean
cd ../PiGlow cd ../PiGlow
echo -n "PiGlow: " ; make clean echo -n "PiGlow: " ; make V=1 clean
cd ../scrollPhat cd ../scrollPhat
echo -n "scrollPhat: " ; make clean echo -n "scrollPhat: " ; make V=1 clean
cd ../.. cd ../..
echo -n "Deb: " ; rm -f debian-template/wiringpi*.deb echo -n "Deb: " ; rm -f debian-template/wiringpi*.deb
echo echo
@ -176,11 +177,11 @@ fi
if [ x$1 = "xuninstall" ]; then if [ x$1 = "xuninstall" ]; then
cd wiringPi cd wiringPi
echo -n "wiringPi: " ; $sudo make uninstall echo -n "wiringPi: " ; $sudo make V=1 uninstall
cd ../devLib cd ../devLib
echo -n "DevLib: " ; $sudo make uninstall echo -n "DevLib: " ; $sudo make V=1 uninstall
cd ../gpio cd ../gpio
echo -n "gpio: " ; $sudo make uninstall echo -n "gpio: " ; $sudo make V=1 uninstall
exit exit
fi fi
@ -193,13 +194,13 @@ if [ x$1 = "xdebian" ]; then
rm -rf usr rm -rf usr
echo "building wiringPi" echo "building wiringPi"
cd $here/wiringPi cd $here/wiringPi
make install-deb make V=1 install-deb
echo "building devLib" echo "building devLib"
cd $here/devLib cd $here/devLib
make install-deb INCLUDE='-I. -I../wiringPi' make V=1 install-deb INCLUDE='-I. -I../wiringPi'
echo "building gpio" echo "building gpio"
cd $here/gpio cd $here/gpio
make install-deb INCLUDE='-I../wiringPi -I../devLib' LDFLAGS=-L../debian-template/wiringPi/usr/lib make V=1 install-deb INCLUDE='-I../wiringPi -I../devLib' LDFLAGS=-L../debian-template/wiringPi/usr/lib
echo "Building deb package" echo "Building deb package"
cd $here/debian-template cd $here/debian-template
fakeroot dpkg-deb --build wiringPi fakeroot dpkg-deb --build wiringPi
@ -239,53 +240,53 @@ fi
echo echo
echo "WiringPi Library" echo "WiringPi Library"
cd wiringPi cd wiringPi
$sudo make uninstall $sudo make V=1 uninstall
if [ x$1 = "xstatic" ]; then if [ x$1 = "xstatic" ]; then
make -j5 static make V=1 -j5 static
check_make_ok check_make_ok
$sudo make install-static $sudo make V=1 install-static
else else
make -j5 make V=1 -j5
check_make_ok check_make_ok
$sudo make install $sudo make V=1 install
fi fi
check_make_ok check_make_ok
echo echo
echo "WiringPi Devices Library" echo "WiringPi Devices Library"
cd ../devLib cd ../devLib
$sudo make uninstall $sudo make V=1 uninstall
if [ x$1 = "xstatic" ]; then if [ x$1 = "xstatic" ]; then
make -j5 static make V=1 -j5 static
check_make_ok check_make_ok
$sudo make install-static $sudo make V=1 install-static
else else
make -j5 make V=1 -j5
check_make_ok check_make_ok
$sudo make install $sudo make V=1 install
fi fi
check_make_ok check_make_ok
echo echo
echo "GPIO Utility" echo "GPIO Utility"
cd ../gpio cd ../gpio
make -j5 make V=1 -j5
check_make_ok check_make_ok
$sudo make install $sudo make V=1 install
check_make_ok check_make_ok
# echo # echo
# echo "wiringPi Daemon" # echo "wiringPi Daemon"
# cd ../wiringPiD # cd ../wiringPiD
# make -j5 # make V=1 -j5
# check_make_ok # check_make_ok
# $sudo make install # $sudo make V=1 install
# check_make_ok # check_make_ok
# echo # echo
# echo "Examples" # echo "Examples"
# cd ../examples # cd ../examples
# make # make V=1
# cd .. # cd ..
echo echo

View File

@ -671,79 +671,7 @@ char *physNames [64] =
}; };
#endif #endif
// #ifdef CONFIG_ORANGEPI_ZERO2
// int physToWpi [64] =
// {
// -1, // 0
// -1, -1, // 1, 2
// 0, -1,
// 1, -1,
// 2, 3, //7, 8
// -1, 4,
// 5, 6, //11, 12
// 7, -1,
// 8, 9, //15, 16
// -1, 10,
// 11, -1, //19, 20
// 12, 13,
// 14, 15, //23, 24
// -1, 16, // 25, 26
// 17, -1,
// 18, -1,
// 19, -1,
// 20, -1,
// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56
// -1, // ... 63
// };
// char *physNames [64] =
// {
// NULL,
// " 3.3V", "5V ",
// " SDA.3", "5V ",
// " SCL.3", "GND ",
// " PC9", "TXD.5 ",
// " GND", "RXD.5 ",
// " PC6", "PC11 ",
// " PC5", "GND ",
// " PC8", "PC15 ",
// " 3.3V", "PC14 ",
// " MOSI.1", "GND ",
// " MISO.1", "PC7 ",
// " SCLK.1", "CE.1 ",
// " GND", "PC10 ",
// " PC1", " ",
// " PI16", " ",
// " PI6", " ",
// " PH10", " ",
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL, NULL,
// NULL,
// };
// #endif
#ifdef CONFIG_ORANGEPI_ZERO2 #ifdef CONFIG_ORANGEPI_ZERO2
// phys = pins
int pinToGpioOrangePi [64] = int pinToGpioOrangePi [64] =
{ {
-1, // 0 -1, // 0
@ -767,19 +695,10 @@ int pinToGpioOrangePi [64] =
258 , 234 , 258 , 234 ,
272 , 260 , 272 , 260 ,
-1 , 259 , // 40 -1 , 259 , // 40
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1,-1, // 63
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, // 63
}; };
int physToWpi[64] = int physToWpi[64] =
{ {
-1, //0 -1, //0
@ -804,7 +723,6 @@ int physToWpi[64] =
37, 38, //37, 38 37, 38, //37, 38
-1, 40, //39, 40 -1, 40, //39, 40
// Padding: // Padding:
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56
-1, -1, -1, -1, -1, -1, -1, // ... 63 -1, -1, -1, -1, -1, -1, -1, // ... 63
}; };
@ -813,25 +731,25 @@ char *physNames[64] =
{ {
NULL, NULL,
" 3.3V", "5V ", " 3.3V", "5V ",
" TWI1_SDA", "5V ", " PI10", "5V ",
" TWI1_SCL", "GND ",
"I2S0_MCLK", "TX0",
" GND", "RX0",
" TX5", "I2S_CLK",
" RX5", "GND ",
" TX4/PWM3", "RX4/PWM4",
" 3.3V", "PH4",
"SPI1_MOSI", "GND ",
"SPI1_MISO", "RX2",
" SPI1_CLK", "SPI1_CS0 ",
" GND", "SPI1_CS1",
" TWI2_SDA", "TWI2_SCL",
" PI11", "GND ",
" PI12", "LEDC/TX2",
" PI15", "GND ", " PI15", "GND ",
"I2S0_LRCK", "PH10", " PI12", "PI11 ",
" PI16", "I2S0_DOUT", " GND", "PI5 ",
" GND", "I2S0_DIN", " PI4", "PI6 ",
" PI7", "GND ",
" PI16", "PI14 ",
" 3.3V", "PI0 ",
" PI2", "GND ",
" PH8", "PH1 ",
" PH0", "PH7 ",
" GND", "PH10 ",
" PH5", "PH9 ",
" PI3", "GND ",
" PI9", "PI1 ",
" PI13", "GND ",
" PH4", "PI8 ",
" PH2", "PH6 ",
" GND", "PH3 ",
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
@ -1326,7 +1244,7 @@ void OrangePiReadAll(void)
for (pin = 1 ; pin <= 13; pin += 2) for (pin = 1 ; pin <= 13; pin += 2)
#elif CONFIG_ORANGEPI_ZERO2 #elif CONFIG_ORANGEPI_ZERO2
for (pin = 1 ; pin <= 34; pin += 2) for (pin = 1 ; pin <= 40; pin += 2)
#endif #endif
readallPhys(pin); readallPhys(pin);

View File

@ -960,15 +960,6 @@ int ORANGEPI_PIN_MASK[12][32] = //[BANK] [INDEX]
#ifdef CONFIG_ORANGEPI_ZERO2 #ifdef CONFIG_ORANGEPI_ZERO2
int pinToGpioOrangePi [64] = int pinToGpioOrangePi [64] =
{ {
// 229, 228, 73, 226, 227, 70,
// 75, 69, 72, 79, 78, 231, 232,
// 71, 230, 233, 74, 65, 272, 262,234,
// // Padding:
// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 47
// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 63
-1, // 0 -1, // 0
-1 , -1 , -1 , -1 ,
264 , -1 , 264 , -1 ,
@ -990,45 +981,12 @@ int pinToGpioOrangePi [64] =
258 , 234 , 258 , 234 ,
272 , 260 , 272 , 260 ,
-1 , 259 , // 40 -1 , 259 , // 40
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, // 63
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, // 63
}; };
int physToGpioOrangePi [64] = int physToGpioOrangePi [64] =
{ {
// -1, // 0
// -1, -1, // 1, 2
// 229, -1,
// 228, -1,
// 73, 226,
// -1, 227,
// 70, 75,
// 69, -1,
// 72, 79,
// -1, 78,
// 231, -1,
// 232, 71,
// 230, 233,
// -1, 74, // 25, 26
// 65, -1,
// 272, -1,
// 262, -1,
// 234, -1,
// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56
// -1, -1, -1, -1, // ... 63
-1, // 0 -1, // 0
-1 , -1 , -1 , -1 ,
264 , -1 , 264 , -1 ,
@ -1050,45 +1008,12 @@ int physToGpioOrangePi [64] =
258 , 234 , 258 , 234 ,
272 , 260 , 272 , 260 ,
-1 , 259 , // 40 -1 , 259 , // 40
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, // 63
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, // 63
} ; } ;
int physToPinOrangePi [64] = int physToPinOrangePi [64] =
{ {
// -1, // 0
// -1, -1, // 1, 2
// 0, -1,
// 1, -1,
// 2, 3, //7, 8
// -1, 4,
// 5, 6, //11, 12
// 7, -1,
// 8, 9, //15, 16
// -1, 10,
// 11, -1, //19, 20
// 12, 13,
// 14, 15, //23, 24
// -1, 16, // 25, 26
// 17, -1,
// 18, -1,
// 19, -1,
// 20, -1,
// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 56
// -1, // ... 63
-1, // 0 -1, // 0
-1, -1, // 1, 2 -1, -1, // 1, 2
3, -1, //3, 4 3, -1, //3, 4
@ -1117,19 +1042,6 @@ int physToPinOrangePi [64] =
int ORANGEPI_PIN_MASK[12][32] = //[BANK] [INDEX] int OR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