Added a 2.13V3 Arduino GUI library usage routine
This commit is contained in:
parent
bb184dbc64
commit
cb2805f9b7
@ -90,6 +90,8 @@ Epd::Epd()
|
|||||||
busy_pin = BUSY_PIN;
|
busy_pin = BUSY_PIN;
|
||||||
width = EPD_WIDTH;
|
width = EPD_WIDTH;
|
||||||
height = EPD_HEIGHT;
|
height = EPD_HEIGHT;
|
||||||
|
bufwidth = 128/8; //16
|
||||||
|
bufheight = 63;
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -281,6 +283,7 @@ void Epd::Reset(void)
|
|||||||
DelayMs(2);
|
DelayMs(2);
|
||||||
DigitalWrite(reset_pin, HIGH);
|
DigitalWrite(reset_pin, HIGH);
|
||||||
DelayMs(20);
|
DelayMs(20);
|
||||||
|
this->count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -332,6 +335,27 @@ void Epd::Display(const unsigned char* frame_buffer)
|
|||||||
WaitUntilIdle();
|
WaitUntilIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Epd::Display1(const unsigned char* frame_buffer) {
|
||||||
|
if(this->count == 0){
|
||||||
|
SendCommand(0x24);
|
||||||
|
this->count++;
|
||||||
|
}else if(this->count > 0 && this->count < 4 ){
|
||||||
|
this->count++;
|
||||||
|
}
|
||||||
|
for(int i = 0; i < this->bufwidth * this->bufheight; i++){
|
||||||
|
SendData(frame_buffer[i]);
|
||||||
|
}
|
||||||
|
if(this->count == 4){
|
||||||
|
SendCommand(0x22);
|
||||||
|
SendData(0xC7);
|
||||||
|
SendCommand(0x20);
|
||||||
|
WaitUntilIdle();
|
||||||
|
this->count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
function : Refresh a base image
|
function : Refresh a base image
|
||||||
parameter:
|
parameter:
|
||||||
|
@ -44,6 +44,9 @@ class Epd : EpdIf {
|
|||||||
public:
|
public:
|
||||||
unsigned long width;
|
unsigned long width;
|
||||||
unsigned long height;
|
unsigned long height;
|
||||||
|
int bufwidth;
|
||||||
|
int bufheight;
|
||||||
|
int count;
|
||||||
|
|
||||||
Epd();
|
Epd();
|
||||||
~Epd();
|
~Epd();
|
||||||
@ -57,6 +60,7 @@ public:
|
|||||||
void Reset(void);
|
void Reset(void);
|
||||||
void Clear(void);
|
void Clear(void);
|
||||||
void Display(const unsigned char* frame_buffer);
|
void Display(const unsigned char* frame_buffer);
|
||||||
|
void Display1(const unsigned char* frame_buffer);
|
||||||
void DisplayPartBaseImage(const unsigned char* frame_buffer);
|
void DisplayPartBaseImage(const unsigned char* frame_buffer);
|
||||||
void DisplayPart(const unsigned char* frame_buffer);
|
void DisplayPart(const unsigned char* frame_buffer);
|
||||||
void ClearPart(void);
|
void ClearPart(void);
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include "epd2in13_V3.h"
|
#include "epd2in13_V3.h"
|
||||||
|
#include "epdpaint.h"
|
||||||
#include "imagedata.h"
|
#include "imagedata.h"
|
||||||
|
|
||||||
|
#define COLORED 0
|
||||||
|
#define UNCOLORED 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Due to RAM not enough in Arduino UNO, a frame buffer is not allowed.
|
||||||
|
* In this case, a smaller image buffer is allocated and you have to
|
||||||
|
* update a partial display several times.
|
||||||
|
* 1 byte = 8 pixels, therefore you have to set 8*N pixels at a time.
|
||||||
|
*/
|
||||||
|
unsigned char image[1050];
|
||||||
|
Paint paint(image, 0, 0);
|
||||||
Epd epd;
|
Epd epd;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
@ -12,17 +24,46 @@ void setup()
|
|||||||
epd.Init(FULL);
|
epd.Init(FULL);
|
||||||
epd.Display(IMAGE_DATA);
|
epd.Display(IMAGE_DATA);
|
||||||
|
|
||||||
Serial.println("epd PART");
|
delay(2000);
|
||||||
epd.DisplayPartBaseImage(IMAGE_DATA);
|
|
||||||
char i = 0;
|
Paint paint(image, epd.bufwidth*8, epd.bufheight); //width should be the multiple of 8
|
||||||
for (i = 0; i < 10; i++) {
|
|
||||||
Serial.println("e-Paper PART IMAGE_DATA");
|
paint.Clear(UNCOLORED);
|
||||||
epd.Init(PART);
|
paint.DrawStringAt(8, 2, "e-Paper Demo", &Font12, COLORED);
|
||||||
epd.DisplayPart(IMAGE_DATA);
|
paint.DrawStringAt(8, 20, "Hello world", &Font12, COLORED);
|
||||||
Serial.println("e-Paper PART Clear");
|
epd.Display1(image);//1
|
||||||
epd.Init(PART);
|
|
||||||
epd.ClearPart();
|
paint.Clear(UNCOLORED);
|
||||||
}
|
paint.DrawRectangle(2,2,50,50,COLORED);
|
||||||
|
paint.DrawLine(2,2,50,50,COLORED);
|
||||||
|
paint.DrawLine(2,50,50,2,COLORED);
|
||||||
|
paint.DrawFilledRectangle(52,2,100,50,COLORED);
|
||||||
|
paint.DrawLine(52,2,100,50,UNCOLORED);
|
||||||
|
paint.DrawLine(100,2,52,50,UNCOLORED);
|
||||||
|
epd.Display1(image);//2
|
||||||
|
|
||||||
|
paint.Clear(UNCOLORED);
|
||||||
|
paint.DrawCircle(25,25,20,COLORED);
|
||||||
|
paint.DrawFilledCircle(75,25,20,COLORED);
|
||||||
|
epd.Display1(image);//3
|
||||||
|
|
||||||
|
paint.Clear(UNCOLORED);
|
||||||
|
epd.Display1(image);//4
|
||||||
|
|
||||||
|
delay(2000);
|
||||||
|
|
||||||
|
// Serial.println("epd PART");
|
||||||
|
// epd.DisplayPartBaseImage(IMAGE_DATA);
|
||||||
|
// char i = 0;
|
||||||
|
// for (i = 0; i < 10; i++) {
|
||||||
|
// Serial.println("e-Paper PART IMAGE_DATA");
|
||||||
|
// epd.Init(PART);
|
||||||
|
// epd.DisplayPart(IMAGE_DATA);
|
||||||
|
// Serial.println("e-Paper PART Clear");
|
||||||
|
// epd.Init(PART);
|
||||||
|
// epd.ClearPart();
|
||||||
|
// delay(2000);
|
||||||
|
// }
|
||||||
|
|
||||||
epd.Init(FULL);
|
epd.Init(FULL);
|
||||||
Serial.println("e-Paper clear and sleep");
|
Serial.println("e-Paper clear and sleep");
|
||||||
|
@ -95,8 +95,8 @@ int EPD_test(void)
|
|||||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||||
|
|
||||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
Paint_DrawString_CN(130, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
Paint_DrawString_CN(130, 20, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||||
|
|
||||||
EPD_2IN7_V2_Display_Fast(BlackImage);
|
EPD_2IN7_V2_Display_Fast(BlackImage);
|
||||||
DEV_Delay_ms(3000);
|
DEV_Delay_ms(3000);
|
||||||
@ -147,8 +147,8 @@ int EPD_test(void)
|
|||||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||||
|
|
||||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
Paint_DrawString_CN(130, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
Paint_DrawString_CN(130, 20, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||||
|
|
||||||
EPD_2IN7_V2_Display_Base(BlackImage);
|
EPD_2IN7_V2_Display_Base(BlackImage);
|
||||||
DEV_Delay_ms(3000);
|
DEV_Delay_ms(3000);
|
||||||
@ -233,11 +233,11 @@ int EPD_test(void)
|
|||||||
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
Paint_DrawString_EN(10, 20, "hello world", &Font12, GRAY3, GRAY1);
|
||||||
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
Paint_DrawNum(10, 33, 123456789, &Font12, GRAY4, GRAY2);
|
||||||
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
Paint_DrawNum(10, 50, 987654321, &Font16, GRAY1, GRAY4);
|
||||||
Paint_DrawString_CN(150, 0,"ÄãºÃabc", &Font12CN, GRAY4, GRAY1);
|
Paint_DrawString_CN(150, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY4, GRAY1);
|
||||||
Paint_DrawString_CN(150, 20,"ÄãºÃabc", &Font12CN, GRAY3, GRAY2);
|
Paint_DrawString_CN(150, 20,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY3, GRAY2);
|
||||||
Paint_DrawString_CN(150, 40,"ÄãºÃabc", &Font12CN, GRAY2, GRAY3);
|
Paint_DrawString_CN(150, 40,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY2, GRAY3);
|
||||||
Paint_DrawString_CN(150, 60,"ÄãºÃabc", &Font12CN, GRAY1, GRAY4);
|
Paint_DrawString_CN(150, 60,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, GRAY1, GRAY4);
|
||||||
Paint_DrawString_CN(10, 130, "΢ѩµç×Ó", &Font24CN, GRAY1, GRAY4);
|
Paint_DrawString_CN(10, 130, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, GRAY1, GRAY4);
|
||||||
EPD_2IN7_V2_4GrayDisplay(BlackImage);
|
EPD_2IN7_V2_4GrayDisplay(BlackImage);
|
||||||
DEV_Delay_ms(3000);
|
DEV_Delay_ms(3000);
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@ int EPD_test(void)
|
|||||||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||||
|
|
||||||
Paint_DrawString_CN(130, 0,"你好abc", &Font12CN, BLACK, WHITE);
|
Paint_DrawString_CN(130, 0, "ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||||
Paint_DrawString_CN(130, 20, "微雪电子", &Font24CN, WHITE, BLACK);
|
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||||
|
|
||||||
EPD_2IN9_V2_Display_Base(BlackImage);
|
EPD_2IN9_V2_Display_Base(BlackImage);
|
||||||
DEV_Delay_ms(3000);
|
DEV_Delay_ms(3000);
|
||||||
|
3
Special Reminder.txt
Normal file
3
Special Reminder.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The Arduino program in this package only supports the Arduino series development boards, not the ESP32, ESP8266 and other development boards that use the Arduino IDE for development.
|
||||||
|
ESP32 development board use: https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board
|
||||||
|
ESP8266 development board use: https://www.waveshare.com/wiki/E-Paper_ESP8266_Driver_Board
|
Loading…
Reference in New Issue
Block a user