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

This commit is contained in:
SSYYL 2021-07-19 15:03:19 +08:00
commit 588163b176
22 changed files with 1634 additions and 7190 deletions

View file

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