This commit is contained in:
Carlo Caione 2023-06-18 16:25:28 -05:00 committed by GitHub
commit bfb05d0253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 14 deletions

View file

@ -182,7 +182,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
@ -210,10 +210,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
@ -226,7 +230,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))
@ -252,6 +260,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)

View file

@ -53,7 +53,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
@ -75,7 +75,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
@ -100,7 +100,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
@ -122,7 +122,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");
@ -164,7 +164,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);
@ -192,7 +192,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);
@ -234,7 +234,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);
@ -264,6 +264,11 @@ void DEV_GPIO_Init(void)
EPD_CS_PIN = SPI0_CS0;
EPD_PWR_PIN = GPIO18;
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);
@ -325,7 +330,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");
@ -373,7 +378,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_PWR_PIN;

View file

@ -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"

View file

@ -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
#endif

View file

@ -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.
Examples\: This is the test program for the ink screen. You can see the specific usage method in it.