Browse Source

Support Orange Pi R1

pull/11/head
leeboby 5 years ago
parent
commit
975bbdba63
  1. 4
      examples/blink.c
  2. 5
      gpio/Makefile
  3. 40
      gpio/OrangePi.c
  4. 4
      wiringPi/Makefile

4
examples/blink.c

@ -1,8 +1,8 @@
#include <stdio.h> #include <stdio.h>
#include <wiringPi.h> #include <wiringPi.h>
//#define NUM 17 #define NUM 17
#define NUM 28 //#define NUM 28
int main (void) int main (void)
{ {

5
gpio/Makefile

@ -47,6 +47,7 @@ ifeq ($(PLATFORM),)
#PLATFORM = OrangePi_A64 #PLATFORM = OrangePi_A64
#PLATFORM = OrangePi_H5 #PLATFORM = OrangePi_H5
#PLATFORM = OrangePi_ZERO #PLATFORM = OrangePi_ZERO
#PLATFORM = OrangePi_R1
#PLATFORM = OrangePi_H3 #PLATFORM = OrangePi_H3
#PLATFORM = OrangePi_LITE2 #PLATFORM = OrangePi_LITE2
PLATFORM = OrangePi_ONEPLUS PLATFORM = OrangePi_ONEPLUS
@ -86,7 +87,7 @@ EXTRA_CFLAGS = -DCONFIG_ORANGEPI_A64
EXTRA_CFLAGS += -DCONFIG_ORANGEPI EXTRA_CFLAGS += -DCONFIG_ORANGEPI
endif endif
ifeq ($(PLATFORM), OrangePi_ZERO) ifneq ($(findstring $(PLATFORM), "OrangePi_ZERO" "OrangePi_R1"),)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_ZERO EXTRA_CFLAGS = -DCONFIG_ORANGEPI_ZERO
EXTRA_CFLAGS += -DCONFIG_ORANGEPI EXTRA_CFLAGS += -DCONFIG_ORANGEPI
endif endif
@ -150,7 +151,7 @@ ifneq ($(findstring $(PLATFORM), "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_
SRC += OrangePi.c SRC += OrangePi.c
endif endif
ifeq ($(PLATFORM), OrangePi_ZERO) ifneq ($(findstring $(PLATFORM), "OrangePi_ZERO" "OrangePi_R1"),)
SRC += OrangePi.c SRC += OrangePi.c
endif endif

40
gpio/OrangePi.c

@ -518,7 +518,7 @@ char *physNames[64] =
" 3.3V", "SCK.1 ", " 3.3V", "SCK.1 ",
" MOSI.1", "GND ", " MOSI.1", "GND ",
" MISO.1", "RTS.2 ", " MISO.1", "RTS.2 ",
" SCLK.1", "CS.1 ", " SCLK.1", "CE.1 ",
" GND", "PA10 ", " GND", "PA10 ",
NULL, NULL, NULL, NULL,
@ -575,16 +575,16 @@ char *physNames [64] =
" SCL.1", "GND ", " SCL.1", "GND ",
" PWM1", "PD21 ", " PWM1", "PD21 ",
" GND", "PD22 ", " GND", "PD22 ",
" RXD3", "PC09 ", " RXD.3", "PC09 ",
" TXD3", "GND ", " TXD.3", "GND ",
" CTS3", "PC08 ", " CTS.3", "PC08 ",
" 3.3V", "PC07 ", " 3.3V", "PC07 ",
" MOSI.0", "GND ", " MOSI.0", "GND ",
" MISO.0", "RTS3 ", " MISO.0", "RTS.3 ",
" SCLK.0", "CE.0 ", " SCLK.0", "CE.0 ",
" GND", "PH03 ", " GND", "PH03 ",
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
@ -636,10 +636,10 @@ char *physNames [64] =
" 3.3V", "5V ", " 3.3V", "5V ",
" SDA.0", "5V ", " SDA.0", "5V ",
" SCL.0", "GND ", " SCL.0", "GND ",
" PWM0", "PL02 ", " PWM.0", "PL02 ",
" GND", "PL03 ", " GND", "PL03 ",
" RXD3", "PD18 ", " RXD.3", "PD18 ",
" TXD3", "GND ", " TXD.3", "GND ",
" PL10", "PD15 ", " PL10", "PD15 ",
" 3.3V", "PD16 ", " 3.3V", "PD16 ",
" MOSI.1", "GND ", " MOSI.1", "GND ",
@ -647,7 +647,7 @@ char *physNames [64] =
" SCLK.1", "CE.1 ", " SCLK.1", "CE.1 ",
" GND", "PL08 ", " GND", "PL08 ",
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
@ -680,7 +680,7 @@ int pinToGpioOrangePi [64] =
67, 39, //10,11 67, 39, //10,11
40, 83, //12,13 40, 83, //12,13
41, 42, //14,15 41, 42, //14,15
133, 154, //16,17 133, 154, //16,17
50, 68, //18,19 50, 68, //18,19
69, 76, //20,21 69, 76, //20,21
70, 71, //22,23 70, 71, //22,23
@ -693,6 +693,7 @@ int pinToGpioOrangePi [64] =
-1, -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, -1, -1, -1, // ... 47
-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,// ... 63
}; };
int physToWpi[64] = int physToWpi[64] =
{ {
-1, // 0 -1, // 0
@ -876,11 +877,14 @@ void OrangePiReadAll(void)
#elif CONFIG_ORANGEPI_ZEROPLUS2_H3 #elif CONFIG_ORANGEPI_ZEROPLUS2_H3
printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_ZERO #elif CONFIG_ORANGEPI_ZERO
printf (" +------+-----+----------+------+---+ OPi Zero +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_A64 #elif CONFIG_ORANGEPI_A64
printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3 #elif CONFIG_ORANGEPI_LITE2
printf (" +------+-----+----------+------+---+OrangePiH6+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi H6 +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_3
printf (" +------+-----+----------+------+---+ OPi 3 +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_RK3399
#elif CONFIG_ORANGEPI_RK3399 #elif CONFIG_ORANGEPI_RK3399
printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_4 #elif CONFIG_ORANGEPI_4
@ -916,11 +920,13 @@ void OrangePiReadAll(void)
#elif CONFIG_ORANGEPI_ZEROPLUS2_H3 #elif CONFIG_ORANGEPI_ZEROPLUS2_H3
printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ZEROPLUS 2+---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_ZERO #elif CONFIG_ORANGEPI_ZERO
printf (" +------+-----+----------+------+---+ OPi Zero +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi H2 +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_A64 #elif CONFIG_ORANGEPI_A64
printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi Win +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_LITE2 || CONFIG_ORANGEPI_3 #elif CONFIG_ORANGEPI_LITE2
printf (" +------+-----+----------+------+---+OrangePiH6+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+ OPi H6 +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_3
printf (" +------+-----+----------+------+---+ OPi 3 +---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_RK3399 #elif CONFIG_ORANGEPI_RK3399
printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n"); printf (" +------+-----+----------+------+---+OPi RK3399+---+------+----------+-----+------+\n");
#elif CONFIG_ORANGEPI_4 #elif CONFIG_ORANGEPI_4

4
wiringPi/Makefile

@ -90,7 +90,7 @@ EXTRA_CFLAGS = -DCONFIG_ORANGEPI_H3
EXTRA_CFLAGS += -DCONFIG_ORANGEPI EXTRA_CFLAGS += -DCONFIG_ORANGEPI
endif endif
ifeq ($(PLATFORM), OrangePi_ZERO) ifneq ($(findstring $(PLATFORM), "OrangePi_ZERO" "OrangePi_R1"),)
EXTRA_CFLAGS = -DCONFIG_ORANGEPI_ZERO EXTRA_CFLAGS = -DCONFIG_ORANGEPI_ZERO
EXTRA_CFLAGS += -DCONFIG_ORANGEPI EXTRA_CFLAGS += -DCONFIG_ORANGEPI
endif endif
@ -170,7 +170,7 @@ ifneq ($(findstring $(PLATFORM), "OrangePi_ONE_H3" "OrangePi_LITE_H3" "OrangePi_
SRC += OrangePi.c SRC += OrangePi.c
endif endif
ifeq ($(PLATFORM), OrangePi_ZERO) ifneq ($(findstring $(PLATFORM), "OrangePi_ZERO" "OrangePi_R1"),)
SRC += OrangePi.c SRC += OrangePi.c
endif endif

Loading…
Cancel
Save