add support for NanoPi-Duo2
This commit is contained in:
parent
6a608ee8ab
commit
9a6860b4bd
|
@ -1,4 +1,5 @@
|
|||
*.o
|
||||
/gpio/gpio
|
||||
libwiringPiDev.so.2.0
|
||||
libwiringPi.so.2.0
|
||||
/test/
|
||||
|
|
|
@ -5,6 +5,7 @@ Currently supported boards:
|
|||
NanoPi Neo
|
||||
NanoPi Neo Air
|
||||
NanoPi Duo
|
||||
NanoPi Duo2
|
||||
NanoPi NEO2
|
||||
NanoPi NEO Plus2
|
||||
NanoPi M1
|
||||
|
|
|
@ -1130,11 +1130,10 @@ int main (int argc, char *argv [])
|
|||
printf ("\n") ;
|
||||
|
||||
BoardHardwareInfo* retBoardInfo;
|
||||
int boardId;
|
||||
boardId = getBoardType(&retBoardInfo);
|
||||
if (boardId >= 0) {
|
||||
if (boardId > ALLWINNER_BASE && boardId <= ALLWINNER_MAX
|
||||
&& boardId != NanoPi_A64) {
|
||||
int ret = getBoardType(&retBoardInfo);
|
||||
if (ret >= 0) {
|
||||
if (retBoardInfo->boardTypeId > ALLWINNER_BASE && retBoardInfo->boardTypeId <= ALLWINNER_MAX
|
||||
&& retBoardInfo->boardTypeId != NanoPi_A64) {
|
||||
printf ("NanoPi Details:\n") ;
|
||||
printf (" Type: %s, Revision: %d, Maker: FriednlyELEC\n\n",
|
||||
retBoardInfo->boardDisplayName, retBoardInfo->kernelRevision) ;
|
||||
|
|
259
gpio/readall.c
259
gpio/readall.c
|
@ -42,6 +42,8 @@ extern int wpMode ;
|
|||
# define FALSE (1==2)
|
||||
#endif
|
||||
|
||||
#define DEBUG_READALL 0
|
||||
|
||||
/*
|
||||
* doReadallExternal:
|
||||
* A relatively crude way to read the pins on an external device.
|
||||
|
@ -252,7 +254,7 @@ static int physToWpi_duo [MAX_PIN_COUNT] =
|
|||
0, -1, //17, 18
|
||||
2, -1, //19, 20
|
||||
3, 16, //21, 22
|
||||
12, -1, //23, 24
|
||||
12, 18, //23, 24
|
||||
|
||||
13, -1, //25, 26
|
||||
-1, -1, //27, 28
|
||||
|
@ -287,7 +289,7 @@ static char *physNames_duo [MAX_PIN_COUNT] =
|
|||
" GPIOA16", "USB-DP3 ",
|
||||
" GPIOA14", "USB-DM3 ",
|
||||
" GPIOA13", "GPIOG11 ",
|
||||
" GPIOA12", "IR-RX ",
|
||||
" GPIOA12", "GPIOL11 ",
|
||||
" GPIOA11", "0v ", //25, 26
|
||||
" 0v", "3.3v ",
|
||||
" GPIOA4", "5v ",
|
||||
|
@ -320,6 +322,91 @@ static char *physNames_duo [MAX_PIN_COUNT] =
|
|||
NULL //73
|
||||
} ;
|
||||
|
||||
static int physToWpi_duo2 [MAX_PIN_COUNT] =
|
||||
{
|
||||
-1, // 0
|
||||
-1, 15, // 1, 2
|
||||
-1, 14, // 3, 4
|
||||
-1, -1, // 5, 6
|
||||
-1, 13, // 7, 8
|
||||
|
||||
18, 12, // 9, 10
|
||||
16, 3, //11, 12
|
||||
-1, 2, //13, 14
|
||||
-1, 0, //15, 16
|
||||
-1, 7, //17, 18
|
||||
-1, 9, //19, 20
|
||||
-1, 8, //21, 22
|
||||
-1, -1, //23, 24
|
||||
|
||||
-1, -1, //25, 26
|
||||
-1, -1, //27, 28
|
||||
-1, -1, //29, 30
|
||||
-1, -1, //31, 32
|
||||
|
||||
|
||||
/* ---------nanopi duo end----------- */
|
||||
-1, -1, //33, 34
|
||||
-1, -1, //35, 36
|
||||
|
||||
-1, -1, //37, 38
|
||||
|
||||
/* 39~63 */
|
||||
-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,
|
||||
|
||||
/* 64~73 */
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
} ;
|
||||
|
||||
static char *physNames_duo2 [MAX_PIN_COUNT] =
|
||||
{
|
||||
NULL,
|
||||
// 32 Pin
|
||||
" 5v", "GPIOA5 ",
|
||||
" 5v", "GPIOA4 ",
|
||||
" 3.3v", "0v ",
|
||||
" 0v", "GPIOA11 ",
|
||||
" GPIOL11", "GPIOA12 ",
|
||||
" GPIOG11", "GPIOA13 ",
|
||||
" USB-DM3", "GPIOA14 ", //13, 14
|
||||
" USB-DP3", "GPIOA16 ",
|
||||
" USB-DM2", "GPIOA15 ",
|
||||
" USB-DP2", "GPIOG7 ",
|
||||
" EPhyRXN", "GPIOG6 ",
|
||||
" EPhyRXP", "CVBS ",
|
||||
" EPhyTXN", "LineOutL", //25, 26
|
||||
" EPhyTXP", "LineOutR",
|
||||
"EPhyLinK", "MIC_P ",
|
||||
" EPhySPD", "MIC_N ",
|
||||
|
||||
/* ---------nanopi duo end----------- */
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
|
||||
/* UART0, tx, rx */
|
||||
NULL, NULL,
|
||||
|
||||
NULL, NULL, //39, 40
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL, //49, 50
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL, //59, 60
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL, //71, 72
|
||||
NULL //73
|
||||
} ;
|
||||
|
||||
|
||||
static int physToWpi_neocore [MAX_PIN_COUNT] =
|
||||
{
|
||||
|
@ -425,22 +512,25 @@ static char *physNames_neocore [MAX_PIN_COUNT] =
|
|||
*********************************************************************************
|
||||
*/
|
||||
|
||||
static void readallPhys (int boardId, int physPin, int pair)
|
||||
static void readallPhys (int faBoardId, int physPin, int pair)
|
||||
{
|
||||
int pin ;
|
||||
int *physToWpi;
|
||||
char **physNames;
|
||||
|
||||
if (boardId == NanoPi_M1 || boardId == NanoPi_K1_Plus || boardId == NanoPi_M1_Plus || boardId == NanoPi_M1_Plus2) {
|
||||
if (faBoardId == NanoPi_M1 || faBoardId == NanoPi_K1_Plus || faBoardId == NanoPi_M1_Plus || faBoardId == NanoPi_M1_Plus2) {
|
||||
physToWpi = physToWpi_m1;
|
||||
physNames = physNames_m1;
|
||||
} else if (boardId == NanoPi_NEO || boardId == NanoPi_NEO_Air || boardId == NanoPi_NEO2 || boardId == NanoPi_NEO_Plus2) {
|
||||
} else if (faBoardId == NanoPi_NEO || faBoardId == NanoPi_NEO_Air || faBoardId == NanoPi_NEO2 || faBoardId == NanoPi_NEO_Plus2) {
|
||||
physToWpi = physToWpi_neo;
|
||||
physNames = physNames_neo;
|
||||
} else if (boardId == NanoPi_Duo) {
|
||||
} else if (faBoardId == NanoPi_Duo) {
|
||||
physToWpi = physToWpi_duo;
|
||||
physNames = physNames_duo;
|
||||
} else if (boardId == NanoPi_NEO_Core || boardId == NanoPi_NEO_Core2) {
|
||||
} else if (faBoardId == NanoPi_Duo2) {
|
||||
physToWpi = physToWpi_duo2;
|
||||
physNames = physNames_duo2;
|
||||
} else if (faBoardId == NanoPi_NEO_Core || faBoardId == NanoPi_NEO_Core2) {
|
||||
physToWpi = physToWpi_neocore;
|
||||
physNames = physNames_neocore;
|
||||
} else {
|
||||
|
@ -469,8 +559,14 @@ static void readallPhys (int boardId, int physPin, int pair)
|
|||
pin = physToWpi [physPin] ;
|
||||
}
|
||||
|
||||
printf (" | %4s", alts [getAlt (pin)]) ;
|
||||
printf (" | %d", digitalRead (pin)) ;
|
||||
int alt = getAltSilence (pin);
|
||||
if (alt >= 0) {
|
||||
printf (" | %4s", alts [alt]) ;
|
||||
} else {
|
||||
printf (" | ") ;
|
||||
}
|
||||
|
||||
printf (" | %d", digitalReadSilence (pin)) ;
|
||||
}
|
||||
|
||||
// Pin numbers:
|
||||
|
@ -502,8 +598,13 @@ static void readallPhys (int boardId, int physPin, int pair)
|
|||
pin = physToWpi [physPin] ;
|
||||
}
|
||||
|
||||
printf (" | %d", digitalRead (pin)) ;
|
||||
printf (" | %-4s", alts [getAlt (pin)]) ;
|
||||
printf (" | %d", digitalReadSilence (pin)) ;
|
||||
int alt = getAltSilence (pin);
|
||||
if (alt >= 0) {
|
||||
printf (" | %4s", alts [alt]) ;
|
||||
} else {
|
||||
printf (" | ") ;
|
||||
}
|
||||
}
|
||||
|
||||
printf (" | %-5s", physNames [physPin]) ;
|
||||
|
@ -516,18 +617,68 @@ static void readallPhys (int boardId, int physPin, int pair)
|
|||
printf (" |\n") ;
|
||||
}
|
||||
|
||||
static void debugReadallPhys (int faBoardId, int physPin)
|
||||
{
|
||||
int pin ;
|
||||
int *physToWpi;
|
||||
char **physNames;
|
||||
|
||||
if (faBoardId == NanoPi_M1 || faBoardId == NanoPi_K1_Plus || faBoardId == NanoPi_M1_Plus || faBoardId == NanoPi_M1_Plus2) {
|
||||
physToWpi = physToWpi_m1;
|
||||
physNames = physNames_m1;
|
||||
} else if (faBoardId == NanoPi_NEO || faBoardId == NanoPi_NEO_Air || faBoardId == NanoPi_NEO2 || faBoardId == NanoPi_NEO_Plus2) {
|
||||
physToWpi = physToWpi_neo;
|
||||
physNames = physNames_neo;
|
||||
} else if (faBoardId == NanoPi_Duo) {
|
||||
physToWpi = physToWpi_duo;
|
||||
physNames = physNames_duo;
|
||||
} else if (faBoardId == NanoPi_Duo2) {
|
||||
physToWpi = physToWpi_duo2;
|
||||
physNames = physNames_duo2;
|
||||
} else if (faBoardId == NanoPi_NEO_Core || faBoardId == NanoPi_NEO_Core2) {
|
||||
physToWpi = physToWpi_neocore;
|
||||
physNames = physNames_neocore;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
|
||||
printf("## physPin: %d, %s\n", physPin, physNames [physPin]);
|
||||
if (physPinToGpio (physPin) == -1)
|
||||
printf("\tnot gpio\n");
|
||||
else
|
||||
printf("\tphysPinToGpio=%d, physToWpi=%d\n", physPinToGpio (physPin), physToWpi [physPin]);
|
||||
|
||||
if (physToWpi [physPin] == -1) {
|
||||
printf("\t\tnot Wpi pin\n");
|
||||
} else {
|
||||
if (wpMode == WPI_MODE_GPIO) {
|
||||
pin = physPinToGpio (physPin) ;
|
||||
printf("\t\tWPI_MODE_GPIO, physPinToGpio (physPin) = %d\n", pin);
|
||||
} else if (wpMode == WPI_MODE_PHYS) {
|
||||
pin = physPin ;
|
||||
printf("\t\tWPI_MODE_PHYS, pin = physPin = %d\n", pin);
|
||||
} else {
|
||||
printf("\t\tUnknow Mode, physPin=%d, physToWpi [physPin] =%d\n", physPin, physToWpi [physPin]);
|
||||
pin = physToWpi [physPin] ;
|
||||
}
|
||||
|
||||
printf ("\t\t\talts = %4s\n", alts [getAltSilence (pin)]) ;
|
||||
printf ("\t\t\tdigitalRead = %d\n", digitalReadSilence (pin)) ;
|
||||
}
|
||||
}
|
||||
|
||||
void NanoPiReadAll()
|
||||
{
|
||||
int pin ;
|
||||
BoardHardwareInfo* retBoardInfo;
|
||||
int boardId;
|
||||
boardId = getBoardType(&retBoardInfo);
|
||||
if (boardId >= 0) {
|
||||
if (boardId > ALLWINNER_BASE && boardId <= ALLWINNER_MAX
|
||||
&& boardId != NanoPi_A64) {
|
||||
int ret = getBoardType(&retBoardInfo);
|
||||
if (ret >= 0) {
|
||||
if (retBoardInfo->boardTypeId > ALLWINNER_BASE
|
||||
&& retBoardInfo->boardTypeId <= ALLWINNER_MAX
|
||||
&& retBoardInfo->boardTypeId != NanoPi_A64) {
|
||||
// nothing to do.
|
||||
} else {
|
||||
printf ("This NanoPi model is currently not supported. ") ;
|
||||
printf ("This NanoPi model is currently not supported. \n") ;
|
||||
return ;
|
||||
}
|
||||
} else {
|
||||
|
@ -538,19 +689,32 @@ void NanoPiReadAll()
|
|||
}
|
||||
|
||||
int pinCount;
|
||||
if (boardId == NanoPi_M1 || boardId == NanoPi_K1_Plus || boardId == NanoPi_M1_Plus || boardId == NanoPi_M1_Plus2) {
|
||||
if (retBoardInfo->boardTypeId == NanoPi_M1
|
||||
|| retBoardInfo->boardTypeId == NanoPi_K1_Plus
|
||||
|| retBoardInfo->boardTypeId == NanoPi_M1_Plus
|
||||
|| retBoardInfo->boardTypeId == NanoPi_M1_Plus2) {
|
||||
pinCount = 40;
|
||||
} else if (boardId == NanoPi_NEO
|
||||
|| boardId == NanoPi_NEO_Air
|
||||
|| boardId == NanoPi_NEO2
|
||||
|| boardId == NanoPi_NEO_Plus2
|
||||
|| boardId == NanoPi_NEO_Core
|
||||
|| boardId == NanoPi_NEO_Core2
|
||||
} else if (retBoardInfo->boardTypeId == NanoPi_NEO
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Air
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO2
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Plus2
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Core
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Core2
|
||||
) {
|
||||
pinCount = 24;
|
||||
} else if (boardId == NanoPi_Duo) {
|
||||
} else if (retBoardInfo->boardTypeId == NanoPi_Duo
|
||||
|| retBoardInfo->boardTypeId == NanoPi_Duo2) {
|
||||
pinCount = 32;
|
||||
} else {
|
||||
printf ("This NanoPi model(id: %d) is currently not supported. \n", retBoardInfo->boardTypeId) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if (DEBUG_READALL) {
|
||||
printf (" +-----+-----+----------+------+---+-%s--+------+----------+-----+-----+\n", retBoardInfo->boardDisplayName) ;
|
||||
for (pin = 1 ; pin <= pinCount ; pin++) {
|
||||
debugReadallPhys (retBoardInfo->boardTypeId, pin) ;
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -559,34 +723,44 @@ void NanoPiReadAll()
|
|||
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+\n") ;
|
||||
for (pin = 1 ; pin <= pinCount ; pin += 2)
|
||||
readallPhys (boardId, pin, 1) ;
|
||||
readallPhys (retBoardInfo->boardTypeId, pin, 1) ;
|
||||
printf (" +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+\n") ;
|
||||
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+-%s--+------+----------+-----+-----+\n", retBoardInfo->boardDisplayName) ;
|
||||
printf ("\n");
|
||||
|
||||
/* Print Second 1 ~ 12/24 pins */
|
||||
if (boardId == NanoPi_M1 || boardId == NanoPi_K1_Plus || boardId == NanoPi_M1_Plus || boardId == NanoPi_M1_Plus2) {
|
||||
if (retBoardInfo->boardTypeId == NanoPi_M1
|
||||
|| retBoardInfo->boardTypeId == NanoPi_K1_Plus
|
||||
|| retBoardInfo->boardTypeId == NanoPi_M1_Plus
|
||||
|| retBoardInfo->boardTypeId == NanoPi_M1_Plus2) {
|
||||
// nothing to do.
|
||||
} else if (boardId == NanoPi_NEO || boardId == NanoPi_NEO_Air || boardId == NanoPi_NEO2 || boardId == NanoPi_NEO_Plus2) {
|
||||
} else if (retBoardInfo->boardTypeId == NanoPi_NEO
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Air
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO2
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Plus2) {
|
||||
printf (" +-----+----%s USB/Audio-+----+\n", retBoardInfo->boardDisplayName) ;
|
||||
printf (" | BCM | wPi | Name | Mode | V | Ph |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+----+\n") ;
|
||||
for (pin = 25 ; pin <= 36 ; pin++) {
|
||||
readallPhys (boardId, pin, 0) ;
|
||||
readallPhys (retBoardInfo->boardTypeId, pin, 0) ;
|
||||
}
|
||||
printf (" +-----+-----+----------+------+---+----+\n") ;
|
||||
printf ("\n");
|
||||
} else if (boardId == NanoPi_Duo || boardId == NanoPi_NEO_Core || boardId == NanoPi_NEO_Core2) {
|
||||
} else if (retBoardInfo->boardTypeId == NanoPi_Duo
|
||||
|| retBoardInfo->boardTypeId == NanoPi_Duo2
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Core
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Core2) {
|
||||
// nothing to do.
|
||||
}
|
||||
|
||||
if (boardId == NanoPi_NEO_Core || boardId == NanoPi_NEO_Core2) {
|
||||
if (retBoardInfo->boardTypeId == NanoPi_NEO_Core
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Core2) {
|
||||
printf (" +-----+-----+----------+---- %s USB/Audio ----+----------+-----+-----+\n", retBoardInfo->boardDisplayName) ;
|
||||
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+\n") ;
|
||||
for (pin = 25 ; pin <= 48 ; pin += 2)
|
||||
readallPhys (boardId, pin, 1) ;
|
||||
readallPhys (retBoardInfo->boardTypeId, pin, 1) ;
|
||||
printf (" +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+\n") ;
|
||||
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+-%s--+------+----------+-----+-----+\n", retBoardInfo->boardDisplayName) ;
|
||||
|
@ -596,32 +770,41 @@ void NanoPiReadAll()
|
|||
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+\n") ;
|
||||
for (pin = 49 ; pin <= 68 ; pin += 2)
|
||||
readallPhys (boardId, pin, 1) ;
|
||||
readallPhys (retBoardInfo->boardTypeId, pin, 1) ;
|
||||
printf (" +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+\n") ;
|
||||
printf (" | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+-%s--+------+----------+-----+-----+\n", retBoardInfo->boardDisplayName) ;
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
if (boardId == NanoPi_M1 || boardId == NanoPi_K1_Plus || boardId == NanoPi_M1_Plus || boardId == NanoPi_M1_Plus2) {
|
||||
if (retBoardInfo->boardTypeId == NanoPi_M1
|
||||
|| retBoardInfo->boardTypeId == NanoPi_K1_Plus
|
||||
|| retBoardInfo->boardTypeId == NanoPi_M1_Plus
|
||||
|| retBoardInfo->boardTypeId == NanoPi_M1_Plus2) {
|
||||
printf (" +-----+----%s Debug UART-+----+\n", retBoardInfo->boardDisplayName) ;
|
||||
printf (" | BCM | wPi | Name | Mode | V | Ph |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+----+\n") ;
|
||||
for (pin = 41 ; pin < 45 ; pin++) {
|
||||
readallPhys (boardId, pin, 0) ;
|
||||
readallPhys (retBoardInfo->boardTypeId, pin, 0) ;
|
||||
}
|
||||
printf (" +-----+-----+----------+------+---+----+\n") ;
|
||||
printf ("\n");
|
||||
} else if (boardId == NanoPi_NEO || boardId == NanoPi_NEO_Air || boardId == NanoPi_NEO2 || boardId == NanoPi_NEO_Plus2) {
|
||||
} else if (retBoardInfo->boardTypeId == NanoPi_NEO
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Air
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO2
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Plus2) {
|
||||
printf (" +-----+----%s Debug UART-+----+\n", retBoardInfo->boardDisplayName) ;
|
||||
printf (" | BCM | wPi | Name | Mode | V | Ph |\n") ;
|
||||
printf (" +-----+-----+----------+------+---+----+\n") ;
|
||||
for (pin = 37 ; pin <= 38 ; pin++) {
|
||||
readallPhys (boardId, pin, 0) ;
|
||||
readallPhys (retBoardInfo->boardTypeId, pin, 0) ;
|
||||
}
|
||||
printf (" +-----+-----+----------+------+---+----+\n") ;
|
||||
printf ("\n");
|
||||
} else if (boardId == NanoPi_Duo || boardId == NanoPi_NEO_Core || boardId == NanoPi_NEO_Core2) {
|
||||
} else if (retBoardInfo->boardTypeId == NanoPi_Duo
|
||||
|| retBoardInfo->boardTypeId == NanoPi_Duo2
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Core
|
||||
|| retBoardInfo->boardTypeId == NanoPi_NEO_Core2) {
|
||||
// nothing to do.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ BoardHardwareInfo gAllBoardHardwareInfo[] = {
|
|||
|
||||
//s5p6818
|
||||
{"nanopi3", 1, NanoPC_T3, "NanoPC-T3",""},
|
||||
{"nanopi3", 2, NanoPi_M3B, "NanoPi-M3B",""},
|
||||
{"nanopi3", 3, Smart6818, "Smart6818",""},
|
||||
{"nanopi3", 4, NanoPC_T3T, "NanoPC-T3T",""},
|
||||
{"nanopi3", 5, NanoPi_Fire3, "NanoPi-Fire3",""},
|
||||
{"nanopi3", 7, NanoPi_M3, "NanoPi-M3",""},
|
||||
|
@ -39,6 +41,10 @@ BoardHardwareInfo gAllBoardHardwareInfo[] = {
|
|||
{"sun8i", 0, NanoPi_Duo, "NanoPi-Duo", "4(0)"},
|
||||
{"sun8i", 0, NanoPi_NEO_Core, "NanoPi-NEO-Core", "5(0)"},
|
||||
{"sun8i", 0, NanoPi_K1, "NanoPi-K1", "6(0)"},
|
||||
{"sun8i", 0, NanoPi_Hero, "NanoPi-Hero", "7(0)"},
|
||||
{"sun8i", 0, NanoPi_Duo2, "NanoPi-Duo2", "8(0)"},
|
||||
{"sun8i", 0, NanoPi_R1, "NanoPi-R1", "9(0)"},
|
||||
|
||||
// kernel 4.x
|
||||
{"Allwinnersun8iFamily", 0, NanoPi_M1, "NanoPi-M1", "0(0)"},
|
||||
{"Allwinnersun8iFamily", 0, NanoPi_NEO, "NanoPi-NEO", "1(0)"},
|
||||
|
@ -47,7 +53,9 @@ BoardHardwareInfo gAllBoardHardwareInfo[] = {
|
|||
{"Allwinnersun8iFamily", 0, NanoPi_Duo, "NanoPi-Duo", "4(0)"},
|
||||
{"Allwinnersun8iFamily", 0, NanoPi_NEO_Core, "NanoPi-NEO-Core", "5(0)"},
|
||||
{"Allwinnersun8iFamily", 0, NanoPi_K1, "NanoPi-K1", "6(0)"},
|
||||
|
||||
{"Allwinnersun8iFamily", 0, NanoPi_Hero, "NanoPi-Hero", "7(0)"},
|
||||
{"Allwinnersun8iFamily", 0, NanoPi_Duo2, "NanoPi-Duo2", "8(0)"},
|
||||
{"Allwinnersun8iFamily", 0, NanoPi_R1, "NanoPi-R1", "9(0)"},
|
||||
|
||||
// a64
|
||||
{"sun50iw1p1", 0, NanoPi_A64, "NanoPi-A64", "0"},
|
||||
|
@ -69,6 +77,12 @@ BoardHardwareInfo gAllBoardHardwareInfo[] = {
|
|||
|
||||
//k2
|
||||
{"Amlogic", 0, NanoPi_K2, "NanoPi-K2", ""},
|
||||
|
||||
//t4
|
||||
{"nanopi4", 0, NanoPC_T4, "NanoPC-T4",""},
|
||||
{"nanopi4", 1, NanoPi_M4, "NanoPi-M4",""},
|
||||
{"nanopi4", 2, NanoPC_T4, "NanoPC-T4",""},
|
||||
{"nanopi4", 4, NanoPi_NEO4, "NanoPi-NEO4",""},
|
||||
};
|
||||
|
||||
static int getFieldValueInCpuInfo(char* hardware, int hardwareMaxLen, char* revision, int revisionMaxLen )
|
||||
|
@ -218,16 +232,22 @@ int getBoardType(BoardHardwareInfo** retBoardInfo) {
|
|||
if (ret == 0) {
|
||||
//LOGD("got boardid: %s\n", allwinnerBoardID);
|
||||
for (i=0; i<(sizeof(gAllBoardHardwareInfo)/sizeof(BoardHardwareInfo)); i++) {
|
||||
//LOGD("\t\t enum, start compare[%d]: %s <--> %s\n", i, gAllBoardHardwareInfo[i].kernelHardware, hardware);
|
||||
//LOGD("\t{{ enum, start compare[%d]: %s <--> %s\n", i, gAllBoardHardwareInfo[i].kernelHardware, hardware);
|
||||
if (strncasecmp(gAllBoardHardwareInfo[i].kernelHardware, hardware, strlen(gAllBoardHardwareInfo[i].kernelHardware)) == 0) {
|
||||
//LOGD("\t\tMATCH %s\n", hardware);
|
||||
if (strncasecmp(gAllBoardHardwareInfo[i].allwinnerBoardID, allwinnerBoardID, strlen(gAllBoardHardwareInfo[i].allwinnerBoardID)) == 0) {
|
||||
if (retBoardInfo != 0) {
|
||||
*retBoardInfo = &gAllBoardHardwareInfo[i];
|
||||
}
|
||||
//LOGD("\t\t\tMATCH board id: %s\n", allwinnerBoardID);
|
||||
return gAllBoardHardwareInfo[i].boardTypeId;
|
||||
} else {
|
||||
//LOGD("\t\t\tnot match board id: %s\n", allwinnerBoardID);
|
||||
}
|
||||
} else {
|
||||
//LOGD("\t\tnot match %s\n", hardware);
|
||||
}
|
||||
//LOGD("\t\t enum, end compare[%d]\n", i);
|
||||
//LOGD("\t}} enum, end compare[%d]\n", i);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -39,6 +39,8 @@ typedef struct {
|
|||
//s5p6818
|
||||
#define S5P6818_BASE (6818)
|
||||
#define NanoPC_T3 (S5P6818_BASE+1)
|
||||
#define NanoPi_M3B (S5P6818_BASE+2)
|
||||
#define Smart6818 (S5P6818_BASE+3)
|
||||
#define NanoPC_T3T (S5P6818_BASE+4)
|
||||
#define NanoPi_Fire3 (S5P6818_BASE+5)
|
||||
#define NanoPi_M3 (S5P6818_BASE+7)
|
||||
|
@ -64,12 +66,21 @@ typedef struct {
|
|||
#define NanoPi_NEO_Core2 (ALLWINNER_BASE+11)
|
||||
#define NanoPi_K1 (ALLWINNER_BASE+12)
|
||||
#define NanoPi_K1_Plus (ALLWINNER_BASE+13)
|
||||
#define ALLWINNER_MAX NanoPi_K1_Plus
|
||||
#define NanoPi_Hero (ALLWINNER_BASE+14)
|
||||
#define NanoPi_Duo2 (ALLWINNER_BASE+15)
|
||||
#define NanoPi_R1 (ALLWINNER_BASE+16)
|
||||
#define ALLWINNER_MAX NanoPi_R1
|
||||
|
||||
//amlogic
|
||||
#define AMLOGIC_BASE (8000)
|
||||
#define NanoPi_K2 (AMLOGIC_BASE+1)
|
||||
|
||||
//rk3399
|
||||
#define RK3399_BASE (9000)
|
||||
#define NanoPC_T4 (RK3399_BASE+1)
|
||||
#define NanoPi_M4 (RK3399_BASE+2)
|
||||
#define NanoPi_NEO4 (RK3399_BASE+3)
|
||||
|
||||
extern int getBoardType(BoardHardwareInfo** retBoardInfo);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -382,7 +382,7 @@ static int pinToGpio_duo [MAX_PIN_COUNT] ={
|
|||
-1, 12, //11, 12
|
||||
11, 4, //13, 14
|
||||
5, 203, //15, 16
|
||||
-1, -1, //17, 18
|
||||
-1,363, //17, 18
|
||||
-1, -1, //19, 20
|
||||
-1, -1, //21, 22
|
||||
-1, -1, //23, 24
|
||||
|
@ -406,7 +406,41 @@ static int pinToGpio_duo [MAX_PIN_COUNT] ={
|
|||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
// wPi number to /sys/gpio number
|
||||
static int pinToGpio_duo2 [MAX_PIN_COUNT] ={
|
||||
16, //0
|
||||
/* 32 Pin */
|
||||
-1, 14, //1, 2
|
||||
13, -1, //3, 4
|
||||
-1, -1, //5, 6
|
||||
15,198, //7, 8
|
||||
-1,199, //9, 10
|
||||
-1, 12, //11, 12
|
||||
11, 4, //13, 14
|
||||
5,203, //15, 16
|
||||
-1,363, //17, 18
|
||||
-1, -1, //19, 20
|
||||
-1, -1, //21, 22
|
||||
-1, -1, //23, 24
|
||||
-1, -1, //25, 26
|
||||
-1, -1, //27, 28
|
||||
-1, -1, //29, 30
|
||||
-1, -1, //31, 32
|
||||
/* ---------nanopi duo end----------- */
|
||||
|
||||
-1, -1, //33, 34
|
||||
-1, -1, //35, 36
|
||||
|
||||
/* UART0 Tx,Rx */
|
||||
-1, -1, //37, 38
|
||||
|
||||
/* 39~63 */
|
||||
-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,
|
||||
|
||||
/* 64~73 */
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
// wPi number to /sys/gpio number
|
||||
static int pinToGpio_neocore [MAX_PIN_COUNT] ={
|
||||
|
@ -440,9 +474,6 @@ static int pinToGpio_neocore [MAX_PIN_COUNT] ={
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
static int pinTobcm [64] ={
|
||||
19, 18, //map to BCM GPIO0,1
|
||||
|
@ -555,8 +586,6 @@ static int physToGpio_neocore [MAX_PIN_COUNT] ={
|
|||
-1, //73
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int physToGpio_m1 [MAX_PIN_COUNT] ={
|
||||
-1, // 0
|
||||
-1, -1, // 1, 2
|
||||
|
@ -586,7 +615,6 @@ static int physToGpio_m1 [MAX_PIN_COUNT] ={
|
|||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
|
||||
// phys pin number to /sys/gpio number
|
||||
static int physToGpio_duo [MAX_PIN_COUNT] ={
|
||||
-1, //0
|
||||
|
@ -596,7 +624,7 @@ static int physToGpio_duo [MAX_PIN_COUNT] ={
|
|||
-1, -1, //5, 6
|
||||
-1, -1, //7, 8
|
||||
-1, -1, //9, 10
|
||||
198,-1, //11, 12
|
||||
198,363, //11, 12
|
||||
199,-1, //13, 14
|
||||
15, -1, //15, 16
|
||||
16, -1, //17, 18
|
||||
|
@ -622,6 +650,44 @@ static int physToGpio_duo [MAX_PIN_COUNT] ={
|
|||
/* 64~73 */
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
|
||||
// phys pin number to /sys/gpio number
|
||||
static int physToGpio_duo2 [MAX_PIN_COUNT] ={
|
||||
-1, //0
|
||||
/* 32 Pin */
|
||||
-1, 5, //1, 2
|
||||
-1, 4, //3, 4
|
||||
-1, -1, //5, 6
|
||||
-1, 11, //7, 8
|
||||
363, 12, //9, 10
|
||||
203, 13, //11, 12
|
||||
-1, 14, //13, 14
|
||||
-1, 16, //15, 16
|
||||
-1, 15, //17, 18
|
||||
-1, 199, //19, 20
|
||||
-1, 198, //21, 22
|
||||
-1, -1, //23, 24
|
||||
-1, -1, //25, 26
|
||||
-1, -1, //27, 28
|
||||
-1, -1, //29, 30
|
||||
-1, -1, //31, 32
|
||||
/* ---------nanopi duo end----------- */
|
||||
|
||||
-1, -1, //33, 34
|
||||
-1, -1, //35, 36
|
||||
|
||||
/* UART0 Tx,Rx */
|
||||
-1, -1, //37, 38
|
||||
|
||||
/* 39~63 */
|
||||
-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,
|
||||
|
||||
/* 64~73 */
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
static int syspin_neo [MAX_PIN_COUNT] ={
|
||||
|
@ -673,6 +739,17 @@ static int syspin_duo [MAX_PIN_COUNT] ={
|
|||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
static int syspin_duo2 [MAX_PIN_COUNT] ={
|
||||
-1, -1, 2, 3, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
/* 64~73 */
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
/*static int edge [MAX_PIN_COUNT] ={
|
||||
-1, -1, -1, -1, 4, -1, -1, 7, //support the INT
|
||||
|
@ -817,7 +894,6 @@ static int physToPin_duo [MAX_PIN_COUNT] = //return wiringPI pin //note: same as
|
|||
2, -1, //19, 20
|
||||
3, 16, //21, 22
|
||||
12, -1, //23, 24
|
||||
|
||||
13, -1, //25, 26
|
||||
-1, -1, //27, 28
|
||||
14, -1, //29, 30
|
||||
|
@ -836,6 +912,39 @@ static int physToPin_duo [MAX_PIN_COUNT] = //return wiringPI pin //note: same as
|
|||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
static int physToPin_duo2 [MAX_PIN_COUNT] = //return wiringPI pin //note: same as physToWpi
|
||||
{
|
||||
-1, // 0
|
||||
-1, 15, // 1, 2
|
||||
-1, 14, // 3, 4
|
||||
-1, -1, // 5, 6
|
||||
-1, 13, // 7, 8
|
||||
-1, 12, // 9, 10
|
||||
16, 3, //11, 12
|
||||
-1, 2, //13, 14
|
||||
-1, 0, //15, 16
|
||||
-1, 7, //17, 18
|
||||
-1, 9, //19, 20
|
||||
-1, 8, //21, 22
|
||||
-1, -1, //23, 24
|
||||
-1, -1, //25, 26
|
||||
-1, -1, //27, 28
|
||||
-1, -1, //29, 30
|
||||
-1, -1, //31, 32
|
||||
/* ---------nanopi duo end----------- */
|
||||
-1, -1, //33, 34
|
||||
-1, -1, //35, 36
|
||||
|
||||
-1, -1, //37, 38
|
||||
|
||||
/* 39~63 */
|
||||
-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,
|
||||
|
||||
/* 64~73 */
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
// pins available on pin out by banks
|
||||
static int BP_PIN_MASK[9][32] = //[BANK] [INDEX]
|
||||
{
|
||||
|
@ -1285,11 +1394,10 @@ int isA20(void) {
|
|||
|
||||
int piBoardRev(void) {
|
||||
BoardHardwareInfo* retBoardInfo;
|
||||
int boardId;
|
||||
boardId = getBoardType(&retBoardInfo);
|
||||
if (boardId >= 0) {
|
||||
if (boardId > ALLWINNER_BASE && boardId <= ALLWINNER_MAX
|
||||
&& boardId != NanoPi_A64) {
|
||||
int ret = getBoardType(&retBoardInfo);
|
||||
if (ret >= 0) {
|
||||
if (retBoardInfo->boardTypeId > ALLWINNER_BASE && retBoardInfo->boardTypeId <= ALLWINNER_MAX
|
||||
&& retBoardInfo->boardTypeId != NanoPi_A64) {
|
||||
version = BPRVER;
|
||||
if (wiringPiDebug)
|
||||
printf("piBoardRev: %d\n", version);
|
||||
|
@ -1313,19 +1421,14 @@ int piBoardRev(void) {
|
|||
*/
|
||||
|
||||
void piBoardId(int *model, int *rev, int *mem, int *maker, int *overVolted) {
|
||||
FILE *cpuFd;
|
||||
char line [120];
|
||||
char *c;
|
||||
|
||||
(void) piBoardRev(); // Call this first to make sure all's OK. Don't care about the result.
|
||||
|
||||
BoardHardwareInfo* retBoardInfo;
|
||||
int boardId;
|
||||
boardId = getBoardType(&retBoardInfo);
|
||||
if (boardId >= 0) {
|
||||
if (boardId > ALLWINNER_BASE && boardId <= ALLWINNER_MAX
|
||||
&& boardId != NanoPi_A64) {
|
||||
*model = boardId;
|
||||
int ret = getBoardType(&retBoardInfo);
|
||||
if (ret >= 0) {
|
||||
if (retBoardInfo->boardTypeId > ALLWINNER_BASE && retBoardInfo->boardTypeId <= ALLWINNER_MAX
|
||||
&& retBoardInfo->boardTypeId != NanoPi_A64) {
|
||||
*model = retBoardInfo->boardTypeId;
|
||||
*rev = PI_VERSION_1_2;
|
||||
*mem = 1024;
|
||||
*maker = PI_MAKER_FRIENDLYELEC;
|
||||
|
@ -1448,6 +1551,33 @@ int getAlt(int pin) {
|
|||
|
||||
}
|
||||
|
||||
int getAltSilence(int pin) {
|
||||
int alt;
|
||||
|
||||
if (pin >= MAX_PIN_COUNT || pin < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pinToGpio == 0 || physToGpio == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//printf("[%s:L%d] the pin:%d mode: %d is invaild,please check it over!\n", __func__, __LINE__, pin, wiringPiMode);
|
||||
if (wiringPiMode == WPI_MODE_PINS)
|
||||
pin = pinToGpio [pin];
|
||||
else if (wiringPiMode == WPI_MODE_PHYS)
|
||||
pin = physToGpio[pin];
|
||||
else if (wiringPiMode == WPI_MODE_GPIO) //pin = pinTobcm[pin];
|
||||
pin = pin;
|
||||
else return 0;
|
||||
|
||||
if (-1 == pin) {
|
||||
return -1;
|
||||
}
|
||||
alt = sunxi_get_gpio_mode(pin);
|
||||
return alt;
|
||||
}
|
||||
|
||||
/*
|
||||
* pwmSetMode:
|
||||
* Select the native "balanced" mode, or standard mark:space mode
|
||||
|
@ -1611,7 +1741,7 @@ void pinMode(int pin, int mode) {
|
|||
|
||||
if (pinToGpio == 0 || physToGpio == 0) {
|
||||
printf("please call wiringPiSetup first.\n");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// On-board pin
|
||||
|
@ -1736,9 +1866,12 @@ int digitalRead(int pin) {
|
|||
struct wiringPiNodeStruct *node = wiringPiNodes;
|
||||
int oldPin = pin;
|
||||
|
||||
if (wiringPiDebug)
|
||||
printf("Func: %s, Line: %d,pin:%d\n", __func__, __LINE__, pin);
|
||||
|
||||
if (pinToGpio == 0 || physToGpio == 0) {
|
||||
printf("please call wiringPiSetup first.\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pin > 0 && pin < MAX_PIN_COUNT) {
|
||||
|
@ -1802,8 +1935,49 @@ int digitalRead(int pin) {
|
|||
return LOW;
|
||||
return node->digitalRead(node, pin);
|
||||
}
|
||||
}
|
||||
|
||||
int digitalReadSilence(int pin) {
|
||||
char c;
|
||||
struct wiringPiNodeStruct *node = wiringPiNodes;
|
||||
int oldPin = pin;
|
||||
|
||||
if (pinToGpio == 0 || physToGpio == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pin > 0 && pin < MAX_PIN_COUNT) {
|
||||
if (wiringPiMode == WPI_MODE_GPIO_SYS) // Sys mode
|
||||
{
|
||||
if (pin == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sysFds [pin] == -1) {
|
||||
return LOW;
|
||||
}
|
||||
lseek(sysFds [pin], 0L, SEEK_SET);
|
||||
read(sysFds [pin], &c, 1);
|
||||
return (c == '0') ? LOW : HIGH;
|
||||
} else if (wiringPiMode == WPI_MODE_PINS) {
|
||||
pin = pinToGpio [pin];
|
||||
} else if (wiringPiMode == WPI_MODE_PHYS) {
|
||||
pin = physToGpio[pin];
|
||||
} else if (wiringPiMode == WPI_MODE_GPIO) {
|
||||
// pin = pinTobcm[pin];
|
||||
pin = pin;
|
||||
} else {
|
||||
return LOW;
|
||||
}
|
||||
if (-1 == pin) {
|
||||
return LOW;
|
||||
}
|
||||
return sunxi_digitalRead(pin);
|
||||
} else {
|
||||
if ((node = wiringPiFindNode(pin)) == NULL)
|
||||
return LOW;
|
||||
return node->digitalRead(node, pin);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2334,23 +2508,28 @@ int wiringPiSetup(void) {
|
|||
piBoardId(&model, &rev, &mem, &maker, &overVolted);
|
||||
wiringPiMode = WPI_MODE_PINS;
|
||||
|
||||
int boardId = model;
|
||||
if (boardId == NanoPi_M1 || boardId == NanoPi_M1_Plus || boardId == NanoPi_M1_Plus2 || boardId == NanoPi_K1_Plus) {
|
||||
int faBoardId = model;
|
||||
if (faBoardId == NanoPi_M1 || faBoardId == NanoPi_M1_Plus || faBoardId == NanoPi_M1_Plus2 || faBoardId == NanoPi_K1_Plus) {
|
||||
pinToGpio = pinToGpio_m1;
|
||||
physToGpio = physToGpio_m1;
|
||||
physToPin = physToPin_m1;
|
||||
syspin = syspin_m1;
|
||||
} else if (boardId == NanoPi_NEO || boardId == NanoPi_NEO_Air || boardId == NanoPi_NEO2 || boardId == NanoPi_NEO_Plus2) {
|
||||
} else if (faBoardId == NanoPi_NEO || faBoardId == NanoPi_NEO_Air || faBoardId == NanoPi_NEO2 || faBoardId == NanoPi_NEO_Plus2) {
|
||||
pinToGpio = pinToGpio_neo;
|
||||
physToGpio = physToGpio_neo;
|
||||
physToPin = physToPin_neo;
|
||||
syspin = syspin_neo;
|
||||
} else if (boardId == NanoPi_Duo) {
|
||||
} else if (faBoardId == NanoPi_Duo) {
|
||||
pinToGpio = pinToGpio_duo;
|
||||
physToGpio = physToGpio_duo;
|
||||
physToPin = physToPin_duo;
|
||||
syspin = syspin_duo;
|
||||
} else if (boardId == NanoPi_NEO_Core || boardId == NanoPi_NEO_Core2) {
|
||||
} else if (faBoardId == NanoPi_Duo2) {
|
||||
pinToGpio = pinToGpio_duo2;
|
||||
physToGpio = physToGpio_duo2;
|
||||
physToPin = physToPin_duo2;
|
||||
syspin = syspin_duo2;
|
||||
} else if (faBoardId == NanoPi_NEO_Core || faBoardId == NanoPi_NEO_Core2) {
|
||||
pinToGpio = pinToGpio_neocore;
|
||||
physToGpio = physToGpio_neocore;
|
||||
physToPin = physToPin_neocore;
|
||||
|
@ -2427,20 +2606,24 @@ int wiringPiSetupSys(void) {
|
|||
printf("wiringPi: wiringPiSetupSys called\n");
|
||||
|
||||
piBoardId(&model, &rev, &mem, &maker, &overVolted);
|
||||
int boardId = model;
|
||||
if (boardId == NanoPi_M1 || boardId == NanoPi_M1_Plus || boardId == NanoPi_M1_Plus2 || boardId == NanoPi_K1_Plus) {
|
||||
int faBoardId = model;
|
||||
if (faBoardId == NanoPi_M1 || faBoardId == NanoPi_M1_Plus || faBoardId == NanoPi_M1_Plus2 || faBoardId == NanoPi_K1_Plus) {
|
||||
pinToGpio = pinToGpio_m1;
|
||||
physToGpio = physToGpio_m1;
|
||||
physToPin = physToPin_m1;
|
||||
} else if (boardId == NanoPi_NEO || boardId == NanoPi_NEO_Air || boardId == NanoPi_NEO2 || boardId == NanoPi_NEO_Plus2) {
|
||||
} else if (faBoardId == NanoPi_NEO || faBoardId == NanoPi_NEO_Air || faBoardId == NanoPi_NEO2 || faBoardId == NanoPi_NEO_Plus2) {
|
||||
pinToGpio = pinToGpio_neo;
|
||||
physToGpio = physToGpio_neo;
|
||||
physToPin = physToPin_neo;
|
||||
} else if (boardId == NanoPi_Duo) {
|
||||
} else if (faBoardId == NanoPi_Duo) {
|
||||
pinToGpio = pinToGpio_duo;
|
||||
physToGpio = physToGpio_duo;
|
||||
physToPin = physToPin_duo;
|
||||
} else if (boardId == NanoPi_NEO_Core || boardId == NanoPi_NEO_Core2) {
|
||||
} else if (faBoardId == NanoPi_Duo2) {
|
||||
pinToGpio = pinToGpio_duo2;
|
||||
physToGpio = physToGpio_duo2;
|
||||
physToPin = physToPin_duo2;
|
||||
} else if (faBoardId == NanoPi_NEO_Core || faBoardId == NanoPi_NEO_Core2) {
|
||||
pinToGpio = pinToGpio_neocore;
|
||||
physToGpio = physToGpio_neocore;
|
||||
physToPin = physToPin_neocore;
|
||||
|
|
Loading…
Reference in New Issue