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