add 4.01f demo
This commit is contained in:
parent
c65eec8e5e
commit
7b958776c8
52 changed files with 11250 additions and 1902 deletions
|
|
@ -56,7 +56,7 @@ int EPD_2in13_V2_test(void)
|
|||
Paint_SetMirroring(MIRROR_HORIZONTAL); //
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 0 // show bmp
|
||||
#if 1 // show bmp
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
|
@ -82,7 +82,7 @@ int EPD_2in13_V2_test(void)
|
|||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 0 // Drawing on the image
|
||||
#if 1 // Drawing on the image
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
|
|
@ -150,7 +150,7 @@ int EPD_2in13_V2_test(void)
|
|||
Paint_DrawString_CN(60, 55, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN13_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(20000);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
|
|
|
|||
170
RaspberryPi_JetsonNano/c/examples/EPD_2in13_V3_test.c
Normal file
170
RaspberryPi_JetsonNano/c/examples/EPD_2in13_V3_test.c
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13_V3_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V3 test demo
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-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_2in13_V3.h"
|
||||
#include <time.h>
|
||||
|
||||
int EPD_2in13_V3_test(void)
|
||||
{
|
||||
printf("EPD_2in13_V3_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("e-Paper Init and Clear...\r\n");
|
||||
EPD_2in13_V3_Init();
|
||||
|
||||
struct timespec start={0,0}, finish={0,0};
|
||||
clock_gettime(CLOCK_REALTIME,&start);
|
||||
EPD_2in13_V3_Clear();
|
||||
clock_gettime(CLOCK_REALTIME,&finish);
|
||||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
|
||||
//Create a new image cache
|
||||
UBYTE *BlackImage;
|
||||
UWORD Imagesize = ((EPD_2in13_V3_WIDTH % 8 == 0)? (EPD_2in13_V3_WIDTH / 8 ): (EPD_2in13_V3_WIDTH / 8 + 1)) * EPD_2in13_V3_HEIGHT;
|
||||
if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
|
||||
printf("Failed to apply for black memory...\r\n");
|
||||
return -1;
|
||||
}
|
||||
printf("Paint_NewImage\r\n");
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
#if 1 // show bmp
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 0, WHITE);
|
||||
printf("show window BMP-----------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 0, 0);
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
GUI_ReadBmp("./pic/2in13-v2.bmp", 0, 0);
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 0 //show image for array
|
||||
printf("show image for array\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in13);
|
||||
|
||||
EPD_2in13_V3_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
||||
#if 1 // Drawing on the image
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_HEIGHT, 90, WHITE);
|
||||
printf("Drawing\r\n");
|
||||
//1.Select Image
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
|
||||
// 2.Drawing on the image
|
||||
Paint_DrawPoint(5, 10, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 25, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 40, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT);
|
||||
Paint_DrawPoint(5, 55, BLACK, DOT_PIXEL_4X4, DOT_STYLE_DFT);
|
||||
|
||||
Paint_DrawLine(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(70, 10, 20, 60, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID);
|
||||
Paint_DrawRectangle(20, 10, 70, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawRectangle(85, 10, 135, 60, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawLine(45, 15, 45, 55, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawLine(25, 35, 70, 35, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
|
||||
Paint_DrawCircle(45, 35, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
|
||||
Paint_DrawCircle(110, 35, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL);
|
||||
|
||||
Paint_DrawString_EN(140, 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);
|
||||
|
||||
EPD_2in13_V3_Display_Base(BlackImage);
|
||||
DEV_Delay_ms(3000);
|
||||
#endif
|
||||
|
||||
#if 1 //Partial refresh, example shows time
|
||||
Paint_NewImage(BlackImage, EPD_2in13_V3_WIDTH, EPD_2in13_V3_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_2in13_V3_Display_Partial(BlackImage);
|
||||
DEV_Delay_ms(500);//Analog clock 1s
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Clear...\r\n");
|
||||
EPD_2in13_V3_Init();
|
||||
EPD_2in13_V3_Clear();
|
||||
|
||||
printf("Goto Sleep...\r\n");
|
||||
EPD_2in13_V3_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;
|
||||
}
|
||||
|
||||
|
|
@ -60,9 +60,9 @@ int EPD_4in01f_test(void)
|
|||
#if 1
|
||||
printf("show image for array\r\n");
|
||||
Paint_Clear(EPD_4IN01F_WHITE);
|
||||
GUI_ReadBmp_RGB_7Color("./pic/4in01f.bmp", 0, 0);
|
||||
GUI_ReadBmp_RGB_7Color("./pic/4in01-1.bmp", 0, 0);
|
||||
EPD_4IN01F_Display(BlackImage);
|
||||
// EPD_4IN01F_Display_part(BlackImage, 0, 0, 600, 260);
|
||||
// EPD_4IN01F_Display_part(BlackImage, 0, 0, 640, 200);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#include "EPD_4in2b_V2.h"
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
int EPD_4in2b_V2_test(void)
|
||||
{
|
||||
printf("EPD_4IN2B_V2_test Demo\r\n");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* DEV_Delay_ms(2000);//important, at least 2s/*****************************************************************************
|
||||
/*****************************************************************************
|
||||
* | File : EPD_5in65f_test.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 5.65inch F e-paper test demo
|
||||
|
|
@ -47,9 +47,6 @@ int EPD_5in65f_test(void)
|
|||
printf("%ld S\r\n",finish.tv_sec-start.tv_sec);
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
// EPD_5IN65F_Show7Block();
|
||||
// DEV_Delay_ms(10000);
|
||||
|
||||
UBYTE *BlackImage;
|
||||
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
|
||||
UDOUBLE Imagesize = ((EPD_5IN65F_WIDTH % 2 == 0)? (EPD_5IN65F_WIDTH / 2 ): (EPD_5IN65F_WIDTH / 2 + 1)) * EPD_5IN65F_HEIGHT;
|
||||
|
|
@ -69,6 +66,14 @@ int EPD_5in65f_test(void)
|
|||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
printf("show image for array\r\n");
|
||||
Paint_Clear(EPD_5IN65F_WHITE);
|
||||
GUI_ReadBmp_RGB_7Color("./pic/5in65f.bmp", 0, 0);
|
||||
EPD_5IN65F_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
Paint_Clear(EPD_5IN65F_WHITE);
|
||||
printf("Drawing:BlackImage\r\n");
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
#include <time.h>
|
||||
|
||||
int EPD_7in5_HD_test(void)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
printf("EPD_7IN5_HD_test Demo\r\n");
|
||||
if(DEV_Module_Init()!=0){
|
||||
|
|
@ -119,7 +117,7 @@ while(1)
|
|||
// close 5V
|
||||
printf("close 5V, Module enters 0 power consumption ...\r\n");
|
||||
DEV_Module_Exit();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ int EPD_7in5_V2_test(void)
|
|||
|
||||
printf("show bmp------------------------\r\n");
|
||||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
GUI_ReadBmp("./pic/100x100.bmp", 0, 0);
|
||||
EPD_7IN5_V2_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ int EPD_2in9d_test(void);
|
|||
|
||||
int EPD_2in13_test(void);
|
||||
int EPD_2in13_V2_test(void);
|
||||
int EPD_2in13_V3_test(void);
|
||||
int EPD_2in13bc_test(void);
|
||||
int EPD_2in13b_V3_test(void);
|
||||
int EPD_2in13d_test(void);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ int main(void)
|
|||
|
||||
// EPD_2in13_test();
|
||||
// EPD_2in13_V2_test();
|
||||
// EPD_2in13_V3_test();
|
||||
// EPD_2in13bc_test();
|
||||
// EPD_2in13b_V3_test();
|
||||
// EPD_2in13d_test();
|
||||
|
|
|
|||
259
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in13_V3.c
Normal file
259
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in13_V3.c
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2in13_V3.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V3
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-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_2in13_V3.h"
|
||||
#include "Debug.h"
|
||||
|
||||
/******************************************************************************
|
||||
function : Software reset
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_Reset(void)
|
||||
{
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(2);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send command
|
||||
parameter:
|
||||
Reg : Command register
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SendCommand(UBYTE Reg)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 0);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Reg);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : send data
|
||||
parameter:
|
||||
Data : Write data
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SendData(UBYTE Data)
|
||||
{
|
||||
DEV_Digital_Write(EPD_DC_PIN, 1);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 0);
|
||||
DEV_SPI_WriteByte(Data);
|
||||
DEV_Digital_Write(EPD_CS_PIN, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Wait until the busy_pin goes LOW
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_ReadBusy(void)
|
||||
{
|
||||
Debug("e-Paper busy\r\n");
|
||||
while(1)
|
||||
{ //=1 BUSY
|
||||
if(DEV_Digital_Read(EPD_BUSY_PIN)==0)
|
||||
break;
|
||||
DEV_Delay_ms(50);
|
||||
}
|
||||
DEV_Delay_ms(50);
|
||||
Debug("e-Paper busy release\r\n");
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Turn On Display
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_TurnOnDisplay(void)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x22); //Display Update Control
|
||||
EPD_2in13_V3_SendData(0xF7);
|
||||
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
||||
static void EPD_2in13_V3_TurnOnDisplay_Partial(void)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x22); //Display Update Control
|
||||
EPD_2in13_V3_SendData(0xFF);
|
||||
EPD_2in13_V3_SendCommand(0x20); //Activate Display Update Sequence
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Setting the display window
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
EPD_2in13_V3_SendData((Xstart>>3) & 0xFF);
|
||||
EPD_2in13_V3_SendData((Xend>>3) & 0xFF);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
EPD_2in13_V3_SendData(Ystart & 0xFF);
|
||||
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
|
||||
EPD_2in13_V3_SendData(Yend & 0xFF);
|
||||
EPD_2in13_V3_SendData((Yend >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Set Cursor
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
static void EPD_2in13_V3_SetCursor(UWORD Xstart, UWORD Ystart)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
|
||||
EPD_2in13_V3_SendData(Xstart & 0xFF);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
|
||||
EPD_2in13_V3_SendData(Ystart & 0xFF);
|
||||
EPD_2in13_V3_SendData((Ystart >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Initialize the e-Paper register
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Init(void)
|
||||
{
|
||||
EPD_2in13_V3_Reset();
|
||||
DEV_Delay_ms(100);
|
||||
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
EPD_2in13_V3_SendCommand(0x12); //SWRESET
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x01); //Driver output control
|
||||
EPD_2in13_V3_SendData(0x27);
|
||||
EPD_2in13_V3_SendData(0x01);
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x11); //data entry mode
|
||||
EPD_2in13_V3_SendData(0x03);
|
||||
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2in13_V3_SendData(0x05);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x21); // Display update control
|
||||
EPD_2in13_V3_SendData(0x00);
|
||||
EPD_2in13_V3_SendData(0x80);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x18); //Read built-in temperature sensor
|
||||
EPD_2in13_V3_SendData(0x80);
|
||||
|
||||
EPD_2in13_V3_SetCursor(0, 0);
|
||||
EPD_2in13_V3_ReadBusy();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Clear screen
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Clear(void)
|
||||
{
|
||||
UWORD i;
|
||||
EPD_2in13_V3_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
EPD_2in13_V3_SendData(0xff);
|
||||
}
|
||||
EPD_2in13_V3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Sends the image buffer in RAM to e-Paper and displays
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Display(UBYTE *Image)
|
||||
{
|
||||
UWORD i;
|
||||
EPD_2in13_V3_SendCommand(0x24); //write RAM for black(0)/white (1)
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
EPD_2in13_V3_SendData(Image[i]);
|
||||
}
|
||||
EPD_2in13_V3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_2in13_V3_Display_Base(UBYTE *Image)
|
||||
{
|
||||
UWORD i;
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
EPD_2in13_V3_SendData(Image[i]);
|
||||
}
|
||||
EPD_2in13_V3_SendCommand(0x26); //Write Black and White image to RAM
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
EPD_2in13_V3_SendData(Image[i]);
|
||||
}
|
||||
EPD_2in13_V3_TurnOnDisplay();
|
||||
}
|
||||
|
||||
void EPD_2in13_V3_Display_Partial(UBYTE *Image)
|
||||
{
|
||||
UWORD i;
|
||||
|
||||
//Reset
|
||||
DEV_Digital_Write(EPD_RST_PIN, 0);
|
||||
DEV_Delay_ms(5);
|
||||
DEV_Digital_Write(EPD_RST_PIN, 1);
|
||||
DEV_Delay_ms(10);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x3C); //BorderWavefrom
|
||||
EPD_2in13_V3_SendData(0x80);
|
||||
|
||||
EPD_2in13_V3_SetWindows(0, 0, EPD_2in13_V3_WIDTH-1, EPD_2in13_V3_HEIGHT-1);
|
||||
EPD_2in13_V3_SetCursor(0, 0);
|
||||
|
||||
EPD_2in13_V3_SendCommand(0x24); //Write Black and White image to RAM
|
||||
for(i=0;i<4736;i++)
|
||||
{
|
||||
EPD_2in13_V3_SendData(Image[i]);
|
||||
}
|
||||
EPD_2in13_V3_TurnOnDisplay_Partial();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function : Enter sleep mode
|
||||
parameter:
|
||||
******************************************************************************/
|
||||
void EPD_2in13_V3_Sleep(void)
|
||||
{
|
||||
EPD_2in13_V3_SendCommand(0x10); //enter deep sleep
|
||||
EPD_2in13_V3_SendData(0x01);
|
||||
DEV_Delay_ms(100);
|
||||
}
|
||||
47
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in13_V3.h
Normal file
47
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in13_V3.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*****************************************************************************
|
||||
* | File : EPD_2Iin13_V3.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : 2.13inch e-paper V3
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2020-12-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_2in13_V3_H_
|
||||
#define __EPD_2in13_V3_H_
|
||||
|
||||
#include "DEV_Config.h"
|
||||
|
||||
// Display resolution
|
||||
#define EPD_2in13_V3_WIDTH 122
|
||||
#define EPD_2in13_V3_HEIGHT 250
|
||||
|
||||
void EPD_2in13_V3_Init(void);
|
||||
void EPD_2in13_V3_Clear(void);
|
||||
void EPD_2in13_V3_Display(UBYTE *Image);
|
||||
void EPD_2in13_V3_Display_Base(UBYTE *Image);
|
||||
void EPD_2in13_V3_Display_Partial(UBYTE *Image);
|
||||
void EPD_2in13_V3_Sleep(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -214,7 +214,7 @@ void EPD_3IN7_4Gray_Init(void)
|
|||
|
||||
EPD_3IN7_SendCommand(0x2C); // set vcom value
|
||||
EPD_3IN7_SendData(0x44);
|
||||
|
||||
|
||||
EPD_3IN7_SendCommand(0x37); // set display option, these setting turn on previous function
|
||||
EPD_3IN7_SendData(0x00);
|
||||
EPD_3IN7_SendData(0x00);
|
||||
|
|
@ -260,7 +260,7 @@ void EPD_3IN7_1Gray_Init(void)
|
|||
EPD_3IN7_SendCommand(0x47);
|
||||
EPD_3IN7_SendData(0xF7);
|
||||
EPD_3IN7_ReadBusy_HIGH();
|
||||
|
||||
|
||||
EPD_3IN7_SendCommand(0x01); // setting gaet number
|
||||
EPD_3IN7_SendData(0xDF);
|
||||
EPD_3IN7_SendData(0x01);
|
||||
|
|
@ -548,30 +548,30 @@ notes:
|
|||
******************************************************************************/
|
||||
void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
|
||||
{
|
||||
UWORD i, Width;
|
||||
Width = (Xend-Xstart)%8 == 0 ? (Xend-Xstart)/8 : (Xend-Xstart)/8+1;
|
||||
UWORD IMAGE_COUNTER = Width * (Yend-Ystart);
|
||||
UWORD i, Width;
|
||||
Width = (Xend-Xstart)%8 == 0 ? (Xend-Xstart)/8 : (Xend-Xstart)/8+1;
|
||||
UWORD IMAGE_COUNTER = Width * (Yend-Ystart);
|
||||
|
||||
EPD_3IN7_SendCommand(0x44);
|
||||
EPD_3IN7_SendData(Xstart & 0xff);
|
||||
EPD_3IN7_SendData((Xstart>>8) & 0x03);
|
||||
EPD_3IN7_SendData(Xend & 0xff);
|
||||
EPD_3IN7_SendData((Xend>>8) & 0x03);
|
||||
EPD_3IN7_SendCommand(0x45);
|
||||
EPD_3IN7_SendData(Ystart & 0xff);
|
||||
EPD_3IN7_SendData((Ystart>>8) & 0x03);
|
||||
EPD_3IN7_SendData(Yend & 0xff);
|
||||
EPD_3IN7_SendData((Yend>>8) & 0x03);
|
||||
EPD_3IN7_SendCommand(0x44);
|
||||
EPD_3IN7_SendData(Xstart & 0xff);
|
||||
EPD_3IN7_SendData((Xstart>>8) & 0x03);
|
||||
EPD_3IN7_SendData(Xend & 0xff);
|
||||
EPD_3IN7_SendData((Xend>>8) & 0x03);
|
||||
EPD_3IN7_SendCommand(0x45);
|
||||
EPD_3IN7_SendData(Ystart & 0xff);
|
||||
EPD_3IN7_SendData((Ystart>>8) & 0x03);
|
||||
EPD_3IN7_SendData(Yend & 0xff);
|
||||
EPD_3IN7_SendData((Yend>>8) & 0x03);
|
||||
|
||||
EPD_3IN7_SendCommand(0x24);
|
||||
for (i = 0; i < IMAGE_COUNTER; i++)
|
||||
{
|
||||
EPD_3IN7_SendData(Image[i]);
|
||||
}
|
||||
|
||||
EPD_3IN7_Load_LUT(2);
|
||||
EPD_3IN7_SendCommand(0x20);
|
||||
EPD_3IN7_ReadBusy_HIGH();
|
||||
EPD_3IN7_SendCommand(0x24);
|
||||
for (i = 0; i < IMAGE_COUNTER; i++)
|
||||
{
|
||||
EPD_3IN7_SendData(Image[i]);
|
||||
}
|
||||
|
||||
EPD_3IN7_Load_LUT(2);
|
||||
EPD_3IN7_SendCommand(0x20);
|
||||
EPD_3IN7_ReadBusy_HIGH();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ function:
|
|||
void EPD_4IN01F_Display(const UBYTE *image)
|
||||
{
|
||||
unsigned long i, j;
|
||||
// UBYTE k = 0;
|
||||
UBYTE k = 0;
|
||||
EPD_4IN01F_SendCommand(0x61);//Set Resolution setting
|
||||
EPD_4IN01F_SendData(0x02);
|
||||
EPD_4IN01F_SendData(0x80);
|
||||
|
|
@ -205,12 +205,12 @@ void EPD_4IN01F_Display(const UBYTE *image)
|
|||
for(i=0; i<EPD_4IN01F_HEIGHT; i++) {
|
||||
for(j=0; j<EPD_4IN01F_WIDTH/2; j++) {
|
||||
EPD_4IN01F_SendData(image[j+((EPD_4IN01F_WIDTH/2)*i)]);
|
||||
// printf("0x%x, ", image[j+((EPD_4IN01F_WIDTH/2)*i)]);
|
||||
// k++;
|
||||
// if(k == 16) {
|
||||
// printf("\n");
|
||||
// k = 0;
|
||||
// }
|
||||
printf("0x%x, ", image[j+((EPD_4IN01F_WIDTH/2)*i)]);
|
||||
k++;
|
||||
if(k == 16) {
|
||||
printf("\n");
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
EPD_4IN01F_SendCommand(0x04);//0x04
|
||||
|
|
|
|||
|
|
@ -150,45 +150,6 @@ void EPD_5IN65F_Clear(UBYTE color)
|
|||
DEV_Delay_ms(500);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function:
|
||||
show 7 kind of color block
|
||||
******************************************************************************/
|
||||
void EPD_5IN65F_Show7Block(void)
|
||||
{
|
||||
unsigned long i,j,k;
|
||||
unsigned char const Color_seven[8] =
|
||||
{EPD_5IN65F_BLACK,EPD_5IN65F_BLUE,EPD_5IN65F_GREEN,EPD_5IN65F_ORANGE,
|
||||
EPD_5IN65F_RED,EPD_5IN65F_YELLOW,EPD_5IN65F_WHITE,EPD_5IN65F_WHITE};
|
||||
EPD_5IN65F_SendCommand(0x61);//Set Resolution setting
|
||||
EPD_5IN65F_SendData(0x02);
|
||||
EPD_5IN65F_SendData(0x58);
|
||||
EPD_5IN65F_SendData(0x01);
|
||||
EPD_5IN65F_SendData(0xC0);
|
||||
EPD_5IN65F_SendCommand(0x10);
|
||||
for(i=0; i<224; i++) {
|
||||
for(k = 0 ; k < 4; k ++) {
|
||||
for(j = 0 ; j < 75; j ++) {
|
||||
EPD_5IN65F_SendData((Color_seven[k]<<4) |Color_seven[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i=0; i<224; i++) {
|
||||
for(k = 4 ; k < 8; k ++) {
|
||||
for(j = 0 ; j < 75; j ++) {
|
||||
EPD_5IN65F_SendData((Color_seven[k]<<4) |Color_seven[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
EPD_5IN65F_SendCommand(0x04);//0x04
|
||||
EPD_5IN65F_BusyHigh();
|
||||
EPD_5IN65F_SendCommand(0x12);//0x12
|
||||
EPD_5IN65F_BusyHigh();
|
||||
EPD_5IN65F_SendCommand(0x02); //0x02
|
||||
EPD_5IN65F_BusyLow();
|
||||
DEV_Delay_ms(200);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function:
|
||||
refresh display
|
||||
|
|
@ -236,19 +197,19 @@ void EPD_5IN65F_Display_part(const UBYTE *image, UWORD xstart, UWORD ystart,
|
|||
EPD_5IN65F_SendCommand(0x10);
|
||||
for(i=0; i<EPD_5IN65F_HEIGHT; i++) {
|
||||
for(j=0; j< EPD_5IN65F_WIDTH/2; j++) {
|
||||
if(i<image_heigh+ystart && i>=ystart && j<(image_width+xstart)/2 && j>=xstart/2) {
|
||||
EPD_5IN65F_SendData(image[(j-xstart/2) + (image_width/2*(i-ystart))]);
|
||||
// printf("0x%x, ", image[j+((EPD_5IN65F_WIDTH/2)*i)]);
|
||||
// k++;
|
||||
// if(k == 16) {
|
||||
// printf("\r\n");
|
||||
// k = 0;
|
||||
// }
|
||||
}
|
||||
else {
|
||||
EPD_5IN65F_SendData(0x11);
|
||||
}
|
||||
}
|
||||
if(i<image_heigh+ystart && i>=ystart && j<(image_width+xstart)/2 && j>=xstart/2) {
|
||||
EPD_5IN65F_SendData(image[(j-xstart/2) + (image_width/2*(i-ystart))]);
|
||||
// printf("0x%x, ", image[j+((EPD_5IN65F_WIDTH/2)*i)]);
|
||||
// k++;
|
||||
// if(k == 16) {
|
||||
// printf("\r\n");
|
||||
// k = 0;
|
||||
// }
|
||||
}
|
||||
else {
|
||||
EPD_5IN65F_SendData(0x11);
|
||||
}
|
||||
}
|
||||
}
|
||||
EPD_5IN65F_SendCommand(0x04);//0x04
|
||||
EPD_5IN65F_BusyHigh();
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ Color Index
|
|||
void EPD_5IN65F_Clear(UBYTE color);
|
||||
void EPD_5IN65F_Sleep(void);
|
||||
void EPD_Init(void);
|
||||
void EPD_5IN65F_Show7Block(void);
|
||||
void EPD_5IN65F_Display(const UBYTE *image);
|
||||
void EPD_5IN65F_Init(void);
|
||||
void EPD_5IN65F_Display_part(const UBYTE *image, UWORD xstart, UWORD ystart,
|
||||
|
|
|
|||
|
|
@ -80,11 +80,10 @@ static void EPD_5in83_V2_ReadBusy(void)
|
|||
Debug("e-Paper busy\r\n");
|
||||
do {
|
||||
EPD_5in83_V2_SendCommand(0x71);
|
||||
DEV_Delay_ms(50);
|
||||
DEV_Delay_ms(10);
|
||||
}
|
||||
while(!DEV_Digital_Read(EPD_BUSY_PIN));
|
||||
Debug("e-Paper busy release\r\n");
|
||||
DEV_Delay_ms(50);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
|||
|
|
@ -126,12 +126,6 @@ UBYTE EPD_7IN5_V2_Init(void)
|
|||
EPD_SendData(0x01); //gate 480
|
||||
EPD_SendData(0xE0);
|
||||
|
||||
// EPD_SendCommand(0x06);
|
||||
// EPD_SendData(0xff);
|
||||
// EPD_SendData(0xff);
|
||||
// EPD_SendData(0xff);
|
||||
// EPD_SendData(0xff);
|
||||
|
||||
EPD_SendCommand(0X15);
|
||||
EPD_SendData(0x00);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue