Adjust reset timing

This commit is contained in:
SSYYL 2021-07-19 16:51:02 +08:00
commit abe28de022
2 changed files with 13 additions and 7 deletions

View file

@ -202,10 +202,12 @@ void Epd::SendData(unsigned char data) {
*/ */
void Epd::WaitUntilIdle(void) { void Epd::WaitUntilIdle(void) {
unsigned char busy; unsigned char busy;
Serial.print("e-Paper Busy\r\n ");
do{ do{
SendCommand(0x71); SendCommand(0x71);
busy = DigitalRead(busy_pin); busy = DigitalRead(busy_pin);
}while(busy == 0); }while(busy == 0);
Serial.print("e-Paper Busy Release\r\n ");
DelayMs(20); DelayMs(20);
} }
@ -215,6 +217,8 @@ void Epd::WaitUntilIdle(void) {
* see Epd::Sleep(); * see Epd::Sleep();
*/ */
void Epd::Reset(void) { void Epd::Reset(void) {
DigitalWrite(reset_pin, HIGH);
DelayMs(20);
DigitalWrite(reset_pin, LOW); //module reset DigitalWrite(reset_pin, LOW); //module reset
DelayMs(4); DelayMs(4);
DigitalWrite(reset_pin, HIGH); DigitalWrite(reset_pin, HIGH);
@ -296,10 +300,10 @@ void Epd::Sleep(void) {
void Epd::Clear(void) { void Epd::Clear(void) {
SendCommand(0x10); // SendCommand(0x10);
for(unsigned long i=0; i<height*width; i++) { // for(unsigned long i=0; i<height*width; i++) {
SendData(0x00); // SendData(0x00);
} // }
SendCommand(0x13); SendCommand(0x13);
for(unsigned long i=0; i<height*width; i++) { for(unsigned long i=0; i<height*width; i++) {
SendData(0x00); SendData(0x00);

View file

@ -30,17 +30,19 @@
void setup() { void setup() {
// put your setup code here, to run once: // put your setup code here, to run once:
Serial.begin(9600); Serial.begin(115200);
Epd epd; Epd epd;
Serial.print("e-Paper init \r\n "); Serial.print("e-Paper init \r\n ");
if (epd.Init() != 0) { if (epd.Init() != 0) {
Serial.print("e-Paper init failed\r\n "); Serial.print("e-Paper init failed\r\n ");
return; return;
} }
Serial.print("e-Paper Display\r\n ");
epd.Displaypart(IMAGE_DATA,250, 200,240,103);
Serial.print("e-Paper Clear\r\n "); Serial.print("e-Paper Clear\r\n ");
epd.Clear(); epd.Clear();
epd.Displaypart(IMAGE_DATA,250, 200,240,103);
} }
void loop() { void loop() {