Updates STM32 and Arduino refresh rates (1.54v2, 2.9v2, 7.5)
This commit is contained in:
parent
07230521f9
commit
588163b176
22 changed files with 1645 additions and 7201 deletions
|
@ -30,6 +30,79 @@
|
|||
#include <stdlib.h>
|
||||
#include "epd1in54_V2.h"
|
||||
|
||||
|
||||
// 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,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)
|
||||
// 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,
|
||||
// };
|
||||
|
||||
Epd::~Epd()
|
||||
{
|
||||
};
|
||||
|
@ -73,6 +146,33 @@ void Epd::WaitUntilIdle(void)
|
|||
DelayMs(200);
|
||||
}
|
||||
|
||||
void Epd::Lut(unsigned char* lut)
|
||||
{
|
||||
SendCommand(0x32);
|
||||
for(unsigned char i=0; i<153; i++)
|
||||
SendData(lut[i]);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
void Epd::SetLut(unsigned char* lut)
|
||||
{
|
||||
Lut(lut);
|
||||
|
||||
SendCommand(0x3f);
|
||||
SendData(lut[153]);
|
||||
|
||||
SendCommand(0x03);
|
||||
SendData(lut[154]);
|
||||
|
||||
SendCommand(0x04);
|
||||
SendData(lut[155]);
|
||||
SendData(lut[156]);
|
||||
SendData(lut[157]);
|
||||
|
||||
SendCommand(0x2c);
|
||||
SendData(lut[158]);
|
||||
}
|
||||
|
||||
// High Direction
|
||||
int Epd::HDirInit(void)
|
||||
{
|
||||
|
@ -121,6 +221,8 @@ int Epd::HDirInit(void)
|
|||
SendData(0xC7);
|
||||
SendData(0x00);
|
||||
WaitUntilIdle();
|
||||
|
||||
SetLut(WF_Full_1IN54);
|
||||
/* EPD hardware init end */
|
||||
|
||||
return 0;
|
||||
|
@ -151,12 +253,12 @@ int Epd::LDirInit(void)
|
|||
SendCommand(0x44);
|
||||
/* x point must be the multiple of 8 or the last 3 bits will be ignored */
|
||||
SendData((0 >> 3) & 0xFF);
|
||||
SendData((200 >> 3) & 0xFF);
|
||||
SendData((199 >> 3) & 0xFF);
|
||||
SendCommand(0x45);
|
||||
SendData(0 & 0xFF);
|
||||
SendData((0 >> 8) & 0xFF);
|
||||
SendData(200 & 0xFF);
|
||||
SendData((200 >> 8) & 0xFF);
|
||||
SendData(199 & 0xFF);
|
||||
SendData((199 >> 8) & 0xFF);
|
||||
|
||||
SendCommand(0x3C); //BorderWavefrom
|
||||
SendData(0x01);
|
||||
|
@ -174,6 +276,8 @@ int Epd::LDirInit(void)
|
|||
SendData(0xC7);
|
||||
SendData(0x00);
|
||||
WaitUntilIdle();
|
||||
|
||||
SetLut(WF_Full_1IN54);
|
||||
/* EPD hardware init end */
|
||||
|
||||
return 0;
|
||||
|
@ -188,11 +292,11 @@ int Epd::LDirInit(void)
|
|||
void Epd::Reset(void)
|
||||
{
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(200);
|
||||
DelayMs(20);
|
||||
DigitalWrite(reset_pin, LOW); //module reset
|
||||
DelayMs(10);
|
||||
DelayMs(5);
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(200);
|
||||
DelayMs(20);
|
||||
}
|
||||
|
||||
void Epd::Clear(void)
|
||||
|
@ -207,6 +311,12 @@ void Epd::Clear(void)
|
|||
SendData(0xff);
|
||||
}
|
||||
}
|
||||
SendCommand(0x26);
|
||||
for (int j = 0; j < h; j++) {
|
||||
for (int i = 0; i < w; i++) {
|
||||
SendData(0xff);
|
||||
}
|
||||
}
|
||||
//DISPLAY REFRESH
|
||||
DisplayFrame();
|
||||
}
|
||||
|
@ -339,7 +449,7 @@ void Epd::DisplayFrame(void)
|
|||
{
|
||||
//DISPLAY REFRESH
|
||||
SendCommand(0x22);
|
||||
SendData(0xF7);
|
||||
SendData(0xc7);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
@ -347,7 +457,7 @@ void Epd::DisplayFrame(void)
|
|||
void Epd::DisplayPartFrame(void)
|
||||
{
|
||||
SendCommand(0x22);
|
||||
SendData(0xFF);
|
||||
SendData(0xcF);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
@ -365,9 +475,9 @@ void Epd::SetFrameMemory(
|
|||
int y_end;
|
||||
|
||||
DigitalWrite(reset_pin, LOW); //module reset
|
||||
DelayMs(10);
|
||||
DelayMs(2);
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(10);
|
||||
DelayMs(2);
|
||||
SendCommand(0x3c);
|
||||
SendData(0x80);
|
||||
|
||||
|
@ -402,6 +512,74 @@ void Epd::SetFrameMemory(
|
|||
}
|
||||
}
|
||||
|
||||
void Epd::SetFrameMemoryPartial(
|
||||
const unsigned char* image_buffer,
|
||||
int x,
|
||||
int y,
|
||||
int image_width,
|
||||
int image_height
|
||||
)
|
||||
{
|
||||
int x_end;
|
||||
int y_end;
|
||||
|
||||
DigitalWrite(reset_pin, LOW); //module reset
|
||||
DelayMs(2);
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(2);
|
||||
|
||||
SetLut(WF_PARTIAL_1IN54_0);
|
||||
SendCommand(0x37);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x40);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0x3c);
|
||||
SendData(0x80);
|
||||
|
||||
SendCommand(0x22);
|
||||
SendData(0xc0);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
|
||||
if (
|
||||
image_buffer == NULL ||
|
||||
x < 0 || image_width < 0 ||
|
||||
y < 0 || image_height < 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
/* x point must be the multiple of 8 or the last 3 bits will be ignored */
|
||||
x &= 0xF8;
|
||||
image_width &= 0xF8;
|
||||
if (x + image_width >= this->width) {
|
||||
x_end = this->width - 1;
|
||||
} else {
|
||||
x_end = x + image_width - 1;
|
||||
}
|
||||
if (y + image_height >= this->height) {
|
||||
y_end = this->height - 1;
|
||||
} else {
|
||||
y_end = y + image_height - 1;
|
||||
}
|
||||
SetMemoryArea(x, y, x_end, y_end);
|
||||
SetMemoryPointer(x, y);
|
||||
SendCommand(0x24);
|
||||
/* send the image data */
|
||||
for (int j = 0; j < y_end - y + 1; j++) {
|
||||
for (int i = 0; i < (x_end - x + 1) / 8; i++) {
|
||||
SendData(image_buffer[i + j * (image_width / 8)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: After this command is transmitted, the chip would enter the
|
||||
* deep-sleep mode to save power.
|
||||
|
|
|
@ -64,6 +64,13 @@ public:
|
|||
int image_width,
|
||||
int image_height
|
||||
);
|
||||
void SetFrameMemoryPartial(
|
||||
const unsigned char* image_buffer,
|
||||
int x,
|
||||
int y,
|
||||
int image_width,
|
||||
int image_height
|
||||
);
|
||||
void DisplayFrame(void);
|
||||
void DisplayPartFrame(void);
|
||||
|
||||
|
@ -74,6 +81,8 @@ private:
|
|||
unsigned int cs_pin;
|
||||
unsigned int busy_pin;
|
||||
|
||||
void Lut(unsigned char* lut);
|
||||
void SetLut(unsigned char* lut);
|
||||
void SetMemoryArea(int x_start, int y_start, int x_end, int y_end);
|
||||
void SetMemoryPointer(int x, int y);
|
||||
};
|
||||
|
|
|
@ -58,7 +58,7 @@ void setup()
|
|||
|
||||
Serial.println("e-Paper show pic");
|
||||
epd.HDirInit();
|
||||
epd.Display(IMAGE_DATA);
|
||||
// epd.Display(IMAGE_DATA);
|
||||
|
||||
//Part display
|
||||
epd.HDirInit();
|
||||
|
@ -73,7 +73,7 @@ void setup()
|
|||
for (i = 0; i < 10; i++) {
|
||||
paint.Clear(UNCOLORED);
|
||||
paint.DrawStringAt(10, 10, str[i], &Font24, COLORED);
|
||||
epd.SetFrameMemory(paint.GetImage(), 80, 70, paint.GetWidth(), paint.GetHeight());
|
||||
epd.SetFrameMemoryPartial(paint.GetImage(), 80, 70, paint.GetWidth(), paint.GetHeight());
|
||||
epd.DisplayPartFrame();
|
||||
delay(100);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "epd2in9_V2.h"
|
||||
|
||||
unsigned char WF_PARTIAL_2IN9[159] =
|
||||
unsigned char _WF_PARTIAL_2IN9[159] =
|
||||
{
|
||||
0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
0x80,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
|
||||
|
@ -50,6 +50,29 @@ unsigned char WF_PARTIAL_2IN9[159] =
|
|||
0x22,0x17,0x41,0xB0,0x32,0x36,
|
||||
};
|
||||
|
||||
unsigned char 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
|
||||
};
|
||||
|
||||
Epd::~Epd() {
|
||||
};
|
||||
|
||||
|
@ -91,6 +114,8 @@ int Epd::Init() {
|
|||
|
||||
SetMemoryPointer(0, 0);
|
||||
WaitUntilIdle();
|
||||
|
||||
SetLut_by_host(WS_20_30);
|
||||
/* EPD hardware init end */
|
||||
return 0;
|
||||
}
|
||||
|
@ -122,9 +147,9 @@ void Epd::WaitUntilIdle(void) {
|
|||
while(1) { //=1 BUSY
|
||||
if(DigitalRead(busy_pin)==LOW)
|
||||
break;
|
||||
DelayMs(50);
|
||||
DelayMs(5);
|
||||
}
|
||||
DelayMs(50);
|
||||
DelayMs(5);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,11 +159,11 @@ void Epd::WaitUntilIdle(void) {
|
|||
*/
|
||||
void Epd::Reset(void) {
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(200);
|
||||
DelayMs(20);
|
||||
DigitalWrite(reset_pin, LOW); //module reset
|
||||
DelayMs(5);
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(200);
|
||||
DelayMs(20);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -217,11 +242,11 @@ void Epd::SetFrameMemory_Partial(
|
|||
}
|
||||
|
||||
DigitalWrite(reset_pin, LOW);
|
||||
DelayMs(5);
|
||||
DelayMs(2);
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(10);
|
||||
DelayMs(2);
|
||||
|
||||
SetLut();
|
||||
SetLut(_WF_PARTIAL_2IN9);
|
||||
SendCommand(0x37);
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
|
@ -317,7 +342,7 @@ void Epd::ClearFrameMemory(unsigned char color) {
|
|||
*/
|
||||
void Epd::DisplayFrame(void) {
|
||||
SendCommand(0x22);
|
||||
SendData(0xF7);
|
||||
SendData(0xc7);
|
||||
SendCommand(0x20);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
@ -329,14 +354,28 @@ void Epd::DisplayFrame_Partial(void) {
|
|||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
void Epd::SetLut(void) {
|
||||
void Epd::SetLut(unsigned char *lut) {
|
||||
unsigned char count;
|
||||
SendCommand(0x32);
|
||||
for(count=0; count<153; count++)
|
||||
SendData(WF_PARTIAL_2IN9[count]);
|
||||
SendData(lut[count]);
|
||||
WaitUntilIdle();
|
||||
}
|
||||
|
||||
void Epd::SetLut_by_host(unsigned char *lut) {
|
||||
SetLut((unsigned char *)lut);
|
||||
SendCommand(0x3f);
|
||||
SendData(*(lut+153));
|
||||
SendCommand(0x03); // gate voltage
|
||||
SendData(*(lut+154));
|
||||
SendCommand(0x04); // source voltage
|
||||
SendData(*(lut+155)); // VSH
|
||||
SendData(*(lut+156)); // VSH2
|
||||
SendData(*(lut+157)); // VSL
|
||||
SendCommand(0x2c); // VCOM
|
||||
SendData(*(lut+158));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: private function to specify the memory area for data R/W
|
||||
*/
|
||||
|
|
|
@ -72,7 +72,8 @@ private:
|
|||
unsigned int cs_pin;
|
||||
unsigned int busy_pin;
|
||||
|
||||
void SetLut(void);
|
||||
void SetLut(unsigned char *lut);
|
||||
void SetLut_by_host(unsigned char *lut);
|
||||
void SetMemoryArea(int x_start, int y_start, int x_end, int y_end);
|
||||
void SetMemoryPointer(int x, int y);
|
||||
};
|
||||
|
|
|
@ -27,6 +27,60 @@
|
|||
#include <stdlib.h>
|
||||
#include "epd7in5_V2.h"
|
||||
|
||||
unsigned char Voltage_Frame_7IN5_V2[]={
|
||||
0x6, 0x3F, 0x3F, 0x11, 0x24, 0x7, 0x17,
|
||||
};
|
||||
|
||||
unsigned char 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,
|
||||
};
|
||||
|
||||
unsigned char 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,
|
||||
};
|
||||
|
||||
unsigned char 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,
|
||||
};
|
||||
|
||||
unsigned char 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,
|
||||
};
|
||||
|
||||
unsigned char 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,
|
||||
};
|
||||
|
||||
Epd::~Epd() {
|
||||
};
|
||||
|
||||
|
@ -45,18 +99,60 @@ int Epd::Init(void) {
|
|||
}
|
||||
Reset();
|
||||
|
||||
SendCommand(0x01);
|
||||
SendData(0x07);
|
||||
SendData(0x07);
|
||||
SendData(0x3f);
|
||||
SendData(0x3f);
|
||||
// SendCommand(0x01);
|
||||
// SendData(0x07);
|
||||
// SendData(0x07);
|
||||
// SendData(0x3f);
|
||||
// SendData(0x3f);
|
||||
|
||||
SendCommand(0x04);
|
||||
// SendCommand(0x04);
|
||||
// DelayMs(100);
|
||||
// WaitUntilIdle();
|
||||
|
||||
// SendCommand(0X00); //PANNEL SETTING
|
||||
// SendData(0x1F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
|
||||
// SendCommand(0x61); //tres
|
||||
// SendData(0x03); //source 800
|
||||
// SendData(0x20);
|
||||
// SendData(0x01); //gate 480
|
||||
// SendData(0xE0);
|
||||
|
||||
// SendCommand(0X15);
|
||||
// SendData(0x00);
|
||||
|
||||
// SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
// SendData(0x10);
|
||||
// SendData(0x07);
|
||||
|
||||
// SendCommand(0X60); //TCON SETTING
|
||||
// SendData(0x22);
|
||||
|
||||
SendCommand(0x01); // power setting
|
||||
SendData(0x17); // 1-0=11: internal power
|
||||
SendData(*(Voltage_Frame_7IN5_V2+6)); // VGH&VGL
|
||||
SendData(*(Voltage_Frame_7IN5_V2+1)); // VSH
|
||||
SendData(*(Voltage_Frame_7IN5_V2+2)); // VSL
|
||||
SendData(*(Voltage_Frame_7IN5_V2+3)); // VSHR
|
||||
|
||||
SendCommand(0x82); // VCOM DC Setting
|
||||
SendData(*(Voltage_Frame_7IN5_V2+4)); // VCOM
|
||||
|
||||
SendCommand(0x06); // Booster Setting
|
||||
SendData(0x27);
|
||||
SendData(0x27);
|
||||
SendData(0x2F);
|
||||
SendData(0x17);
|
||||
|
||||
SendCommand(0x30); // OSC Setting
|
||||
SendData(*(Voltage_Frame_7IN5_V2+0)); // 2-0=100: N=4 ; 5-3=111: M=7 ; 3C=50Hz 3A=100HZ
|
||||
|
||||
SendCommand(0x04); //POWER ON
|
||||
DelayMs(100);
|
||||
WaitUntilIdle();
|
||||
|
||||
|
||||
SendCommand(0X00); //PANNEL SETTING
|
||||
SendData(0x1F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
SendData(0x3F); //KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||
|
||||
SendCommand(0x61); //tres
|
||||
SendData(0x03); //source 800
|
||||
|
@ -69,11 +165,19 @@ int Epd::Init(void) {
|
|||
|
||||
SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING
|
||||
SendData(0x10);
|
||||
SendData(0x07);
|
||||
SendData(0x00);
|
||||
|
||||
SendCommand(0X60); //TCON SETTING
|
||||
SendData(0x22);
|
||||
|
||||
SendCommand(0x65); // Resolution setting
|
||||
SendData(0x00);
|
||||
SendData(0x00);//800*480
|
||||
SendData(0x00);
|
||||
SendData(0x00);
|
||||
|
||||
SetLut_by_host(LUT_VCOM_7IN5_V2, LUT_WW_7IN5_V2, LUT_BW_7IN5_V2, LUT_WB_7IN5_V2, LUT_BB_7IN5_V2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -102,7 +206,7 @@ void Epd::WaitUntilIdle(void) {
|
|||
SendCommand(0x71);
|
||||
busy = DigitalRead(busy_pin);
|
||||
}while(busy == 0);
|
||||
DelayMs(200);
|
||||
DelayMs(20);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,7 +218,7 @@ void Epd::Reset(void) {
|
|||
DigitalWrite(reset_pin, LOW); //module reset
|
||||
DelayMs(4);
|
||||
DigitalWrite(reset_pin, HIGH);
|
||||
DelayMs(200);
|
||||
DelayMs(20);
|
||||
}
|
||||
|
||||
void Epd::DisplayFrame(const unsigned char* frame_buffer) {
|
||||
|
@ -148,8 +252,33 @@ void Epd::Displaypart(const unsigned char* pbuffer, unsigned long xStart, unsign
|
|||
SendCommand(0x12);
|
||||
DelayMs(100);
|
||||
WaitUntilIdle();
|
||||
|
||||
}
|
||||
|
||||
void Epd::SetLut_by_host(unsigned char* lut_vcom, unsigned char* lut_ww, unsigned char* lut_bw, unsigned char* lut_wb, unsigned char* lut_bb)
|
||||
{
|
||||
unsigned char count;
|
||||
|
||||
SendCommand(0x20); //VCOM
|
||||
for(count=0; count<60; count++)
|
||||
SendData(lut_vcom[count]);
|
||||
|
||||
SendCommand(0x21); //LUTBW
|
||||
for(count=0; count<60; count++)
|
||||
SendData(lut_ww[count]);
|
||||
|
||||
SendCommand(0x22); //LUTBW
|
||||
for(count=0; count<60; count++)
|
||||
SendData(lut_bw[count]);
|
||||
|
||||
SendCommand(0x23); //LUTWB
|
||||
for(count=0; count<60; count++)
|
||||
SendData(lut_wb[count]);
|
||||
|
||||
SendCommand(0x24); //LUTBB
|
||||
for(count=0; count<60; count++)
|
||||
SendData(lut_bb[count]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief: After this command is transmitted, the chip would enter the
|
||||
* deep-sleep mode to save power.
|
||||
|
|
|
@ -55,6 +55,9 @@ private:
|
|||
unsigned int busy_pin;
|
||||
unsigned long width;
|
||||
unsigned long height;
|
||||
|
||||
void SetLut(unsigned char *lut);
|
||||
void SetLut_by_host(unsigned char *lut_vcom, unsigned char *lut_ww, unsigned char *lut_bw, unsigned char *lut_wb, unsigned char *lut_bb);
|
||||
};
|
||||
|
||||
#endif /* EPD7IN5_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue