fix 2.9_V2 & 4.01f

This commit is contained in:
SSYYL 2021-01-26 14:35:45 +08:00
commit 7c368a22af
65 changed files with 4803 additions and 335 deletions

View file

@ -1,7 +1,7 @@
/**
* @filename : epd2in9_V2.cpp
* @brief : Implements for e-paper library
* @author : Yehui from Waveshare
* @author :
*
* Copyright (C) Waveshare Nov 9 2020
*
@ -27,6 +27,29 @@
#include <stdlib.h>
#include "epd2in9_V2.h"
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,
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,
0x0A,0x0,0x0,0x0,0x0,0x0,0x2,
0x1,0x0,0x0,0x0,0x0,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,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,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,0xB0,0x32,0x36,
};
Epd::~Epd() {
};
@ -51,27 +74,21 @@ int Epd::Init() {
WaitUntilIdle();
SendCommand(0x12); //SWRESET
WaitUntilIdle();
SendCommand(0x01); //Driver output control
SendData(0x27);
SendData(0x01);
SendData(0x00);
SendCommand(0x11); //data entry mode
SendData(0x03);
SetMemoryArea(0, 0, width-1, height-1);
SendCommand(0x3C); //BorderWavefrom
SendData(0x05);
SendCommand(0x21); // Display update control
SendData(0x00);
SendData(0x80);
SendCommand(0x18); //Read built-in temperature sensor
SendData(0x80);
SetMemoryPointer(0, 0);
WaitUntilIdle();
/* EPD hardware init end */
@ -203,9 +220,27 @@ void Epd::SetFrameMemory_Partial(
DelayMs(5);
DigitalWrite(reset_pin, HIGH);
DelayMs(10);
SetLut();
SendCommand(0x37);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendData(0x40);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendData(0x00);
SendCommand(0x3C); //BorderWavefrom
SendData(0x80);
SendCommand(0x22);
SendData(0xC0);
SendCommand(0x20);
WaitUntilIdle();
SetMemoryArea(x, y, x_end, y_end);
SetMemoryPointer(x, y);
@ -289,11 +324,19 @@ void Epd::DisplayFrame(void) {
void Epd::DisplayFrame_Partial(void) {
SendCommand(0x22);
SendData(0xFF);
SendData(0x0F);
SendCommand(0x20);
WaitUntilIdle();
}
void Epd::SetLut(void) {
unsigned char count;
SendCommand(0x32);
for(count=0; count<153; count++)
SendData(WF_PARTIAL_2IN9[count]);
WaitUntilIdle();
}
/**
* @brief: private function to specify the memory area for data R/W
*/

View file

@ -1,7 +1,7 @@
/**
* @filename : epd2in9_V2.h
* @brief : Header file for e-paper display library epd2in9_V2.cpp
* @author : Yehui from Waveshare
* @author :
*
* Copyright (C) Waveshare Nov 09 2020
*
@ -71,7 +71,8 @@ private:
unsigned int dc_pin;
unsigned int cs_pin;
unsigned int busy_pin;
void SetLut(void);
void SetMemoryArea(int x_start, int y_start, int x_end, int y_end);
void SetMemoryPointer(int x, int y);
};

View file

@ -127,5 +127,5 @@ void loop() {
epd.SetFrameMemory_Partial(paint.GetImage(), 80, 72, paint.GetWidth(), paint.GetHeight());
epd.DisplayFrame_Partial();
delay(500);
// delay(300);
}