Merge branch 'master' into jetson-spidev
|
|
@ -13,8 +13,8 @@ JETSON_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.
|
|||
|
||||
DEBUG = -D DEBUG
|
||||
|
||||
# USELIB_RPI = USE_BCM2835_LIB
|
||||
USELIB_RPI = USE_WIRINGPI_LIB
|
||||
USELIB_RPI = USE_BCM2835_LIB
|
||||
#USELIB_RPI = USE_WIRINGPI_LIB
|
||||
# USELIB_RPI = USE_DEV_LIB
|
||||
|
||||
LIB_RPI=-Wl,--gc-sections
|
||||
|
|
|
|||
|
|
@ -114,23 +114,24 @@ int EPD_1in54_V2_test(void)
|
|||
Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_1IN54_V2_Display(BlackImage);
|
||||
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
|
||||
// The image of the previous frame must be uploaded, otherwise the
|
||||
// first few seconds will display an exception.
|
||||
EPD_1IN54_V2_Init();
|
||||
EPD_1IN54_V2_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
EPD_1IN54_V2_DisplayPartBaseImage(BlackImage);
|
||||
|
||||
// enter partial mode
|
||||
EPD_1IN54_V2_Init_Partial();
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 20;
|
||||
UBYTE num = 15;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in13_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in13_V2_test(void)
|
||||
{
|
||||
|
|
@ -39,7 +40,13 @@ int EPD_2in13_V2_test(void)
|
|||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN13_V2_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
|
||||
|
|
@ -107,8 +114,8 @@ int EPD_2in13_V2_test(void)
|
|||
Paint_DrawString_EN(140, 15, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawNum(140, 40, 123456789, &Font16, BLACK, WHITE);
|
||||
|
||||
Paint_DrawString_CN(140, 60, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 65, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawString_CN(140, 60, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(5, 65, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
|
@ -147,7 +154,7 @@ int EPD_2in13_V2_test(void)
|
|||
Paint_DrawLine(9, 114,9, 9, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
|
||||
Paint_DrawString_EN(60, 25, "waveshare", &Font16, BLACK, WHITE);
|
||||
Paint_DrawString_CN(60, 55, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawString_CN(60, 55, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
|
|
|||
176
RaspberryPi_JetsonNano/c/examples/EPD_2in7_V2_test.c
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7_V2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch V2 e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-04-22
|
||||
* | 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_2in7_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in7_V2_test(void)
|
||||
{
|
||||
printf("EPD_2IN7_V2_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN7_V2_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_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1)) * EPD_2IN7_V2_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_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 10, 10);
|
||||
EPD_2IN7_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in7.bmp", 0, 0);
|
||||
EPD_2IN7_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //show image for array
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in7);
|
||||
|
||||
EPD_2IN7_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_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_2IN7_V2_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
Paint_NewImage(BlackImage, EPD_2IN7_V2_WIDTH, EPD_2IN7_V2_HEIGHT, 90, WHITE);
|
||||
printf("Partial refresh\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
||||
PAINT_TIME sPaint_time;
|
||||
sPaint_time.Hour = 12;
|
||||
sPaint_time.Min = 34;
|
||||
sPaint_time.Sec = 56;
|
||||
UBYTE num = 10;
|
||||
for (;;) {
|
||||
sPaint_time.Sec = sPaint_time.Sec + 1;
|
||||
if (sPaint_time.Sec == 60) {
|
||||
sPaint_time.Min = sPaint_time.Min + 1;
|
||||
sPaint_time.Sec = 0;
|
||||
if (sPaint_time.Min == 60) {
|
||||
sPaint_time.Hour = sPaint_time.Hour + 1;
|
||||
sPaint_time.Min = 0;
|
||||
if (sPaint_time.Hour == 24) {
|
||||
sPaint_time.Hour = 0;
|
||||
sPaint_time.Min = 0;
|
||||
sPaint_time.Sec = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Paint_ClearWindows(150, 80, 150 + Font20.Width * 7, 80 + Font20.Height, WHITE);
|
||||
Paint_DrawTime(150, 80, &sPaint_time, &Font20, WHITE, BLACK);
|
||||
|
||||
num = num - 1;
|
||||
if(num == 0) {
|
||||
break;
|
||||
}
|
||||
EPD_2IN7_V2_Display_Partial(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2IN7_V2_Init();
|
||||
EPD_2IN7_V2_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2IN7_V2_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;
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
******************************************************************************/
|
||||
#include "EPD_Test.h"
|
||||
#include "EPD_2in7.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in7_test(void)
|
||||
{
|
||||
|
|
@ -39,8 +40,12 @@ int EPD_2in7_test(void)
|
|||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2IN7_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2IN7_Clear();
|
||||
DEV_Delay_ms(500);
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
|
|
|
|||
|
|
@ -91,26 +91,25 @@ int EPD_5in65f_test(void)
|
|||
Paint_DrawString_EN(10, 20, "hello world", &Font12, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawNum(10, 33, 123456789, &Font12, EPD_5IN65F_BLACK, EPD_5IN65F_WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(300, 0, "ÄãºÃabc", &Font12CN, EPD_5IN65F_BLACK, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 20, "ÄãºÃabc", &Font12CN, EPD_5IN65F_GREEN, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 40, "ÄãºÃabc", &Font12CN, EPD_5IN65F_BLUE, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 60, "ÄãºÃabc", &Font12CN, EPD_5IN65F_RED, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 80, "ÄãºÃabc", &Font12CN, EPD_5IN65F_YELLOW, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 100, "ÄãºÃabc", &Font12CN, EPD_5IN65F_ORANGE, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(150, 0, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 40, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_GREEN, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 80, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_BLUE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 120, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_RED, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 160, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_YELLOW, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 200, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_ORANGE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 240, "΢ѩµç×Ó", &Font24CN, EPD_5IN65F_BLACK, EPD_5IN65F_YELLOW);
|
||||
Paint_DrawString_CN(300, 0, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_BLACK, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 20, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_GREEN, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 40, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_BLUE, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 60, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_RED, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 80, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_YELLOW, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(300, 100, "<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, EPD_5IN65F_ORANGE, EPD_5IN65F_WHITE);
|
||||
Paint_DrawString_CN(150, 0, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_WHITE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 40, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_GREEN, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 80, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_BLUE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 120, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_RED, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 160, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_YELLOW, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 200, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_ORANGE, EPD_5IN65F_BLACK);
|
||||
Paint_DrawString_CN(150, 240, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, EPD_5IN65F_BLACK, EPD_5IN65F_YELLOW);
|
||||
|
||||
EPD_5IN65F_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#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");
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ int EPD_1in54c_test(void);
|
|||
int EPD_2in66_test(void);
|
||||
int EPD_2in66b_test(void);
|
||||
int EPD_2in7_test(void);
|
||||
int EPD_2in7_V2_test(void);
|
||||
int EPD_2in7b_test(void);
|
||||
int EPD_2in7b_V2_test(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ int main(void)
|
|||
// EPD_1in02d_test();
|
||||
|
||||
// EPD_1in54_test();
|
||||
// EPD_1in54_V2_test();
|
||||
// EPD_1in54_V2_test();
|
||||
// EPD_1in54b_test();
|
||||
// EPD_1in54b_V2_test();
|
||||
// EPD_1in54c_test();
|
||||
|
|
@ -32,6 +32,7 @@ int main(void)
|
|||
// EPD_2in66b_test();
|
||||
|
||||
// EPD_2in7_test();
|
||||
// EPD_2in7_V2_test();
|
||||
// EPD_2in7b_test();
|
||||
// EPD_2in7b_V2_test();
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len)
|
|||
#ifdef RPI
|
||||
#ifdef USE_BCM2835_LIB
|
||||
char rData[Len];
|
||||
bcm2835_spi_transfernb(pData,rData,Len);
|
||||
bcm2835_spi_transfernb((char *)pData,rData,Len);
|
||||
#elif USE_WIRINGPI_LIB
|
||||
wiringPiSPIDataRW(0, pData, Len);
|
||||
#elif USE_DEV_LIB
|
||||
|
|
|
|||
|
|
@ -30,14 +30,39 @@
|
|||
#include "EPD_1in54_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
const unsigned char WF_PARTIAL_1IN54[159] =
|
||||
// waveform full refresh
|
||||
unsigned char WF_Full_1IN54[159] =
|
||||
{
|
||||
0x80, 0x48, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x48, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x80, 0x48, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x48, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0xA, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x8, 0x1, 0x0, 0x8, 0x1, 0x0, 0x2,
|
||||
0xA, 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, 0x0, 0x32, 0x20
|
||||
};
|
||||
|
||||
// waveform partial refresh(fast)
|
||||
unsigned char WF_PARTIAL_1IN54_0[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,
|
||||
0xF,0x0,0x0,0x0,0x0,0x0,0x1,
|
||||
0xF,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x1,0x1,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
|
|
@ -53,6 +78,30 @@ const unsigned char WF_PARTIAL_1IN54[159] =
|
|||
0x02,0x17,0x41,0xB0,0x32,0x28,
|
||||
};
|
||||
|
||||
// waveform partial refresh(quality)
|
||||
unsigned char WF_PARTIAL_1IN54_1[159] =
|
||||
{
|
||||
0x0,0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x40,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,
|
||||
0xA,0x0,0x0,0x0,0x0,0x0,0x1,
|
||||
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,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x22,0x17,0x41,0x0,0x32,0x20,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
|
|
@ -101,7 +150,7 @@ static void EPD_1IN54_V2_ReadBusy(void)
|
|||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Delay_ms(1);
|
||||
}
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
|
@ -113,7 +162,7 @@ parameter:
|
|||
static void EPD_1IN54_V2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x22);
|
||||
EPD_1IN54_V2_SendData(0xF7);
|
||||
EPD_1IN54_V2_SendData(0xc7);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
|
@ -125,19 +174,38 @@ parameter:
|
|||
static void EPD_1IN54_V2_TurnOnDisplayPart(void)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x22);
|
||||
EPD_1IN54_V2_SendData(0xFF);
|
||||
EPD_1IN54_V2_SendData(0xcF);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetLut(void)
|
||||
static void EPD_1IN54_V2_Lut(UBYTE *lut)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x32);
|
||||
for(UBYTE i=0; i<153; i++)
|
||||
EPD_1IN54_V2_SendData(WF_PARTIAL_1IN54[i]);
|
||||
EPD_1IN54_V2_SendData(lut[i]);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetLut(UBYTE *lut)
|
||||
{
|
||||
EPD_1IN54_V2_Lut(lut);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x3f);
|
||||
EPD_1IN54_V2_SendData(lut[153]);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x03);
|
||||
EPD_1IN54_V2_SendData(lut[154]);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x04);
|
||||
EPD_1IN54_V2_SendData(lut[155]);
|
||||
EPD_1IN54_V2_SendData(lut[156]);
|
||||
EPD_1IN54_V2_SendData(lut[157]);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x2c);
|
||||
EPD_1IN54_V2_SendData(lut[158]);
|
||||
}
|
||||
|
||||
static void EPD_1IN54_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_1IN54_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
|
|
@ -181,15 +249,6 @@ void EPD_1IN54_V2_Init(void)
|
|||
EPD_1IN54_V2_SendCommand(0x11); //data entry mode
|
||||
EPD_1IN54_V2_SendData(0x01);
|
||||
|
||||
// EPD_1IN54_V2_SendCommand(0x44); //set Ram-X address start/end position
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendData(0x18); //0x0C-->(18+1)*8=200
|
||||
|
||||
// EPD_1IN54_V2_SendCommand(0x45); //set Ram-Y address start/end position
|
||||
// EPD_1IN54_V2_SendData(0xC7); //0xC7-->(199+1)=200
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SetWindows(0, EPD_1IN54_V2_HEIGHT-1, EPD_1IN54_V2_WIDTH-1, 0);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
|
|
@ -202,13 +261,41 @@ void EPD_1IN54_V2_Init(void)
|
|||
EPD_1IN54_V2_SendData(0XB1);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
|
||||
// EPD_1IN54_V2_SendCommand(0x4E); // set RAM x address count to 0;
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
// EPD_1IN54_V2_SendCommand(0x4F); // set RAM y address count to 0X199;
|
||||
// EPD_1IN54_V2_SendData(0xC7);
|
||||
// EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SetCursor(0, EPD_1IN54_V2_HEIGHT-1);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
|
||||
EPD_1IN54_V2_SetLut(WF_Full_1IN54);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register (Partial display)
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_1IN54_V2_Init_Partial(void)
|
||||
{
|
||||
EPD_1IN54_V2_Reset();
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
|
||||
EPD_1IN54_V2_SetLut(WF_PARTIAL_1IN54_1);
|
||||
EPD_1IN54_V2_SendCommand(0x37);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x40);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_1IN54_V2_SendData(0x80);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x22);
|
||||
EPD_1IN54_V2_SendData(0xc0);
|
||||
EPD_1IN54_V2_SendCommand(0x20);
|
||||
EPD_1IN54_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -283,7 +370,7 @@ void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image)
|
|||
EPD_1IN54_V2_SendData(Image[Addr]);
|
||||
}
|
||||
}
|
||||
EPD_1IN54_V2_TurnOnDisplayPart();
|
||||
EPD_1IN54_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -295,27 +382,6 @@ void EPD_1IN54_V2_DisplayPart(UBYTE *Image)
|
|||
UWORD Width, Height;
|
||||
Width = (EPD_1IN54_V2_WIDTH % 8 == 0)? (EPD_1IN54_V2_WIDTH / 8 ): (EPD_1IN54_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_1IN54_V2_HEIGHT;
|
||||
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(5);
|
||||
|
||||
EPD_1IN54_V2_SetLut();
|
||||
EPD_1IN54_V2_SendCommand(0x37);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x40);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
EPD_1IN54_V2_SendData(0x00);
|
||||
|
||||
EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_1IN54_V2_SendData(0x80);
|
||||
|
||||
UDOUBLE Addr = 0;
|
||||
EPD_1IN54_V2_SendCommand(0x24);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#define EPD_1IN54_V2_HEIGHT 200
|
||||
|
||||
void EPD_1IN54_V2_Init(void);
|
||||
void EPD_1IN54_V2_Init_Partial(void);
|
||||
void EPD_1IN54_V2_Clear(void);
|
||||
void EPD_1IN54_V2_Display(UBYTE *Image);
|
||||
void EPD_1IN54_V2_DisplayPartBaseImage(UBYTE *Image);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,52 @@
|
|||
#include "EPD_2in13_V3.h"
|
||||
#include "Debug.h"
|
||||
|
||||
UBYTE WF_PARTIAL_2IN13_V2[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,
|
||||
0x14,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
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,0x00,0x32,0x36,
|
||||
};
|
||||
|
||||
UBYTE WS_20_30_2IN13_V2[159] =
|
||||
{
|
||||
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x80, 0x4A, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x4A, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0xF, 0x0, 0x0, 0xF, 0x0, 0x0, 0x2,
|
||||
0xF, 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,
|
||||
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
|
||||
0x22, 0x17, 0x41, 0x0, 0x32, 0x36
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
|
|
@ -95,7 +141,7 @@ parameter:
|
|||
static void EPD_2in13_V3_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x22); //Display Update Control
|
||||
EPD_2in13_V3_SendData(0xF7);
|
||||
EPD_2in13_V3_SendData(0xc7);
|
||||
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
|
@ -103,11 +149,36 @@ static void EPD_2in13_V3_TurnOnDisplay(void)
|
|||
static void EPD_2in13_V3_TurnOnDisplay_Partial(void)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x22); //Display Update Control
|
||||
EPD_2in13_V3_SendData(0xFF);
|
||||
EPD_2in13_V3_SendData(0x0f); // c0/ff
|
||||
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_2IN13_V3_LUT(UBYTE *lut)
|
||||
{
|
||||
UBYTE count;
|
||||
EPD_2in13_V3_SendCommand(0x32);
|
||||
for(count=0; count<153; count++)
|
||||
EPD_2in13_V3_SendData(lut[count]);
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_2IN13_V2_LUT_by_host(UBYTE *lut)
|
||||
{
|
||||
EPD_2IN13_V3_LUT((UBYTE *)lut); //lut
|
||||
EPD_2in13_V3_SendCommand(0x3f);
|
||||
EPD_2in13_V3_SendData(*(lut+153));
|
||||
EPD_2in13_V3_SendCommand(0x03); // gate voltage
|
||||
EPD_2in13_V3_SendData(*(lut+154));
|
||||
EPD_2in13_V3_SendCommand(0x04); // source voltage
|
||||
EPD_2in13_V3_SendData(*(lut+155)); // VSH
|
||||
EPD_2in13_V3_SendData(*(lut+156)); // VSH2
|
||||
EPD_2in13_V3_SendData(*(lut+157)); // VSL
|
||||
EPD_2in13_V3_SendCommand(0x2c); // VCOM
|
||||
EPD_2in13_V3_SendData(*(lut+158));
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
|
|
@ -178,6 +249,8 @@ void EPD_2in13_V3_Init(void)
|
|||
|
||||
EPD_2in13_V3_SetCursor(0, 0);
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
|
||||
EPD_2IN13_V2_LUT_by_host(WS_20_30_2IN13_V2);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -233,12 +306,31 @@ void EPD_2in13_V3_Display_Partial(UBYTE *Image)
|
|||
|
||||
//Reset
|
||||
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(10);
|
||||
DEV_Delay_ms(3);
|
||||
|
||||
EPD_2IN13_V2_LUT_by_host(WF_PARTIAL_2IN13_V2);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x37);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x40); ///RAM Ping-Pong enable
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2in13_V3_SendData(0x80);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x22); //Display Update Sequence Option
|
||||
EPD_2in13_V3_SendData(0xC0); // Enable clock and Enable analog
|
||||
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, 296-1);
|
||||
EPD_2in13_V3_SetCursor(0, 0);
|
||||
|
|
|
|||
|
|
@ -97,11 +97,11 @@ parameter:
|
|||
static void EPD_2IN66_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Delay_ms(20);
|
||||
while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy
|
||||
DEV_Delay_ms(5);
|
||||
}
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Delay_ms(10);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
315
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in7_V2.c
Normal file
|
|
@ -0,0 +1,315 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7_V2.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch V2 e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-04-22
|
||||
* | 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_2in7_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
UBYTE WF_PARTIAL_2in7_V2[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,
|
||||
0xF,0x0,0x0,0x0,0x0,0x0,0x1,
|
||||
0x1,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,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x22,0x17,0x41,0xB0,0x32,0x32,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7_V2_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7_V2_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_2IN7_V2_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_2IN7_V2_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
do {
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN) == 0)
|
||||
break;
|
||||
} while(1);
|
||||
DEV_Delay_ms(20);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn on display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7_V2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN7_V2_SendCommand(0x20);
|
||||
EPD_2IN7_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_2IN7_V2_TurnOnDisplay_Partial(void)
|
||||
{
|
||||
EPD_2IN7_V2_SendCommand(0x22);
|
||||
EPD_2IN7_V2_SendData(0x0f);
|
||||
EPD_2IN7_V2_SendCommand(0x20);
|
||||
EPD_2IN7_V2_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : set the look-up tables
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7_V2_SetLut(void)
|
||||
{
|
||||
unsigned int count;
|
||||
EPD_2IN7_V2_SendCommand(0x32); //vcom
|
||||
for(count = 0; count < 153; count++) {
|
||||
EPD_2IN7_V2_SendData(WF_PARTIAL_2in7_V2[count]);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_2IN7_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2IN7_V2_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_2IN7_V2_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2IN7_V2_SendData(Ystart & 0xFF);
|
||||
EPD_2IN7_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_2IN7_V2_SendData(Yend & 0xFF);
|
||||
EPD_2IN7_V2_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2IN7_V2_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_2IN7_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2IN7_V2_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_2IN7_V2_SendData(Ystart & 0xFF);
|
||||
EPD_2IN7_V2_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7_V2_Init(void)
|
||||
{
|
||||
EPD_2IN7_V2_Reset();
|
||||
EPD_2IN7_V2_ReadBusy();
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x12);
|
||||
EPD_2IN7_V2_ReadBusy();
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x01); //Driver output control
|
||||
EPD_2IN7_V2_SendData(0x27);
|
||||
EPD_2IN7_V2_SendData(0x01);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x11); //data entry mode
|
||||
EPD_2IN7_V2_SendData(0x03);
|
||||
|
||||
EPD_2IN7_V2_SetWindows(0, 0, EPD_2IN7_V2_WIDTH-1, EPD_2IN7_V2_HEIGHT-1);
|
||||
EPD_2IN7_V2_SetCursor(0, 0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7_V2_Clear(void)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7_V2_HEIGHT;
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7_V2_SendData(0XFF);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x26);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7_V2_SendData(0X00);
|
||||
}
|
||||
}
|
||||
EPD_2IN7_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7_V2_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7_V2_HEIGHT;
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN7_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_2IN7_V2_Display_Base(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7_V2_HEIGHT;
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x24); //Write Black and White image to RAM
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN7_V2_SendCommand(0x26); //Write Black and White image to RAM
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
EPD_2IN7_V2_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_2IN7_V2_Display_Partial(UBYTE *Image)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
Width = (EPD_2IN7_V2_WIDTH % 8 == 0)? (EPD_2IN7_V2_WIDTH / 8 ): (EPD_2IN7_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_2IN7_V2_HEIGHT;
|
||||
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(1);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
|
||||
EPD_2IN7_V2_ReadBusy();
|
||||
EPD_2IN7_V2_SetLut();
|
||||
EPD_2IN7_V2_SendCommand(0x37);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
EPD_2IN7_V2_SendData(0x40);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
EPD_2IN7_V2_SendData(0x00);
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x3c);
|
||||
EPD_2IN7_V2_SendData(0x80);
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x22);
|
||||
EPD_2IN7_V2_SendData(0xc0);
|
||||
EPD_2IN7_V2_SendCommand(0x20);
|
||||
EPD_2IN7_V2_ReadBusy();
|
||||
|
||||
EPD_2IN7_V2_SendCommand(0x24);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
EPD_2IN7_V2_SendData(Image[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
EPD_2IN7_V2_TurnOnDisplay_Partial();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2IN7_V2_Sleep(void)
|
||||
{
|
||||
EPD_2IN7_V2_SendCommand(0X10);
|
||||
EPD_2IN7_V2_SendData(0x01);
|
||||
}
|
||||
48
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in7_V2.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in7_V2.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.7inch V2 e-paper
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-04-22
|
||||
* | 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_2IN7_V2_H_
|
||||
#define __EPD_2IN7_V2_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2IN7_V2_WIDTH 176
|
||||
#define EPD_2IN7_V2_HEIGHT 264
|
||||
|
||||
void EPD_2IN7_V2_Init(void);
|
||||
void EPD_2IN7_V2_Clear(void);
|
||||
void EPD_2IN7_V2_Display(UBYTE *Image);
|
||||
void EPD_2IN7_V2_Sleep(void);
|
||||
|
||||
void EPD_2IN7_V2_Display_Base(UBYTE *Image);
|
||||
void EPD_2IN7_V2_Display_Partial(UBYTE *Image);
|
||||
|
||||
#endif
|
||||
|
|
@ -54,6 +54,29 @@ UBYTE _WF_PARTIAL_2IN9[159] =
|
|||
0x22,0x17,0x41,0xB0,0x32,0x36,
|
||||
};
|
||||
|
||||
UBYTE WS_20_30[159] =
|
||||
{
|
||||
0x80, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0,
|
||||
0x10, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0,
|
||||
0x80, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0,
|
||||
0x10, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x14, 0x8, 0x0, 0x0, 0x0, 0x0, 0x1,
|
||||
0xA, 0xA, 0x0, 0xA, 0xA, 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,
|
||||
0x14, 0x8, 0x0, 0x1, 0x0, 0x0, 0x1,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x0, 0x0, 0x0,
|
||||
0x22, 0x17, 0x41, 0x0, 0x32, 0x36
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
|
|
@ -61,11 +84,11 @@ parameter:
|
|||
static void EPD_2IN9_V2_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -111,15 +134,31 @@ 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(UBYTE *lut)
|
||||
{
|
||||
UBYTE count;
|
||||
EPD_2IN9_V2_SendCommand(0x32);
|
||||
for(count=0; count<153; count++)
|
||||
EPD_2IN9_V2_SendData(_WF_PARTIAL_2IN9[count]);
|
||||
EPD_2IN9_V2_SendData(lut[count]);
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_2IN9_V2_LUT_by_host(UBYTE *lut)
|
||||
{
|
||||
EPD_2IN9_V2_LUT((UBYTE *)lut); //lut
|
||||
EPD_2IN9_V2_SendCommand(0x3f);
|
||||
EPD_2IN9_V2_SendData(*(lut+153));
|
||||
EPD_2IN9_V2_SendCommand(0x03); // gate voltage
|
||||
EPD_2IN9_V2_SendData(*(lut+154));
|
||||
EPD_2IN9_V2_SendCommand(0x04); // source voltage
|
||||
EPD_2IN9_V2_SendData(*(lut+155)); // VSH
|
||||
EPD_2IN9_V2_SendData(*(lut+156)); // VSH2
|
||||
EPD_2IN9_V2_SendData(*(lut+157)); // VSL
|
||||
EPD_2IN9_V2_SendCommand(0x2c); // VCOM
|
||||
EPD_2IN9_V2_SendData(*(lut+158));
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
|
|
@ -127,7 +166,7 @@ parameter:
|
|||
static void EPD_2IN9_V2_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2IN9_V2_SendCommand(0x22); //Display Update Control
|
||||
EPD_2IN9_V2_SendData(0xF7);
|
||||
EPD_2IN9_V2_SendData(0xc7);
|
||||
EPD_2IN9_V2_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
}
|
||||
|
|
@ -200,6 +239,8 @@ void EPD_2IN9_V2_Init(void)
|
|||
|
||||
EPD_2IN9_V2_SetCursor(0, 0);
|
||||
EPD_2IN9_V2_ReadBusy();
|
||||
|
||||
EPD_2IN9_V2_LUT_by_host(WS_20_30);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -209,6 +250,7 @@ parameter:
|
|||
void EPD_2IN9_V2_Clear(void)
|
||||
{
|
||||
UWORD i;
|
||||
|
||||
EPD_2IN9_V2_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
|
|
@ -255,11 +297,11 @@ void EPD_2IN9_V2_Display_Partial(UBYTE *Image)
|
|||
|
||||
//Reset
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(5);
|
||||
DEV_Delay_ms(1);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
DEV_Delay_ms(2);
|
||||
|
||||
EPD_2IN9_V2_LUT();
|
||||
EPD_2IN9_V2_LUT(_WF_PARTIAL_2IN9);
|
||||
EPD_2IN9_V2_SendCommand(0x37);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
EPD_2IN9_V2_SendData(0x00);
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ void EPD_3IN7_4Gray_Init(void)
|
|||
EPD_3IN7_SendData(0x03);
|
||||
|
||||
EPD_3IN7_SendCommand(0x3C); // set border
|
||||
EPD_3IN7_SendData(0x00);
|
||||
EPD_3IN7_SendData(0x03);
|
||||
|
||||
EPD_3IN7_SendCommand(0x0C); // set booster strength
|
||||
EPD_3IN7_SendData(0xAE);
|
||||
|
|
@ -278,7 +278,7 @@ void EPD_3IN7_1Gray_Init(void)
|
|||
EPD_3IN7_SendData(0x03);
|
||||
|
||||
EPD_3IN7_SendCommand(0x3C); // set border
|
||||
EPD_3IN7_SendData(0x00);
|
||||
EPD_3IN7_SendData(0x03);
|
||||
|
||||
EPD_3IN7_SendCommand(0x0C); // set booster strength
|
||||
EPD_3IN7_SendData(0xAE);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,61 @@
|
|||
#include "EPD_7in5_V2.h"
|
||||
#include "Debug.h"
|
||||
|
||||
|
||||
UBYTE Voltage_Frame_7IN5_V2[]={
|
||||
0x6, 0x3F, 0x3F, 0x11, 0x24, 0x7, 0x17,
|
||||
};
|
||||
|
||||
UBYTE LUT_VCOM_7IN5_V2[]={
|
||||
0x0, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x0, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x0, 0xF, 0xF, 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,
|
||||
};
|
||||
|
||||
UBYTE LUT_WW_7IN5_V2[]={
|
||||
0x10, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x20, 0xF, 0xF, 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,
|
||||
};
|
||||
|
||||
UBYTE LUT_BW_7IN5_V2[]={
|
||||
0x10, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x20, 0xF, 0xF, 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,
|
||||
};
|
||||
|
||||
UBYTE LUT_WB_7IN5_V2[]={
|
||||
0x80, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x40, 0xF, 0xF, 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,
|
||||
};
|
||||
|
||||
UBYTE LUT_BB_7IN5_V2[]={
|
||||
0x80, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x40, 0xF, 0xF, 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,
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
|
|
@ -38,11 +93,11 @@ parameter:
|
|||
static void EPD_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(200);
|
||||
DEV_Delay_ms(20);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
@ -79,20 +134,43 @@ static void EPD_WaitUntilIdle(void)
|
|||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
do{
|
||||
EPD_SendCommand(0x71);
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Delay_ms(5);
|
||||
}while(!(DEV_Digital_Read(EPD_BUSY_PIN)));
|
||||
DEV_Delay_ms(20);
|
||||
DEV_Delay_ms(5);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
static void EPD_7IN5_V2_LUT(UBYTE* lut_vcom, UBYTE* lut_ww, UBYTE* lut_bw, UBYTE* lut_wb, UBYTE* lut_bb)
|
||||
{
|
||||
UBYTE count;
|
||||
|
||||
EPD_SendCommand(0x20); //VCOM
|
||||
for(count=0; count<42; count++)
|
||||
EPD_SendData(lut_vcom[count]);
|
||||
|
||||
EPD_SendCommand(0x21); //LUTBW
|
||||
for(count=0; count<42; count++)
|
||||
EPD_SendData(lut_ww[count]);
|
||||
|
||||
EPD_SendCommand(0x22); //LUTBW
|
||||
for(count=0; count<42; count++)
|
||||
EPD_SendData(lut_bw[count]);
|
||||
|
||||
EPD_SendCommand(0x23); //LUTWB
|
||||
for(count=0; count<42; count++)
|
||||
EPD_SendData(lut_wb[count]);
|
||||
|
||||
EPD_SendCommand(0x24); //LUTBB
|
||||
for(count=0; count<42; count++)
|
||||
EPD_SendData(lut_bb[count]);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_7IN5_V2_TurnOnDisplay(void)
|
||||
{
|
||||
{
|
||||
EPD_SendCommand(0x12); //DISPLAY REFRESH
|
||||
DEV_Delay_ms(100); //!!!The delay here is necessary, 200uS at least!!!
|
||||
EPD_WaitUntilIdle();
|
||||
|
|
@ -106,18 +184,37 @@ UBYTE EPD_7IN5_V2_Init(void)
|
|||
{
|
||||
EPD_Reset();
|
||||
|
||||
EPD_SendCommand(0x01); //POWER SETTING
|
||||
EPD_SendData(0x07);
|
||||
EPD_SendData(0x07); //VGH=20V,VGL=-20V
|
||||
EPD_SendData(0x3f); //VDH=15V
|
||||
EPD_SendData(0x3f); //VDL=-15V
|
||||
// EPD_SendCommand(0x01); //POWER SETTING
|
||||
// EPD_SendData(0x07);
|
||||
// EPD_SendData(0x07); //VGH=20V,VGL=-20V
|
||||
// EPD_SendData(0x3f); //VDH=15V
|
||||
// EPD_SendData(0x3f); //VDL=-15V
|
||||
|
||||
EPD_SendCommand(0x01); // power setting
|
||||
EPD_SendData(0x17); // 1-0=11: internal power
|
||||
EPD_SendData(*(Voltage_Frame_7IN5_V2+6)); // VGH&VGL
|
||||
EPD_SendData(*(Voltage_Frame_7IN5_V2+1)); // VSH
|
||||
EPD_SendData(*(Voltage_Frame_7IN5_V2+2)); // VSL
|
||||
EPD_SendData(*(Voltage_Frame_7IN5_V2+3)); // VSHR
|
||||
|
||||
EPD_SendCommand(0x82); // VCOM DC Setting
|
||||
EPD_SendData(*(Voltage_Frame_7IN5_V2+4)); // VCOM
|
||||
|
||||
EPD_SendCommand(0x06); // Booster Setting
|
||||
EPD_SendData(0x27);
|
||||
EPD_SendData(0x27);
|
||||
EPD_SendData(0x2F);
|
||||
EPD_SendData(0x17);
|
||||
|
||||
EPD_SendCommand(0x30); // OSC Setting
|
||||
EPD_SendData(*(Voltage_Frame_7IN5_V2+0)); // 2-0=100: N=4 ; 5-3=111: M=7 ; 3C=50Hz 3A=100HZ
|
||||
|
||||
EPD_SendCommand(0x04); //POWER ON
|
||||
DEV_Delay_ms(100);
|
||||
EPD_WaitUntilIdle();
|
||||
|
||||
EPD_SendCommand(0X00); //PANNEL SETTING
|
||||
EPD_SendData(0x1F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
EPD_SendData(0x3F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
|
||||
EPD_SendCommand(0x61); //tres
|
||||
EPD_SendData(0x03); //source 800
|
||||
|
|
@ -141,6 +238,8 @@ UBYTE EPD_7IN5_V2_Init(void)
|
|||
EPD_SendData(0x00);
|
||||
EPD_SendData(0x00);
|
||||
|
||||
EPD_7IN5_V2_LUT(LUT_VCOM_7IN5_V2, LUT_WW_7IN5_V2, LUT_BW_7IN5_V2, LUT_WB_7IN5_V2, LUT_BB_7IN5_V2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -193,13 +292,13 @@ void EPD_7IN5_V2_Display(const UBYTE *blackimage)
|
|||
UDOUBLE Width, Height;
|
||||
Width =(EPD_7IN5_V2_WIDTH % 8 == 0)?(EPD_7IN5_V2_WIDTH / 8 ):(EPD_7IN5_V2_WIDTH / 8 + 1);
|
||||
Height = EPD_7IN5_V2_HEIGHT;
|
||||
|
||||
EPD_SendCommand(0x10);
|
||||
for (UDOUBLE j = 0; j < Height; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
EPD_SendData(blackimage[i + j * Width]);
|
||||
}
|
||||
}
|
||||
|
||||
// EPD_SendCommand(0x10);
|
||||
// for (UDOUBLE j = 0; j < Height; j++) {
|
||||
// for (UDOUBLE i = 0; i < Width; i++) {
|
||||
// EPD_SendData(blackimage[i + j * Width]);
|
||||
// }
|
||||
// }
|
||||
EPD_SendCommand(0x13);
|
||||
for (UDOUBLE j = 0; j < Height; j++) {
|
||||
for (UDOUBLE i = 0; i < Width; i++) {
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/7in5_V2_0.bmp
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/Color7.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/c/pic/Pico_3in7.bmp
Normal file
|
After Width: | Height: | Size: 66 KiB |
|
|
@ -21,7 +21,7 @@ try:
|
|||
epd = epd1in54_V2.EPD()
|
||||
|
||||
logging.info("init and Clear")
|
||||
epd.init()
|
||||
epd.init(0)
|
||||
epd.Clear(0xFF)
|
||||
time.sleep(1)
|
||||
|
||||
|
|
@ -67,6 +67,7 @@ try:
|
|||
# Image.new('1', (epd.width, epd.height), 255)
|
||||
epd.displayPartBaseImage(epd.getbuffer(time_image))
|
||||
|
||||
epd.init(1) # into partial refresh mode
|
||||
time_draw = ImageDraw.Draw(time_image)
|
||||
num = 0
|
||||
while (True):
|
||||
|
|
@ -80,7 +81,7 @@ try:
|
|||
break
|
||||
|
||||
logging.info("Clear...")
|
||||
epd.init()
|
||||
epd.init(0)
|
||||
epd.Clear(0xFF)
|
||||
|
||||
logging.info("Goto Sleep...")
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ try:
|
|||
draw.arc((140, 50, 190, 100), 0, 360, fill = 0)
|
||||
draw.rectangle((80, 50, 130, 100), fill = 0)
|
||||
draw.chord((200, 50, 250, 100), 0, 360, fill = 0)
|
||||
# Himage = Himage.transpose(method=Image.ROTATE_180)
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(2)
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ try:
|
|||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
drawry = ImageDraw.Draw(HRYimage)
|
||||
drawblack.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
drawblack.text((10, 20), '5.83inch e-Paper bc', font = font24, fill = 0)
|
||||
drawblack.text((10, 20), '5.83inch e-Paper b V2', 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)
|
||||
|
|
@ -57,7 +57,7 @@ try:
|
|||
drawry = ImageDraw.Draw(LRYimage)
|
||||
|
||||
drawblack.text((2, 0), 'hello world', font = font18, fill = 0)
|
||||
drawblack.text((2, 20), '5.83inch epd bc', font = font18, fill = 0)
|
||||
drawblack.text((2, 20), '5.83inch epd b V2', font = font18, fill = 0)
|
||||
drawblack.text((20, 50), u'微雪电子', font = font18, fill = 0)
|
||||
drawblack.line((10, 90, 60, 140), fill = 0)
|
||||
drawblack.line((60, 90, 10, 140), fill = 0)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ try:
|
|||
time.sleep(2)
|
||||
|
||||
logging.info("4.read bmp file on window")
|
||||
Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
Himage2 = Image.new('1', (epd.width, epd.height), 255) # 255: clear the frame
|
||||
bmp = Image.open(os.path.join(picdir, '100x100.bmp'))
|
||||
Himage2.paste(bmp, (50,10))
|
||||
epd.display(epd.getbuffer(Himage2))
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ try:
|
|||
time.sleep(2)
|
||||
|
||||
logging.info("3.read bmp file")
|
||||
Himage = Image.open(os.path.join(picdir, '7in5_V2_r.bmp'))
|
||||
Himage_Other = Image.open(os.path.join(picdir, '7in5_V2_b.bmp'))
|
||||
Himage = Image.open(os.path.join(picdir, '7in5_V2_b.bmp'))
|
||||
Himage_Other = Image.open(os.path.join(picdir, '7in5_V2_r.bmp'))
|
||||
epd.display(epd.getbuffer(Himage),epd.getbuffer(Himage_Other))
|
||||
time.sleep(2)
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 80
|
||||
EPD_HEIGHT = 128
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -109,7 +111,7 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.send_command(0x71)
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
busy =not(busy & 0x01)
|
||||
|
|
@ -118,7 +120,7 @@ class EPD:
|
|||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
busy =not(busy & 0x01)
|
||||
epdconfig.delay_ms(800)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x12)
|
||||
|
|
@ -242,14 +244,14 @@ class EPD:
|
|||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 200
|
||||
EPD_HEIGHT = 200
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -131,10 +133,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
|
|
@ -206,14 +208,14 @@ class EPD:
|
|||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 200
|
||||
EPD_HEIGHT = 200
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -43,6 +45,75 @@ class EPD:
|
|||
self.width = EPD_WIDTH
|
||||
self.height = EPD_HEIGHT
|
||||
|
||||
# waveform full refresh
|
||||
WF_Full_1IN54 = [
|
||||
0x80, 0x48, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x48, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x80, 0x48, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x40, 0x48, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0xA, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x8, 0x1, 0x0, 0x8, 0x1, 0x0, 0x2,
|
||||
0xA, 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, 0x0, 0x32, 0x20
|
||||
]
|
||||
|
||||
# waveform partial refresh(fast)
|
||||
WF_PARTIAL_1IN54_0 = [
|
||||
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,
|
||||
0xF,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x1,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,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x02,0x17,0x41,0xB0,0x32,0x28,
|
||||
]
|
||||
|
||||
# waveform partial refresh(quality)
|
||||
WF_PARTIAL_1IN54_1 = [
|
||||
0x0,0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x40,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,
|
||||
0xA,0x0,0x0,0x0,0x0,0x0,0x1,
|
||||
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,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x22,0x22,0x22,0x22,0x22,0x22,0x0,0x0,0x0,
|
||||
0x22,0x17,0x41,0x0,0x32,0x20,
|
||||
]
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
|
|
@ -65,69 +136,130 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1):
|
||||
epdconfig.delay_ms(20)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
self.send_data(0xF7)
|
||||
self.send_data(0xc7)
|
||||
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_data(0xcF)
|
||||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
self.ReadBusy()
|
||||
|
||||
def init(self):
|
||||
def lut(self, lut):
|
||||
self.send_command(0x32) # WRITE_LUT_REGISTER
|
||||
for i in range(0, len(lut)):
|
||||
self.send_data(lut[i])
|
||||
|
||||
def set_lut(self, lut):
|
||||
self.lut(lut)
|
||||
|
||||
self.send_command(0x3f)
|
||||
self.send_data(lut[153])
|
||||
|
||||
self.send_command(0x03)
|
||||
self.send_data(lut[154])
|
||||
|
||||
self.send_command(0x04)
|
||||
self.send_data(lut[155])
|
||||
self.send_data(lut[156])
|
||||
self.send_data(lut[157])
|
||||
|
||||
self.send_command(0x2c)
|
||||
self.send_data(lut[158])
|
||||
|
||||
def SetWindows(self, Xstart, Ystart, Xend, Yend):
|
||||
self.send_command(0x44) # SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
self.send_data((Xstart>>3) & 0xFF)
|
||||
self.send_data((Xend>>3) & 0xFF)
|
||||
|
||||
self.send_command(0x45) # SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
self.send_data(Ystart & 0xFF)
|
||||
self.send_data((Ystart >> 8) & 0xFF)
|
||||
self.send_data(Yend & 0xFF)
|
||||
self.send_data((Yend >> 8) & 0xFF)
|
||||
|
||||
|
||||
def SetCursor(self, Xstart, Ystart):
|
||||
self.send_command(0x4E) # SET_RAM_X_ADDRESS_COUNTER
|
||||
self.send_data(Xstart & 0xFF)
|
||||
|
||||
self.send_command(0x4F) # SET_RAM_Y_ADDRESS_COUNTER
|
||||
self.send_data(Ystart & 0xFF)
|
||||
self.send_data((Ystart >> 8) & 0xFF)
|
||||
|
||||
def init(self, isPartial):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
if(isPartial):
|
||||
logger.debug("partial refresh")
|
||||
self.reset()
|
||||
self.ReadBusy()
|
||||
|
||||
self.set_lut(self.WF_PARTIAL_1IN54_0)
|
||||
|
||||
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.ReadBusy()
|
||||
self.send_command(0x12) # SWRESET
|
||||
self.ReadBusy()
|
||||
|
||||
self.send_command(0x01) # DRIVER_OUTPUT_CONTROL
|
||||
self.send_data(0xC7) # (EPD_HEIGHT - 1) & 0xFF
|
||||
self.send_data(0x00) # ((EPD_HEIGHT - 1) >> 8) & 0xFF
|
||||
self.send_data(0x01) # GD = 0 SM = 0 TB = 0
|
||||
|
||||
self.send_command(0x11) # data entry mode
|
||||
self.send_data(0x01)
|
||||
|
||||
self.send_command(0x44) # set Ram-X address start/end position
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x18) # 0x0C-->(18+1)*8=200
|
||||
|
||||
self.send_command(0x45) # set Ram-Y address start/end position
|
||||
self.send_data(0xC7) # 0xC7-->(199+1)=200
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x00)
|
||||
else:
|
||||
logger.debug("full refresh")
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
self.ReadBusy()
|
||||
self.send_command(0x12) # SWRESET (software reset)
|
||||
self.ReadBusy()
|
||||
|
||||
self.send_command(0x01) # DRIVER_OUTPUT_CONTROL
|
||||
self.send_data(0xC7) # (EPD_HEIGHT - 1) & 0xFF
|
||||
self.send_data(0x00) # ((EPD_HEIGHT - 1) >> 8) & 0xFF
|
||||
self.send_data(0x01) # GD = 0 SM = 0 TB = 0
|
||||
|
||||
self.send_command(0x11) # data entry mode
|
||||
self.send_data(0x01)
|
||||
|
||||
self.SetWindows(0, self.height-1, self.width-1, 0) # Set Windows
|
||||
|
||||
self.send_command(0x3C) # BorderWavefrom
|
||||
self.send_data(0x01)
|
||||
|
||||
self.send_command(0x3C) # BorderWavefrom
|
||||
self.send_data(0x01)
|
||||
self.send_command(0x18)
|
||||
self.send_data(0x80)
|
||||
|
||||
self.send_command(0x18)
|
||||
self.send_data(0x80)
|
||||
self.send_command(0x22) # #Load Temperature and waveform setting.
|
||||
self.send_data(0XB1)
|
||||
self.send_command(0x20)
|
||||
|
||||
self.send_command(0x22) # #Load Temperature and waveform setting.
|
||||
self.send_data(0XB1)
|
||||
self.send_command(0x20)
|
||||
|
||||
self.send_command(0x4E) # set RAM x address count to 0;
|
||||
self.send_data(0x00)
|
||||
self.send_command(0x4F) # set RAM y address count to 0X199;
|
||||
self.send_data(0xC7)
|
||||
self.send_data(0x00)
|
||||
|
||||
self.ReadBusy()
|
||||
self.SetCursor(0, self.height-1) # Set Cursor
|
||||
|
||||
self.ReadBusy()
|
||||
|
||||
self.set_lut(self.WF_Full_1IN54) # Set lut
|
||||
|
||||
def Clear(self, color):
|
||||
self.send_command(0x24)
|
||||
|
|
@ -143,14 +275,14 @@ class EPD:
|
|||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
@ -188,14 +320,6 @@ class EPD:
|
|||
def displayPart(self, image):
|
||||
if (image == None):
|
||||
return
|
||||
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(10)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.send_command(0x3c)
|
||||
self.send_data(0x80)
|
||||
|
||||
self.send_command(0x24)
|
||||
for j in range(0, self.height):
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 200
|
||||
EPD_HEIGHT = 200
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -74,10 +76,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0):
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def set_lut_bw(self):
|
||||
self.send_command(0x20) # vcom
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 200
|
||||
EPD_HEIGHT = 200
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,10 +68,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1):
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 152
|
||||
EPD_HEIGHT = 152
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -64,10 +66,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(200)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -101,14 +103,14 @@ class EPD:
|
|||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
@ -119,11 +121,11 @@ class EPD:
|
|||
|
||||
def display(self, blackimage, yellowimage):
|
||||
self.send_command(0x10)
|
||||
logging.debug("blackimage")
|
||||
logger.debug("blackimage")
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(blackimage[i])
|
||||
self.send_command(0x13)
|
||||
logging.debug("yellowimage")
|
||||
logger.debug("yellowimage")
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(yellowimage[i])
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ import numpy as np
|
|||
EPD_WIDTH = 122
|
||||
EPD_HEIGHT = 250
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -90,9 +92,9 @@ class EPD:
|
|||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
self.send_command(0xFF) # TERMINATE_FRAME_READ_WRITE
|
||||
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.ReadBusy()
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self, lut):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -168,14 +170,14 @@ class EPD:
|
|||
pixels = image_monocolor.load()
|
||||
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
if pixels[x, y] == 0:
|
||||
# x = imwidth - x
|
||||
buf[int(x / 8) + y * linewidth] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ import numpy as np
|
|||
EPD_WIDTH = 122
|
||||
EPD_HEIGHT = 250
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -222,14 +224,14 @@ class EPD:
|
|||
pixels = image_monocolor.load()
|
||||
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
if pixels[x, y] == 0:
|
||||
x = imwidth - x
|
||||
buf[int(x / 8) + y * linewidth] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
@ -293,7 +295,7 @@ class EPD:
|
|||
linewidth = int(self.width/8)
|
||||
else:
|
||||
linewidth = int(self.width/8) + 1
|
||||
# logging.debug(linewidth)
|
||||
# logger.debug(linewidth)
|
||||
|
||||
self.send_command(0x24)
|
||||
for j in range(0, self.height):
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 104
|
||||
EPD_HEIGHT = 212
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -65,12 +67,12 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.send_command(0x71);
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0):
|
||||
self.send_command(0x71);
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -96,21 +98,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 104
|
||||
EPD_HEIGHT = 212
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -65,10 +67,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -97,21 +99,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ import RPi.GPIO as GPIO
|
|||
EPD_WIDTH = 104
|
||||
EPD_HEIGHT = 212
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -170,11 +172,11 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
self.send_command(0x71)
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x12)
|
||||
|
|
@ -263,21 +265,21 @@ class EPD:
|
|||
self.send_data(self.lut_bb1[count])
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 152
|
||||
EPD_HEIGHT = 296
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -88,10 +90,10 @@ class EPD:
|
|||
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(200)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
|
||||
def init(self, mode):
|
||||
|
|
@ -143,7 +145,7 @@ class EPD:
|
|||
self.ReadBusy()
|
||||
|
||||
else:
|
||||
logging.debug("There is no such mode")
|
||||
logger.debug("There is no such mode")
|
||||
|
||||
return 0
|
||||
|
||||
|
|
@ -159,21 +161,21 @@ class EPD:
|
|||
self.ReadBusy()
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 152
|
||||
EPD_HEIGHT = 296
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -68,10 +70,10 @@ class EPD:
|
|||
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(20)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
|
||||
def init(self):
|
||||
|
|
@ -122,21 +124,21 @@ class EPD:
|
|||
self.ReadBusy()
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ GRAY1 = 0xff #white
|
|||
GRAY2 = 0xC0
|
||||
GRAY3 = 0x80 #gray
|
||||
GRAY4 = 0x00 #Blackest
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -171,10 +174,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(200)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def set_lut(self):
|
||||
self.send_command(0x20) # vcom
|
||||
|
|
@ -361,21 +364,21 @@ class EPD:
|
|||
self.send_data(0x57)
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
@ -385,15 +388,15 @@ class EPD:
|
|||
return buf
|
||||
|
||||
def getbuffer_4Gray(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width / 4) * self.height)
|
||||
image_monocolor = image.convert('L')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
i=0
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
|
|
@ -406,11 +409,11 @@ class EPD:
|
|||
buf[int((x + (y * self.width))/4)] = ((pixels[x-3, y]&0xc0) | (pixels[x-2, y]&0xc0)>>2 | (pixels[x-1, y]&0xc0)>>4 | (pixels[x, y]&0xc0)>>6)
|
||||
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for x in range(imwidth):
|
||||
for y in range(imheight):
|
||||
newx = y
|
||||
newy = x
|
||||
newy = self.height - x - 1
|
||||
if(pixels[x, y] == 0xC0):
|
||||
pixels[x, y] = 0x80
|
||||
elif (pixels[x, y] == 0x80):
|
||||
|
|
@ -501,13 +504,13 @@ class EPD:
|
|||
self.ReadBusy()
|
||||
# pass
|
||||
|
||||
def Clear(self, color):
|
||||
def Clear(self, color=0xFF):
|
||||
self.send_command(0x10)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(0xFF)
|
||||
self.send_data(color)
|
||||
self.send_command(0x13)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(0xFF)
|
||||
self.send_data(color)
|
||||
self.send_command(0x12)
|
||||
self.ReadBusy()
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 176
|
||||
EPD_HEIGHT = 264
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -119,10 +121,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def set_lut(self):
|
||||
self.send_command(0x20) # vcom
|
||||
|
|
@ -206,21 +208,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
@ -243,15 +245,15 @@ class EPD:
|
|||
self.send_command(0x12)
|
||||
self.ReadBusy()
|
||||
|
||||
def Clear(self):
|
||||
def Clear(self, color=0x00):
|
||||
self.send_command(0x10)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(0x00)
|
||||
self.send_data(color)
|
||||
self.send_command(0x11)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(0x00)
|
||||
self.send_data(color)
|
||||
self.send_command(0x11)
|
||||
|
||||
self.send_command(0x12)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 176
|
||||
EPD_HEIGHT = 264
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -69,10 +71,10 @@ class EPD:
|
|||
|
||||
# Read Busy
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
# Setting the display window
|
||||
def SetWindows(self, Xstart, Ystart, Xend, Yend):
|
||||
|
|
@ -118,21 +120,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 128
|
||||
EPD_HEIGHT = 296
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -90,9 +92,9 @@ class EPD:
|
|||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
self.send_command(0xFF) # TERMINATE_FRAME_READ_WRITE
|
||||
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.ReadBusy()
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def SetWindow(self, x_start, y_start, x_end, y_end):
|
||||
self.send_command(0x44) # SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
|
|
@ -149,21 +151,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 128
|
||||
EPD_HEIGHT = 296
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -44,25 +46,47 @@ class EPD:
|
|||
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,
|
||||
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,
|
||||
]
|
||||
|
||||
WS_20_30 = [
|
||||
0x80, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0,
|
||||
0x10, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0,
|
||||
0x80, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0,
|
||||
0x10, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x14, 0x8, 0x0, 0x0, 0x0, 0x0, 0x2,
|
||||
0xA, 0xA, 0x0, 0xA, 0xA, 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,
|
||||
0x14, 0x8, 0x0, 0x1, 0x0, 0x0, 0x1,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x0, 0x0, 0x0,
|
||||
0x22, 0x17, 0x41, 0x0, 0x32, 0x36
|
||||
]
|
||||
|
||||
# Hardware reset
|
||||
|
|
@ -87,14 +111,14 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x22) # DISPLAY_UPDATE_CONTROL_2
|
||||
self.send_data(0xF7)
|
||||
self.send_data(0xc7)
|
||||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
self.ReadBusy()
|
||||
|
||||
|
|
@ -104,12 +128,25 @@ class EPD:
|
|||
self.send_command(0x20) # MASTER_ACTIVATION
|
||||
self.ReadBusy()
|
||||
|
||||
def SendLut(self):
|
||||
def lut(self, lut):
|
||||
self.send_command(0x32)
|
||||
for i in range(0, 153):
|
||||
self.send_data(self.WF_PARTIAL_2IN9[i])
|
||||
self.send_data(lut[i])
|
||||
self.ReadBusy()
|
||||
|
||||
def SetLut(self, lut):
|
||||
self.lut(lut)
|
||||
self.send_command(0x3f)
|
||||
self.send_data(lut[153])
|
||||
self.send_command(0x03); # gate voltage
|
||||
self.send_data(lut[154])
|
||||
self.send_command(0x04); # source voltage
|
||||
self.send_data(lut[155]) # VSH
|
||||
self.send_data(lut[156]) # VSH2
|
||||
self.send_data(lut[157]) # VSL
|
||||
self.send_command(0x2c); # VCOM
|
||||
self.send_data(lut[158])
|
||||
|
||||
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
|
||||
|
|
@ -129,7 +166,6 @@ class EPD:
|
|||
self.send_command(0x4F) # SET_RAM_Y_ADDRESS_COUNTER
|
||||
self.send_data(y & 0xFF)
|
||||
self.send_data((y >> 8) & 0xFF)
|
||||
self.ReadBusy()
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -137,45 +173,47 @@ class EPD:
|
|||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
self.ReadBusy();
|
||||
self.send_command(0x12); #SWRESET
|
||||
self.ReadBusy();
|
||||
self.ReadBusy()
|
||||
self.send_command(0x12) #SWRESET
|
||||
self.ReadBusy()
|
||||
|
||||
self.send_command(0x01); #Driver output control
|
||||
self.send_data(0x27);
|
||||
self.send_data(0x01);
|
||||
self.send_data(0x00);
|
||||
self.send_command(0x01) #Driver output control
|
||||
self.send_data(0x27)
|
||||
self.send_data(0x01)
|
||||
self.send_data(0x00)
|
||||
|
||||
self.send_command(0x11); #data entry mode
|
||||
self.send_data(0x03);
|
||||
self.send_command(0x11) #data entry mode
|
||||
self.send_data(0x03)
|
||||
|
||||
self.SetWindow(0, 0, self.width-1, self.height-1);
|
||||
self.SetWindow(0, 0, self.width-1, self.height-1)
|
||||
|
||||
self.send_command(0x21); # Display update control
|
||||
self.send_data(0x00);
|
||||
self.send_data(0x80);
|
||||
self.send_command(0x21) # Display update control
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x80)
|
||||
|
||||
self.SetCursor(0, 0);
|
||||
self.ReadBusy();
|
||||
self.SetCursor(0, 0)
|
||||
self.ReadBusy()
|
||||
|
||||
self.SetLut(self.WS_20_30)
|
||||
# EPD hardware init end
|
||||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
@ -218,26 +256,26 @@ class EPD:
|
|||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(2)
|
||||
|
||||
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.SetLut(self.WF_PARTIAL_2IN9)
|
||||
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(0x3C) #BorderWavefrom
|
||||
self.send_data(0x80)
|
||||
|
||||
self.send_command(0x22);
|
||||
self.send_data(0xC0);
|
||||
self.send_command(0x20);
|
||||
self.ReadBusy();
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 128
|
||||
EPD_HEIGHT = 296
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,12 +68,12 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.send_command(0X71)
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
self.send_command(0X71)
|
||||
epdconfig.delay_ms(200)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -98,21 +100,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 128
|
||||
EPD_HEIGHT = 296
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,10 +68,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(200)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -97,21 +99,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ import RPi.GPIO as GPIO
|
|||
EPD_WIDTH = 128
|
||||
EPD_HEIGHT = 296
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -129,11 +131,11 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
self.send_command(0x71)
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x12)
|
||||
|
|
@ -213,21 +215,21 @@ class EPD:
|
|||
self.send_data(self.lut_bb1[count])
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -36,8 +36,11 @@ EPD_HEIGHT = 480
|
|||
|
||||
GRAY1 = 0xff #white
|
||||
GRAY2 = 0xC0 #Close to white
|
||||
GRAY3 = 0x80 #Close to balck
|
||||
GRAY4 = 0x00 #balck
|
||||
GRAY3 = 0x80 #Close to black
|
||||
GRAY4 = 0x00 #black
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -132,10 +135,10 @@ class EPD:
|
|||
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
|
||||
def init(self, mode):
|
||||
|
|
@ -211,7 +214,7 @@ class EPD:
|
|||
self.send_data(0xFF)
|
||||
self.send_data(0xFF)
|
||||
else:
|
||||
logging.debug("There is no such mode")
|
||||
logger.debug("There is no such mode")
|
||||
|
||||
self.send_command(0x44) # setting X direction start/end position of RAM
|
||||
self.send_data(0x00)
|
||||
|
|
@ -237,21 +240,21 @@ class EPD:
|
|||
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
@ -262,15 +265,15 @@ class EPD:
|
|||
|
||||
|
||||
def getbuffer_4Gray(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width / 4) * self.height)
|
||||
image_monocolor = image.convert('L')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
i=0
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
|
|
@ -283,7 +286,7 @@ class EPD:
|
|||
buf[int((x + (y * self.width))/4)] = ((pixels[x-3, y]&0xc0) | (pixels[x-2, y]&0xc0)>>2 | (pixels[x-1, y]&0xc0)>>4 | (pixels[x, y]&0xc0)>>6)
|
||||
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for x in range(imwidth):
|
||||
for y in range(imheight):
|
||||
newx = y
|
||||
|
|
@ -430,7 +433,7 @@ class EPD:
|
|||
elif(mode == 1): #1Gray
|
||||
self.load_lut(self.lut_1Gray_DU)
|
||||
else:
|
||||
logging.debug("There is no such mode")
|
||||
logger.debug("There is no such mode")
|
||||
|
||||
self.send_command(0x20)
|
||||
self.ReadBusy()
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 640
|
||||
EPD_HEIGHT = 400
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -75,16 +77,16 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusyHigh(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def ReadBusyLow(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -129,7 +131,7 @@ class EPD:
|
|||
image_monocolor = image.convert('RGB')#Picture mode conversion
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
logging.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
logger.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ GRAY2 = 0xC0
|
|||
GRAY3 = 0x80 #gray
|
||||
GRAY4 = 0x00 #Blackest
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -388,21 +390,21 @@ class EPD:
|
|||
self.send_data(0x97)
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
@ -412,15 +414,15 @@ class EPD:
|
|||
return buf
|
||||
|
||||
def getbuffer_4Gray(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width / 4) * self.height)
|
||||
image_monocolor = image.convert('L')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
i=0
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
|
|
@ -433,7 +435,7 @@ class EPD:
|
|||
buf[int((x + (y * self.width))/4)] = ((pixels[x-3, y]&0xc0) | (pixels[x-2, y]&0xc0)>>2 | (pixels[x-1, y]&0xc0)>>4 | (pixels[x, y]&0xc0)>>6)
|
||||
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for x in range(imwidth):
|
||||
for y in range(imheight):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 400
|
||||
EPD_HEIGHT = 300
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -65,12 +67,12 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.send_command(0x71);
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
self.send_command(0x71);
|
||||
epdconfig.delay_ms(20)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -87,21 +89,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 400
|
||||
EPD_HEIGHT = 300
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -65,10 +67,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -90,21 +92,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -32,10 +32,16 @@
|
|||
import logging
|
||||
from . import epdconfig
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 600
|
||||
EPD_HEIGHT = 448
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -51,12 +57,12 @@ class EPD:
|
|||
self.RED = 0x0000ff # 0100
|
||||
self.YELLOW = 0x00ffff # 0101
|
||||
self.ORANGE = 0x0080ff # 0110
|
||||
|
||||
|
||||
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(600)
|
||||
epdconfig.delay_ms(600)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(2)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
|
|
@ -73,25 +79,31 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 0)
|
||||
epdconfig.spi_writebyte([data])
|
||||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
|
||||
def send_data_bulk(self, data):
|
||||
epdconfig.digital_write(self.dc_pin, 1)
|
||||
epdconfig.digital_write(self.cs_pin, 0)
|
||||
epdconfig.spi_writebyte2(data)
|
||||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusyHigh(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
|
||||
epdconfig.delay_ms(100)
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def ReadBusyLow(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 1): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
|
||||
epdconfig.delay_ms(100)
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
|
||||
self.ReadBusyHigh()
|
||||
self.send_command(0x00)
|
||||
self.send_data(0xEF)
|
||||
|
|
@ -122,7 +134,7 @@ class EPD:
|
|||
self.send_data(0xC0)
|
||||
self.send_command(0xE3)
|
||||
self.send_data(0xAA)
|
||||
|
||||
|
||||
epdconfig.delay_ms(100)
|
||||
self.send_command(0x50)
|
||||
self.send_data(0x37)
|
||||
|
|
@ -130,102 +142,67 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
buf = [0x00] * int(self.width * self.height / 2)
|
||||
image_monocolor = image.convert('RGB')#Picture mode conversion
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
logging.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
# Create a pallette with the 7 colors supported by the panel
|
||||
pal_image = Image.new("P", (1,1))
|
||||
pal_image.putpalette( (0,0,0, 255,255,255, 0,255,0, 0,0,255, 255,0,0, 255,255,0, 255,128,0) + (0,0,0)*249)
|
||||
|
||||
# Check if we need to rotate the image
|
||||
imwidth, imheight = image.size
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
Add = int((x + y * self.width) / 2)
|
||||
Color = 0;
|
||||
if (pixels[x, y][0] == 0 and pixels[x, y][1] == 0 and pixels[x, y][2] == 0):
|
||||
Color = 0
|
||||
elif (pixels[x, y][0] == 255 and pixels[x, y][1] == 255 and pixels[x, y][2] == 255):
|
||||
Color = 1
|
||||
elif (pixels[x, y][0] == 0 and pixels[x, y][1] == 255 and pixels[x, y][2] == 0):
|
||||
Color = 2
|
||||
elif (pixels[x, y][0] == 0 and pixels[x, y][1] == 0 and pixels[x, y][2] == 255):
|
||||
Color = 3
|
||||
elif (pixels[x, y][0] == 255 and pixels[x, y][1] == 0 and pixels[x, y][2] == 0):
|
||||
Color = 4
|
||||
elif (pixels[x, y][0] == 255 and pixels[x, y][1] == 255 and pixels[x, y][2] == 0):
|
||||
Color = 5
|
||||
elif (pixels[x, y][0] == 255 and pixels[x, y][1] == 128 and pixels[x, y][2] == 0):
|
||||
Color = 6
|
||||
|
||||
data_t = buf[Add]&(~(0xF0 >> ((x % 2)*4)))
|
||||
buf[Add] = data_t | ((Color << 4) >> ((x % 2)*4));
|
||||
|
||||
image_temp = image
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
newy = self.height - x - 1
|
||||
Add = int((newx + newy*self.width) / 2)
|
||||
Color = 0;
|
||||
if (pixels[x, y][0] == 0 and pixels[x, y][1] == 0 and pixels[x, y][2] == 0):
|
||||
Color = 0
|
||||
elif (pixels[x, y][0] == 255 and pixels[x, y][1] == 255 and pixels[x, y][2] == 255):
|
||||
Color = 1
|
||||
elif (pixels[x, y][0] == 0 and pixels[x, y][1] == 255 and pixels[x, y][2] == 0):
|
||||
Color = 2
|
||||
elif (pixels[x, y][0] == 0 and pixels[x, y][1] == 0 and pixels[x, y][2] == 255):
|
||||
Color = 3
|
||||
elif (pixels[x, y][0] == 255 and pixels[x, y][1] == 0 and pixels[x, y][2] == 0):
|
||||
Color = 4
|
||||
elif (pixels[x, y][0] == 255 and pixels[x, y][1] == 255 and pixels[x, y][2] == 0):
|
||||
Color = 5
|
||||
elif (pixels[x, y][0] == 255 and pixels[x, y][1] == 128 and pixels[x, y][2] == 0):
|
||||
Color = 6
|
||||
|
||||
data_t = buf[Add]&(~(0xF0 >> ((newx % 2)*4)))
|
||||
buf[Add] = data_t | ((Color << 4) >> ((newx % 2)*4));
|
||||
image_temp = image.rotate(90, expand=True)
|
||||
else:
|
||||
logger.warning("Invalid image dimensions: %d x %d, expected %d x %d" % (imwidth, imheight, self.width, self.height))
|
||||
|
||||
# Convert the soruce image to the 7 colors, dithering if needed
|
||||
image_7color = image_temp.convert("RGB").quantize(palette=pal_image)
|
||||
buf_7color = bytearray(image_7color.tobytes('raw'))
|
||||
|
||||
# PIL does not support 4 bit color, so pack the 4 bits of color
|
||||
# into a single byte to transfer to the panel
|
||||
buf = [0x00] * int(self.width * self.height / 2)
|
||||
idx = 0
|
||||
for i in range(0, len(buf_7color), 2):
|
||||
buf[idx] = (buf_7color[i] << 4) + buf_7color[i+1]
|
||||
idx += 1
|
||||
|
||||
return buf
|
||||
|
||||
def display(self,image):
|
||||
self.send_command(0x61)#Set Resolution setting
|
||||
self.send_command(0x61) #Set Resolution setting
|
||||
self.send_data(0x02)
|
||||
self.send_data(0x58)
|
||||
self.send_data(0x01)
|
||||
self.send_data(0xC0)
|
||||
self.send_command(0x10)
|
||||
for i in range(0, int(EPD_HEIGHT)):
|
||||
for j in range(0, int(EPD_WIDTH/2)):
|
||||
self.send_data((image[j+(int(EPD_WIDTH/2)*i)]))
|
||||
self.send_command(0x04)#0x04
|
||||
|
||||
self.send_data_bulk(image)
|
||||
self.send_command(0x04) #0x04
|
||||
self.ReadBusyHigh()
|
||||
self.send_command(0x12)#0x12
|
||||
self.send_command(0x12) #0x12
|
||||
self.ReadBusyHigh()
|
||||
self.send_command(0x02) #0x02
|
||||
self.send_command(0x02) #0x02
|
||||
self.ReadBusyLow()
|
||||
epdconfig.delay_ms(500)
|
||||
|
||||
|
||||
def Clear(self):
|
||||
self.send_command(0x61)#Set Resolution setting
|
||||
self.send_command(0x61) #Set Resolution setting
|
||||
self.send_data(0x02)
|
||||
self.send_data(0x58)
|
||||
self.send_data(0x01)
|
||||
self.send_data(0xC0)
|
||||
self.send_command(0x10)
|
||||
for i in range(0, int(EPD_HEIGHT)):
|
||||
for j in range(0, int(EPD_WIDTH/2)):
|
||||
self.send_data(0x11)
|
||||
#BLACK 0x00 /// 0000
|
||||
#WHITE 0x11 /// 0001
|
||||
#GREEN 0x22 /// 0010
|
||||
#BLUE 0x33 /// 0011
|
||||
#RED 0x44 /// 0100
|
||||
#YELLOW 0x55 /// 0101
|
||||
#ORANGE 0x66 /// 0110
|
||||
#CLEAN 0x77 /// 0111 unavailable Afterimage
|
||||
self.send_command(0x04)#0x04
|
||||
|
||||
# Set all pixels to white
|
||||
buf = [0x11] * int(self.width * self.height / 2)
|
||||
self.send_data_bulk(buf)
|
||||
|
||||
self.send_command(0x04) #0x04
|
||||
self.ReadBusyHigh()
|
||||
self.send_command(0x12)#0x12
|
||||
self.send_command(0x12) #0x12
|
||||
self.ReadBusyHigh()
|
||||
self.send_command(0x02) #0x02
|
||||
self.send_command(0x02) #0x02
|
||||
self.ReadBusyLow()
|
||||
epdconfig.delay_ms(500)
|
||||
|
||||
|
|
@ -236,5 +213,4 @@ class EPD:
|
|||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
|
||||
epdconfig.delay_ms(2000)
|
||||
epdconfig.module_exit()
|
||||
|
||||
epdconfig.module_exit()
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 600
|
||||
EPD_HEIGHT = 448
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,10 +68,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -125,7 +127,7 @@ class EPD:
|
|||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
logging.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
logger.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 648
|
||||
EPD_HEIGHT = 480
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -65,10 +67,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0):
|
||||
epdconfig.delay_ms(20)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x12); #POWER ON
|
||||
|
|
@ -114,21 +116,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 648
|
||||
EPD_HEIGHT = 480
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,12 +68,12 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.send_command(0X71)
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
self.send_command(0X71)
|
||||
epdconfig.delay_ms(200)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -111,21 +113,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
# logging.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 600
|
||||
EPD_HEIGHT = 448
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,10 +68,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -117,21 +119,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
logging.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
logger.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 640
|
||||
EPD_HEIGHT = 384
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -72,10 +74,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -134,7 +136,7 @@ class EPD:
|
|||
img = img.rotate(90, expand=True).convert('1')
|
||||
imwidth, imheight = img.size
|
||||
else:
|
||||
logging.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
|
||||
logger.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
|
||||
# return a blank buffer
|
||||
return buf
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 880
|
||||
EPD_HEIGHT = 528
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -72,7 +74,7 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
while(busy == 1):
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
|
|
@ -136,7 +138,7 @@ class EPD:
|
|||
elif(imwidth == self.height and imheight == self.width):
|
||||
img = img.rotate(90, expand=True).convert('1')
|
||||
else:
|
||||
logging.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
|
||||
logger.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
|
||||
# return a blank buffer
|
||||
return [0xff] * int(self.width * self.height / 8)
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 800
|
||||
EPD_HEIGHT = 480
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -44,14 +46,68 @@ class EPD:
|
|||
self.width = EPD_WIDTH
|
||||
self.height = EPD_HEIGHT
|
||||
|
||||
Voltage_Frame_7IN5_V2 = [
|
||||
0x6, 0x3F, 0x3F, 0x11, 0x24, 0x7, 0x17,
|
||||
]
|
||||
|
||||
LUT_VCOM_7IN5_V2 = [
|
||||
0x0, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x0, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x0, 0xF, 0xF, 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,
|
||||
]
|
||||
|
||||
LUT_WW_7IN5_V2 = [
|
||||
0x10, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x20, 0xF, 0xF, 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,
|
||||
]
|
||||
|
||||
LUT_BW_7IN5_V2 = [
|
||||
0x10, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x20, 0xF, 0xF, 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,
|
||||
]
|
||||
|
||||
LUT_WB_7IN5_V2 = [
|
||||
0x80, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x40, 0xF, 0xF, 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,
|
||||
]
|
||||
|
||||
LUT_BB_7IN5_V2 = [
|
||||
0x80, 0xF, 0xF, 0x0, 0x0, 0x1,
|
||||
0x84, 0xF, 0x1, 0xF, 0x1, 0x2,
|
||||
0x40, 0xF, 0xF, 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,
|
||||
]
|
||||
|
||||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.delay_ms(20)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(2)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.delay_ms(20)
|
||||
|
||||
def send_command(self, command):
|
||||
epdconfig.digital_write(self.dc_pin, 0)
|
||||
|
|
@ -72,32 +128,79 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.send_command(0x71)
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
while(busy == 0):
|
||||
self.send_command(0x71)
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.delay_ms(20)
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def SetLut(self, lut_vcom, lut_ww, lut_bw, lut_wb, lut_bb):
|
||||
self.send_command(0x20)
|
||||
for count in range(0, 42):
|
||||
self.send_data(lut_vcom[count])
|
||||
|
||||
self.send_command(0x21)
|
||||
for count in range(0, 42):
|
||||
self.send_data(lut_ww[count])
|
||||
|
||||
self.send_command(0x22)
|
||||
for count in range(0, 42):
|
||||
self.send_data(lut_bw[count])
|
||||
|
||||
self.send_command(0x23)
|
||||
for count in range(0, 42):
|
||||
self.send_data(lut_wb[count])
|
||||
|
||||
self.send_command(0x24)
|
||||
for count in range(0, 42):
|
||||
self.send_data(lut_bb[count])
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
self.send_command(0x01) #POWER SETTING
|
||||
self.send_data(0x07)
|
||||
self.send_data(0x07) #VGH=20V,VGL=-20V
|
||||
self.send_data(0x3f) #VDH=15V
|
||||
self.send_data(0x3f) #VDL=-15V
|
||||
# self.send_command(0x06) # btst
|
||||
# self.send_data(0x17)
|
||||
# self.send_data(0x17)
|
||||
# self.send_data(0x28) # If an exception is displayed, try using 0x38
|
||||
# self.send_data(0x17)
|
||||
|
||||
# self.send_command(0x01) #POWER SETTING
|
||||
# self.send_data(0x07)
|
||||
# self.send_data(0x07) #VGH=20V,VGL=-20V
|
||||
# self.send_data(0x3f) #VDH=15V
|
||||
# self.send_data(0x3f) #VDL=-15V
|
||||
|
||||
self.send_command(0x01) # power setting
|
||||
self.send_data(0x17) # 1-0=11: internal power
|
||||
self.send_data(self.Voltage_Frame_7IN5_V2[6]) # VGH&VGL
|
||||
self.send_data(self.Voltage_Frame_7IN5_V2[1]) # VSH
|
||||
self.send_data(self.Voltage_Frame_7IN5_V2[2]) # VSL
|
||||
self.send_data(self.Voltage_Frame_7IN5_V2[3]) # VSHR
|
||||
|
||||
self.send_command(0x82) # VCOM DC Setting
|
||||
self.send_data(self.Voltage_Frame_7IN5_V2[4]) # VCOM
|
||||
|
||||
self.send_command(0x06) # Booster Setting
|
||||
self.send_data(0x27)
|
||||
self.send_data(0x27)
|
||||
self.send_data(0x2F)
|
||||
self.send_data(0x17)
|
||||
|
||||
self.send_command(0x30) # OSC Setting
|
||||
self.send_data(self.Voltage_Frame_7IN5_V2[0]) # 2-0=100: N=4 5-3=111: M=7 3C=50Hz 3A=100HZ
|
||||
|
||||
self.send_command(0x04) #POWER ON
|
||||
epdconfig.delay_ms(100)
|
||||
self.ReadBusy()
|
||||
|
||||
self.send_command(0X00) #PANNEL SETTING
|
||||
self.send_data(0x1F) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
self.send_data(0x3F) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
|
||||
self.send_command(0x61) #tres
|
||||
self.send_data(0x03) #source 800
|
||||
|
|
@ -115,6 +218,13 @@ class EPD:
|
|||
self.send_command(0X60) #TCON SETTING
|
||||
self.send_data(0x22)
|
||||
|
||||
self.send_command(0x65) # Resolution setting
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x00) # 800*480
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x00)
|
||||
|
||||
self.SetLut(self.LUT_VCOM_7IN5_V2, self.LUT_WW_7IN5_V2, self.LUT_BW_7IN5_V2, self.LUT_WB_7IN5_V2, self.LUT_BB_7IN5_V2)
|
||||
# EPD hardware init end
|
||||
return 0
|
||||
|
||||
|
|
@ -127,7 +237,7 @@ class EPD:
|
|||
# image has correct dimensions, but needs to be rotated
|
||||
img = img.rotate(90, expand=True).convert('1')
|
||||
else:
|
||||
logging.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
|
||||
logger.warning("Wrong image dimensions: must be " + str(self.width) + "x" + str(self.height))
|
||||
# return a blank buffer
|
||||
return [0x00] * (int(self.width/8) * self.height)
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 880
|
||||
EPD_HEIGHT = 528
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,7 +68,7 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
while(busy == 1):
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
|
|
@ -135,21 +137,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
logging.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
logger.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 800
|
||||
EPD_HEIGHT = 480
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,20 +68,27 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
self.send_command(0x71)
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
while(busy == 0):
|
||||
self.send_command(0x71)
|
||||
busy = epdconfig.digital_read(self.busy_pin)
|
||||
epdconfig.delay_ms(200)
|
||||
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
return -1
|
||||
|
||||
self.reset()
|
||||
|
||||
# self.send_command(0x06) # btst
|
||||
# self.send_data(0x17)
|
||||
# self.send_data(0x17)
|
||||
# self.send_data(0x38) # If an exception is displayed, try using 0x38
|
||||
# self.send_data(0x17)
|
||||
|
||||
self.send_command(0x01); #POWER SETTING
|
||||
self.send_data(0x07);
|
||||
self.send_data(0x07); #VGH=20V,VGL=-20V
|
||||
|
|
@ -118,21 +127,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
logging.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
logger.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ from . import epdconfig
|
|||
EPD_WIDTH = 640
|
||||
EPD_HEIGHT = 384
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class EPD:
|
||||
def __init__(self):
|
||||
self.reset_pin = epdconfig.RST_PIN
|
||||
|
|
@ -66,10 +68,10 @@ class EPD:
|
|||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
logging.debug("e-Paper busy")
|
||||
logger.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
epdconfig.delay_ms(100)
|
||||
logging.debug("e-Paper busy release")
|
||||
logger.debug("e-Paper busy release")
|
||||
|
||||
def init(self):
|
||||
if (epdconfig.module_init() != 0):
|
||||
|
|
@ -117,21 +119,21 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
buf = [0xFF] * (int(self.width/8) * self.height)
|
||||
image_monocolor = image.convert('1')
|
||||
imwidth, imheight = image_monocolor.size
|
||||
pixels = image_monocolor.load()
|
||||
logging.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
logger.debug('imwidth = %d imheight = %d ',imwidth, imheight)
|
||||
if(imwidth == self.width and imheight == self.height):
|
||||
logging.debug("Horizontal")
|
||||
logger.debug("Horizontal")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
# Set the bits for the column of pixels at the current position.
|
||||
if pixels[x, y] == 0:
|
||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
||||
elif(imwidth == self.height and imheight == self.width):
|
||||
logging.debug("Vertical")
|
||||
logger.debug("Vertical")
|
||||
for y in range(imheight):
|
||||
for x in range(imwidth):
|
||||
newx = y
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ DC_PIN = 25
|
|||
CS_PIN = 8
|
||||
BUSY_PIN = 24
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
SPI = spidev.SpiDev()
|
||||
|
||||
def digital_write(pin, value):
|
||||
|
|
@ -72,13 +74,13 @@ def module_init():
|
|||
return 0
|
||||
|
||||
def module_exit():
|
||||
logging.debug("spi end")
|
||||
logger.debug("spi end")
|
||||
SPI.close()
|
||||
|
||||
logging.debug("close 5V, Module enters 0 power consumption ...")
|
||||
logger.debug("close 5V, Module enters 0 power consumption ...")
|
||||
GPIO.output(RST_PIN, 0)
|
||||
GPIO.output(DC_PIN, 0)
|
||||
|
||||
GPIO.cleanup()
|
||||
|
||||
### END OF FILE ###
|
||||
### END OF FILE ###
|
||||
BIN
RaspberryPi_JetsonNano/python/pic/2in13d_1.bmp
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4in2_1.bmp
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4in2_B.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4in2_Pico.bmp
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4in2_R.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/5.83_V2_0.bmp
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/Color7.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/Pico-ePaper-5.65.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/Pico_2in7.bmp
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/Pico_3in7.bmp
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/image_black.bmp
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/image_red.bmp
Normal file
|
After Width: | Height: | Size: 47 KiB |