mirror of
https://github.com/HalfSweetStudio/EPaperDrive.git
synced 2026-03-29 06:19:48 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19d7b3224f | ||
|
|
c1ae182026 | ||
|
|
4f1d375a1a | ||
|
|
f847b5651c | ||
|
|
1196c4f91a | ||
|
|
a3264912ad | ||
|
|
8797aaa8b3 | ||
|
|
8728602643 | ||
|
|
a2fa1a4778 | ||
|
|
5a874ea7cf |
@@ -2,7 +2,7 @@
|
|||||||
这是一个简单好用性能强大的Arduino墨水屏驱动库,支持目前市面上较常见的多种墨水屏。
|
这是一个简单好用性能强大的Arduino墨水屏驱动库,支持目前市面上较常见的多种墨水屏。
|
||||||
|
|
||||||
## 我应该如何使用它?
|
## 我应该如何使用它?
|
||||||
请着重参考[例程](https://github.com/HalfSweetStudio/EPaperDrive/tree/main/examples)与[API手册](docs/API手册.md),如果您遇到了例程不能使用的情况,请提交issue说明详细情况。
|
请着重参考[例程](https://github.com/HalfSweetStudio/EPaperDrive/tree/main/examples)、[API手册](docs/API手册.md)以及[用户手册](docs/用户手册.md),如果您遇到了例程不能使用的情况,请提交issue说明详细情况。
|
||||||
|
|
||||||
## 我应该采用什么样的驱动电路?
|
## 我应该采用什么样的驱动电路?
|
||||||
事实上,几乎所有的串口SPI的墨水屏驱动电路以及引脚定义都是相同的,如果您有微雪或者大连佳显等厂商提供的驱动板,您开源直接使用它。如果您是裸屏,那么我建议您采用这款[驱动板](https://oshwhub.com/ludas/mo-shui-ping-qu-dong)。需要注意的是,请您采用4-wire模式来驱动墨水屏,我们暂不支持3-wire模式。
|
事实上,几乎所有的串口SPI的墨水屏驱动电路以及引脚定义都是相同的,如果您有微雪或者大连佳显等厂商提供的驱动板,您开源直接使用它。如果您是裸屏,那么我建议您采用这款[驱动板](https://oshwhub.com/ludas/mo-shui-ping-qu-dong)。需要注意的是,请您采用4-wire模式来驱动墨水屏,我们暂不支持3-wire模式。
|
||||||
|
|||||||
@@ -18,3 +18,6 @@
|
|||||||
## 如何显示图片?
|
## 如何显示图片?
|
||||||
想要在墨水屏上显示一些图片,也许是个不错的主意。令人兴奋的是,我们提供了一系列的API供您完成您绝妙的创意。您可以调用`drawXbm`与`DrawXbm_P`函数来向缓存中绘入您所期望的图片。这两个函数的区别在于`DrawXbm_P`绘制的是您采用PROGMEM类型存储的图像,这会将数据存储在flash而不是RAM,相信您会喜欢上这一点。
|
想要在墨水屏上显示一些图片,也许是个不错的主意。令人兴奋的是,我们提供了一系列的API供您完成您绝妙的创意。您可以调用`drawXbm`与`DrawXbm_P`函数来向缓存中绘入您所期望的图片。这两个函数的区别在于`DrawXbm_P`绘制的是您采用PROGMEM类型存储的图像,这会将数据存储在flash而不是RAM,相信您会喜欢上这一点。
|
||||||
也许您会有这样的疑问,如何将.jpg等拓展名的图像转换为可识别的数据呢?非常简单,只需要使用任意一款图像取模软件(我喜欢用Image2lcd,虽然它很古老,但是依旧能完美地完成任务),使用单色模式垂直扫描将其转换为一连串的c数组即可。
|
也许您会有这样的疑问,如何将.jpg等拓展名的图像转换为可识别的数据呢?非常简单,只需要使用任意一款图像取模软件(我喜欢用Image2lcd,虽然它很古老,但是依旧能完美地完成任务),使用单色模式垂直扫描将其转换为一连串的c数组即可。
|
||||||
|
|
||||||
|
## 制作自己的字体
|
||||||
|
您可以使用[FontMaker](https://gitee.com/kerndev/FontMaker)软件来生成自己的字库,使用该软件生成垂直扫描、高位在前,标准字库为ASCII或者Unicode的bin文件字库,并调用`SetFont()`函数进行定义文件路径和宽高。
|
||||||
@@ -56,6 +56,7 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
EPD.SetHardSPI(&SPI);
|
EPD.SetHardSPI(&SPI);
|
||||||
|
LittleFS.begin();
|
||||||
EPD.SetFS(&LittleFS); //设置存放字体的文件系统,传入的为该文件系统的操作指针,可自行修改
|
EPD.SetFS(&LittleFS); //设置存放字体的文件系统,传入的为该文件系统的操作指针,可自行修改
|
||||||
|
|
||||||
EPD.EPD_Set_Model(HINKE0266A15A0); //设置屏幕类型,具体型号可以参考文档
|
EPD.EPD_Set_Model(HINKE0266A15A0); //设置屏幕类型,具体型号可以参考文档
|
||||||
|
|||||||
BIN
examples/HardSPIHelloWorld/data/font10
Normal file
BIN
examples/HardSPIHelloWorld/data/font10
Normal file
Binary file not shown.
BIN
examples/HardSPIHelloWorld/data/font12
Normal file
BIN
examples/HardSPIHelloWorld/data/font12
Normal file
Binary file not shown.
BIN
examples/HardSPIHelloWorld/data/font32
Normal file
BIN
examples/HardSPIHelloWorld/data/font32
Normal file
Binary file not shown.
BIN
examples/HardSPIHelloWorld/data/font60
Normal file
BIN
examples/HardSPIHelloWorld/data/font60
Normal file
Binary file not shown.
BIN
examples/HardSPIHelloWorld/data/font70
Normal file
BIN
examples/HardSPIHelloWorld/data/font70
Normal file
Binary file not shown.
BIN
examples/HardSPIHelloWorld/data/weathericon
Normal file
BIN
examples/HardSPIHelloWorld/data/weathericon
Normal file
Binary file not shown.
BIN
examples/HardSPIHelloWorld/data/weathericon32
Normal file
BIN
examples/HardSPIHelloWorld/data/weathericon32
Normal file
Binary file not shown.
BIN
examples/HardSPIHelloWorld/data/weathericon50
Normal file
BIN
examples/HardSPIHelloWorld/data/weathericon50
Normal file
Binary file not shown.
BIN
examples/HardSPIHelloWorld/data/weathericon80
Normal file
BIN
examples/HardSPIHelloWorld/data/weathericon80
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/font10
Normal file
BIN
examples/HelloWorld/data/font10
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/font12
Normal file
BIN
examples/HelloWorld/data/font12
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/font32
Normal file
BIN
examples/HelloWorld/data/font32
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/font60
Normal file
BIN
examples/HelloWorld/data/font60
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/font70
Normal file
BIN
examples/HelloWorld/data/font70
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/weathericon
Normal file
BIN
examples/HelloWorld/data/weathericon
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/weathericon32
Normal file
BIN
examples/HelloWorld/data/weathericon32
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/weathericon50
Normal file
BIN
examples/HelloWorld/data/weathericon50
Normal file
Binary file not shown.
BIN
examples/HelloWorld/data/weathericon80
Normal file
BIN
examples/HelloWorld/data/weathericon80
Normal file
Binary file not shown.
86
examples/ThreeColor/ThreeColor.ino
Normal file
86
examples/ThreeColor/ThreeColor.ino
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* @file HelloWorld.ino
|
||||||
|
* @author HalfSweet (Email:HalfSweet@HalfSweet.cn or QQ:2522182733)
|
||||||
|
* @brief 该文件为支持三色的墨水屏显示出三种颜色的例程
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-04-20
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <EPaperDrive.h>
|
||||||
|
//包含你需要使用的文件系统,例如:
|
||||||
|
#include <LittleFS.h>
|
||||||
|
|
||||||
|
#define BAUD_SPEED 74880 //串口调试的波特率,可自行修改
|
||||||
|
|
||||||
|
#define CS 15
|
||||||
|
#define RST 2
|
||||||
|
#define DC 0
|
||||||
|
#define BUSY 4
|
||||||
|
#define CLK 14
|
||||||
|
#define DIN 13
|
||||||
|
EPaperDrive EPD(0, CS, RST, DC, BUSY, CLK, DIN); //驱动库的实例化,此处为使用软件SPI
|
||||||
|
|
||||||
|
const uint8_t city_icon[24] = {
|
||||||
|
/* 0X01,0X01,0X0C,0X00,0X0C,0X00, */
|
||||||
|
0X00,
|
||||||
|
0X00,
|
||||||
|
0X1C,
|
||||||
|
0X00,
|
||||||
|
0X77,
|
||||||
|
0X00,
|
||||||
|
0X41,
|
||||||
|
0X80,
|
||||||
|
0X9C,
|
||||||
|
0X60,
|
||||||
|
0XA2,
|
||||||
|
0X30,
|
||||||
|
0XA2,
|
||||||
|
0X30,
|
||||||
|
0X9C,
|
||||||
|
0XC0,
|
||||||
|
0X41,
|
||||||
|
0X80,
|
||||||
|
0X77,
|
||||||
|
0X00,
|
||||||
|
0X1C,
|
||||||
|
0X00,
|
||||||
|
0X00,
|
||||||
|
0X00,
|
||||||
|
};
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(BAUD_SPEED);
|
||||||
|
LittleFS.begin(); //请务必先手动初始化一遍文件系统再将指针传入
|
||||||
|
EPD.SetFS(&LittleFS); //设置存放字体的文件系统,传入的为该文件系统的操作指针,可自行修改
|
||||||
|
|
||||||
|
EPD.EPD_Set_Model(DKE42_3COLOR); //设置屏幕类型,具体型号可以参考文档
|
||||||
|
EPD.EPD_init_Full(); //全刷初始化,使用全刷波形
|
||||||
|
EPD.clearbuffer(); //清空缓存(全白)
|
||||||
|
EPD.fontscale = 2; //字体缩放系数(支持1和2,对图片也有效,用完记得重新改成1)
|
||||||
|
EPD.SetFont(FONT12); //选择字体,具体支持的字体见文档
|
||||||
|
EPD.DrawUTF(0, 0, "Hello World"); //绘制字符串
|
||||||
|
EPD.DrawUTF(26, 0, "我喜欢墨水屏"); //绘制字符串
|
||||||
|
EPD.fontscale = 1; //字体缩放系数改回1
|
||||||
|
EPD.DrawXbm_P(100, 0, 12, 12, (uint8_t *)city_icon); //绘制图片
|
||||||
|
EPD.EPD_Transfer_Full_BW((unsigned char *)EPD.EPDbuffer, 1); //将黑白图像传入缓存
|
||||||
|
EPD.clearbuffer();
|
||||||
|
EPD.fontscale = 2;
|
||||||
|
EPD.DrawUTF(40, 0, "现在是红色");
|
||||||
|
EPD.fontscale = 1;
|
||||||
|
EPD.DrawXbm_P(100, 30, 12, 12, (uint8_t *)city_icon); //绘制图片
|
||||||
|
EPD.EPD_Transfer_Full_RED((unsigned char *)EPD.EPDbuffer,1);
|
||||||
|
Serial.printf("缓存图像绘制完毕,准备全刷 \n");
|
||||||
|
EPD.EPD_Update();
|
||||||
|
EPD.ReadBusy_long();//等待屏幕刷新完成后才继续往下运行
|
||||||
|
EPD.deepsleep(); //让屏幕进入休眠模式
|
||||||
|
Serial.println("全刷完毕");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
delay(1); //防止看门狗咬
|
||||||
|
}
|
||||||
0
examples/ThreeColor/data/ThreeColor.ino
Normal file
0
examples/ThreeColor/data/ThreeColor.ino
Normal file
BIN
examples/ThreeColor/data/font10
Normal file
BIN
examples/ThreeColor/data/font10
Normal file
Binary file not shown.
BIN
examples/ThreeColor/data/font12
Normal file
BIN
examples/ThreeColor/data/font12
Normal file
Binary file not shown.
BIN
examples/ThreeColor/data/font32
Normal file
BIN
examples/ThreeColor/data/font32
Normal file
Binary file not shown.
BIN
examples/ThreeColor/data/font60
Normal file
BIN
examples/ThreeColor/data/font60
Normal file
Binary file not shown.
BIN
examples/ThreeColor/data/font70
Normal file
BIN
examples/ThreeColor/data/font70
Normal file
Binary file not shown.
BIN
examples/ThreeColor/data/weathericon32
Normal file
BIN
examples/ThreeColor/data/weathericon32
Normal file
Binary file not shown.
BIN
examples/ThreeColor/data/weathericon50
Normal file
BIN
examples/ThreeColor/data/weathericon50
Normal file
Binary file not shown.
BIN
examples/ThreeColor/data/weathericon80
Normal file
BIN
examples/ThreeColor/data/weathericon80
Normal file
Binary file not shown.
@@ -18,6 +18,7 @@ EPaperDrive::EPaperDrive(bool SPIMode, uint8_t CS, uint8_t RST, uint8_t DC, uint
|
|||||||
pinMode(CS, OUTPUT); // io初始化
|
pinMode(CS, OUTPUT); // io初始化
|
||||||
pinMode(DC, OUTPUT);
|
pinMode(DC, OUTPUT);
|
||||||
pinMode(RST, OUTPUT);
|
pinMode(RST, OUTPUT);
|
||||||
|
digitalWrite(RST, HIGH);
|
||||||
pinMode(BUSY, INPUT);
|
pinMode(BUSY, INPUT);
|
||||||
pinMode(CLK, OUTPUT);
|
pinMode(CLK, OUTPUT);
|
||||||
pinMode(DIN, OUTPUT);
|
pinMode(DIN, OUTPUT);
|
||||||
@@ -27,6 +28,7 @@ EPaperDrive::EPaperDrive(bool SPIMode, uint8_t CS, uint8_t RST, uint8_t DC, uint
|
|||||||
pinMode(CS, OUTPUT);
|
pinMode(CS, OUTPUT);
|
||||||
pinMode(DC, OUTPUT);
|
pinMode(DC, OUTPUT);
|
||||||
pinMode(RST, OUTPUT);
|
pinMode(RST, OUTPUT);
|
||||||
|
digitalWrite(RST, HIGH);
|
||||||
pinMode(BUSY, INPUT);
|
pinMode(BUSY, INPUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +80,7 @@ void EPaperDrive::SPI_Write(uint8_t value)
|
|||||||
|
|
||||||
void EPaperDrive::SetFont(FONT fontindex)
|
void EPaperDrive::SetFont(FONT fontindex)
|
||||||
{
|
{
|
||||||
FontIndex = fontindex;
|
// FontIndex = fontindex;
|
||||||
switch (fontindex)
|
switch (fontindex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -148,6 +150,14 @@ void EPaperDrive::SetFont(FONT fontindex)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EPaperDrive::SetFont(const char *dir, uint16_t hight, uint16_t width)
|
||||||
|
{
|
||||||
|
fontname = String(dir);
|
||||||
|
fontwidth = width;
|
||||||
|
fontheight = hight;
|
||||||
|
}
|
||||||
|
|
||||||
void EPaperDrive::DrawCircle(int x, int y, int r, bool fill)
|
void EPaperDrive::DrawCircle(int x, int y, int r, bool fill)
|
||||||
{
|
{
|
||||||
if (fill == 0)
|
if (fill == 0)
|
||||||
@@ -182,8 +192,8 @@ void EPaperDrive::DrawEmptyBox(int x, int y, int w, int h)
|
|||||||
{
|
{
|
||||||
DrawXline(y, y + w, x);
|
DrawXline(y, y + w, x);
|
||||||
DrawXline(y, y + w, x + h);
|
DrawXline(y, y + w, x + h);
|
||||||
DrawYline(x, x + w, y);
|
DrawYline(x, x + h, y);
|
||||||
DrawYline(x, x + w, y + w);
|
DrawYline(x, x + h, y + w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EPaperDrive::DrawChart(int x, int y, int w, int c1, int c2, int c3, int c4, int c5, int c6)
|
void EPaperDrive::DrawChart(int x, int y, int w, int c1, int c2, int c3, int c4, int c5, int c6)
|
||||||
@@ -661,6 +671,7 @@ void EPaperDrive::DrawUnicodeChar(int16_t x, int16_t y, uint8_t width, uint8_t h
|
|||||||
else
|
else
|
||||||
sizeofsinglechar = (height / 8 + 1) * width;
|
sizeofsinglechar = (height / 8 + 1) * width;
|
||||||
offset = (code[0] * 0x100 + code[1]) * sizeofsinglechar;
|
offset = (code[0] * 0x100 + code[1]) * sizeofsinglechar;
|
||||||
|
Serial.printf("offset:%d", offset);
|
||||||
// Serial.println("code[1]");
|
// Serial.println("code[1]");
|
||||||
// Serial.println(code[1]);
|
// Serial.println(code[1]);
|
||||||
// Serial.println("sizeofsinglechar");
|
// Serial.println("sizeofsinglechar");
|
||||||
@@ -677,15 +688,16 @@ void EPaperDrive::DrawUnicodeChar(int16_t x, int16_t y, uint8_t width, uint8_t h
|
|||||||
}*/
|
}*/
|
||||||
// Serial.println("offset");
|
// Serial.println("offset");
|
||||||
// Serial.println(offset);
|
// Serial.println(offset);
|
||||||
if (offset < 0xff * sizeofsinglechar && FontIndex < 10)
|
/* if (offset < 0xff * sizeofsinglechar && FontIndex < 10)
|
||||||
{
|
{
|
||||||
drawXbm(x, y, width, height, (uint8_t *)zi);
|
drawXbm(x, y, width, height, (uint8_t *)zi);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawXbm(x, y, width, height, (uint8_t *)zi);
|
drawXbm(x, y, width, height, (uint8_t *)zi);
|
||||||
}
|
} */
|
||||||
|
// 上面这坨代码我也不知道是干啥的,看着好像没用就注释了
|
||||||
|
drawXbm(x, y, width, height, (uint8_t *)zi); // 上面注释里面需要的东西
|
||||||
// SPIFFS.end();
|
// SPIFFS.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2086,8 +2098,8 @@ void EPaperDrive::EPD_init_Full(void)
|
|||||||
// Serial.printf("即将写入全刷波形 \n");
|
// Serial.printf("即将写入全刷波形 \n");
|
||||||
EPD_Write((uint8_t *)LUTDefault_full_GDEY042Z98, sizeof(LUTDefault_full_GDEY042Z98));
|
EPD_Write((uint8_t *)LUTDefault_full_GDEY042Z98, sizeof(LUTDefault_full_GDEY042Z98));
|
||||||
|
|
||||||
EPD_WriteCMD(0x3F);
|
// EPD_WriteCMD(0x3F);
|
||||||
EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 227 + 1));
|
// EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 227 + 1));
|
||||||
|
|
||||||
EPD_WriteCMD(0x03); // 门电压 gate voltage
|
EPD_WriteCMD(0x03); // 门电压 gate voltage
|
||||||
EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 228 + 1));
|
EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 228 + 1));
|
||||||
@@ -2452,6 +2464,10 @@ void EPaperDrive::EPD_Dis_Full(uint8_t *DisBuffer, uint8_t Label)
|
|||||||
|
|
||||||
else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
|
else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10)
|
||||||
{
|
{
|
||||||
|
if (EPD_Type == WFT0290CZ10)
|
||||||
|
{
|
||||||
|
EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff);
|
||||||
|
}
|
||||||
if (Label == 2)
|
if (Label == 2)
|
||||||
{
|
{
|
||||||
EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // white
|
EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // white
|
||||||
@@ -2495,12 +2511,38 @@ void EPaperDrive::EPD_Dis_Part(int xStart, int xEnd, int yStart, int yEnd, uint8
|
|||||||
yEnd = yDot - temp1 - 2;
|
yEnd = yDot - temp1 - 2;
|
||||||
yStart = yDot - temp2 - 3;
|
yStart = yDot - temp2 - 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (EPD_Type)
|
||||||
|
{
|
||||||
|
case WX29:
|
||||||
|
case WFT0290CZ10:
|
||||||
|
case DKE29_3COLOR:
|
||||||
|
case WF29:
|
||||||
|
if (xStart % 8 != 0)
|
||||||
|
{
|
||||||
|
xStart -= (xStart % 8);
|
||||||
|
}
|
||||||
|
if (xEnd % 8 != 0)
|
||||||
|
{
|
||||||
|
xEnd += (8 - xEnd % 8);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (yStart % 8 != 0)
|
||||||
|
{
|
||||||
|
yStart -= (yStart % 8);
|
||||||
|
}
|
||||||
|
if (yEnd % 8 != 0)
|
||||||
|
{
|
||||||
|
yEnd += (8 - yEnd % 8);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int Xsize = xEnd - xStart;
|
unsigned int Xsize = xEnd - xStart;
|
||||||
unsigned int Ysize = yEnd - yStart + 1;
|
unsigned int Ysize = yEnd - yStart + 1;
|
||||||
if (Xsize % 8 != 0)
|
|
||||||
{
|
|
||||||
Xsize = Xsize + (8 - Xsize % 8);
|
|
||||||
}
|
|
||||||
Xsize = Xsize / 8;
|
Xsize = Xsize / 8;
|
||||||
unsigned int offset = yStart * xDot / 8 + xStart / 8;
|
unsigned int offset = yStart * xDot / 8 + xStart / 8;
|
||||||
if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
|
if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0)
|
||||||
@@ -2537,6 +2579,15 @@ void EPaperDrive::EPD_Dis_Part(int xStart, int xEnd, int yStart, int yEnd, uint8
|
|||||||
EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
|
EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
|
||||||
EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
|
EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
|
||||||
}
|
}
|
||||||
|
else if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR)
|
||||||
|
{
|
||||||
|
EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
|
||||||
|
}
|
||||||
|
else if (EPD_Type == WX29)
|
||||||
|
{
|
||||||
|
EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256);
|
||||||
|
EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// EPD_WriteDispRam_Old(Xsize, Ysize,(uint8_t *)DisBuffer,offset,1);
|
// EPD_WriteDispRam_Old(Xsize, Ysize,(uint8_t *)DisBuffer,offset,1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,6 +209,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetFont(FONT fontindex);
|
void SetFont(FONT fontindex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 设置字体,使用自定义的路径以及尺寸
|
||||||
|
*
|
||||||
|
* @param dir 字体文件的路径
|
||||||
|
* @param hight 字体高度
|
||||||
|
* @param width 字体宽度
|
||||||
|
*/
|
||||||
|
void SetFont(const char *dir, uint16_t hight, uint16_t width);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 在图像缓存中画字符串
|
* @brief 在图像缓存中画字符串
|
||||||
*
|
*
|
||||||
@@ -463,6 +472,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void EPD_Write(uint8_t *value, uint8_t datalen);
|
void EPD_Write(uint8_t *value, uint8_t datalen);
|
||||||
|
|
||||||
|
void EPD_WriteDispRam_Old(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
|
||||||
|
void EPD_WriteDispRam(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
|
||||||
|
void EPD_SetRamPointer(uint16_t addrX, uint8_t addrY, uint8_t addrY1);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _CS;
|
uint8_t _CS;
|
||||||
uint8_t _RST;
|
uint8_t _RST;
|
||||||
@@ -489,14 +503,13 @@ private:
|
|||||||
void driver_delay_xms(unsigned long xms);
|
void driver_delay_xms(unsigned long xms);
|
||||||
|
|
||||||
void EPD_WriteDispRam_RED(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
|
void EPD_WriteDispRam_RED(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
|
||||||
void EPD_WriteDispRam(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
|
|
||||||
// void EPD_SetRamArea(uint16_t Xstart,uint16_t Xend,uint8_t Ystart,uint8_t Ystart1,uint8_t Yend,uint8_t Yend1);
|
// void EPD_SetRamArea(uint16_t Xstart,uint16_t Xend,uint8_t Ystart,uint8_t Ystart1,uint8_t Yend,uint8_t Yend1);
|
||||||
void EPD_SetRamPointer(uint16_t addrX, uint8_t addrY, uint8_t addrY1);
|
|
||||||
void EPD_WirteLUT(uint8_t *LUTvalue, uint8_t Size);
|
void EPD_WirteLUT(uint8_t *LUTvalue, uint8_t Size);
|
||||||
|
|
||||||
void EPD_Init(void);
|
void EPD_Init(void);
|
||||||
void EPD_WriteCMD_p1(uint8_t command, uint8_t para);
|
void EPD_WriteCMD_p1(uint8_t command, uint8_t para);
|
||||||
void EPD_WriteDispRam_Old(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label);
|
|
||||||
void EPD_SetRamArea(uint16_t Xstart, uint16_t Xend, uint8_t Ystart, uint8_t Ystart1, uint8_t Yend, uint8_t Yend1);
|
void EPD_SetRamArea(uint16_t Xstart, uint16_t Xend, uint8_t Ystart, uint8_t Ystart1, uint8_t Yend, uint8_t Yend1);
|
||||||
|
|
||||||
int getIcon(int weathercodeindex);
|
int getIcon(int weathercodeindex);
|
||||||
|
|||||||
@@ -814,8 +814,8 @@ const uint8_t lut_bb_part_WFT0290CZ10[]={
|
|||||||
const uint8_t LUTDefault_full_GDEY042Z98[] = {
|
const uint8_t LUTDefault_full_GDEY042Z98[] = {
|
||||||
0x32,
|
0x32,
|
||||||
//VCOM
|
//VCOM
|
||||||
0x01, 0x28, 0x28, 0x14, 0x3C, 0x01, 0x01,
|
0x01, 0x23, 0x23, 0x05, 0x3C, 0x02, 0x03,
|
||||||
0x01, 0x28, 0x28, 0x14, 0x3C, 0x01, 0x01,
|
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,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
@@ -823,8 +823,8 @@ const uint8_t LUTDefault_full_GDEY042Z98[] = {
|
|||||||
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,
|
||||||
//RED
|
//RED
|
||||||
0x01, 0x28, 0x28, 0x94, 0xFC, 0x01, 0x01,
|
0x01, 0x63, 0xA3, 0x85, 0xFC, 0x02, 0x03,
|
||||||
0x01, 0x28, 0x28, 0x94, 0xFC, 0x01, 0x01,
|
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,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
@@ -832,8 +832,8 @@ const uint8_t LUTDefault_full_GDEY042Z98[] = {
|
|||||||
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,
|
||||||
//WHITE
|
//WHITE
|
||||||
0x01, 0x68, 0xA8, 0x14, 0x3C, 0x01, 0x01,
|
0x01, 0x63, 0xA3, 0x05, 0x3C, 0x02, 0x03,
|
||||||
0x01, 0x68, 0xA8, 0x14, 0x3C, 0x01, 0x01,
|
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,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
@@ -841,8 +841,8 @@ const uint8_t LUTDefault_full_GDEY042Z98[] = {
|
|||||||
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,
|
||||||
//BLACK
|
//BLACK
|
||||||
0x01, 0xA8, 0x68, 0x14, 0x3C, 0x01, 0x01,
|
0x01, 0xA3, 0x63, 0x05, 0x3C, 0x02, 0x03,
|
||||||
0x01, 0xA8, 0x68, 0x14, 0x3C, 0x01, 0x01,
|
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,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
@@ -850,9 +850,10 @@ const uint8_t LUTDefault_full_GDEY042Z98[] = {
|
|||||||
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,
|
||||||
|
|
||||||
0x02, 0x00, 0x00, 0x22, 0x17, 0x41, 0xA8,
|
0x03, 0x00, 0x00, 0x22, 0x17, 0x41, 0xA8,
|
||||||
0x32, 0x48,
|
0x32, 0x48,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t LUTDefault_part_GDEY042Z98[] = {
|
const uint8_t LUTDefault_part_GDEY042Z98[] = {
|
||||||
@@ -907,6 +908,94 @@ const uint8_t LUTDefault_part_GDEY042Z98[] = {
|
|||||||
0x32, 0x08,
|
0x32, 0x08,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t LUT_gray_GDEY042Z98[] = {
|
||||||
|
0x32,
|
||||||
|
//VCOM
|
||||||
|
0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 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, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
//RED
|
||||||
|
0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 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, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
//WHITE
|
||||||
|
0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 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, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
//BLACK
|
||||||
|
0x01, 0x41, 0x00, 0x00, 0x00, 0x01, 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, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
|
||||||
|
0x02, 0x00, 0x00, 0x22, 0x17, 0x4B, 0xA8,
|
||||||
|
0x32, 0x48,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LUT_gray_red_GDEY042Z98[] = {
|
||||||
|
0x32,
|
||||||
|
//VCOM
|
||||||
|
0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 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, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
//RED
|
||||||
|
0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 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, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
//WHITE
|
||||||
|
0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 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, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
//BLACK
|
||||||
|
0x01, 0xC9, 0x00, 0x00, 0x00, 0x01, 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, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
|
||||||
|
0x03, 0x00, 0x00, 0x22, 0x17, 0x4B, 0xA8,
|
||||||
|
0x32, 0x48,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
static const uint8_t LUTDefault_full_HINKE0266A15A0[] = {
|
static const uint8_t LUTDefault_full_HINKE0266A15A0[] = {
|
||||||
0x32, // command
|
0x32, // command
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user