fix 2.9_V2 & 4.01f
This commit is contained in:
parent
49260094e6
commit
7c368a22af
65 changed files with 4803 additions and 335 deletions
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @filename : epd2in9_V2.cpp
|
||||
* @brief : Implements for e-paper library
|
||||
* @author : Yehui from Waveshare
|
||||
* @author :
|
||||
*
|
||||
* Copyright (C) Waveshare Nov 9 2020
|
||||
*
|
||||
|
@ -27,6 +27,29 @@
|
|||
#include <stdlib.h>
|
||||
#include "epd2in9_V2.h"
|
||||
|
||||
unsigned char WF_PARTIAL_2IN9[159] =
|
||||
{
|
||||
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0A,0x0,0x0,0x0,0x0,0x0,0x2,
|
||||
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x22,0x17,0x41,0xB0,0x32,0x36,
|
||||
};
|
||||
|
||||
Epd::~Epd() {
|
||||
};
|
||||
|
||||
|
@ -62,16 +85,10 @@ int Epd::Init() {
|
|||
|
||||
SetMemoryArea(0, 0, width-1, height-1);
|
||||
|
||||
SendCommand(0x3C); //BorderWavefrom
|
||||
SendData(0x05);
|
||||
|
||||
SendCommand(0x21); // Display update control
|
||||
SendData(0x00);
|
||||
SendData(0x80);
|
||||
|
||||
SendCommand(0x18); //Read built-in temperature sensor
|
||||
SendData(0x80);
|
||||
|
||||
SetMemoryPointer(0, 0);
|
||||
WaitUntilIdle();
|
||||
/* EPD hardware init end */
|
||||
|
@ -204,9 +221,27 @@ void Epd::SetFrameMemory_Partial(
|
|||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(10);
|
||||
|
||||
SetLut();
|
||||
SendCommand(0x37);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x40);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0x3C); //BorderWavefrom
|
||||
SendData(0x80);
|
||||
|
||||
SendCommand(0x22);
|
||||
SendData(0xC0);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
|
||||
SetMemoryArea(x, y, x_end, y_end);
|
||||
SetMemoryPointer(x, y);
|
||||
SendCommand(0x24);
|
||||
|
@ -289,11 +324,19 @@ void Epd::DisplayFrame(void) {
|
|||
|
||||
void Epd::DisplayFrame_Partial(void) {
|
||||
SendCommand(0x22);
|
||||
SendData(0xFF);
|
||||
SendData(0x0F);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
void Epd::SetLut(void) {
|
||||
unsigned char count;
|
||||
SendCommand(0x32);
|
||||
for(count=0; count<153; count++)
|
||||
SendData(WF_PARTIAL_2IN9[count]);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: private function to specify the memory area for data R/W
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @filename : epd2in9_V2.h
|
||||
* @brief : Header file for e-paper display library epd2in9_V2.cpp
|
||||
* @author : Yehui from Waveshare
|
||||
* @author :
|
||||
*
|
||||
* Copyright (C) Waveshare Nov 09 2020
|
||||
*
|
||||
|
@ -72,6 +72,7 @@ private:
|
|||
unsigned int cs_pin;
|
||||
unsigned int busy_pin;
|
||||
|
||||
void SetLut(void);
|
||||
void SetMemoryArea(int x_start, int y_start, int x_end, int y_end);
|
||||
void SetMemoryPointer(int x, int y);
|
||||
};
|
||||
|
|
|
@ -127,5 +127,5 @@ void loop() {
|
|||
epd.SetFrameMemory_Partial(paint.GetImage(), 80, 72, paint.GetWidth(), paint.GetHeight());
|
||||
epd.DisplayFrame_Partial();
|
||||
|
||||
delay(500);
|
||||
// delay(300);
|
||||
}
|
||||
|
|
82
RaspberryPi_JetsonNano/c/Makefile.save
Normal file
82
RaspberryPi_JetsonNano/c/Makefile.save
Normal file
|
@ -0,0 +1,82 @@
|
|||
DIR_Config = ./lib/Config
|
||||
DIR_EPD = ./lib/e-Paper
|
||||
DIR_FONTS = ./lib/Fonts
|
||||
DIR_GUI = ./lib/GUI
|
||||
DIR_Examples = ./examples
|
||||
DIR_BIN = ./bin
|
||||
|
||||
OBJ_C = $(wildcard ${DIR_EPD}/*.c ${DIR_GUI}/*.c ${DIR_Examples}/*.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 )
|
||||
|
||||
$(shell if[! -e $(DIR_BIN)];then mkdir -p $(DIR_BIN); fi)
|
||||
$(shell if[! -e $(DIR_BIN)];then mkdir -p $(DIR_BIN); fi)
|
||||
DEBUG = -D DEBUG
|
||||
|
||||
# USELIB_RPI = USE_BCM2835_LIB
|
||||
USELIB_RPI = USE_WIRINGPI_LIB
|
||||
# USELIB_RPI = USE_DEV_LIB
|
||||
|
||||
ifeq ($(USELIB_RPI), USE_BCM2835_LIB)
|
||||
LIB_RPI = -lbcm2835 -lm
|
||||
else ifeq ($(USELIB_RPI), USE_WIRINGPI_LIB)
|
||||
LIB_RPI = -lwiringPi -lm
|
||||
else ifeq ($(USELIB_RPI), USE_DEV_LIB)
|
||||
LIB_RPI = -lm
|
||||
endif
|
||||
DEBUG_RPI = -D $(USELIB_RPI) -D RPI
|
||||
|
||||
USELIB_JETSONI = USE_DEV_LIB
|
||||
# USELIB_JETSONI = USE_HARDWARE_LIB
|
||||
ifeq ($(USELIB_JETSONI), USE_DEV_LIB)
|
||||
LIB_JETSONI = -lm
|
||||
else ifeq ($(USELIB_JETSONI), USE_HARDWARE_LIB)
|
||||
LIB_JETSONI = -lm
|
||||
endif
|
||||
DEBUG_JETSONI = -D $(USELIB_JETSONI) -D JETSON
|
||||
|
||||
.PHONY : RPI JETSON clean
|
||||
|
||||
RPI:RPI_DEV RPI_epd
|
||||
JETSON: JETSON_DEV JETSON_epd
|
||||
|
||||
TARGET = epd
|
||||
CC = gcc
|
||||
MSG = -g -O0 -Wall
|
||||
CFLAGS += $(MSG)
|
||||
|
||||
RPI_epd:${OBJ_O}
|
||||
echo $(@)
|
||||
$(CC) $(CFLAGS) -D RPI $(OBJ_O) $(RPI_DEV_C) -o $(TARGET) $(LIB_RPI) $(DEBUG)
|
||||
|
||||
JETSON_epd:${OBJ_O}
|
||||
echo $(@)
|
||||
$(CC) $(CFLAGS) $(OBJ_O) $(JETSON_DEV_C) -o $(TARGET) $(LIB_JETSONI) $(DEBUG)
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_Examples)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD) $(DEBUG)
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_EPD)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) $(DEBUG)
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_FONTS)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@ $(DEBUG)
|
||||
|
||||
${DIR_BIN}/%.o:$(DIR_GUI)/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) $(DEBUG)
|
||||
|
||||
RPI_DEV:
|
||||
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/dev_hardware_SPI.c -o $(DIR_BIN)/dev_hardware_SPI.o $(LIB_RPI) $(DEBUG)
|
||||
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/RPI_sysfs_gpio.c -o $(DIR_BIN)/RPI_sysfs_gpio.o $(LIB_RPI) $(DEBUG)
|
||||
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_RPI) $(DEBUG)
|
||||
|
||||
JETSON_DEV:
|
||||
$(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/sysfs_software_spi.c -o $(DIR_BIN)/sysfs_software_spi.o $(LIB_JETSONI) $(DEBUG)
|
||||
$(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)
|
||||
|
||||
clean :
|
||||
rm $(DIR_BIN)/*.*
|
||||
rm $(TARGET)
|
||||
|
161
RaspberryPi_JetsonNano/c/examples/EPD_10in2b_test.c
Normal file
161
RaspberryPi_JetsonNano/c/examples/EPD_10in2b_test.c
Normal file
|
@ -0,0 +1,161 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_10.2inb_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 10.2inch b e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-20
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_10in2b.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_10in2b_test(void)
|
||||
{
|
||||
printf("EPD_10IN2b_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_10IN2b_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_10IN2b_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
UDOUBLE Imagesize = ((EPD_10IN2b_WIDTH % 8 == 0)? (EPD_10IN2b_WIDTH / 8 ): (EPD_10IN2b_WIDTH / 8 + 1)) * EPD_10IN2b_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_10IN2b_WIDTH, EPD_10IN2b_HEIGHT, 0, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(RedImage, EPD_10IN2b_WIDTH, EPD_10IN2b_HEIGHT, 0, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_10IN2b_WIDTH, EPD_10IN2b_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_10IN2b_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 0, 0);
|
||||
EPD_10IN2b_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_10IN2b_WIDTH, EPD_10IN2b_HEIGHT, 0, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_10IN2b_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
|
||||
Paint_DrawCircle(480, 480, 110, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(750, 270, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(200, 310, 90, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
|
||||
Paint_DrawLine(200, 310, 480, 480, BLACK, DOT_PIXEL_3X3, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(480, 480, 750, 270, BLACK, DOT_PIXEL_3X3, LINE_STYLE_DOTTED);
|
||||
|
||||
// Red Image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawLine(750, 270, 200, 310, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawCircle(480, 480, 150, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(480, 480, 110, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(750, 270, 70, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(200, 310, 40, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
EPD_10IN2b_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_10IN2b_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_10IN2b_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
150
RaspberryPi_JetsonNano/c/examples/EPD_13in3_test.c
Normal file
150
RaspberryPi_JetsonNano/c/examples/EPD_13in3_test.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_13IN3_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 13.3inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-20
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_13in3.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_13in3_test(void)
|
||||
{
|
||||
printf("EPD_13IN3_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_13IN3_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_13IN3_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UDOUBLE Imagesize = ((EPD_13IN3_WIDTH % 8 == 0)? (EPD_13IN3_WIDTH / 8 ): (EPD_13IN3_WIDTH / 8 + 1)) * EPD_13IN3_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_13IN3_WIDTH, EPD_13IN3_HEIGHT, 0, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_13IN3_WIDTH, EPD_13IN3_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_13IN3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 0, 0);
|
||||
EPD_13IN3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_13IN3_WIDTH, EPD_13IN3_HEIGHT, 0, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_13IN3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_13IN3_WIDTH, EPD_13IN3_HEIGHT, 0, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
Paint_DrawCircle(200, 310, 90, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(200, 310, 40, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(480, 480, 150, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(480, 480, 110, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(750, 270, 100, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(750, 270, 70, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(200, 310, 480, 480, BLACK, DOT_PIXEL_3X3, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(480, 480, 750, 270, BLACK, DOT_PIXEL_3X3, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(750, 270, 200, 310, BLACK, DOT_PIXEL_3X3, LINE_STYLE_SOLID);
|
||||
|
||||
EPD_13IN3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_13IN3_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_13IN3_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
134
RaspberryPi_JetsonNano/c/examples/EPD_1in54_DES_test.c
Normal file
134
RaspberryPi_JetsonNano/c/examples/EPD_1in54_DES_test.c
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1IN54_DES_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch DES e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_1in54_DES.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_1in54_DES_test(void)
|
||||
{
|
||||
printf("EPD_1IN54_DES_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_1IN54_DES_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_1IN54_DES_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_1IN54_DES_WIDTH % 8 == 0)? (EPD_1IN54_DES_WIDTH / 8 ): (EPD_1IN54_DES_WIDTH / 8 + 1)) * EPD_1IN54_DES_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_DES_WIDTH, EPD_1IN54_DES_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_DES_WIDTH, EPD_1IN54_DES_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_1IN54_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/1in54.bmp", 0, 0);
|
||||
EPD_1IN54_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_DES_WIDTH, EPD_1IN54_DES_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_1in54);
|
||||
|
||||
EPD_1IN54_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_1IN54_DES_WIDTH, EPD_1IN54_DES_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(45, 10, 45, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(20, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 130, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(45, 35, 10, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawString_EN(5, 65, "waveshare", &Font20, BLACK, WHITE);
|
||||
Paint_DrawNum(5, 90, 123456789, &Font20, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(5, 105, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_1IN54_DES_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_1IN54_DES_Sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
|
@ -111,7 +111,7 @@ int EPD_1in54_test(void)
|
|||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 //Partial refresh, example shows time
|
||||
#if 1 //Partial refresh, example shows time
|
||||
printf("Partial refresh\r\n");
|
||||
EPD_1IN54_Init(EPD_1IN54_PART);
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
|
135
RaspberryPi_JetsonNano/c/examples/EPD_2in13_DES_test.c
Normal file
135
RaspberryPi_JetsonNano/c/examples/EPD_2in13_DES_test.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN13_DES_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch DES e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13_DES.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in13_DES_test(void)
|
||||
{
|
||||
printf("EPD_2IN13_DES_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_DES_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN13_DES_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN13_DES_WIDTH % 8 == 0)? (EPD_2IN13_DES_WIDTH / 8 ): (EPD_2IN13_DES_WIDTH / 8 + 1)) * EPD_2IN13_DES_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_DES_WIDTH, EPD_2IN13_DES_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_DES_WIDTH, EPD_2IN13_DES_HEIGHT, 90, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN13_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13.bmp", 0, 0);
|
||||
EPD_2IN13_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_DES_WIDTH, EPD_2IN13_DES_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2IN13_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN13_DES_WIDTH, EPD_2IN13_DES_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 65, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawString_EN(140, 35, "wave", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(140, 51, "share", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(140, 75, 12345, &Font16, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(140, 10, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 63, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN13_DES_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN13_DES_Sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
|
@ -59,7 +59,7 @@ int EPD_2in13_V3_test(void)
|
|||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 0, WHITE);
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 0, 0);
|
||||
|
@ -73,7 +73,7 @@ int EPD_2in13_V3_test(void)
|
|||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
#if 1 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
|
|
@ -68,9 +68,9 @@ int EPD_2in66b_test(void)
|
|||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/f_b.bmp", 0, 0);
|
||||
GUI_ReadBmp("./pic/2in66b_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/f_r.bmp", 0, 0);
|
||||
GUI_ReadBmp("./pic/2in66b_r.bmp", 0, 0);
|
||||
EPD_2IN66B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
|
|
@ -142,7 +142,6 @@ int EPD_2in7b_V2_test(void)
|
|||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
DEV_Delay_ms(12000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ int EPD_2in7b_test(void)
|
|||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
DEV_Delay_ms(12000);
|
||||
DEV_Delay_ms(2000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
138
RaspberryPi_JetsonNano/c/examples/EPD_2in9_DES_test.c
Normal file
138
RaspberryPi_JetsonNano/c/examples/EPD_2in9_DES_test.c
Normal file
|
@ -0,0 +1,138 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2IN9_DES_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch DES e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in9_DES.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in9_DES_test(void)
|
||||
{
|
||||
printf("EPD_2IN9_DES_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN9_DES_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN9_DES_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2IN9_DES_WIDTH % 8 == 0)? (EPD_2IN9_DES_WIDTH / 8 ): (EPD_2IN9_DES_WIDTH / 8 + 1)) * EPD_2IN9_DES_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_DES_WIDTH, EPD_2IN9_DES_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_DES_WIDTH, EPD_2IN9_DES_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN9_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in9.bmp", 0, 0);
|
||||
EPD_2IN9_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_DES_WIDTH, EPD_2IN9_DES_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in9);
|
||||
|
||||
EPD_2IN9_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN9_DES_WIDTH, EPD_2IN9_DES_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN9_DES_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN9_DES_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN9_DES_Sleep();
|
||||
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
int EPD_2in9_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN9_V2_test Demo\r\n");
|
||||
printf("_EPD_2IN9_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
@ -173,4 +173,3 @@ int EPD_2in9_V2_test(void)
|
|||
DEV_Module_Exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ int EPD_3in7_test(void)
|
|||
#endif
|
||||
|
||||
#if 1 // partial update, just 1 Gray mode
|
||||
Paint_NewImage(BlackImage, 50, 120, 270, WHITE);
|
||||
EPD_3IN7_1Gray_Init(); //init 1 Gray mode
|
||||
EPD_3IN7_1Gray_Clear();
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
@ -123,7 +124,7 @@ int EPD_3in7_test(void)
|
|||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
UBYTE num = 15;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
|
@ -139,8 +140,9 @@ int EPD_3in7_test(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(300, 0, 479, 80, WHITE);
|
||||
Paint_DrawTime(300, 20, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawRectangle(1, 1, 120, 50, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawTime(10, 15, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
|
@ -148,8 +150,7 @@ int EPD_3in7_test(void)
|
|||
}
|
||||
|
||||
printf("Part refresh...\r\n");
|
||||
EPD_3IN7_1Gray_Display(BlackImage);
|
||||
// EPD_3IN7_1Gray_Display_Part(BlackImage, 0, 0, 279, 180);
|
||||
EPD_3IN7_1Gray_Display_Part(BlackImage, 40, 30, 90, 150); // Xstart must be a multiple of 8
|
||||
DEV_Delay_ms(500);
|
||||
}
|
||||
|
||||
|
|
158
RaspberryPi_JetsonNano/c/examples/EPD_4in37b_test.c
Normal file
158
RaspberryPi_JetsonNano/c/examples/EPD_4in37b_test.c
Normal file
|
@ -0,0 +1,158 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in37b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.37inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-07
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_4in37b.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_4in37b_test(void)
|
||||
{
|
||||
printf("EPD_4IN37B_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_4IN37B_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_4IN37B_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage, *RedImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_4IN37B_WIDTH % 8 == 0)? (EPD_4IN37B_WIDTH / 8 ): (EPD_4IN37B_WIDTH / 8 + 1)) * EPD_4IN37B_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
if((RedImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for red memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_4IN37B_WIDTH, EPD_4IN37B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_NewImage(RedImage, EPD_4IN37B_WIDTH, EPD_4IN37B_HEIGHT, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/4in37b_b.bmp", 0, 0);
|
||||
Paint_SelectImage(RedImage);
|
||||
GUI_ReadBmp("./pic/4in37b_r.bmp", 0, 0);
|
||||
EPD_4IN37B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
|
||||
//1.Draw black image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
EPD_4IN37B_Display(BlackImage, RedImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //partial data transmission
|
||||
Paint_NewImage(BlackImage, 120, 300, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_NewImage(RedImage, 120, 300, 270, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawLine(1, 1, 300, 1, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(300, 1, 300, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(300, 120, 1, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(1, 120, 1, 1, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawLine(20, 95, 70, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
//2.Draw red image
|
||||
Paint_SelectImage(RedImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 20, "partial transmission", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
|
||||
EPD_4IN37B_Display_Part(BlackImage, RedImage, 20, 100, 140, 400);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_4IN37B_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_4IN37B_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -111,6 +111,7 @@ int EPD_5in65f_test(void)
|
|||
#endif
|
||||
printf("e-Paper Clear...\r\n");
|
||||
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
|
||||
EPD_5IN65F_Clear(EPD_5IN65F_WHITE);
|
||||
DEV_Delay_ms(1000);
|
||||
|
||||
printf("e-Paper Sleep...\r\n");
|
||||
|
|
123
RaspberryPi_JetsonNano/c/examples/EPD_5in84_test.c
Normal file
123
RaspberryPi_JetsonNano/c/examples/EPD_5in84_test.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in84_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.84inch e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-08
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_5in84.h"
|
||||
#include "time.h"
|
||||
|
||||
int EPD_5in84_test(void)
|
||||
{
|
||||
printf("EPD_5IN84_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_5in84_Init();
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_5in84_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(500);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UWORD Imagesize = ((EPD_5in84_WIDTH % 8 == 0)? (EPD_5in84_WIDTH / 8 ): (EPD_5in84_WIDTH / 8 + 1)) * EPD_5in84_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_5in84_WIDTH, EPD_5in84_HEIGHT, 0, WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/5in84_2.bmp", 0, 0);
|
||||
EPD_5in84_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_5in84);
|
||||
EPD_5in84_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
//1.Select Image
|
||||
printf("SelectImage:BlackImage\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0, " ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
printf("EPD_Display\r\n");
|
||||
EPD_5in84_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_5in84_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_5in84_Sleep();
|
||||
free(BlackImage);
|
||||
BlackImage = NULL;
|
||||
DEV_Delay_ms(2000);//important, at least 2s
|
||||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -117,7 +117,6 @@ int EPD_7in5_HD_test(void)
|
|||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
#include "Debug.h"
|
||||
#include <stdlib.h> // malloc() free()
|
||||
|
||||
int EPD_1in54_DES_test(void);
|
||||
int EPD_2in13_DES_test(void);
|
||||
int EPD_2in9_DES_test(void);
|
||||
|
||||
int EPD_1in02d_test(void);
|
||||
|
||||
|
@ -73,6 +76,8 @@ int EPD_4in2_test(void);
|
|||
int EPD_4in2bc_test(void);
|
||||
int EPD_4in2b_V2_test(void);
|
||||
|
||||
int EPD_4in37b_test(void);
|
||||
|
||||
int EPD_5in65f_test(void);
|
||||
|
||||
int EPD_5in83_test(void);
|
||||
|
@ -80,10 +85,16 @@ int EPD_5in83_V2_test(void);
|
|||
int EPD_5in83bc_test(void);
|
||||
int EPD_5in83b_V2_test(void);
|
||||
|
||||
int EPD_5in84_test(void);
|
||||
|
||||
int EPD_7in5_test(void);
|
||||
int EPD_7in5_HD_test(void);
|
||||
int EPD_7in5_V2_test(void);
|
||||
int EPD_7in5bc_test(void);
|
||||
int EPD_7in5b_V2_test(void);
|
||||
int EPD_7in5b_HD_test(void);
|
||||
|
||||
int EPD_10in2b_test(void);
|
||||
|
||||
int EPD_13in3_test(void);
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -70,6 +70,8 @@ extern const unsigned char gImage_5in83bc_ry[];
|
|||
extern const unsigned char gImage_5in83b_V2_b[];
|
||||
extern const unsigned char gImage_5in83b_V2_r[];
|
||||
|
||||
extern const unsigned char gImage_5in84[];
|
||||
|
||||
extern const unsigned char gImage_7in5[];
|
||||
extern const unsigned char gImage_7in5_V2[];
|
||||
extern const unsigned char gImage_7in5bc_b[];
|
||||
|
|
|
@ -11,7 +11,6 @@ void Handler(int signo)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Exception handling:ctrl + c
|
||||
|
@ -21,6 +20,14 @@ int main(void)
|
|||
// return -1;
|
||||
// }
|
||||
|
||||
// while(1) {
|
||||
// DEV_Delay_ms(10000);
|
||||
// }
|
||||
|
||||
// EPD_1in54_DES_test();
|
||||
// EPD_2in13_DES_test();
|
||||
// EPD_2in9_DES_test();
|
||||
|
||||
// EPD_1in02d_test();
|
||||
|
||||
// EPD_1in54_test();
|
||||
|
@ -34,11 +41,11 @@ int main(void)
|
|||
|
||||
// EPD_2in7_test();
|
||||
// EPD_2in7b_test();
|
||||
|
||||
// EPD_2in7b_V2_test();
|
||||
|
||||
// EPD_2in9_test();
|
||||
// EPD_2in9_V2_test();
|
||||
|
||||
// EPD_2in9bc_test();
|
||||
// EPD_2in9b_V3_test();
|
||||
// EPD_2in9d_test();
|
||||
|
@ -58,6 +65,8 @@ int main(void)
|
|||
// EPD_4in2bc_test();
|
||||
// EPD_4in2b_V2_test();
|
||||
|
||||
// EPD_4in37b_test();
|
||||
|
||||
// EPD_5in65f_test();
|
||||
|
||||
// EPD_5in83_test();
|
||||
|
@ -76,6 +85,10 @@ int main(void)
|
|||
// EPD_7in5_HD_test();
|
||||
// EPD_7in5b_HD_test();
|
||||
|
||||
// EPD_10in2b_test();
|
||||
|
||||
// EPD_13in3_test();
|
||||
|
||||
// DEV_Module_Exit();
|
||||
|
||||
return 0;
|
||||
|
|
241
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_10in2b.c
Normal file
241
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_10in2b.c
Normal file
|
@ -0,0 +1,241 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_10in2b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 10.2inch b e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-20
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_10in2b.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_10IN2b_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_10IN2b_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_10IN2b_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_10IN2b_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(1)
|
||||
{ //=1 BUSY
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN)==0)
|
||||
break;
|
||||
DEV_Delay_ms(20);
|
||||
}
|
||||
DEV_Delay_ms(20);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_10IN2b_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_10IN2b_SendCommand(0x22); //Display Update Control
|
||||
EPD_10IN2b_SendData(0xC7);
|
||||
EPD_10IN2b_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_10IN2b_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_10IN2b_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_10IN2b_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_10IN2b_SendData(Xstart & 0xFF);
|
||||
EPD_10IN2b_SendData((Xstart>>8) & 0x03);
|
||||
EPD_10IN2b_SendData(Xend & 0xFF);
|
||||
EPD_10IN2b_SendData((Xend>>8) & 0x03);
|
||||
|
||||
EPD_10IN2b_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_10IN2b_SendData(Ystart & 0xFF);
|
||||
EPD_10IN2b_SendData((Ystart>>8) & 0x03);
|
||||
EPD_10IN2b_SendData(Yend & 0xFF);
|
||||
EPD_10IN2b_SendData((Yend>>8) & 0x03);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_10IN2b_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_10IN2b_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_10IN2b_SendData(Xstart & 0xFF);
|
||||
EPD_10IN2b_SendData((Xstart>>8) & 0x03);
|
||||
|
||||
EPD_10IN2b_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_10IN2b_SendData(Ystart & 0xFF);
|
||||
EPD_10IN2b_SendData((Ystart>>8) & 0x03);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_10IN2b_Init(void)
|
||||
{
|
||||
EPD_10IN2b_Reset();
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_10IN2b_ReadBusy();
|
||||
EPD_10IN2b_SendCommand(0x12); //SWRESET
|
||||
EPD_10IN2b_ReadBusy();
|
||||
|
||||
EPD_10IN2b_SendCommand(0x0C); //set soft start
|
||||
EPD_10IN2b_SendData(0xAE);
|
||||
EPD_10IN2b_SendData(0xC7);
|
||||
EPD_10IN2b_SendData(0xC3);
|
||||
EPD_10IN2b_SendData(0xC0);
|
||||
EPD_10IN2b_SendData(0x80);
|
||||
|
||||
EPD_10IN2b_SendCommand(0x01); // drive output control
|
||||
EPD_10IN2b_SendData(0xA7); // Y
|
||||
EPD_10IN2b_SendData(0x02); // Y
|
||||
EPD_10IN2b_SendData(0x00);
|
||||
|
||||
EPD_10IN2b_SendCommand(0x11); // data entry mode
|
||||
EPD_10IN2b_SendData(0x03); // X-mode x+ y-
|
||||
|
||||
EPD_10IN2b_SetWindows(0, 0, EPD_10IN2b_WIDTH-1, EPD_10IN2b_HEIGHT-1);
|
||||
|
||||
EPD_10IN2b_SendCommand(0x3C); // Border Border setting
|
||||
EPD_10IN2b_SendData(0x01);
|
||||
|
||||
EPD_10IN2b_SendCommand(0x18); // use the internal temperature sensor
|
||||
EPD_10IN2b_SendData(0x80);
|
||||
|
||||
EPD_10IN2b_SendCommand(0x22);
|
||||
EPD_10IN2b_SendData(0xB1);
|
||||
EPD_10IN2b_SendCommand(0x20);
|
||||
|
||||
EPD_10IN2b_SetCursor(0, 0);
|
||||
|
||||
EPD_10IN2b_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_10IN2b_Clear(void)
|
||||
{
|
||||
UWORD i, j;
|
||||
UWORD height = EPD_10IN2b_HEIGHT;
|
||||
UWORD width = EPD_10IN2b_WIDTH/8;
|
||||
|
||||
EPD_10IN2b_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
for(j=0; j<width; j++)
|
||||
EPD_10IN2b_SendData(0xff);
|
||||
}
|
||||
EPD_10IN2b_SendCommand(0x26); //write RAM for black(0)/white (1)
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
for(j=0; j<width; j++)
|
||||
EPD_10IN2b_SendData(0x00);
|
||||
}
|
||||
EPD_10IN2b_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_10IN2b_Display(UBYTE *Image, UBYTE *RedImage)
|
||||
{
|
||||
UWORD i, j;
|
||||
UWORD height = EPD_10IN2b_HEIGHT;
|
||||
UWORD width = EPD_10IN2b_WIDTH/8;
|
||||
|
||||
EPD_10IN2b_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
for(j=0; j<width; j++)
|
||||
EPD_10IN2b_SendData(Image[j + i*width]);
|
||||
}
|
||||
EPD_10IN2b_SendCommand(0x26); //write RAM for black(0)/white (1)
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
for(j=0; j<width; j++)
|
||||
EPD_10IN2b_SendData(~RedImage[j + i*width]);
|
||||
}
|
||||
EPD_10IN2b_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_10IN2b_Sleep(void)
|
||||
{
|
||||
EPD_10IN2b_SendCommand(0x10); //enter deep sleep
|
||||
EPD_10IN2b_SendData(0x01);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_10in2b.h
Normal file
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_10in2b.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_10in2b.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 10.2inch b e-paper test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-20
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_10IN2b_H_
|
||||
#define __EPD_10IN2b_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_10IN2b_WIDTH 960
|
||||
#define EPD_10IN2b_HEIGHT 640
|
||||
|
||||
void EPD_10IN2b_Init(void);
|
||||
void EPD_10IN2b_Clear(void);
|
||||
void EPD_10IN2b_Display(UBYTE *Image, UBYTE *RedImage);
|
||||
void EPD_10IN2b_Sleep(void);
|
||||
|
||||
#endif
|
229
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_13in3.c
Normal file
229
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_13in3.c
Normal file
|
@ -0,0 +1,229 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_13in3.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 13.3inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-20
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_13in3.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_13IN3_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_13IN3_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_13IN3_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_13IN3_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(1)
|
||||
{ //=1 BUSY
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN)==0)
|
||||
break;
|
||||
DEV_Delay_ms(20);
|
||||
}
|
||||
DEV_Delay_ms(20);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_13IN3_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_13IN3_SendCommand(0x22); //Display Update Control
|
||||
EPD_13IN3_SendData(0xC7);
|
||||
EPD_13IN3_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_13IN3_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_13IN3_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_13IN3_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_13IN3_SendData(Xstart & 0xFF);
|
||||
EPD_13IN3_SendData((Xstart>>8) & 0x03);
|
||||
EPD_13IN3_SendData(Xend & 0xFF);
|
||||
EPD_13IN3_SendData((Xend>>8) & 0x03);
|
||||
|
||||
EPD_13IN3_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_13IN3_SendData(Ystart & 0xFF);
|
||||
EPD_13IN3_SendData((Ystart>>8) & 0x03);
|
||||
EPD_13IN3_SendData(Yend & 0xFF);
|
||||
EPD_13IN3_SendData((Yend>>8) & 0x03);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_13IN3_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_13IN3_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_13IN3_SendData(Xstart & 0xFF);
|
||||
EPD_13IN3_SendData((Xstart>>8) & 0x03);
|
||||
|
||||
EPD_13IN3_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_13IN3_SendData(Ystart & 0xFF);
|
||||
EPD_13IN3_SendData((Ystart>>8) & 0x03);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_13IN3_Init(void)
|
||||
{
|
||||
EPD_13IN3_Reset();
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_13IN3_ReadBusy();
|
||||
EPD_13IN3_SendCommand(0x12); //SWRESET
|
||||
EPD_13IN3_ReadBusy();
|
||||
|
||||
EPD_13IN3_SendCommand(0x0C); //set soft start
|
||||
EPD_13IN3_SendData(0xAE);
|
||||
EPD_13IN3_SendData(0xC7);
|
||||
EPD_13IN3_SendData(0xC3);
|
||||
EPD_13IN3_SendData(0xC0);
|
||||
EPD_13IN3_SendData(0x80);
|
||||
|
||||
EPD_13IN3_SendCommand(0x01); // drive output control
|
||||
EPD_13IN3_SendData(0xA7); // Y
|
||||
EPD_13IN3_SendData(0x02); // Y
|
||||
EPD_13IN3_SendData(0x00);
|
||||
|
||||
EPD_13IN3_SendCommand(0x11); // data entry mode
|
||||
EPD_13IN3_SendData(0x03); // X-mode x+ y-
|
||||
|
||||
EPD_13IN3_SetWindows(0, 0, EPD_13IN3_WIDTH-1, EPD_13IN3_HEIGHT-1);
|
||||
|
||||
EPD_13IN3_SendCommand(0x3C); // Border Border setting
|
||||
EPD_13IN3_SendData(0x01);
|
||||
|
||||
EPD_13IN3_SendCommand(0x18); // use the internal temperature sensor
|
||||
EPD_13IN3_SendData(0x80);
|
||||
|
||||
EPD_13IN3_SendCommand(0x22);
|
||||
EPD_13IN3_SendData(0xB1);
|
||||
EPD_13IN3_SendCommand(0x20);
|
||||
|
||||
EPD_13IN3_SetCursor(0, 0);
|
||||
|
||||
EPD_13IN3_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_13IN3_Clear(void)
|
||||
{
|
||||
UWORD i, j;
|
||||
UWORD height = EPD_13IN3_HEIGHT;
|
||||
UWORD width = EPD_13IN3_WIDTH/8;
|
||||
|
||||
EPD_13IN3_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
for(j=0; j<width; j++)
|
||||
EPD_13IN3_SendData(0xff);
|
||||
}
|
||||
EPD_13IN3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_13IN3_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD i, j;
|
||||
UWORD height = EPD_13IN3_HEIGHT;
|
||||
UWORD width = EPD_13IN3_WIDTH/8;
|
||||
|
||||
EPD_13IN3_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0; i<height; i++)
|
||||
{
|
||||
for(j=0; j<width; j++)
|
||||
EPD_13IN3_SendData(Image[j + i*width]);
|
||||
}
|
||||
EPD_13IN3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_13IN3_Sleep(void)
|
||||
{
|
||||
EPD_13IN3_SendCommand(0x10); //enter deep sleep
|
||||
EPD_13IN3_SendData(0x03);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_13in3.h
Normal file
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_13in3.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_13in3.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 13.3inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-20
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_13IN3_H_
|
||||
#define __EPD_13IN3_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_13IN3_WIDTH 960
|
||||
#define EPD_13IN3_HEIGHT 680
|
||||
|
||||
void EPD_13IN3_Init(void);
|
||||
void EPD_13IN3_Clear(void);
|
||||
void EPD_13IN3_Display(UBYTE *Image);
|
||||
void EPD_13IN3_Sleep(void);
|
||||
|
||||
#endif
|
173
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_1in54_DES.c
Normal file
173
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_1in54_DES.c
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54_DES.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch DES e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_1in54_DES.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_DES_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_DES_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_DES_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_DES_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(1)
|
||||
{ //=1 BUSY
|
||||
EPD_1IN54_DES_SendCommand(0x71);
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN)==1)
|
||||
break;
|
||||
DEV_Delay_ms(50);
|
||||
}
|
||||
DEV_Delay_ms(50);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_1IN54_DES_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_1IN54_DES_SendCommand(0x12); //Display Update Control
|
||||
EPD_1IN54_DES_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_DES_Init(void)
|
||||
{
|
||||
EPD_1IN54_DES_Reset();
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_1IN54_DES_SendCommand(0x04); //SWRESET
|
||||
EPD_1IN54_DES_ReadBusy();
|
||||
|
||||
EPD_1IN54_DES_SendCommand(0x00); //Driver output control
|
||||
EPD_1IN54_DES_SendData(0x1f);
|
||||
|
||||
EPD_1IN54_DES_SendCommand(0x50);
|
||||
EPD_1IN54_DES_SendData(0x97);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_DES_Clear(void)
|
||||
{
|
||||
UWORD i;
|
||||
// EPD_1IN54_DES_SendCommand(0x10);
|
||||
// for(i=0;i<2888;i++)
|
||||
// {
|
||||
// EPD_1IN54_DES_SendData(0xff);
|
||||
// }
|
||||
EPD_1IN54_DES_SendCommand(0x13);
|
||||
for(i=0;i<2888;i++)
|
||||
{
|
||||
EPD_1IN54_DES_SendData(0xff);
|
||||
}
|
||||
EPD_1IN54_DES_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_DES_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD i;
|
||||
// EPD_1IN54_DES_SendCommand(0x10);
|
||||
// for(i=0;i<2888;i++)
|
||||
// {
|
||||
// EPD_1IN54_DES_SendData(0xff);
|
||||
// }
|
||||
EPD_1IN54_DES_SendCommand(0x13);
|
||||
for(i=0;i<2888;i++)
|
||||
{
|
||||
EPD_1IN54_DES_SendData(Image[i]);
|
||||
}
|
||||
EPD_1IN54_DES_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_DES_Sleep(void)
|
||||
{
|
||||
EPD_1IN54_DES_SendCommand(0x50); //enter deep sleep
|
||||
EPD_1IN54_DES_SendData(0xf7);
|
||||
EPD_1IN54_DES_SendCommand(0x02);
|
||||
EPD_1IN54_DES_ReadBusy();
|
||||
EPD_1IN54_DES_SendCommand(0x07);
|
||||
EPD_1IN54_DES_SendData(0xa5);
|
||||
}
|
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_1in54_DES.h
Normal file
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_1in54_DES.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_1in54_DES.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 1.54inch DES e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_1IN54_DES_H_
|
||||
#define __EPD_1IN54_DES_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_1IN54_DES_WIDTH 152
|
||||
#define EPD_1IN54_DES_HEIGHT 152
|
||||
|
||||
void EPD_1IN54_DES_Init(void);
|
||||
void EPD_1IN54_DES_Clear(void);
|
||||
void EPD_1IN54_DES_Display(UBYTE *Image);
|
||||
void EPD_1IN54_DES_Sleep(void);
|
||||
|
||||
#endif
|
173
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in13_DES.c
Normal file
173
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in13_DES.c
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13_DES.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch DES e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in13_DES.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_DES_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_DES_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_DES_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_DES_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(1)
|
||||
{ //=1 BUSY
|
||||
EPD_2IN13_DES_SendCommand(0x71);
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN)==1)
|
||||
break;
|
||||
DEV_Delay_ms(50);
|
||||
}
|
||||
DEV_Delay_ms(50);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN13_DES_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN13_DES_SendCommand(0x12); //Display Update Control
|
||||
EPD_2IN13_DES_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_DES_Init(void)
|
||||
{
|
||||
EPD_2IN13_DES_Reset();
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_2IN13_DES_SendCommand(0x04); //SWRESET
|
||||
EPD_2IN13_DES_ReadBusy();
|
||||
|
||||
EPD_2IN13_DES_SendCommand(0x00); //Driver output control
|
||||
EPD_2IN13_DES_SendData(0x1f);
|
||||
|
||||
EPD_2IN13_DES_SendCommand(0x50);
|
||||
EPD_2IN13_DES_SendData(0x97);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_DES_Clear(void)
|
||||
{
|
||||
UWORD i;
|
||||
// EPD_2IN13_DES_SendCommand(0x10);
|
||||
// for(i=0;i<2756;i++)
|
||||
// {
|
||||
// EPD_2IN13_DES_SendData(0xff);
|
||||
// }
|
||||
EPD_2IN13_DES_SendCommand(0x13);
|
||||
for(i=0;i<2756;i++)
|
||||
{
|
||||
EPD_2IN13_DES_SendData(0xff);
|
||||
}
|
||||
EPD_2IN13_DES_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_DES_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD i;
|
||||
// EPD_2IN13_DES_SendCommand(0x10);
|
||||
// for(i=0;i<2756;i++)
|
||||
// {
|
||||
// EPD_2IN13_DES_SendData(0xff);
|
||||
// }
|
||||
EPD_2IN13_DES_SendCommand(0x13);
|
||||
for(i=0;i<2756;i++)
|
||||
{
|
||||
EPD_2IN13_DES_SendData(Image[i]);
|
||||
}
|
||||
EPD_2IN13_DES_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN13_DES_Sleep(void)
|
||||
{
|
||||
EPD_2IN13_DES_SendCommand(0x50); //enter deep sleep
|
||||
EPD_2IN13_DES_SendData(0xf7);
|
||||
EPD_2IN13_DES_SendCommand(0x02);
|
||||
EPD_2IN13_DES_ReadBusy();
|
||||
EPD_2IN13_DES_SendCommand(0x07);
|
||||
EPD_2IN13_DES_SendData(0xa5);
|
||||
}
|
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in13_DES.h
Normal file
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in13_DES.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13_DES.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch DES e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_2IN13_DES_H_
|
||||
#define __EPD_2IN13_DES_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN13_DES_WIDTH 104
|
||||
#define EPD_2IN13_DES_HEIGHT 212
|
||||
|
||||
void EPD_2IN13_DES_Init(void);
|
||||
void EPD_2IN13_DES_Clear(void);
|
||||
void EPD_2IN13_DES_Display(UBYTE *Image);
|
||||
void EPD_2IN13_DES_Sleep(void);
|
||||
|
||||
#endif
|
|
@ -114,15 +114,17 @@ parameter:
|
|||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
// Ystart = 295 - Ystart;
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2in13_V3_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_2in13_V3_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2in13_V3_SendData(Ystart & 0xFF);
|
||||
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_2in13_V3_SendData(Yend & 0xFF);
|
||||
EPD_2in13_V3_SendData((Yend >> 8) & 0xFF);
|
||||
EPD_2in13_V3_SendData(Ystart & 0xFF);
|
||||
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -131,6 +133,8 @@ parameter:
|
|||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
Ystart = 295 - Ystart;
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2in13_V3_SendData(Xstart & 0xFF);
|
||||
|
||||
|
@ -155,12 +159,12 @@ void EPD_2in13_V3_Init(void)
|
|||
EPD_2in13_V3_SendCommand(0x01); //Driver output control
|
||||
EPD_2in13_V3_SendData(0x27);
|
||||
EPD_2in13_V3_SendData(0x01);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x01);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x11); //data entry mode
|
||||
EPD_2in13_V3_SendData(0x03);
|
||||
EPD_2in13_V3_SendData(0x01);
|
||||
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, 296-1);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2in13_V3_SendData(0x05);
|
||||
|
@ -227,7 +231,7 @@ void EPD_2in13_V3_Display_Partial(UBYTE *Image)
|
|||
{
|
||||
UWORD i;
|
||||
|
||||
//Reset
|
||||
//Reset
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(5);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
|
@ -236,7 +240,7 @@ void EPD_2in13_V3_Display_Partial(UBYTE *Image)
|
|||
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2in13_V3_SendData(0x80);
|
||||
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, 296-1);
|
||||
EPD_2in13_V3_SetCursor(0, 0);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
|
||||
|
|
|
@ -79,12 +79,48 @@ parameter:
|
|||
static void EPD_2IN7B_V2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //0: busy, 1: idle
|
||||
DEV_Delay_ms(100);
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //1: busy, 0: idle
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
static void EPD_2IN7B_V2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN7B_V2_SendCommand(0x20);
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_2IN7B_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2IN7B_V2_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_2IN7B_V2_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2IN7B_V2_SendData(Ystart & 0xFF);
|
||||
EPD_2IN7B_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_2IN7B_V2_SendData(Yend & 0xFF);
|
||||
EPD_2IN7B_V2_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7B_V2_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_2IN7B_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2IN7B_V2_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_2IN7B_V2_SendData(Ystart & 0xFF);
|
||||
EPD_2IN7B_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
|
@ -95,55 +131,19 @@ void EPD_2IN7B_V2_Init(void)
|
|||
EPD_2IN7B_V2_Reset();
|
||||
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x4D);
|
||||
EPD_2IN7B_V2_SendData(0xAA);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x87);
|
||||
EPD_2IN7B_V2_SendData(0x28);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x84);
|
||||
EPD_2IN7B_V2_SendData(0x00);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x83);
|
||||
EPD_2IN7B_V2_SendData(0x05);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0xA8);
|
||||
EPD_2IN7B_V2_SendData(0xDF);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0xA9);
|
||||
EPD_2IN7B_V2_SendData(0x05);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0xB1);
|
||||
EPD_2IN7B_V2_SendData(0xE8);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0xAB);
|
||||
EPD_2IN7B_V2_SendData(0xA1);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0xB9);
|
||||
EPD_2IN7B_V2_SendData(0x10);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x88);
|
||||
EPD_2IN7B_V2_SendData(0x80);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x90);
|
||||
EPD_2IN7B_V2_SendData(0x02);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x86);
|
||||
EPD_2IN7B_V2_SendData(0x15);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x91);
|
||||
EPD_2IN7B_V2_SendData(0x8D);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x50);
|
||||
EPD_2IN7B_V2_SendData(0x57);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0xAA);
|
||||
EPD_2IN7B_V2_SendData(0x0F);
|
||||
EPD_2IN7B_V2_SendCommand(0x12);
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x00);
|
||||
EPD_2IN7B_V2_SendData(0x8f);
|
||||
EPD_2IN7B_V2_SendData(0x27);
|
||||
EPD_2IN7B_V2_SendData(0x01);
|
||||
EPD_2IN7B_V2_SendData(0x00);
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x11);
|
||||
EPD_2IN7B_V2_SendData(0x03);
|
||||
|
||||
EPD_2IN7B_V2_SetWindows(0, 0, EPD_2IN7B_V2_WIDTH-1, EPD_2IN7B_V2_HEIGHT-1);
|
||||
EPD_2IN7B_V2_SetCursor(0, 0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -156,29 +156,21 @@ void EPD_2IN7B_V2_Clear(void)
|
|||
Width = (EPD_2IN7B_V2_WIDTH % 8 == 0)? (EPD_2IN7B_V2_WIDTH / 8 ): (EPD_2IN7B_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7B_V2_HEIGHT;
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x10);
|
||||
EPD_2IN7B_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_V2_SendData(0Xff);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x13);
|
||||
EPD_2IN7B_V2_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_V2_SendData(0X00);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x04); // Power ON
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
DEV_Delay_ms(10);
|
||||
EPD_2IN7B_V2_SendCommand(0x12); // Display Refresh
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
DEV_Delay_ms(10);
|
||||
EPD_2IN7B_V2_SendCommand(0x02); // Power OFF
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
DEV_Delay_ms(20);
|
||||
EPD_2IN7B_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -191,30 +183,21 @@ void EPD_2IN7B_V2_Display(UBYTE *Imageblack, UBYTE *Imagered)
|
|||
Width = (EPD_2IN7B_V2_WIDTH % 8 == 0)? (EPD_2IN7B_V2_WIDTH / 8 ): (EPD_2IN7B_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7B_V2_HEIGHT;
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x10);
|
||||
EPD_2IN7B_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_V2_SendData(Imageblack[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x13);
|
||||
EPD_2IN7B_V2_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7B_V2_SendData(~Imagered[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EPD_2IN7B_V2_SendCommand(0x04); // Power ON
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
DEV_Delay_ms(10);
|
||||
EPD_2IN7B_V2_SendCommand(0x12); // Display Refresh
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
DEV_Delay_ms(10);
|
||||
EPD_2IN7B_V2_SendCommand(0x02); // Power OFF
|
||||
EPD_2IN7B_V2_ReadBusy();
|
||||
DEV_Delay_ms(20);
|
||||
EPD_2IN7B_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -223,6 +206,6 @@ parameter:
|
|||
******************************************************************************/
|
||||
void EPD_2IN7B_V2_Sleep(void)
|
||||
{
|
||||
EPD_2IN7B_V2_SendCommand(0x07); // Deep sleep
|
||||
EPD_2IN7B_V2_SendData(0xA5);
|
||||
EPD_2IN7B_V2_SendCommand(0x10); // Deep sleep
|
||||
EPD_2IN7B_V2_SendData(0x01);
|
||||
}
|
||||
|
|
173
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in9_DES.c
Normal file
173
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in9_DES.c
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9_DES.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch DES e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_2in9_DES.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_DES_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_DES_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_DES_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_DES_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(1)
|
||||
{ //=1 BUSY
|
||||
EPD_2IN9_DES_SendCommand(0x71);
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN)==1)
|
||||
break;
|
||||
DEV_Delay_ms(50);
|
||||
}
|
||||
DEV_Delay_ms(50);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN9_DES_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN9_DES_SendCommand(0x12); //Display Update Control
|
||||
EPD_2IN9_DES_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_DES_Init(void)
|
||||
{
|
||||
EPD_2IN9_DES_Reset();
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_2IN9_DES_SendCommand(0x04); //SWRESET
|
||||
EPD_2IN9_DES_ReadBusy();
|
||||
|
||||
EPD_2IN9_DES_SendCommand(0x00); //Driver output control
|
||||
EPD_2IN9_DES_SendData(0x1f);
|
||||
|
||||
EPD_2IN9_DES_SendCommand(0x50);
|
||||
EPD_2IN9_DES_SendData(0x97);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_DES_Clear(void)
|
||||
{
|
||||
UWORD i;
|
||||
// EPD_2IN9_DES_SendCommand(0x10);
|
||||
// for(i=0;i<4736;i++)
|
||||
// {
|
||||
// EPD_2IN9_DES_SendData(0xff);
|
||||
// }
|
||||
EPD_2IN9_DES_SendCommand(0x13);
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
EPD_2IN9_DES_SendData(0xff);
|
||||
}
|
||||
EPD_2IN9_DES_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_DES_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD i;
|
||||
// EPD_2IN9_DES_SendCommand(0x10);
|
||||
// for(i=0;i<4736;i++)
|
||||
// {
|
||||
// EPD_2IN9_DES_SendData(0xff);
|
||||
// }
|
||||
EPD_2IN9_DES_SendCommand(0x13);
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
EPD_2IN9_DES_SendData(Image[i]);
|
||||
}
|
||||
EPD_2IN9_DES_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN9_DES_Sleep(void)
|
||||
{
|
||||
EPD_2IN9_DES_SendCommand(0x50); //enter deep sleep
|
||||
EPD_2IN9_DES_SendData(0xf7);
|
||||
EPD_2IN9_DES_SendCommand(0x02);
|
||||
EPD_2IN9_DES_ReadBusy();
|
||||
EPD_2IN9_DES_SendCommand(0x07);
|
||||
EPD_2IN9_DES_SendData(0xa5);
|
||||
}
|
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in9_DES.h
Normal file
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in9_DES.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in9_DES.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.9inch DES e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-13
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_2IN9_DES_H_
|
||||
#define __EPD_2IN9_DES_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN9_DES_WIDTH 128
|
||||
#define EPD_2IN9_DES_HEIGHT 296
|
||||
|
||||
void EPD_2IN9_DES_Init(void);
|
||||
void EPD_2IN9_DES_Clear(void);
|
||||
void EPD_2IN9_DES_Display(UBYTE *Image);
|
||||
void EPD_2IN9_DES_Sleep(void);
|
||||
|
||||
#endif
|
|
@ -111,14 +111,13 @@ void EPD_2IN9_V2_ReadBusy(void)
|
|||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
static void _EPD_2IN9_V2_LUT(void)
|
||||
static void EPD_2IN9_V2_LUT(void)
|
||||
{
|
||||
UBYTE count;
|
||||
EPD_2IN9_V2_SendCommand(0x32);
|
||||
for(count=0; count<153; count++)
|
||||
EPD_2IN9_V2_SendData(_WF_PARTIAL_2IN9[count]);
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -134,14 +133,6 @@ static void EPD_2IN9_V2_TurnOnDisplay(void)
|
|||
}
|
||||
|
||||
static void EPD_2IN9_V2_TurnOnDisplay_Partial(void)
|
||||
{
|
||||
EPD_2IN9_V2_SendCommand(0x22); //Display Update Control
|
||||
EPD_2IN9_V2_SendData(0xFF);
|
||||
EPD_2IN9_V2_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void _EPD_2IN9_V2_TurnOnDisplay_Partial(void)
|
||||
{
|
||||
EPD_2IN9_V2_SendCommand(0x22); //Display Update Control
|
||||
EPD_2IN9_V2_SendData(0x0F);
|
||||
|
@ -190,7 +181,7 @@ void EPD_2IN9_V2_Init(void)
|
|||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
EPD_2IN9_V2_SendCommand(0x12); //SWRESET
|
||||
EPD_2IN9_V2_SendCommand(0x12); // soft reset
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x01); //Driver output control
|
||||
|
@ -203,34 +194,10 @@ void EPD_2IN9_V2_Init(void)
|
|||
|
||||
EPD_2IN9_V2_SetWindows(0, 0, EPD_2IN9_V2_WIDTH-1, EPD_2IN9_V2_HEIGHT-1);
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2IN9_V2_SendData(0x05);
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x21); // Display update control
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x80);
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x18); //Read built-in temperature sensor
|
||||
EPD_2IN9_V2_SendData(0x80);
|
||||
|
||||
EPD_2IN9_V2_SetCursor(0, 0);
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
}
|
||||
|
||||
void _EPD_2IN9_V2_Init(void)
|
||||
{
|
||||
EPD_2IN9_V2_Reset();
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
EPD_2IN9_V2_SendCommand(0x12); // soft reset
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x11); //data entry mode
|
||||
EPD_2IN9_V2_SendData(0x03);
|
||||
|
||||
EPD_2IN9_V2_SetWindows(0, 0, EPD_2IN9_V2_WIDTH-1, EPD_2IN9_V2_HEIGHT-1);
|
||||
|
||||
EPD_2IN9_V2_SetCursor(0, 0);
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
}
|
||||
|
@ -292,31 +259,7 @@ void EPD_2IN9_V2_Display_Partial(UBYTE *Image)
|
|||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2IN9_V2_SendData(0x80);
|
||||
|
||||
EPD_2IN9_V2_SetWindows(0, 0, EPD_2IN9_V2_WIDTH-1, EPD_2IN9_V2_HEIGHT-1);
|
||||
EPD_2IN9_V2_SetCursor(0, 0);
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x24); //Write Black and White image to RAM
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
EPD_2IN9_V2_SendData(Image[i]);
|
||||
}
|
||||
EPD_2IN9_V2_TurnOnDisplay_Partial();
|
||||
}
|
||||
|
||||
void _EPD_2IN9_V2_Display_Partial(UBYTE *Image)
|
||||
{
|
||||
UWORD i;
|
||||
|
||||
//Reset
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(5);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
|
||||
_EPD_2IN9_V2_LUT();
|
||||
EPD_2IN9_V2_LUT();
|
||||
EPD_2IN9_V2_SendCommand(0x37);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
|
@ -345,7 +288,7 @@ void _EPD_2IN9_V2_Display_Partial(UBYTE *Image)
|
|||
{
|
||||
EPD_2IN9_V2_SendData(Image[i]);
|
||||
}
|
||||
_EPD_2IN9_V2_TurnOnDisplay_Partial();
|
||||
EPD_2IN9_V2_TurnOnDisplay_Partial();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -38,12 +38,10 @@
|
|||
#define EPD_2IN9_V2_HEIGHT 296
|
||||
|
||||
void EPD_2IN9_V2_Init(void);
|
||||
void _EPD_2IN9_V2_Init(void);
|
||||
void EPD_2IN9_V2_Clear(void);
|
||||
void EPD_2IN9_V2_Display(UBYTE *Image);
|
||||
void EPD_2IN9_V2_Display_Base(UBYTE *Image);
|
||||
void EPD_2IN9_V2_Display_Partial(UBYTE *Image);
|
||||
void _EPD_2IN9_V2_Display_Partial(UBYTE *Image);
|
||||
void EPD_2IN9_V2_Sleep(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -552,6 +552,9 @@ void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart,
|
|||
Width = (Xend-Xstart)%8 == 0 ? (Xend-Xstart)/8 : (Xend-Xstart)/8+1;
|
||||
UWORD IMAGE_COUNTER = Width * (Yend-Ystart);
|
||||
|
||||
Xend -= 1;
|
||||
Yend -= 1;
|
||||
|
||||
EPD_3IN7_SendCommand(0x44);
|
||||
EPD_3IN7_SendData(Xstart & 0xff);
|
||||
EPD_3IN7_SendData((Xstart>>8) & 0x03);
|
||||
|
@ -563,13 +566,20 @@ void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart,
|
|||
EPD_3IN7_SendData(Yend & 0xff);
|
||||
EPD_3IN7_SendData((Yend>>8) & 0x03);
|
||||
|
||||
EPD_3IN7_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_3IN7_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_3IN7_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_3IN7_SendData(Ystart & 0xFF);
|
||||
EPD_3IN7_SendData((Ystart >> 8) & 0xFF);
|
||||
|
||||
EPD_3IN7_SendCommand(0x24);
|
||||
for (i = 0; i < IMAGE_COUNTER; i++)
|
||||
{
|
||||
EPD_3IN7_SendData(Image[i]);
|
||||
}
|
||||
|
||||
EPD_3IN7_Load_LUT(2);
|
||||
EPD_3IN7_Load_LUT(3);
|
||||
EPD_3IN7_SendCommand(0x20);
|
||||
EPD_3IN7_ReadBusy_HIGH();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ static void EPD_4IN01F_Reset(void)
|
|||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(5);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
@ -74,17 +74,20 @@ function:
|
|||
******************************************************************************/
|
||||
static void EPD_4IN01F_BusyHigh(void)// If BUSYN=0 then waiting
|
||||
{
|
||||
printf("e-Paper busy \r\n");
|
||||
while(!(DEV_Digital_Read(EPD_BUSY_PIN)))
|
||||
DEV_Delay_ms(500);
|
||||
printf("e-Paper busy release \r\n");
|
||||
printf("BusyHigh \r\n");
|
||||
while(!(DEV_Digital_Read(EPD_BUSY_PIN))) {
|
||||
DEV_Delay_ms(50);
|
||||
}
|
||||
printf("BusyHigh Release \r\n" );
|
||||
}
|
||||
|
||||
static void EPD_4IN01F_BusyLow(void)// If BUSYN=1 then waiting
|
||||
{
|
||||
printf("e-Paper busy \r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN))
|
||||
DEV_Delay_ms(500);
|
||||
printf("e-Paper busy release \r\n");
|
||||
printf("BusyLow \r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN)) {
|
||||
DEV_Delay_ms(50);
|
||||
}
|
||||
printf("BusyLow Release \r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -140,13 +143,36 @@ void EPD_4IN01F_Clear(UBYTE color)
|
|||
for(int j=0; j<EPD_4IN01F_WIDTH/2; j++)
|
||||
EPD_4IN01F_SendData((color<<4)|color);
|
||||
}
|
||||
DEV_Delay_ms(500);
|
||||
EPD_4IN01F_SendCommand(0x04);//0x04
|
||||
EPD_4IN01F_BusyHigh();
|
||||
EPD_4IN01F_SendCommand(0x12);//0x12
|
||||
EPD_4IN01F_BusyHigh();
|
||||
EPD_4IN01F_SendCommand(0x02); //0x02
|
||||
EPD_4IN01F_BusyLow();
|
||||
// DEV_Delay_ms(500);
|
||||
}
|
||||
|
||||
void EPD_4IN01F_ReClear(void)
|
||||
{
|
||||
EPD_4IN01F_SendCommand(0x61);//Set Resolution setting
|
||||
EPD_4IN01F_SendData(0x02);
|
||||
EPD_4IN01F_SendData(0x80);
|
||||
EPD_4IN01F_SendData(0x01);
|
||||
EPD_4IN01F_SendData(0x90);
|
||||
EPD_4IN01F_SendCommand(0x10);
|
||||
for(int i=0; i<EPD_4IN01F_HEIGHT; i++) {
|
||||
for(int j=0; j<EPD_4IN01F_WIDTH/2; j++)
|
||||
EPD_4IN01F_SendData(0x77);
|
||||
}
|
||||
DEV_Delay_ms(500);
|
||||
EPD_4IN01F_SendCommand(0x04);//0x04
|
||||
EPD_4IN01F_BusyHigh();
|
||||
EPD_4IN01F_SendCommand(0x12);//0x12
|
||||
EPD_4IN01F_BusyHigh();
|
||||
EPD_4IN01F_SendCommand(0x02); //0x02
|
||||
EPD_4IN01F_BusyLow();
|
||||
// DEV_Delay_ms(500);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -165,16 +191,16 @@ void EPD_4IN01F_Show7Block(void)
|
|||
EPD_4IN01F_SendData(0x01);
|
||||
EPD_4IN01F_SendData(0x90);
|
||||
EPD_4IN01F_SendCommand(0x10);
|
||||
for(i=0; i<224; i++) {
|
||||
for(i=0; i<EPD_4IN01F_HEIGHT/2; i++) {
|
||||
for(k = 0 ; k < 4; k ++) {
|
||||
for(j = 0 ; j < 75; j ++) {
|
||||
for(j = 0 ; j < EPD_4IN01F_WIDTH/8; j ++) {
|
||||
EPD_4IN01F_SendData((Color_seven[k]<<4) |Color_seven[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i=0; i<224; i++) {
|
||||
for(i=0; i<EPD_4IN01F_HEIGHT/2; i++) {
|
||||
for(k = 4 ; k < 8; k ++) {
|
||||
for(j = 0 ; j < 75; j ++) {
|
||||
for(j = 0 ; j < EPD_4IN01F_WIDTH/8; j ++) {
|
||||
EPD_4IN01F_SendData((Color_seven[k]<<4) |Color_seven[k]);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +211,7 @@ void EPD_4IN01F_Show7Block(void)
|
|||
EPD_4IN01F_BusyHigh();
|
||||
EPD_4IN01F_SendCommand(0x02); //0x02
|
||||
EPD_4IN01F_BusyLow();
|
||||
DEV_Delay_ms(200);
|
||||
// DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -195,7 +221,7 @@ function:
|
|||
void EPD_4IN01F_Display(const UBYTE *image)
|
||||
{
|
||||
unsigned long i, j;
|
||||
UBYTE k = 0;
|
||||
// UBYTE k = 0;
|
||||
EPD_4IN01F_SendCommand(0x61);//Set Resolution setting
|
||||
EPD_4IN01F_SendData(0x02);
|
||||
EPD_4IN01F_SendData(0x80);
|
||||
|
@ -205,12 +231,12 @@ void EPD_4IN01F_Display(const UBYTE *image)
|
|||
for(i=0; i<EPD_4IN01F_HEIGHT; i++) {
|
||||
for(j=0; j<EPD_4IN01F_WIDTH/2; j++) {
|
||||
EPD_4IN01F_SendData(image[j+((EPD_4IN01F_WIDTH/2)*i)]);
|
||||
printf("0x%x, ", image[j+((EPD_4IN01F_WIDTH/2)*i)]);
|
||||
k++;
|
||||
if(k == 16) {
|
||||
printf("\n");
|
||||
k = 0;
|
||||
}
|
||||
// printf("0x%x, ", image[j+((EPD_4IN01F_WIDTH/2)*i)]);
|
||||
// k++;
|
||||
// if(k == 16) {
|
||||
// printf("\n");
|
||||
// k = 0;
|
||||
// }
|
||||
}
|
||||
}
|
||||
EPD_4IN01F_SendCommand(0x04);//0x04
|
||||
|
@ -219,7 +245,7 @@ void EPD_4IN01F_Display(const UBYTE *image)
|
|||
EPD_4IN01F_BusyHigh();
|
||||
EPD_4IN01F_SendCommand(0x02); //0x02
|
||||
EPD_4IN01F_BusyLow();
|
||||
DEV_Delay_ms(200);
|
||||
// DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
void EPD_4IN01F_Display_part(const UBYTE *image, UWORD xstart, UWORD ystart,
|
||||
|
@ -255,7 +281,7 @@ void EPD_4IN01F_Display_part(const UBYTE *image, UWORD xstart, UWORD ystart,
|
|||
EPD_4IN01F_BusyHigh();
|
||||
EPD_4IN01F_SendCommand(0x02); //0x02
|
||||
EPD_4IN01F_BusyLow();
|
||||
DEV_Delay_ms(200);
|
||||
// DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -264,7 +290,7 @@ function:
|
|||
******************************************************************************/
|
||||
void EPD_4IN01F_Sleep(void)
|
||||
{
|
||||
DEV_Delay_ms(100);
|
||||
// DEV_Delay_ms(100);
|
||||
EPD_4IN01F_SendCommand(0x07);
|
||||
EPD_4IN01F_SendData(0xA5);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ Color Index
|
|||
#define EPD_4IN01F_HEIGHT 400
|
||||
|
||||
void EPD_4IN01F_Clear(UBYTE color);
|
||||
void EPD_4IN01F_ReClear(void);
|
||||
void EPD_4IN01F_Sleep(void);
|
||||
void EPD_Init(void);
|
||||
void EPD_4IN01F_Show7Block(void);
|
||||
|
|
226
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_4in37b.c
Normal file
226
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_4in37b.c
Normal file
|
@ -0,0 +1,226 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in37b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.37inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-07
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_4in37b.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN37B_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_4IN37B_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_4IN37B_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN37B_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
DEV_Delay_ms(50);
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
DEV_Delay_ms(50);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN37B_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_4IN37B_SendCommand(0x12);
|
||||
EPD_4IN37B_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_4IN37B_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_4IN37B_SendCommand(0x90);
|
||||
EPD_4IN37B_SendData(Xstart & 0xf8);
|
||||
EPD_4IN37B_SendData(Xend | 0x07);
|
||||
EPD_4IN37B_SendData((Ystart >> 8) & 0x01);
|
||||
EPD_4IN37B_SendData(Ystart & 0xFF);
|
||||
EPD_4IN37B_SendData((Yend >> 8) & 0x01);
|
||||
EPD_4IN37B_SendData(Yend & 0xFF);
|
||||
EPD_4IN37B_SendData(0x01);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN37B_Init(void)
|
||||
{
|
||||
EPD_4IN37B_Reset();
|
||||
|
||||
EPD_4IN37B_SendCommand(0x04);//soft reset
|
||||
EPD_4IN37B_ReadBusy();
|
||||
|
||||
EPD_4IN37B_SendCommand(0X00); //PANNEL SETTING
|
||||
EPD_4IN37B_SendData(0x0F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN37B_Display(UBYTE *ImageBlack, UBYTE*ImageRed)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN37B_WIDTH % 8 == 0)? (EPD_4IN37B_WIDTH / 8 ): (EPD_4IN37B_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN37B_HEIGHT;
|
||||
|
||||
EPD_4IN37B_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN37B_SendData(ImageBlack[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_4IN37B_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN37B_SendData(~ImageRed[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN37B_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_4IN37B_Display_Part(UBYTE *ImageBlack, UBYTE *ImageRed, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
|
||||
UWORD Width, Height;
|
||||
Width = Xend - Xstart;
|
||||
Height = Yend - Ystart;
|
||||
Width = (Width % 8 == 0)? (Width / 8 ): (Width / 8 + 1);
|
||||
|
||||
if(Xstart % 8 != 0) {
|
||||
Xstart += 8;
|
||||
if(Xstart > Xend) {
|
||||
printf("Xstart must be a multiple of 8 and not more than Xend \r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
EPD_4IN37B_SetWindows(Xstart, Ystart, Xend-1, Yend-1);
|
||||
|
||||
EPD_4IN37B_SendCommand(0x91);
|
||||
EPD_4IN37B_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN37B_SendData(ImageBlack[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_4IN37B_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN37B_SendData(~ImageRed[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_4IN37B_SendCommand(0x92);
|
||||
|
||||
EPD_4IN37B_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN37B_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_4IN37B_WIDTH % 8 == 0)? (EPD_4IN37B_WIDTH / 8 ): (EPD_4IN37B_WIDTH / 8 + 1);
|
||||
Height = EPD_4IN37B_HEIGHT;
|
||||
|
||||
EPD_4IN37B_SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN37B_SendData(0xff);
|
||||
}
|
||||
}
|
||||
EPD_4IN37B_SendCommand(0x13);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_4IN37B_SendData(0x00);
|
||||
}
|
||||
}
|
||||
EPD_4IN37B_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_4IN37B_Sleep(void)
|
||||
{
|
||||
EPD_4IN37B_SendCommand(0x02);
|
||||
DEV_Delay_ms(100);
|
||||
EPD_4IN37B_SendCommand(0x07);
|
||||
EPD_4IN37B_SendData(0xa5);
|
||||
}
|
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_4in37b.h
Normal file
45
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_4in37b.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_4in37b.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 4.37inch e-paper b
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-07
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_4IN37B_H_
|
||||
#define __EPD_4IN37B_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_4IN37B_WIDTH 176
|
||||
#define EPD_4IN37B_HEIGHT 480
|
||||
|
||||
|
||||
void EPD_4IN37B_Init(void);
|
||||
void EPD_4IN37B_Display(UBYTE *ImageBlack, UBYTE*ImageRed);
|
||||
void EPD_4IN37B_Display_Part(UBYTE *ImageBlack, UBYTE*ImageRed, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend);
|
||||
void EPD_4IN37B_Clear(void);
|
||||
void EPD_4IN37B_Sleep(void);
|
||||
#endif
|
218
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_5in84.c
Normal file
218
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_5in84.c
Normal file
|
@ -0,0 +1,218 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in84.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.84inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-01-08
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#include "EPD_5in84.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_5in84_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(3);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_5in84_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_5in84_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_5in84_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
do {
|
||||
EPD_5in84_SendCommand(0x71);
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
while(!DEV_Digital_Read(EPD_BUSY_PIN));
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_5in84_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_5in84_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(100); //!!!The delay here is necessary, 200uS at least!!!
|
||||
EPD_5in84_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5in84_Init(void)
|
||||
{
|
||||
EPD_5in84_Reset();
|
||||
|
||||
EPD_5in84_SendCommand(0x61); // Resolution setting
|
||||
EPD_5in84_SendData(0x03);
|
||||
EPD_5in84_SendData(0x00);
|
||||
EPD_5in84_SendData(0x01);
|
||||
EPD_5in84_SendData(0x00);
|
||||
|
||||
EPD_5in84_SendCommand(0x00);
|
||||
EPD_5in84_SendData(0xdf);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8); // Enter FITI Command
|
||||
EPD_5in84_SendData(0x60);
|
||||
EPD_5in84_SendData(0xA5);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8); // Enter FITI Command
|
||||
EPD_5in84_SendData(0x89);
|
||||
EPD_5in84_SendData(0xA5);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8);
|
||||
EPD_5in84_SendData(0x76);
|
||||
EPD_5in84_SendData(0x1F);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8); //boost constant on time
|
||||
EPD_5in84_SendData(0x7E);
|
||||
EPD_5in84_SendData(0x31);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8);
|
||||
EPD_5in84_SendData(0xB8);
|
||||
EPD_5in84_SendData(0x80);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8); //vgl=> GND:08, HZ:00[default]
|
||||
EPD_5in84_SendData(0x92);
|
||||
EPD_5in84_SendData(0x00);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8); //VCOM(2frme off)=> GND:01(0x88=06)[default], HZ:11
|
||||
EPD_5in84_SendData(0x87);
|
||||
EPD_5in84_SendData(0x01);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8); //r_vcom_init_sel
|
||||
EPD_5in84_SendData(0x88);
|
||||
EPD_5in84_SendData(0x06);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8);
|
||||
EPD_5in84_SendData(0xA8);
|
||||
EPD_5in84_SendData(0x30);
|
||||
|
||||
EPD_5in84_SendCommand(0xF8);
|
||||
EPD_5in84_SendData(0xE8);
|
||||
EPD_5in84_SendData(0x88);
|
||||
|
||||
EPD_5in84_SendCommand(0x04); //power on
|
||||
EPD_5in84_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5in84_Clear(void)
|
||||
{
|
||||
UWORD Width, Height, i;
|
||||
Width = (EPD_5in84_WIDTH % 8 == 0)? (EPD_5in84_WIDTH / 8 ): (EPD_5in84_WIDTH / 8 + 1);
|
||||
Height = EPD_5in84_HEIGHT;
|
||||
|
||||
// EPD_5in84_SendCommand(0x10);
|
||||
// for(i=0; i<Width*Height; i++) {
|
||||
// EPD_5in84_SendData(0x00);
|
||||
// }
|
||||
EPD_5in84_SendCommand(0x13);
|
||||
for(i=0; i<Width*Height; i++) {
|
||||
EPD_5in84_SendData(0xff);
|
||||
}
|
||||
EPD_5in84_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5in84_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height, i, j;
|
||||
Width = (EPD_5in84_WIDTH % 8 == 0)? (EPD_5in84_WIDTH / 8 ): (EPD_5in84_WIDTH / 8 + 1);
|
||||
Height = EPD_5in84_HEIGHT;
|
||||
|
||||
// EPD_5in84_SendCommand(0x10);
|
||||
// for(i=0;i<Height;i++) {
|
||||
// for(j=0; j<Width; j++) {
|
||||
// EPD_5in84_SendData(0x00);
|
||||
// }
|
||||
// }
|
||||
EPD_5in84_SendCommand(0x13);
|
||||
for(i=0;i<Height;i++) {
|
||||
for(j=0; j<Width; j++) {
|
||||
EPD_5in84_SendData(Image[i*Width + j]);
|
||||
}
|
||||
}
|
||||
EPD_5in84_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_5in84_Sleep(void)
|
||||
{
|
||||
EPD_5in84_SendCommand(0X02); //power off
|
||||
EPD_5in84_ReadBusy(); //waiting for the electronic paper IC to release the idle signal
|
||||
EPD_5in84_SendCommand(0X07); //deep sleep
|
||||
EPD_5in84_SendData(0xA5);
|
||||
}
|
||||
|
44
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_5in84.h
Normal file
44
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_5in84.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_5in84.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.84inch e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-01-08
|
||||
* | Info :
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __EPD_5in84_H_
|
||||
#define __EPD_5in84_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_5in84_WIDTH 768
|
||||
#define EPD_5in84_HEIGHT 256
|
||||
|
||||
void EPD_5in84_Init(void);
|
||||
void EPD_5in84_Clear(void);
|
||||
void EPD_5in84_Display(UBYTE *Image);
|
||||
void EPD_5in84_Sleep(void);
|
||||
|
||||
#endif
|
|
@ -82,9 +82,8 @@ static void EPD_WaitUntilIdle(void)
|
|||
EPD_SendCommand(0x71);
|
||||
DEV_Delay_ms(20);
|
||||
}while(!(DEV_Digital_Read(EPD_BUSY_PIN)));
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Delay_ms(20);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
BIN
RaspberryPi_JetsonNano/c/pic/4in37b_b.bmp
Normal file
BIN
RaspberryPi_JetsonNano/c/pic/4in37b_b.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/4in37b_r.bmp
Normal file
BIN
RaspberryPi_JetsonNano/c/pic/4in37b_r.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/5in84.bmp
Normal file
BIN
RaspberryPi_JetsonNano/c/pic/5in84.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/5in84_2.bmp
Normal file
BIN
RaspberryPi_JetsonNano/c/pic/5in84_2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
|
@ -33,7 +33,7 @@ try:
|
|||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
drawry = ImageDraw.Draw(HRYimage)
|
||||
drawblack.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
drawblack.text((10, 20), '2.9inch e-Paper bc', font = font24, fill = 0)
|
||||
drawblack.text((10, 20), '2.66inch e-Paper b', font = font24, fill = 0)
|
||||
drawblack.text((150, 0), u'微雪电子', font = font24, fill = 0)
|
||||
drawblack.line((20, 50, 70, 100), fill = 0)
|
||||
drawblack.line((70, 50, 20, 100), fill = 0)
|
||||
|
|
|
@ -19,7 +19,7 @@ try:
|
|||
logging.info("epd2in7b_V2 Demo")
|
||||
|
||||
epd = epd2in7b_V2.EPD()
|
||||
|
||||
while(1) :
|
||||
logging.info("init and Clear")
|
||||
epd.init()
|
||||
epd.Clear()
|
||||
|
@ -94,7 +94,7 @@ try:
|
|||
logging.info("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
time.sleep(3)
|
||||
time.sleep(30)
|
||||
epd.Dev_exit()
|
||||
|
||||
except IOError as e:
|
||||
|
|
|
@ -67,21 +67,19 @@ class EPD:
|
|||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1):
|
||||
epdconfig.delay_ms(100)
|
||||
epdconfig.delay_ms(20)
|
||||
logging.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
self.send_data(0xF7)
|
||||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
|
||||
self.ReadBusy()
|
||||
|
||||
def TurnOnDisplayPart(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
self.send_data(0xFF)
|
||||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
|
||||
self.ReadBusy()
|
||||
|
||||
def init(self):
|
||||
|
|
|
@ -43,6 +43,28 @@ class EPD:
|
|||
self.width = EPD_WIDTH
|
||||
self.height = EPD_HEIGHT
|
||||
|
||||
WF_PARTIAL_2IN9 = [
|
||||
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x40,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0A,0x0,0x0,0x0,0x0,0x0,0x2,
|
||||
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x1,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x22,0x17,0x41,0xB0,0x32,0x36,
|
||||
]
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
|
@ -78,10 +100,16 @@ class EPD:
|
|||
|
||||
def TurnOnDisplay_Partial(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
self.send_data(0xFF)
|
||||
self.send_data(0x0F)
|
||||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
self.ReadBusy()
|
||||
|
||||
def SendLut(self):
|
||||
self.send_command(0x32)
|
||||
for i in range(0, 153):
|
||||
self.send_data(self.WF_PARTIAL_2IN9[i])
|
||||
self.ReadBusy()
|
||||
|
||||
def SetWindow(self, x_start, y_start, x_end, y_end):
|
||||
self.send_command(0x44) # SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
# x point must be the multiple of 8 or the last 3 bits will be ignored
|
||||
|
@ -123,16 +151,10 @@ class EPD:
|
|||
|
||||
self.SetWindow(0, 0, self.width-1, self.height-1);
|
||||
|
||||
self.send_command(0x3C); #BorderWavefrom
|
||||
self.send_data(0x05);
|
||||
|
||||
self.send_command(0x21); # Display update control
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x80);
|
||||
|
||||
self.send_command(0x18); #Read built-in temperature sensor
|
||||
self.send_data(0x80);
|
||||
|
||||
self.SetCursor(0, 0);
|
||||
self.ReadBusy();
|
||||
# EPD hardware init end
|
||||
|
@ -196,11 +218,30 @@ class EPD:
|
|||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.SendLut();
|
||||
self.send_command(0x37);
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x40);
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x00);
|
||||
|
||||
self.send_command(0x3C); #BorderWavefrom
|
||||
self.send_data(0x80);
|
||||
|
||||
self.send_command(0x22);
|
||||
self.send_data(0xC0);
|
||||
self.send_command(0x20);
|
||||
self.ReadBusy();
|
||||
|
||||
self.SetWindow(0, 0, self.width - 1, self.height - 1)
|
||||
self.SetCursor(0, 0)
|
||||
|
||||
self.send_command(0x24) # WRITE_RAM
|
||||
for j in range(0, self.height):
|
||||
for i in range(0, int(self.width / 8)):
|
||||
|
|
|
@ -58,7 +58,7 @@ class EPD:
|
|||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(2)
|
||||
epdconfig.delay_ms(1)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
|
||||
|
@ -77,13 +77,13 @@ class EPD:
|
|||
def ReadBusyHigh(self):
|
||||
logging.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
|
||||
def ReadBusyLow(self):
|
||||
logging.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
|
@ -196,7 +196,7 @@ class EPD:
|
|||
self.ReadBusyHigh()
|
||||
self.send_command(0x02) #0x02
|
||||
self.ReadBusyLow()
|
||||
epdconfig.delay_ms(500)
|
||||
# epdconfig.delay_ms(500)
|
||||
|
||||
def Clear(self):
|
||||
self.send_command(0x61)#Set Resolution setting
|
||||
|
@ -222,10 +222,10 @@ class EPD:
|
|||
self.ReadBusyHigh()
|
||||
self.send_command(0x02) #0x02
|
||||
self.ReadBusyLow()
|
||||
epdconfig.delay_ms(500)
|
||||
# epdconfig.delay_ms(500)
|
||||
|
||||
def sleep(self):
|
||||
epdconfig.delay_ms(500)
|
||||
# epdconfig.delay_ms(500)
|
||||
self.send_command(0x07) # DEEP_SLEEP
|
||||
self.send_data(0XA5)
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1444,7 +1444,7 @@
|
|||
|
||||
<Group>
|
||||
<GroupName>Config</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
|
|
@ -54,7 +54,7 @@ Package Vendor: Keil
|
|||
<h2>Collection of Component Files used:</h2>
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.2.0
|
||||
Build Time Elapsed: 00:00:03
|
||||
Build Time Elapsed: 00:00:02
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<title>Static Call Graph - [epd-demo\epd-demo.axf]</title></head>
|
||||
<body><HR>
|
||||
<H1>Static Call Graph for image epd-demo\epd-demo.axf</H1><HR>
|
||||
<BR><P>#<CALLGRAPH># ARM Linker, 5060750: Last Updated: Fri Dec 25 15:48:24 2020
|
||||
<BR><P>#<CALLGRAPH># ARM Linker, 5060750: Last Updated: Tue Jan 26 14:34:13 2021
|
||||
<BR><P>
|
||||
<H3>Maximum Stack Usage = 136 bytes + Unknown(Cycles, Untraceable Function Pointers)</H3><H3>
|
||||
Call chain for Maximum Stack Depth:</H3>
|
||||
|
|
|
@ -550,6 +550,7 @@ Section Cross References
|
|||
epd_2in9_v2.o(.text) refers to stm32f1xx_hal_gpio.o(.text) for HAL_GPIO_ReadPin
|
||||
epd_2in9_v2.o(.text) refers to stm32f1xx_hal.o(.text) for HAL_Delay
|
||||
epd_2in9_v2.o(.text) refers to dev_config.o(.text) for DEV_SPI_WriteByte
|
||||
epd_2in9_v2.o(.text) refers to epd_2in9_v2.o(.data) for .data
|
||||
epd_2in9bc.o(.text) refers to printf3.o(i.__0printf$3) for __2printf
|
||||
epd_2in9bc.o(.text) refers to stm32f1xx_hal.o(.text) for HAL_Delay
|
||||
epd_2in9bc.o(.text) refers to stm32f1xx_hal_gpio.o(.text) for HAL_GPIO_ReadPin
|
||||
|
@ -1280,7 +1281,7 @@ Removing Unused input sections from the image.
|
|||
Removing epd_2in9_v2.o(.rev16_text), (4 bytes).
|
||||
Removing epd_2in9_v2.o(.revsh_text), (4 bytes).
|
||||
Removing epd_2in9_v2.o(.rrx_text), (6 bytes).
|
||||
Removing epd_2in9_v2.o(.text), (788 bytes).
|
||||
Removing epd_2in9_v2.o(.text), (908 bytes).
|
||||
Removing epd_2in9_v2.o(.data), (159 bytes).
|
||||
Removing epd_2in9bc.o(.rev16_text), (4 bytes).
|
||||
Removing epd_2in9bc.o(.revsh_text), (4 bytes).
|
||||
|
@ -1388,7 +1389,7 @@ Removing Unused input sections from the image.
|
|||
Removing epd_7in5b_v2.o(.rev16_text), (4 bytes).
|
||||
Removing epd_7in5b_v2.o(.revsh_text), (4 bytes).
|
||||
Removing epd_7in5b_v2.o(.rrx_text), (6 bytes).
|
||||
Removing epd_7in5b_v2.o(.text), (892 bytes).
|
||||
Removing epd_7in5b_v2.o(.text), (880 bytes).
|
||||
Removing epd_7in5b_hd.o(.rev16_text), (4 bytes).
|
||||
Removing epd_7in5b_hd.o(.revsh_text), (4 bytes).
|
||||
Removing epd_7in5b_hd.o(.rrx_text), (6 bytes).
|
||||
|
@ -1424,7 +1425,7 @@ Removing Unused input sections from the image.
|
|||
Removing cdrcmple.o(.text), (48 bytes).
|
||||
Removing depilogue.o(.text), (186 bytes).
|
||||
|
||||
450 unused section(s) (total 963099 bytes) removed from the image.
|
||||
450 unused section(s) (total 963207 bytes) removed from the image.
|
||||
|
||||
==============================================================================
|
||||
|
||||
|
|
|
@ -111,6 +111,15 @@ void EPD_2IN9_V2_ReadBusy(void)
|
|||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
static void EPD_2IN9_V2_LUT(void)
|
||||
{
|
||||
UBYTE count;
|
||||
EPD_2IN9_V2_SendCommand(0x32);
|
||||
for(count=0; count<153; count++)
|
||||
EPD_2IN9_V2_SendData(_WF_PARTIAL_2IN9[count]);
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
|
@ -126,7 +135,7 @@ static void EPD_2IN9_V2_TurnOnDisplay(void)
|
|||
static void EPD_2IN9_V2_TurnOnDisplay_Partial(void)
|
||||
{
|
||||
EPD_2IN9_V2_SendCommand(0x22); //Display Update Control
|
||||
EPD_2IN9_V2_SendData(0xFF);
|
||||
EPD_2IN9_V2_SendData(0x0F);
|
||||
EPD_2IN9_V2_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
}
|
||||
|
@ -256,9 +265,27 @@ void EPD_2IN9_V2_Display_Partial(UBYTE *Image)
|
|||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
|
||||
EPD_2IN9_V2_LUT();
|
||||
EPD_2IN9_V2_SendCommand(0x37);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x40);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2IN9_V2_SendData(0x80);
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x22);
|
||||
EPD_2IN9_V2_SendData(0xC0);
|
||||
EPD_2IN9_V2_SendCommand(0x20);
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
|
||||
EPD_2IN9_V2_SetWindows(0, 0, EPD_2IN9_V2_WIDTH-1, EPD_2IN9_V2_HEIGHT-1);
|
||||
EPD_2IN9_V2_SetCursor(0, 0);
|
||||
|
||||
|
|
|
@ -232,7 +232,6 @@ void EPD_7IN5B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage)
|
|||
EPD_7IN5B_V2_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_7IN5B_V2_SendCommand(0x92);
|
||||
|
||||
//send red data
|
||||
EPD_7IN5B_V2_SendCommand(0x13);
|
||||
|
@ -255,7 +254,6 @@ void EPD_7IN5B_V2_WritePicture(const UBYTE *blackimage, UBYTE Block)
|
|||
if(Block == 0){
|
||||
EPD_7IN5B_V2_SendCommand(0x10);
|
||||
}else if(Block == 2){
|
||||
EPD_7IN5B_V2_SendCommand(0x92);
|
||||
EPD_7IN5B_V2_SendCommand(0x13);
|
||||
}
|
||||
for (UDOUBLE j = 0; j < Height/2; j++) {
|
||||
|
|
|
@ -22,3 +22,4 @@
|
|||
2020-12-03:2.9inch B V2 e-Paper 改名为 2.9inch B V3 e-Paper。
|
||||
2020-12-09:添加新程序2.9inch V2 e-Paper例程。
|
||||
2020-12-09:添加新程序5.83inch V2 e-Paper例程。
|
||||
2020-12-25:添加新程序4.01inch (F) e-Paper例程。
|
|
@ -21,3 +21,4 @@
|
|||
2020-12-03: 2.9inch B V2 e-Paper was renamed 2.9inch B V3 e-Paper.
|
||||
2020-12-09: Added new program 2.9inch V2 e-Paper routine.
|
||||
2020-12-09: Added new program 5.83inch V2 e-Paper routine.
|
||||
2020-12-25: Added new program 4.01inch (F) e-Paper routine.
|
Loading…
Add table
Add a link
Reference in a new issue