Add 4.37inch e-Paper (G) Arduino Program and some fix.
This commit is contained in:
parent
7431785a9c
commit
31c2e4176e
18 changed files with 1518 additions and 534 deletions
|
|
@ -58,7 +58,6 @@ int Epd::Init() {
|
|||
SendCommand(0xB0);
|
||||
SendData(0x03);//1 boost 20211113
|
||||
|
||||
|
||||
SendCommand(0x00);
|
||||
SendData(0x4F);
|
||||
SendData(0x6B);
|
||||
|
|
@ -182,9 +181,7 @@ void Epd::Clear(UBYTE color)
|
|||
SendCommand(0x10);
|
||||
for (UWORD j = 0; j < Height; j++) {
|
||||
for (UWORD i = 0; i < Width; i++) {
|
||||
for(UBYTE k = 0; k < 4; k++) {
|
||||
SendData(color);
|
||||
}
|
||||
SendData((color << 6) | (color << 4) | (color << 2) | color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -216,12 +213,16 @@ void Epd::Display(UBYTE *Image)
|
|||
SendData(pgm_read_byte(&Image[i + j * Width]));
|
||||
}
|
||||
}
|
||||
|
||||
SendCommand(0x68);
|
||||
SendData(0x00);
|
||||
|
||||
TurnOnDisplay();
|
||||
}
|
||||
|
||||
void Epd::Display_part(UBYTE *Image, UWORD xstart, UWORD ystart, UWORD image_width, UWORD image_heigh)
|
||||
void Epd::Display_part(UBYTE *Image, UWORD xstart, UWORD ystart, UWORD image_width, UWORD image_height)
|
||||
{
|
||||
UWORD Width, Height;
|
||||
UWORD Width, Height, i, j;
|
||||
Width = (WIDTH % 4 == 0)? (WIDTH / 4 ): (WIDTH / 4 + 1);
|
||||
Height = HEIGHT;
|
||||
|
||||
|
|
@ -232,20 +233,20 @@ void Epd::Display_part(UBYTE *Image, UWORD xstart, UWORD ystart, UWORD image_wid
|
|||
ReadBusyH();
|
||||
|
||||
SendCommand(0x10);
|
||||
for (UWORD i = 0; i < Height; i++) {
|
||||
for (UWORD j = 0; j < Width; j++) {
|
||||
if((j >= xstart/4) && (j < (image_width + xstart)/4) && (i >= ystart) && (i <= (ystart + image_heigh)) )
|
||||
{
|
||||
SendData(Image[(i-ystart) * image_width/4 + j - xstart/4]);
|
||||
// Serial.print(Image[(i-ystart) * image_width/8 + j - xstart], HEX);
|
||||
// Serial.print(" ");
|
||||
for(i=0; i<Height; i++) {
|
||||
for(j=0; j< Width; j++) {
|
||||
if(i<image_height+ystart && i>=ystart && j<(image_width+xstart)/4 && j>=xstart/4) {
|
||||
SendData(pgm_read_byte(&Image[(j-xstart/4) + (image_width/4*(i-ystart))]));
|
||||
}
|
||||
else
|
||||
{
|
||||
SendData(0x55);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SendData(0x55);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SendCommand(0x68);
|
||||
SendData(0x00);
|
||||
|
||||
TurnOnDisplay();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@
|
|||
#define EPD_WIDTH 168
|
||||
#define EPD_HEIGHT 168
|
||||
|
||||
//colour
|
||||
#define black 0x00
|
||||
#define white 0x55
|
||||
#define yellow 0xAA
|
||||
#define red 0xFF
|
||||
// Color
|
||||
#define black 0x0
|
||||
#define white 0x1
|
||||
#define yellow 0x2
|
||||
#define red 0x3
|
||||
|
||||
#define UWORD unsigned int
|
||||
#define UBYTE unsigned char
|
||||
|
|
@ -59,10 +59,9 @@ public:
|
|||
void TurnOnDisplay(void);
|
||||
void Clear(UBYTE color);
|
||||
void Display(UBYTE *Image);
|
||||
void Display_part(UBYTE *Image, UWORD xstart, UWORD ystart, UWORD image_width, UWORD image_heigh);
|
||||
void Display_part(UBYTE *Image, UWORD xstart, UWORD ystart, UWORD image_width, UWORD image_height);
|
||||
void Sleep(void);
|
||||
|
||||
|
||||
private:
|
||||
unsigned int reset_pin;
|
||||
unsigned int dc_pin;
|
||||
|
|
|
|||
|
|
@ -39,11 +39,16 @@ void setup() {
|
|||
return;
|
||||
}
|
||||
|
||||
Serial.print("While \r\n");
|
||||
epd.Clear(white); // While
|
||||
Serial.print("Image \r\n");
|
||||
epd.Display(IMAGE_DATA);
|
||||
delay(2000);
|
||||
|
||||
epd.Display(IMAGE_DATA);
|
||||
Serial.print("White \r\n");
|
||||
epd.Clear(white);
|
||||
delay(2000);
|
||||
|
||||
Serial.print("Small Image \r\n");
|
||||
epd.Display_part(IMAGE_DATA, 0, 0, 168, 168);
|
||||
delay(2000);
|
||||
|
||||
Serial.print("Clear...\r\n");
|
||||
|
|
@ -52,7 +57,6 @@ void setup() {
|
|||
|
||||
Serial.print("Goto Sleep...\r\n");
|
||||
epd.Sleep();
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue