Procházet zdrojové kódy

Updates STM32 and Arduino refresh rates (1.54v2, 2.9v2, 7.5)

SSYYL před 4 roky
rodič
revize
588163b176

+ 188 - 10
Arduino/epd1in54_V2/epd1in54_V2.cpp

@@ -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.

+ 9 - 0
Arduino/epd1in54_V2/epd1in54_V2.h

@@ -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);
 };

+ 2 - 2
Arduino/epd1in54_V2/epd1in54_V2.ino

@@ -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);
   }

+ 50 - 11
Arduino/epd2in9_V2/epd2in9_V2.cpp

@@ -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
  */

+ 2 - 1
Arduino/epd2in9_V2/epd2in9_V2.h

@@ -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);
 };

+ 140 - 11
Arduino/epd7in5_V2/epd7in5_V2.cpp

@@ -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);
+    // 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(0x04);
+	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. 

+ 3 - 0
Arduino/epd7in5_V2/epd7in5_V2.h

@@ -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 */

+ 6 - 70
RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_7in5_V2.c

@@ -86,70 +86,6 @@ UBYTE LUT_BB_7IN5_V2[]={
 	0x0,	0x0,	0x0,	0x0,	0x0,	0x0,	
 };
 
-
-
-UBYTE lut_vcomDC_7IN5_V2[] ={	
-	0x00,	0x15,	0x19,	0x00,	0x00,	0x01,	
-	0x00,	0x19,	0x01,	0x19,	0x01,	0x02,	
-	0x00,	0x06,	0x01,	0x05,	0x01,	0x04,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-};
-							
-UBYTE lut_ww_7IN5_V2[] ={	
-	0x04,	0x14,	0x01,	0x18,	0x01,	0x01,	
-	0x84,	0x19,	0x01,	0x19,	0x01,	0x02,	
-	0x80,	0x06,	0x01,	0x05,	0x01,	0x04,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-};
-
-UBYTE lut_bw_7IN5_V2[] ={	
-	0x04,	0x14,	0x01,	0x18,	0x01,	0x01,	
-	0x84,	0x19,	0x01,	0x19,	0x01,	0x02,	
-	0x80,	0x06,	0x01,	0x05,	0x01,	0x04,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-};
-
-UBYTE lut_wb_7IN5_V2[] ={	
-	0x80,	0x14,	0x01,	0x18,	0x01,	0x01,	
-	0x84,	0x19,	0x01,	0x19,	0x01,	0x02,	
-	0x04,	0x06,	0x01,	0x05,	0x01,	0x04,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-};
-
-UBYTE lut_bb_7IN5_V2[] ={	
-	0x80,	0x14,	0x01,	0x18,	0x01,	0x01,	
-	0x84,	0x19,	0x01,	0x19,	0x01,	0x02,	
-	0x04,	0x06,	0x01,	0x05,	0x01,	0x04,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-	0x00,	0x00,	0x00,	0x00,	0x00,	0x00,	
-};
-
 /******************************************************************************
 function :	Software reset
 parameter:
@@ -357,12 +293,12 @@ void EPD_7IN5_V2_Display(const UBYTE *blackimage)
     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++) {

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 103
STM32/STM32-F103ZET6/MDK-ARM/epd-demo.uvguix.Ezio


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 1791
STM32/STM32-F103ZET6/MDK-ARM/epd-demo.uvguix.pengqiangyou


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 7 - 7
STM32/STM32-F103ZET6/MDK-ARM/epd-demo.uvguix.qiumingsong


+ 27 - 27
STM32/STM32-F103ZET6/MDK-ARM/epd-demo.uvoptx

@@ -145,7 +145,7 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>ST-LINKIII-KEIL_SWO</Key>
-          <Name>-U34FF68064157373036130757 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("") -D00(00000000) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103ZE$Flash\STM32F10x_512.FLM)</Name>
+          <Name>-U38FF6D064246373030270457 -O2254 -SF1800 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000 -FP0($$Device:STM32F103ZE$Flash\STM32F10x_512.FLM)</Name>
         </SetRegEntry>
       </TargetDriverDllRegistry>
       <Breakpoint>
@@ -243,7 +243,7 @@
 
   <Group>
     <GroupName>Application/MDK-ARM</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -343,7 +343,7 @@
 
   <Group>
     <GroupName>Examples</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -1421,14 +1421,6 @@
     </File>
   </Group>
 
-  <Group>
-    <GroupName>::CMSIS</GroupName>
-    <tvExp>0</tvExp>
-    <tvExpOptDlg>0</tvExpOptDlg>
-    <cbSel>0</cbSel>
-    <RteFlg>1</RteFlg>
-  </Group>
-
   <Group>
     <GroupName>Drivers/CMSIS</GroupName>
     <tvExp>0</tvExp>
@@ -1436,7 +1428,7 @@
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
     <File>
-      <GroupNumber>10</GroupNumber>
+      <GroupNumber>9</GroupNumber>
       <FileNumber>94</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1456,7 +1448,7 @@
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>95</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1468,7 +1460,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>96</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1480,7 +1472,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>97</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1492,7 +1484,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>98</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1504,7 +1496,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>99</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1516,7 +1508,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>100</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1528,7 +1520,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>101</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1540,7 +1532,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>102</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1552,7 +1544,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>103</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1564,7 +1556,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>104</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1576,7 +1568,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>105</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1588,7 +1580,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>106</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1600,7 +1592,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>107</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1612,7 +1604,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>108</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1624,7 +1616,7 @@
       <bShared>0</bShared>
     </File>
     <File>
-      <GroupNumber>11</GroupNumber>
+      <GroupNumber>10</GroupNumber>
       <FileNumber>109</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
@@ -1637,4 +1629,12 @@
     </File>
   </Group>
 
+  <Group>
+    <GroupName>::CMSIS</GroupName>
+    <tvExp>0</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>1</RteFlg>
+  </Group>
+
 </ProjectOpt>

+ 4 - 4
STM32/STM32-F103ZET6/MDK-ARM/epd-demo.uvprojx

@@ -134,7 +134,7 @@
             <RunIndependent>0</RunIndependent>
             <UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
             <Capability>1</Capability>
-            <DriverSelection>4103</DriverSelection>
+            <DriverSelection>4101</DriverSelection>
           </Flash1>
           <bUseTDR>1</bUseTDR>
           <Flash2>STLink\ST-LINKIII-KEIL_SWO.dll</Flash2>
@@ -883,9 +883,6 @@
             </File>
           </Files>
         </Group>
-        <Group>
-          <GroupName>::CMSIS</GroupName>
-        </Group>
         <Group>
           <GroupName>Drivers/CMSIS</GroupName>
           <GroupOption>
@@ -1930,6 +1927,9 @@
             </File>
           </Files>
         </Group>
+        <Group>
+          <GroupName>::CMSIS</GroupName>
+        </Group>
       </Groups>
     </Target>
   </Targets>

+ 5 - 111
STM32/STM32-F103ZET6/MDK-ARM/epd-demo/epd-demo.build_log.htm

@@ -21,121 +21,15 @@ Target DLL:      STLink\ST-LINKIII-KEIL_SWO.dll V3.0.1.0
 Dialog DLL:      TCM.DLL V1.35.1.0
  
 <h2>Project:</h2>
-E:\project\E-Paper_code\STM32\STM32-F103ZET6\MDK-ARM\epd-demo.uvprojx
-Project File Date:  05/27/2021
+E:\github\E-Paper_code\STM32\STM32-F103ZET6\MDK-ARM\epd-demo.uvprojx
+Project File Date:  07/19/2021
 
 <h2>Output:</h2>
 *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Program Files\keil5\ARM\ARMCC\Bin'
-Rebuild target 'epd-demo'
-assembling startup_stm32f103xe.s...
-compiling ImageData.c...
-compiling stm32f1xx_hal_msp.c...
-compiling gpio.c...
-compiling EPD_1in02_test.c...
-compiling spi.c...
-compiling stm32f1xx_it.c...
+Build target 'epd-demo'
 compiling main.c...
-compiling usart.c...
-compiling EPD_1in54_test.c...
-compiling EPD_1in54b_test.c...
-compiling EPD_1in54c_test.c...
-compiling EPD_2in7_test.c...
-compiling EPD_1in54b_V2_test.c...
-compiling EPD_2in7b_test.c...
-compiling EPD_1in54_V2_test.c...
-compiling EPD_2in9_V2_test.c...
-compiling EPD_2in9_test.c...
-compiling EPD_2in9bc_test.c...
-compiling EPD_2in13_test.c...
-compiling EPD_2in9d_test.c...
-compiling EPD_2in13_V2_test.c...
-compiling EPD_2in13d_test.c...
-compiling EPD_2in9b_V3_test.c...
-compiling EPD_2in13b_V3_test.c...
-compiling EPD_2in13bc_test.c...
-compiling EPD_4in01f_test.c...
-compiling EPD_2in66_test.c...
-compiling EPD_4in2bc_test.c...
-compiling EPD_2in66b_test.c...
-compiling EPD_4in2b_V2_test.c...
-compiling EPD_3in7_test.c...
-compiling EPD_5in65f_test.c...
-compiling EPD_4in2_test.c...
-compiling EPD_5in83_V2_test.c...
-compiling EPD_5in83bc_test.c...
-compiling EPD_7in5_V2_test.c...
-compiling EPD_7in5_test.c...
-compiling EPD_7in5b_V2_test.c...
-compiling EPD_5in83b_V2_test.c...
-compiling EPD_5in83_test.c...
-compiling EPD_7in5bc_test.c...
-compiling EPD_7in5b_HD_test.c...
-compiling EPD_2in7b_V2_test.c...
-compiling EPD_1in54b.c...
-compiling EPD_7in5_HD_test.c...
-compiling EPD_1in54_V2.c...
-compiling EPD_1in02d.c...
-compiling EPD_1in54.c...
-compiling EPD_1in54b_V2.c...
-compiling EPD_2in7b_V2.c...
-compiling EPD_2in7.c...
-compiling EPD_2in9.c...
-compiling EPD_2in7b.c...
-compiling EPD_1in54c.c...
-compiling EPD_2in9bc.c...
-compiling EPD_2in9b_V3.c...
-compiling EPD_2in9_V2.c...
-compiling EPD_2in13bc.c...
-compiling EPD_2in13b_V3.c...
-compiling EPD_2in66.c...
-compiling EPD_2in13_V2.c...
-compiling EPD_2in13.c...
-compiling EPD_2in9d.c...
-compiling EPD_2in13d.c...
-compiling EPD_2in66b.c...
-compiling EPD_5in83.c...
-compiling EPD_4in2bc.c...
-compiling EPD_4in2b_V2.c...
-compiling EPD_4in01f.c...
-compiling EPD_4in2.c...
-compiling EPD_5in83_V2.c...
-compiling EPD_5in65f.c...
-compiling EPD_3in7.c...
-compiling EPD_5in83bc.c...
-compiling EPD_7in5_HD.c...
-compiling EPD_7in5.c...
-compiling EPD_7in5b_HD.c...
-compiling EPD_7in5_V2.c...
-compiling EPD_5in83b_V2.c...
-compiling EPD_7in5b_V2.c...
-compiling EPD_7in5bc.c...
-compiling font8.c...
-compiling font12.c...
-compiling font12CN.c...
-compiling font16.c...
-compiling font20.c...
-compiling font24CN.c...
-compiling font24.c...
-compiling GUI_Paint.c...
-compiling DEV_Config.c...
-compiling stm32f1xx_hal_rcc_ex.c...
-compiling stm32f1xx_hal.c...
-compiling system_stm32f1xx.c...
-compiling stm32f1xx_hal_gpio_ex.c...
-compiling stm32f1xx_hal_spi.c...
-compiling stm32f1xx_hal_rcc.c...
-compiling stm32f1xx_hal_cortex.c...
-compiling stm32f1xx_hal_flash.c...
-compiling stm32f1xx_hal_pwr.c...
-compiling stm32f1xx_hal_tim.c...
-compiling stm32f1xx_hal_gpio.c...
-compiling stm32f1xx_hal_exti.c...
-compiling stm32f1xx_hal_dma.c...
-compiling stm32f1xx_hal_flash_ex.c...
-compiling stm32f1xx_hal_tim_ex.c...
-compiling stm32f1xx_hal_uart.c...
 linking...
-Program Size: Code=25320 RO-data=28600 RW-data=68 ZI-data=41140  
+Program Size: Code=18544 RO-data=360 RW-data=20 ZI-data=4252  
 FromELF: creating hex file...
 "epd-demo\epd-demo.axf" - 0 Error(s), 0 Warning(s).
 
@@ -160,7 +54,7 @@ Package Vendor: Keil
 <h2>Collection of Component Files used:</h2>
 
    * Component: ARM::CMSIS:CORE:5.4.0
-Build Time Elapsed:  00:00:47
+Build Time Elapsed:  00:00:03
 </pre>
 </body>
 </html>

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 363 - 737
STM32/STM32-F103ZET6/MDK-ARM/epd-demo/epd-demo.htm


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 369 - 460
STM32/STM32-F103ZET6/MDK-ARM/epd-demo/epd-demo.map


+ 1 - 1
STM32/STM32-F103ZET6/Src/main.c

@@ -102,7 +102,7 @@ int main(void)
 //		EPD_1in54b_V2_test();
 //		EPD_1in54c_test();
 
-		EPD_2in7_test();
+//		EPD_2in7_test();
 //		EPD_2in7b_test();
 //		EPD_2in7b_V2_test();
 

+ 8 - 6
STM32/STM32-F103ZET6/User/Examples/EPD_1in54_V2_test.c

@@ -61,7 +61,7 @@ int EPD_1in54_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);
@@ -86,27 +86,29 @@ int EPD_1in54_V2_test(void)
     Paint_DrawString_EN(5, 85, "waveshare", &Font20, BLACK, WHITE);
     Paint_DrawNum(5, 110, 123456789, &Font20, BLACK, WHITE);
 
-    Paint_DrawString_CN(5, 135,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
-    Paint_DrawString_CN(5, 155, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
+    Paint_DrawString_CN(5, 135,"���abc", &Font12CN, BLACK, WHITE);
+    Paint_DrawString_CN(5, 155, "΢ѩ����", &Font24CN, WHITE, BLACK);
 
     EPD_1IN54_V2_Display(BlackImage);
     DEV_Delay_ms(2000);
 #endif
 
-#if 0   //Partial refresh, example shows time    
+#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);
 
+    // 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 = 10;
     for (;;) {
         sPaint_time.Sec = sPaint_time.Sec + 1;
         if (sPaint_time.Sec == 60) {

+ 166 - 31
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54_V2.c

@@ -30,6 +30,78 @@
 #include "EPD_1in54_V2.h"
 #include "Debug.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,
+};
+
 /******************************************************************************
 function :	Software reset
 parameter:
@@ -77,15 +149,8 @@ parameter:
 static void EPD_1IN54_V2_ReadBusy(void)
 {
     Debug("e-Paper busy\r\n");
-    // UBYTE busy;
-    // do {
-        // EPD_1IN54_V2_SendCommand(0x71);
-        // busy = DEV_Digital_Read(EPD_BUSY_PIN);
-        // busy = !(busy & 0x01);
-    // } while(busy);
-    // DEV_Delay_ms(200);
     while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) {      //LOW: idle, HIGH: busy
-        DEV_Delay_ms(100);
+        DEV_Delay_ms(10);
     }
     Debug("e-Paper busy release\r\n");
 }
@@ -97,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();
 }
@@ -109,11 +174,61 @@ 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_Lut(UBYTE *lut)
+{
+	EPD_1IN54_V2_SendCommand(0x32);
+	for(UBYTE i=0; i<153; 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
+    EPD_1IN54_V2_SendData((Xstart>>3) & 0xFF);
+    EPD_1IN54_V2_SendData((Xend>>3) & 0xFF);
+	
+    EPD_1IN54_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION
+    EPD_1IN54_V2_SendData(Ystart & 0xFF);
+    EPD_1IN54_V2_SendData((Ystart >> 8) & 0xFF);
+    EPD_1IN54_V2_SendData(Yend & 0xFF);
+    EPD_1IN54_V2_SendData((Yend >> 8) & 0xFF);
+}
+
+static void EPD_1IN54_V2_SetCursor(UWORD Xstart, UWORD Ystart)
+{
+    EPD_1IN54_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER
+    EPD_1IN54_V2_SendData(Xstart & 0xFF);
+
+    EPD_1IN54_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER
+    EPD_1IN54_V2_SendData(Ystart & 0xFF);
+    EPD_1IN54_V2_SendData((Ystart >> 8) & 0xFF);
+}
+
 /******************************************************************************
 function :	Initialize the e-Paper register
 parameter:
@@ -134,15 +249,7 @@ 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
     EPD_1IN54_V2_SendData(0x01);
@@ -154,12 +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();
 }
 
 /******************************************************************************
@@ -178,6 +314,12 @@ void EPD_1IN54_V2_Clear(void)
             EPD_1IN54_V2_SendData(0XFF);
         }
     }
+    EPD_1IN54_V2_SendCommand(0x26);
+    for (UWORD j = 0; j < Height; j++) {
+        for (UWORD i = 0; i < Width; i++) {
+            EPD_1IN54_V2_SendData(0XFF);
+        }
+    }
     EPD_1IN54_V2_TurnOnDisplay();
 }
 
@@ -240,13 +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(10);
-    DEV_Digital_Write(EPD_RST_PIN, 1);
-    DEV_Delay_ms(10);	
-    EPD_1IN54_V2_SendCommand(0x3C); //BorderWavefrom
-    EPD_1IN54_V2_SendData(0x80);
 	
     UDOUBLE Addr = 0;
     EPD_1IN54_V2_SendCommand(0x24);

+ 1 - 0
STM32/STM32-F103ZET6/User/e-Paper/EPD_1in54_V2.h

@@ -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);

+ 51 - 10
STM32/STM32-F103ZET6/User/e-Paper/EPD_2in9_V2.c

@@ -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:
@@ -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();
 }
@@ -194,18 +233,20 @@ void EPD_2IN9_V2_Init(void)
 
 	EPD_2IN9_V2_SetWindows(0, 0, EPD_2IN9_V2_WIDTH-1, EPD_2IN9_V2_HEIGHT-1);
 
-	EPD_2IN9_V2_SendCommand(0x3C); //BorderWavefrom
-	EPD_2IN9_V2_SendData(0x05);	
+	// EPD_2IN9_V2_SendCommand(0x3C); //BorderWavefrom
+	// EPD_2IN9_V2_SendData(0x05);	
 
 	EPD_2IN9_V2_SendCommand(0x21); //  Display update control
 	EPD_2IN9_V2_SendData(0x00);
 	EPD_2IN9_V2_SendData(0x80);	
 
-	EPD_2IN9_V2_SendCommand(0x18); //Read built-in temperature sensor
-	EPD_2IN9_V2_SendData(0x80);	
+	// EPD_2IN9_V2_SendCommand(0x18); //Read built-in temperature sensor
+	// EPD_2IN9_V2_SendData(0x80);	
 
 	EPD_2IN9_V2_SetCursor(0, 0);
 	EPD_2IN9_V2_ReadBusy();
+
+	EPD_2IN9_V2_LUT_by_host(WS_20_30);
 }
 
 /******************************************************************************
@@ -261,11 +302,11 @@ void EPD_2IN9_V2_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(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);  

+ 135 - 7
STM32/STM32-F103ZET6/User/e-Paper/EPD_7in5_V2.c

@@ -31,6 +31,60 @@
 #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:
@@ -89,6 +143,30 @@ static void EPD_WaitUntilIdle(void)
 		
 }
 
+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<60; count++)
+		EPD_SendData(lut_vcom[count]);
+
+	EPD_SendCommand(0x21); //LUTBW
+	for(count=0; count<60; count++)
+		EPD_SendData(lut_ww[count]);
+
+	EPD_SendCommand(0x22); //LUTBW
+	for(count=0; count<60; count++)
+		EPD_SendData(lut_bw[count]);
+
+	EPD_SendCommand(0x23); //LUTWB
+	for(count=0; count<60; count++)
+		EPD_SendData(lut_wb[count]);
+
+	EPD_SendCommand(0x24); //LUTBB
+	for(count=0; count<60; count++)
+		EPD_SendData(lut_bb[count]);
+}
 
 /******************************************************************************
 function :	Turn On Display
@@ -109,18 +187,60 @@ 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(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_SendCommand(0x61);        	//tres
+    // EPD_SendData(0x03);		//source 800
+    // EPD_SendData(0x20);
+    // EPD_SendData(0x01);		//gate 480
+    // EPD_SendData(0xE0);
+
+    // EPD_SendCommand(0X15);
+    // EPD_SendData(0x00);
+
+    // EPD_SendCommand(0X50);			//VCOM AND DATA INTERVAL SETTING
+    // EPD_SendData(0x10);
+    // EPD_SendData(0x07);
+
+    // EPD_SendCommand(0X60);			//TCON SETTING
+    // EPD_SendData(0x22);
+
+	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
@@ -133,11 +253,19 @@ UBYTE EPD_7IN5_V2_Init(void)
 
     EPD_SendCommand(0X50);			//VCOM AND DATA INTERVAL SETTING
     EPD_SendData(0x10);
-    EPD_SendData(0x07);
+    EPD_SendData(0x00);
 
     EPD_SendCommand(0X60);			//TCON SETTING
     EPD_SendData(0x22);
 
+    EPD_SendCommand(0x65);  // Resolution setting
+    EPD_SendData(0x00);
+    EPD_SendData(0x00);//800*480
+    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;
 }
 

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů