diff --git a/RaspberryPi_JetsonNano/c/Makefile b/RaspberryPi_JetsonNano/c/Makefile index dcd397df9..4254c2717 100644 --- a/RaspberryPi_JetsonNano/c/Makefile +++ b/RaspberryPi_JetsonNano/c/Makefile @@ -179,7 +179,7 @@ endif OBJ_C = $(wildcard ${OBJ_C_EPD} ${DIR_GUI}/*.c ${OBJ_C_Examples} ${DIR_Examples}/main.c ${DIR_Examples}/ImageData2.c ${DIR_Examples}/ImageData.c ${DIR_FONTS}/*.c ) OBJ_O = $(patsubst %.c,${DIR_BIN}/%.o,$(notdir ${OBJ_C})) RPI_DEV_C = $(wildcard $(DIR_BIN)/dev_hardware_SPI.o $(DIR_BIN)/RPI_sysfs_gpio.o $(DIR_BIN)/DEV_Config.o ) -JETSON_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.o $(DIR_BIN)/DEV_Config.o ) +JETSON_LIBRETECH_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.o $(DIR_BIN)/DEV_Config.o ) DEBUG = -D DEBUG @@ -207,10 +207,14 @@ else ifeq ($(USELIB_JETSONI), USE_HARDWARE_LIB) endif DEBUG_JETSONI = -D $(USELIB_JETSONI) -D JETSON +LIB_LIBRETECH = -lm +DEBUG_LIBRETECH = -D USE_DEV_LIB -D LIBRETECH_CC + .PHONY : RPI JETSON clean RPI:RPI_DEV RPI_epd JETSON: JETSON_DEV JETSON_epd +LIBRETECH: LIBRETECH_DEV LIBRETECH_epd TARGET = epd CC = gcc @@ -223,7 +227,11 @@ RPI_epd:${OBJ_O} JETSON_epd:${OBJ_O} echo $(@) - $(CC) $(CFLAGS) $(OBJ_O) $(JETSON_DEV_C) -o $(TARGET) $(LIB_JETSONI) $(DEBUG) + $(CC) $(CFLAGS) $(OBJ_O) $(JETSON_LIBRETECH_DEV_C) -o $(TARGET) $(LIB_JETSONI) $(DEBUG) + +LIBRETECH_epd:${OBJ_O} + echo $(@) + $(CC) $(CFLAGS) $(OBJ_O) $(JETSON_LIBRETECH_DEV_C) -o $(TARGET) $(LIB_LIBRETECH) $(DEBUG) $(shell mkdir -p $(DIR_BIN)) @@ -249,6 +257,11 @@ JETSON_DEV: $(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/sysfs_gpio.c -o $(DIR_BIN)/sysfs_gpio.o $(LIB_JETSONI) $(DEBUG) $(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_JETSONI) $(DEBUG) +LIBRETECH_DEV: + $(CC) $(CFLAGS) $(DEBUG_LIBRETECH) -c $(DIR_Config)/sysfs_software_spi.c -o $(DIR_BIN)/sysfs_software_spi.o $(LIB_LIBRETECH) $(DEBUG) + $(CC) $(CFLAGS) $(DEBUG_LIBRETECH) -c $(DIR_Config)/sysfs_gpio.c -o $(DIR_BIN)/sysfs_gpio.o $(LIB_LIBRETECH) $(DEBUG) + $(CC) $(CFLAGS) $(DEBUG_LIBRETECH) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_LIBRETECH) $(DEBUG) + clean : rm $(DIR_BIN)/*.* rm $(TARGET) diff --git a/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c b/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c index 08d6a87bb..1e6a5a80c 100644 --- a/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c +++ b/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c @@ -52,7 +52,7 @@ void DEV_Digital_Write(UWORD Pin, UBYTE Value) #endif #endif -#ifdef JETSON +#if defined(JETSON) || defined(LIBRETECH_CC) #ifdef USE_DEV_LIB SYSFS_GPIO_Write(Pin, Value); #elif USE_HARDWARE_LIB @@ -74,7 +74,7 @@ UBYTE DEV_Digital_Read(UWORD Pin) #endif #endif -#ifdef JETSON +#if defined(JETSON) || defined(LIBRETECH_CC) #ifdef USE_DEV_LIB Read_value = SYSFS_GPIO_Read(Pin); #elif USE_HARDWARE_LIB @@ -99,7 +99,7 @@ void DEV_SPI_WriteByte(uint8_t Value) #endif #endif -#ifdef JETSON +#if defined(JETSON) || defined(LIBRETECH_CC) #ifdef USE_DEV_LIB SYSFS_software_spi_transfer(Value); #elif USE_HARDWARE_LIB @@ -121,7 +121,7 @@ void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len) #endif #endif -#ifdef JETSON +#if defined(JETSON) || defined(LIBRETECH_CC) #ifdef USE_DEV_LIB //JETSON nano waits for hardware SPI Debug("not support"); @@ -163,7 +163,7 @@ void DEV_GPIO_Mode(UWORD Pin, UWORD Mode) #endif #endif -#ifdef JETSON +#if defined(JETSON) || defined(LIBRETECH_CC) #ifdef USE_DEV_LIB SYSFS_GPIO_Export(Pin); SYSFS_GPIO_Direction(Pin, Mode); @@ -191,7 +191,7 @@ void DEV_Delay_ms(UDOUBLE xms) #endif #endif -#ifdef JETSON +#if defined(JETSON) || defined(LIBRETECH_CC) UDOUBLE i; for(i=0; i < xms; i++) { usleep(1000); @@ -233,7 +233,7 @@ static int DEV_Equipment_Testing(void) return -1; } #endif -#ifdef JETSON +#if defined(JETSON) || defined(LIBRETECH_CC) char system[] = {"Ubuntu"}; if (strstr(issue_str, system) != NULL) { printf("%s\n", system); @@ -261,6 +261,11 @@ void DEV_GPIO_Init(void) EPD_DC_PIN = GPIO25; EPD_CS_PIN = SPI0_CS0; EPD_BUSY_PIN = GPIO24; +#elif LIBRETECH_CC + EPD_RST_PIN = 620; // 523 + 97 GPIOX_18 + EPD_DC_PIN = 619; // 523 + 96 GPIOX_17 + EPD_CS_PIN = 612; // 523 + 89 GPIOX_10 + EPD_BUSY_PIN = 617; // 523 + 94 GPIOX_15 #endif DEV_GPIO_Mode(EPD_RST_PIN, 1); @@ -320,7 +325,7 @@ UBYTE DEV_Module_Init(void) DEV_HARDWARE_SPI_setSpeed(10000000); #endif -#elif JETSON +#elif defined(JETSON) || defined(LIBRETECH_CC) #ifdef USE_DEV_LIB DEV_GPIO_Init(); printf("Software spi\r\n"); @@ -365,7 +370,7 @@ void DEV_Module_Exit(void) DEV_Digital_Write(EPD_RST_PIN, 0); #endif -#elif JETSON +#elif defined(JETSON) || defined(LIBRETECH_CC) #ifdef USE_DEV_LIB SYSFS_GPIO_Unexport(EPD_CS_PIN); SYSFS_GPIO_Unexport(EPD_DC_PIN); diff --git a/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.h b/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.h index 105ea1964..3dee35092 100644 --- a/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.h +++ b/RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.h @@ -68,7 +68,7 @@ #endif #endif -#ifdef JETSON +#if defined(JETSON) || defined(LIBRETECH_CC) #ifdef USE_DEV_LIB #include "sysfs_gpio.h" #include "sysfs_software_spi.h" diff --git a/RaspberryPi_JetsonNano/c/lib/Config/sysfs_gpio.h b/RaspberryPi_JetsonNano/c/lib/Config/sysfs_gpio.h index cb24d84fe..b7674a8bf 100644 --- a/RaspberryPi_JetsonNano/c/lib/Config/sysfs_gpio.h +++ b/RaspberryPi_JetsonNano/c/lib/Config/sysfs_gpio.h @@ -49,6 +49,8 @@ #define SYSFS_GPIO_Debug(__info,...) #endif +#if defined(JETSON) + // BCM GPIO for Jetson nano #define GPIO4 216 // 7, 4 #define GPIO17 50 // 11, 17 @@ -75,10 +77,18 @@ // 22PIN + 2PIN UART0 + 2PIN I2C0 + 2PIN I2C // + 2PIN 3V3 + 2PIN 5V + 8PIN GND = 40PIN +#elif defined(LIBRETECH_CC) + +#define SPI0_MOSI 610 // 523 + 87 GPIOX_8 +#define SPI0_MISO 611 // 523 + 88 GPIOX_9 +#define SPI0_SCK 613 // 523 + 90 GPIOX_11 + +#endif + int SYSFS_GPIO_Export(int Pin); int SYSFS_GPIO_Unexport(int Pin); int SYSFS_GPIO_Direction(int Pin, int Dir); int SYSFS_GPIO_Read(int Pin); int SYSFS_GPIO_Write(int Pin, int value); -#endif \ No newline at end of file +#endif diff --git a/RaspberryPi_JetsonNano/c/readme_EN.txt b/RaspberryPi_JetsonNano/c/readme_EN.txt index 144fc7cc4..c19c64af5 100644 --- a/RaspberryPi_JetsonNano/c/readme_EN.txt +++ b/RaspberryPi_JetsonNano/c/readme_EN.txt @@ -29,6 +29,17 @@ DC -> 25 RST -> 17 BUSY -> 24 +For Libretech-cc (AML S905X) board: + +VCC -> PIN2 +GND -> PIN6 +DIN -> PIN19 (GPIOX_8) +CLK -> PIN23 (GPIOX_11) +CS -> PIN24 (GPIOX_10) +DC -> PIN29 (GPIOX_17) +RST -> PIN31 (GPIOX_18) +BUSY -> PIN18 (GPIOX_15) + 3. Basic use: Since this project is a comprehensive project, you may need to read the following for use: You can see many test functions and macro definition Settings in main.c. @@ -83,4 +94,4 @@ Config\: This directory is a hardware interface layer file. You can see many def font24CN: 32*41 \lib\E-paper\: This screen is the ink screen driver function; -Examples\: This is the test program for the ink screen. You can see the specific usage method in it. \ No newline at end of file +Examples\: This is the test program for the ink screen. You can see the specific usage method in it.