Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the Libretech-CC board (Amlogic S905X SoC) #285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions RaspberryPi_JetsonNano/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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))

Expand All @@ -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)
Expand Down
23 changes: 14 additions & 9 deletions RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion RaspberryPi_JetsonNano/c/lib/Config/DEV_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 11 additions & 1 deletion RaspberryPi_JetsonNano/c/lib/Config/sysfs_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
13 changes: 12 additions & 1 deletion RaspberryPi_JetsonNano/c/readme_EN.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.