diff --git a/build b/build index e004b7c..07b672f 100755 --- a/build +++ b/build @@ -49,7 +49,7 @@ select_boards() local choice local call=${1} - boards=("OrangePi_R1" "OrangePi_ZERO" "OrangePi_H3" "OrangePi_ZEROPLUS2_H3" "OrangePi_PC2" "OrangePi_PRIME" "OrangePi_ZEROPLUS" "OrangePi_ZEROPLUS2_H5" "OrangePi_A64" "OrangePi_3" "OrangePi_LITE2" "OrangePi_ONEPLUS" "OrangePi_4" "OrangePi_RK3399") + boards=("OrangePi_R1" "OrangePi_ZERO" "OrangePi_PC" "OrangePi_PLUS" "OrangePi_PCPLUS" "OrangePi_PLUS2E" "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_ZEROPLUS2_H3" "OrangePi_PC2" "OrangePi_PRIME" "OrangePi_ZEROPLUS" "OrangePi_ZEROPLUS2_H5" "OrangePi_A64" "OrangePi_3" "OrangePi_LITE2" "OrangePi_ONEPLUS" "OrangePi_4" "OrangePi_RK3399") printf "All available boards:\n" for var in ${boards[@]} ; do diff --git a/examples/blink.c b/examples/blink.c index d031b47..8e10710 100644 --- a/examples/blink.c +++ b/examples/blink.c @@ -1,8 +1,8 @@ #include #include -#define NUM 17 -//#define NUM 28 +//#define NUM 17 +#define NUM 28 int main (void) { diff --git a/gpio/Makefile b/gpio/Makefile index a85bc4f..f68ceaf 100755 --- a/gpio/Makefile +++ b/gpio/Makefile @@ -61,6 +61,11 @@ EXTRA_CFLAGS = -DCONFIG_ORANGEPI_2G_IOT EXTRA_CFLAGS += -DCONFIG_ORANGEPI endif +ifneq ($(findstring $(PLATFORM), "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_PC" "OrangePi_PLUS" "OrangePi_PCPLUS" "OrangePi_PLUS2E"),) +EXTRA_CFLAGS = -DCONFIG_ORANGEPI_H3 +EXTRA_CFLAGS += -DCONFIG_ORANGEPI +endif + ifeq ($(PLATFORM), OrangePi_PC2) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_PC2 EXTRA_CFLAGS += -DCONFIG_ORANGEPI @@ -81,22 +86,12 @@ EXTRA_CFLAGS = -DCONFIG_ORANGEPI_A64 EXTRA_CFLAGS += -DCONFIG_ORANGEPI endif -ifeq ($(PLATFORM), OrangePi_H3) -EXTRA_CFLAGS = -DCONFIG_ORANGEPI_H3 -EXTRA_CFLAGS += -DCONFIG_ORANGEPI -endif - ifeq ($(PLATFORM), OrangePi_ZERO) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_ZERO EXTRA_CFLAGS += -DCONFIG_ORANGEPI endif -ifeq ($(PLATFORM), OrangePi_LITE2) -EXTRA_CFLAGS = -DCONFIG_ORANGEPI_LITE2 -EXTRA_CFLAGS += -DCONFIG_ORANGEPI -endif - -ifeq ($(PLATFORM), OrangePi_ONEPLUS) +ifneq ($(findstring $(PLATFORM), "OrangePi_ONEPLUS" "OrangePi_LITE2"),) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_LITE2 EXTRA_CFLAGS += -DCONFIG_ORANGEPI endif @@ -151,7 +146,7 @@ ifeq ($(PLATFORM), OrangePi_A64) SRC += OrangePi.c endif -ifeq ($(PLATFORM), OrangePi_H3) +ifneq ($(findstring $(PLATFORM), "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_PC" "OrangePi_PLUS" "OrangePi_PCPLUS" "OrangePi_PLUS2E"),) SRC += OrangePi.c endif @@ -159,11 +154,7 @@ ifeq ($(PLATFORM), OrangePi_ZERO) SRC += OrangePi.c endif -ifeq ($(PLATFORM), OrangePi_LITE2) - SRC += OrangePi.c -endif - -ifeq ($(PLATFORM), OrangePi_ONEPLUS) +ifneq ($(findstring $(PLATFORM), "OrangePi_ONEPLUS" "OrangePi_LITE2"),) SRC += OrangePi.c endif diff --git a/gpio/OrangePi.c b/gpio/OrangePi.c index 21bf26a..c6ab5d4 100755 --- a/gpio/OrangePi.c +++ b/gpio/OrangePi.c @@ -332,38 +332,38 @@ int physToWpi [64] = #ifdef CONFIG_ORANGEPI_H3 int physToWpi[64] = { - -1, // 0 - -1, -1, // 1, 2 - 0, -1, //3, 4 - 1, -1, //5, 6 - 2, 3, //7, 8 - -1, 4, //9,10 - 5, 6, //11,12 - 7, -1, //13,14 - 8, 9, //15,16 - -1, 10, //17,18 - 11, -1, //19,20 - 12, 13, //21,22 + -1, //0 + -1, -1, // 1, 2 + 0, -1, // 3, 4 + 1, -1, // 5, 6 + 2, 3, // 7, 8 + -1, 4, // 9, 10 + 5, 6, //11, 12 + 7, -1, //13, 14 + 8, 9, //15, 16 + -1, 10, //17, 18 + 11, -1, //19, 20 + 12, 13, //21, 22 14, 15, //23, 24 - -1, 16, // 25, 26 - - 17, 18, //27, 28 - 19, -1, //29, 30 - 20, 21, //31, 32 + -1, 16, //25, 26 + 17, 18, //27, 28 + 19, -1, //29, 30 + 20, 21, //31, 32 22, -1, //33, 34 23, 24, //35, 36 25, 26, //37, 38 -1, 27, //39, 40 28, 29, //41, 42 + // Padding: - -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, -1, -1, -1, -1, -1, -1, -1, // ... 56 + -1, -1, -1, -1, -1, -1, -1, // ... 63 }; char *physNames[64] = { - NULL, + NULL, " 3.3V", "5V ", " SDA.0", "5V ", @@ -386,15 +386,20 @@ char *physNames[64] = " PA20", "TXD.1 ", " GND", "RXD.1 ", " PA04", "PA05 ", + 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 +#endif /* H3 */ #if CONFIG_ORANGEPI_ZEROPLUS2_H3 || CONFIG_ORANGEPI_ZEROPLUS2_H5 int physToWpi [64] = //return wiringPI pin @@ -855,6 +860,7 @@ void OrangePiReadAll(void) int pin; int tmp = wiringPiDebug; wiringPiDebug = FALSE; + #ifdef CONFIG_ORANGEPI_PC2 printf (" +------+-----+----------+------+---+ OPi PC2 +---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_PRIME @@ -864,23 +870,23 @@ void OrangePiReadAll(void) #elif CONFIG_ORANGEPI_ZEROPLUS2_H5 printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_2G_IOT - printf (" +-----+-----+----------+------+---+OrangePi 2G-IOT+---+---+------+---------+-----+--+\n"); + printf (" +------+-----+----------+------+---+ 2G-IOT +---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_H3 printf (" +------+-----+----------+------+---+OrangePiH3+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_ZEROPLUS2_H3 printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_ZERO - printf (" +------+-----+----------+------+---+OrangePi Zero+---+---+------+---------+-----+--+\n"); + printf (" +------+-----+----------+------+---+ OPi Zero +---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_A64 - printf (" +------+-----+----------+------+---+OrangePi Win/Win+ +---+---+------+---------+-----+--+\n"); + printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3 printf (" +------+-----+----------+------+---+OrangePiH6+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_RK3399 - printf (" +------+-----+----------+------+---+OrangePi RK3399---+---+------+---------+-----+--+\n"); + printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_4 - printf (" +------+-----+----------+------+---+OrangePi 4---+---+------+---------+-----+--+\n"); - + printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n"); #endif + printf (" | GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |\n"); printf (" +------+-----+----------+------+---+----++----+---+------+----------+-----+------+\n"); @@ -894,6 +900,7 @@ void OrangePiReadAll(void) printf (" +------+-----+----------+------+---+----++----+---+------+----------+-----+------+\n"); printf (" | GPIO | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | GPIO |\n"); + #ifdef CONFIG_ORANGEPI_PC2 printf (" +------+-----+----------+------+---+ OPi PC2 +---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_PRIME @@ -903,22 +910,22 @@ void OrangePiReadAll(void) #elif CONFIG_ORANGEPI_ZEROPLUS2_H5 printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_2G_IOT - printf (" +------+-----+----------+------+---+OrangePi 2G-IOT+---+------+----------+-----+-----+\n"); + printf (" +------+-----+----------+------+---+ 2G-IOT +---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_H3 printf (" +------+-----+----------+------+---+OrangePiH3+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_ZEROPLUS2_H3 printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_ZERO - printf (" +------+-----+----------+------+---+OrangePi Zero+---+------+----------+-----+-----+\n"); + printf (" +------+-----+----------+------+---+ OPi Zero +---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_A64 - printf (" +------+-----+----------+------+---+OrangePi Win/Win+ +---+------+----------+-----+-----+\n"); + printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3 printf (" +------+-----+----------+------+---+OrangePiH6+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_RK3399 - printf (" +------+-----+----------+------+---+OrangePi RK3399---+---+------+---------+-----+--+\n"); + printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); #elif CONFIG_ORANGEPI_4 - printf (" +------+-----+----------+------+---+OrangePi 4---+---+------+---------+-----+--+\n"); - + printf (" +------+-----+----------+------+---+OrangePi 4+---+---+--+----------+-----+------+\n"); #endif + wiringPiDebug = tmp; } diff --git a/wiringPi/Makefile b/wiringPi/Makefile index 6e9f12d..2620a3a 100755 --- a/wiringPi/Makefile +++ b/wiringPi/Makefile @@ -85,7 +85,7 @@ EXTRA_CFLAGS = -DCONFIG_ORANGEPI_A64 EXTRA_CFLAGS += -DCONFIG_ORANGEPI endif -ifeq ($(PLATFORM), OrangePi_H3) +ifneq ($(findstring $(PLATFORM), "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_PC" "OrangePi_PLUS" "OrangePi_PCPLUS" "OrangePi_PLUS2E"),) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_H3 EXTRA_CFLAGS += -DCONFIG_ORANGEPI endif @@ -95,12 +95,7 @@ EXTRA_CFLAGS = -DCONFIG_ORANGEPI_ZERO EXTRA_CFLAGS += -DCONFIG_ORANGEPI endif -ifeq ($(PLATFORM), OrangePi_LITE2) -EXTRA_CFLAGS = -DCONFIG_ORANGEPI_LITE2 -EXTRA_CFLAGS += -DCONFIG_ORANGEPI -endif - -ifeq ($(PLATFORM), OrangePi_ONEPLUS) +ifneq ($(findstring $(PLATFORM), "OrangePi_ONEPLUS" "OrangePi_LITE2"),) EXTRA_CFLAGS = -DCONFIG_ORANGEPI_LITE2 EXTRA_CFLAGS += -DCONFIG_ORANGEPI endif @@ -171,7 +166,7 @@ ifeq ($(PLATFORM), OrangePi_A64) SRC += OrangePi.c endif -ifeq ($(PLATFORM), OrangePi_H3) +ifneq ($(findstring $(PLATFORM), "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_PC" "OrangePi_PLUS" "OrangePi_PCPLUS" "OrangePi_PLUS2E"),) SRC += OrangePi.c endif @@ -179,11 +174,7 @@ ifeq ($(PLATFORM), OrangePi_ZERO) SRC += OrangePi.c endif -ifeq ($(PLATFORM), OrangePi_LITE2) -SRC += OrangePi.c -endif - -ifeq ($(PLATFORM), OrangePi_ONEPLUS) +ifneq ($(findstring $(PLATFORM), "OrangePi_ONEPLUS" "OrangePi_LITE2"),) SRC += OrangePi.c endif @@ -309,3 +300,5 @@ wpiExtensions.o: mcp23s17.h sr595.h pcf8574.h pcf8591.h mcp3002.h mcp3004.h wpiExtensions.o: mcp4802.h mcp3422.h max31855.h max5322.h ads1115.h sn3218.h wpiExtensions.o: drcSerial.h pseudoPins.h bmp180.h htu21d.h ds18b20.h wpiExtensions.o: wpiExtensions.h + + diff --git a/wiringPi/OrangePi.c b/wiringPi/OrangePi.c index 38d6ef1..055b03b 100755 --- a/wiringPi/OrangePi.c +++ b/wiringPi/OrangePi.c @@ -513,7 +513,7 @@ int pinToGpioOrangePi [64] = 19, 18, 7, 8, // Rev 2: New GPIOs 8 though 11 wpi 17 - 20 200, 9, 10, 201, 20, // B+ wpi 21, 22, 23, 24, 25 198, 199, // wpi 26, 27 - 4, 5, //PA4, PA5(PWM0) wpi 28, 29 + -1, -1, //PA4, PA5(PWM0) wpi 28, 29 -1, -1, // B+ wpi 30, 31 @@ -1189,7 +1189,7 @@ const char *piModelNames[6] = "OrangePi Win/Winplus", #elif CONFIG_ORANGEPI_H3 || CONFIG_ORANGEPI_ZEROPLUS2_H3 "OrangePi H3 family", -#elif CONFIG_ORANGEPI_ZERO +#elif CONFIG_ORANGEPI_ZERO || CONFIG_ORANGEPI_R1 "OrangePi H2+ family", #endif }; @@ -1861,7 +1861,7 @@ int isOrangePi(void) #elif CONFIG_ORANGEPI_H3 || CONFIG_ORANGEPI_ZEROPLUS2_H3 /* Support: OrangePi Win/Win plus */ char *OrangePi_string = "sun8i"; -#elif CONFIG_ORANGEPI_ZERO +#elif CONFIG_ORANGEPI_ZERO || CONFIG_ORANGEPI_R1 /* Support: OrangePi zero */ char *OrangePi_string = "sun8i"; #elif CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3