diff --git a/.gitignore b/.gitignore index b4d7039..8b13789 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ -# Object file -*.o -# Ada Library Information -*.ali diff --git a/README.md b/README.md index e8702ee..ed26d2b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # EPaperDrive -一个 +一个简单好用性能强大的Arduino墨水屏驱动库,支持目前市面上较常见的多种墨水屏。 diff --git a/data/font10 b/data/font10 new file mode 100644 index 0000000..2bb3235 Binary files /dev/null and b/data/font10 differ diff --git a/data/font12 b/data/font12 new file mode 100644 index 0000000..6a6d468 Binary files /dev/null and b/data/font12 differ diff --git a/data/font32 b/data/font32 new file mode 100644 index 0000000..c8d2aee Binary files /dev/null and b/data/font32 differ diff --git a/data/font60 b/data/font60 new file mode 100644 index 0000000..7d290c5 Binary files /dev/null and b/data/font60 differ diff --git a/data/font70 b/data/font70 new file mode 100644 index 0000000..3eb133c Binary files /dev/null and b/data/font70 differ diff --git a/data/weathericon b/data/weathericon new file mode 100644 index 0000000..5c4a088 Binary files /dev/null and b/data/weathericon differ diff --git a/data/weathericon32 b/data/weathericon32 new file mode 100644 index 0000000..3af8f33 Binary files /dev/null and b/data/weathericon32 differ diff --git a/data/weathericon50 b/data/weathericon50 new file mode 100644 index 0000000..4ea2b70 Binary files /dev/null and b/data/weathericon50 differ diff --git a/data/weathericon80 b/data/weathericon80 new file mode 100644 index 0000000..4d6251d Binary files /dev/null and b/data/weathericon80 differ diff --git a/examples/HelloWorld/HelloWorld.ino b/examples/HelloWorld/HelloWorld.ino new file mode 100644 index 0000000..6380025 --- /dev/null +++ b/examples/HelloWorld/HelloWorld.ino @@ -0,0 +1,89 @@ +/** + * @file HelloWorld.ino + * @author HalfSweet (Email:HalfSweet@HalfSweet.cn or QQ:2522182733) + * @brief 该文件为墨水屏驱动显示Hello World的示例程序,此文件仅仅作为最简单的点亮屏幕,具体的函数用法请参阅文档 + * @version 0.1 + * @date 2022-01-30 + * + * @copyright Copyright (c) 2022 + * + */ +#include +#include +//包含你需要使用的文件系统,例如: +#include + +#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); + EPD.SetFS(&LittleFS); //设置存放字体的文件系统,传入的为该文件系统的操作指针,可自行修改 + + EPD.EPD_Set_Model(HINKE0266A15A0); //设置屏幕类型,具体型号可以参考文档 + 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(60, 0, 12, 12, (uint8_t *)city_icon); //绘制图片 + Serial.printf("缓存图像绘制完毕,准备全刷 \n"); + EPD.EPD_Dis_Full((uint8_t *)EPD.EPDbuffer, 1); //将缓存中的图像传给屏幕控制芯片全刷屏幕 + EPD.deepsleep(); //让屏幕进入休眠模式 + Serial.println("全刷完毕"); + + delay(5000); + + EPD.EPD_init_Part(); //局刷的初始化 + EPD.clearbuffer(); + EPD.fontscale = 2; + EPD.SetFont(FONT12); + EPD.DrawUTF(0, 0, "现在是局刷"); + Serial.printf("开始局刷 \n"); + EPD.EPD_Dis_Part(0, 23, 0, 199, (uint8_t *)EPD.EPDbuffer, 1); //将缓存中的图像传给屏幕控制芯片局新屏幕 + Serial.printf("局刷结束 \n"); + EPD.deepsleep(); +} + +void loop() +{ + delay(1); //防止看门狗咬 +} diff --git a/keywords.txt b/keywords.txt new file mode 100644 index 0000000..6260e8c --- /dev/null +++ b/keywords.txt @@ -0,0 +1,58 @@ +########################################### +# Syntax Coloring Map For EPaperDrive-library +########################################### + +########################################### +# Datatypes (KEYWORD1) +########################################### + +EPaperDrive KEYWORD1 + +########################################### +# Methods and Functions (KEYWORD2) +########################################### + +deepsleep KEYWORD2 +SetFS KEYWORD2 +SetHardSPI KEYWORD2 +EPD_Set_Model KEYWORD2 +EPD_init_Full KEYWORD2 +EPD_init_Part KEYWORD2 +EPD_Dis_Full KEYWORD2 +EPD_Dis_Part KEYWORD2 +EPD_Transfer_Full_BW KEYWORD2 +EPD_Transfer_Full_RED KEYWORD2 +EPD_Transfer_Part KEYWORD2 +SetFont KEYWORD2 +DrawUTF KEYWORD2 +DrawUnicodeChar KEYWORD2 +DrawUnicodeStr KEYWORD2 +clearbuffer KEYWORD2 +DrawYline KEYWORD2 +DrawXline KEYWORD2 +DrawLine KEYWORD2 +Inverse KEYWORD2 +DrawWeatherChart KEYWORD2 +DrawCircle KEYWORD2 +DrawBox KEYWORD2 +DrawEmptyBox KEYWORD2 +DrawChart KEYWORD2 +DrawCircleChart KEYWORD2 +drawXbm KEYWORD2 +DrawXbm_P KEYWORD2 +DrawXbm_p_gray KEYWORD2 +DrawXbm_spiff_gray KEYWORD2 +EPD_Set_Contrast KEYWORD2 +EPD_Update KEYWORD2 +EPD_Update_Part KEYWORD2 +ReadBusy KEYWORD2 +ReadBusy_long KEYWORD2 +EPD_WriteCMD KEYWORD2 +EPD_WriteData KEYWORD2 +EPD_Write KEYWORD2 + +fontscale KEYWORD3 +EPDbuffer KEYWORD3 + +FONT KEYWORD3 +epd_type KEYWORD3 \ No newline at end of file diff --git a/library.properties b/library.properties new file mode 100644 index 0000000..2037315 --- /dev/null +++ b/library.properties @@ -0,0 +1,9 @@ +name=EPaperDrive +version=1.0.0 +author=HalfSweet,HalfSweet@HalfSweet.cn +maintainer=HalfSweet,HalfSweet@HalfSweet.cn +sentence=一个优秀的串口墨水屏驱动库 +paragraph=支持目前市面上绝大多数的墨水屏以及驱动芯片 +category=Display +url=https://github.com/HalfSweetStudio/EPaperDrive +architectures=* diff --git a/src/EPaperDrive.cpp b/src/EPaperDrive.cpp new file mode 100644 index 0000000..9bcc7f8 --- /dev/null +++ b/src/EPaperDrive.cpp @@ -0,0 +1,2618 @@ +#include "EPaperDrive.h" +//#include "EPD_drive_gpio.h" + +uint8_t UNICODEbuffer[200]; +String fontname; + +EPaperDrive::EPaperDrive(bool SPIMode,uint8_t CS, uint8_t RST, uint8_t DC, uint8_t BUSY, uint8_t CLK, uint8_t DIN) +{ + _CS = CS; + _RST = RST; + _DC = DC; + _BUSY = BUSY; + _CLK = CLK; + _DIN = DIN; + _SPIMode = SPIMode; + if (SPIMode == 0) + { + pinMode(CS, OUTPUT); // io初始化 + pinMode(DC, OUTPUT); + pinMode(RST, OUTPUT); + pinMode(BUSY, INPUT); + pinMode(CLK, OUTPUT); + pinMode(DIN, OUTPUT); + } + else + { + pinMode(CS, OUTPUT); + pinMode(DC, OUTPUT); + pinMode(RST, OUTPUT); + pinMode(BUSY, INPUT); + } +} + +EPaperDrive::~EPaperDrive() +{ +} + +void EPaperDrive::driver_delay_xms(unsigned long xms) +{ + delay(xms); +} + +void EPaperDrive::SetFS(FS* userFS) +{ + UserFS = userFS; + UserFS->begin(); +} + +void EPaperDrive::SetHardSPI(SPIClass* spi) +{ + MySPI = spi; +} + +void EPaperDrive::SPI_Write(uint8_t value) +{ + if (_SPIMode == 1) + { + MySPI->transfer(value); + } + else + { + EPD_CLK_0; + // delayMicroseconds(1); + for (int i = 0; i < 8; i++) + { + //高位在前发送方式 根据升级器件特性定 + if ((value & 0x80) == 0x80) + EPD_DIN_1; + else + EPD_DIN_0; + // delayMicroseconds(1); //等待数据稳定 根据实际时钟调整 + EPD_CLK_1; //上升沿发送数据 + // delayMicroseconds(1);//CLK高电平保持一段时间 这个可以不需要 根据具体的spi时钟来确定 + EPD_CLK_0; //把时钟拉低实现为下一次上升沿发送数据做准备 + value = value << 1; //发送数据的位向前移动一位 + } + } +} + +void EPaperDrive::SetFont(FONT fontindex) +{ + FontIndex = fontindex; + switch (fontindex) + { + case 0: + fontname = "/font16"; + fontwidth = 16; + fontheight = 16; + break; + case 1: + fontname = "/font32"; + fontwidth = 32; + fontheight = 32; + break; + case 2: + fontname = "/font10"; + fontwidth = 10; + fontheight = 10; + break; + case 3: + fontname = "/font12"; + fontwidth = 12; + fontheight = 12; + break; + case 5: + fontname = "/font70"; + fontwidth = 70; + fontheight = 70; + break; + case 6: + fontname = "/font12num"; + fontwidth = 12; + fontheight = 12; + break; + case 7: + fontname = "/font24"; + fontwidth = 24; + fontheight = 24; + break; + case 8: + fontname = "/font8"; + fontwidth = 8; + fontheight = 8; + break; + case 9: + fontname = "/font100num"; + fontwidth = 100; + fontheight = 100; + break; + case 11: + fontname = "/weathericon"; + fontwidth = 32; + fontheight = 32; + break; + case 12: + fontname = "/weathericon80"; + fontwidth = 80; + fontheight = 80; + break; + case 13: + fontname = "/weathericon32"; + fontwidth = 32; + fontheight = 32; + break; + case 14: + fontname = "/weathericon50"; + fontwidth = 50; + fontheight = 50; + break; + } +} +void EPaperDrive::DrawCircle(int x, int y, int r, bool fill) +{ + if (fill == 0) + { + for (int i = 0; i < 360; i++) + { + SetPixel(round(cos(i) * r + x), round(sin(i) * r) + y); + } + } + else + { + for (int j = 0; j < r; j++) + { + + for (int i = 0; i < 360; i++) + { + SetPixel(round(cos(i) * j + x), round(sin(i) * j) + y); + } + } + } +} + +void EPaperDrive::DrawBox(uint8_t x, int y, int w, int h) +{ + + for (int i = x; i < x + h; i++) + { + DrawXline(y, y + w - 1, i); + } +} +void EPaperDrive::DrawEmptyBox(int x, int y, int w, int h) +{ + DrawXline(y, y + w, x); + DrawXline(y, y + w, x + h); + DrawYline(x, x + w, y); + DrawYline(x, x + w, y + w); +} + +void EPaperDrive::DrawChart(int x, int y, int w, int c1, int c2, int c3, int c4, int c5, int c6) +{ + + int percent, sum, max_c = 0; + sum = c1 + c2 + c3 + c4 + c5 + c6; + if (sum == 0) + sum = 1; + max_c = max(c1, max_c); + max_c = max(c2, max_c); + max_c = max(c3, max_c); + max_c = max(c4, max_c); + max_c = max(c5, max_c); + max_c = max(c6, max_c); + if (max_c == 0) + max_c = 1; + w = w * sum / (2 * max_c); + + SetFont(FONT12); + DrawUTF(x, y, ">0.3um"); + percent = w * c1 / sum; + DrawBox(x + 1, y + 41, percent, 10); + SetFont(FONT8); + DrawUTF(x + 2, y + 41 + percent, String(c1)); + + SetFont(FONT12); + DrawUTF(x + 12, y, ">0.5um"); + percent = w * c2 / sum; + DrawBox(x + 13, y + 41, percent, 10); + SetFont(FONT8); + DrawUTF(x + 14, y + 41 + percent, String(c2)); + + SetFont(FONT12); + DrawUTF(x + 24, y, ">1.0um"); + percent = w * c3 / sum; + DrawBox(x + 25, y + 41, percent, 10); + SetFont(FONT8); + DrawUTF(x + 26, y + 41 + percent, String(c3)); + + SetFont(FONT12); + DrawUTF(x + 36, y, ">2.5um"); + percent = w * c4 / sum; + DrawBox(x + 37, y + 41, percent, 10); + SetFont(FONT8); + DrawUTF(x + 38, y + 41 + percent, String(c4)); + + SetFont(FONT12); + DrawUTF(x + 48, y, ">5.0um"); + percent = w * c5 / sum; + DrawBox(x + 49, y + 41, percent, 10); + SetFont(FONT8); + DrawUTF(x + 50, y + 41 + percent, String(c5)); + + SetFont(FONT12); + DrawUTF(x + 60, y, ">10um"); + percent = w * c6 / sum; + DrawBox(x + 61, y + 41, percent, 10); + SetFont(FONT8); + DrawUTF(x + 62, y + 41 + percent, String(c6)); +} +void EPaperDrive::DrawCircleChart(int x, int y, int r, int w, int c1, int c2, int c3) +{ + int sum = c1 + c2 + c3; + if (sum == 0) + sum = 1; + for (int i = 0; i < 360; i++) + { + SetPixel(-round(cos(M_PI * i / 180) * r) + x, round(sin(M_PI * i / 180) * r) + y); + } + + for (int i = 0; i < 360; i++) + { + SetPixel(-round(cos(M_PI * i / 180) * (r - w)) + x, round(sin(M_PI * i / 180) * (r - w)) + y); + } + + for (int i = 0; i < c1 * 360 / sum; i++) + { + for (int j = 0; j < w; j++) + { + SetPixel(-round(cos(M_PI * i / 180) * (r - j)) + x, round(sin(M_PI * i / 180) * (r - j)) + y); + } + } + + for (int i = (c1 + c2) * 360 / sum - 1; i < (c1 + c2) * 360 / sum; i++) + { + + for (int j = 0; j < w; j++) + { + SetPixel(-round(cos(M_PI * i / 180) * (r - j)) + x, round(sin(M_PI * i / 180) * (r - j)) + y); + } + } + + for (int i = (c1 + c2) * 360 / sum; i < 360; i += 10) + { + + for (int j = 0; j < w; j++) + { + SetPixel(-round(cos(M_PI * i / 180) * (r - j)) + x, round(sin(M_PI * i / 180) * (r - j)) + y); + } + } + + y += 2; + DrawBox(x - r, y + r + 2, 8, 8); + SetFont(FONT12); + DrawUTF(x - r - 2, y + r + 12, "PM1.0"); + SetFont(FONT12); + DrawUTF(x - r - 2, y + r + 12 + 30, String(c1)); + + SetFont(FONT12); + DrawEmptyBox(x - r + 14, y + r + 2, 8, 8); + DrawUTF(x - r + 12, y + r + 12, "PM2.5"); + + SetFont(FONT12); + DrawUTF(x - r + 12, y + r + 12 + 30, String(c2)); + DrawEmptyBox(x - r + 28, y + r + 2, 8, 8); + for (int i = y + r + 2; i < y + r + 2 + 8; i += 2) + { + DrawYline(x - r + 28, x - r + 28 + 7, i); + } + SetFont(FONT12); + DrawUTF(x - r + 26, y + r + 12, "PM10"); + SetFont(FONT12); + DrawUTF(x - r + 26, y + r + 12 + 30, String(c3)); +} +int EPaperDrive::getIcon(int weathercodeindex) +{ + if (weathercodeindex == 0) + return 12; + if (weathercodeindex == 1) + return 58; + if (weathercodeindex == 2) + return 58; + if (weathercodeindex == 3) + return 58; + if (weathercodeindex == 4) + return 54; + if (weathercodeindex >= 5 && weathercodeindex <= 18) + return 0; + if (weathercodeindex >= 19 && weathercodeindex <= 32) + return 19; + if (weathercodeindex >= 33 && weathercodeindex <= 36) + return 16; + if (weathercodeindex >= 37 && weathercodeindex <= 40) + return 16; + if (weathercodeindex == 41) + return 37; + if (weathercodeindex == 42) + return 37; + if (weathercodeindex == 43) + return 37; + return 17; +} +void EPaperDrive::DrawWeatherChart(int xmin, int xmax, int ymin, int ymax, int point_n, int show_n, String tmax, String tmin, String code_d, String code_n, String text_d, String text_n, String date, String week) //绘制天气温度变化曲线 +{ + if (tmax == ",,,,,") + { + tmax = "5,5,5,5,5,5"; + tmin = "2,2,2,2,2,2"; + code_d = "0,0,0,0,0,0"; + code_n = "0,0,0,0,0,0"; + text_n = "晴,晴,晴,晴,晴,晴"; + text_d = "晴,晴,晴,晴,晴,晴"; + date = "1-1,1-2,1-3,1-4,1-5,1-6"; + week = "1,1,1,1,1,1"; + } + String code_d_a[point_n], code_n_a[point_n], text_d_a[point_n], text_n_a[point_n], date_a[point_n], week_a[point_n]; + int tmax_a[point_n], tmin_a[point_n]; + int min_data = 999, max_data = -999; + int tmin_x_cord[point_n], tmax_x_cord[point_n]; //将数值转成屏幕坐标 + + String temp_min[point_n]; + String temp_max[point_n]; + int j = 0, k = 0, l = 0; + //分割tmax和tmin + // Serial.println(tmax); Serial.println(tmin); + // Serial.println(code_d); + for (int i = 0; i < tmin.length(); i++) + { + temp_min[j] += tmin[i]; + + if (tmin.charAt(i) == char(',')) + j++; + } + for (int i = 0; i < tmax.length(); i++) + { + + temp_max[k] += tmax[i]; + + if (tmax.charAt(i) == char(',')) + k++; + } + j = 0; + //分割code_d + for (int i = 0; i < code_d.length(); i++) + { + code_d_a[j] += code_d[i]; + if (code_d.charAt(i) == char(',')) + j++; + } + //分割code_n + j = 0; + for (int i = 0; i < code_n.length(); i++) + { + code_n_a[j] += code_n[i]; + if (code_n.charAt(i) == char(',')) + j++; + } + //分割text_d + j = 0; + for (int i = 0; i < text_d.length(); i++) + { + if (text_d.charAt(i) == char(',')) + j++; + else + text_d_a[j] += text_d[i]; + } + //分割text_n + j = 0; + for (int i = 0; i < text_n.length(); i++) + { + if (text_n.charAt(i) == char(',')) + j++; + else + text_n_a[j] += text_n[i]; + } + //分割week_n + j = 0; + for (int i = 0; i < week.length(); i++) + { + if (week.charAt(i) == char(',')) + j++; + else + week_a[j] += week[i]; + } + j = 0; + for (int i = 0; i < date.length(); i++) + { + if (date.charAt(i) == char(',')) + j++; + else + date_a[j] += date[i]; + } + for (int i = 0; i < point_n; i++) + { + tmax_a[i] = temp_max[i].toInt(); // Serial.printf("max:%d\n",tmax_a[i]); + tmin_a[i] = temp_min[i].toInt(); // Serial.printf("min:%d\n",tmin_a[i]); + } + //找出计算最大最小值 + for (int i = 0; i < show_n; i++) + { + if (tmax_a[i] > max_data) + max_data = tmax_a[i]; + if (tmax_a[i] < min_data) + min_data = tmax_a[i]; + if (tmin_a[i] > max_data) + max_data = tmin_a[i]; + if (tmin_a[i] < min_data) + min_data = tmin_a[i]; + } + //转换坐标 + if ((max_data - min_data) != 0) + { + for (int i = 0; i < show_n; i++) + { + tmin_x_cord[i] = xmax - ((xmax - xmin) * (tmin_a[i] - min_data) / (max_data - min_data)); + tmax_x_cord[i] = xmax - ((xmax - xmin) * (tmax_a[i] - min_data) / (max_data - min_data)); + } + } + int dy = (ymax - ymin) / (show_n - 1); + + /* + Spline line; + float x[point_n];float y[point_n]; + for(int i=0;i= dy) + { + if (xend > xstart) + { + for (int i = xstart; i <= xend; i++) + { + SetPixel(i, round((i - xstart) * (yend - ystart) / (xend - xstart)) + ystart); + } + } + else + { + for (int i = xstart; i >= xend; i--) + { + SetPixel(i, round((i - xstart) * (yend - ystart) / (xend - xstart)) + ystart); + } + } + } + + else + { + if (yend > ystart) + { + for (int i = ystart; i <= yend; i++) + { + SetPixel(round((i - ystart) * (xend - xstart) / (yend - ystart)) + xstart, i); + } + } + else + { + for (int i = ystart; i >= yend; i--) + { + SetPixel(round((i - ystart) * (xend - xstart) / (yend - ystart)) + xstart, i); + } + } + } +} + +void EPaperDrive::Inverse(int xStart, int xEnd, int yStart, int yEnd) +{ + for (int i = 0; i < (xEnd - xStart); i++) + { + for (int j = 0; j < (yEnd - yStart); j++) + { + InversePixel(xStart + i, yStart + j); + } + } +} +void EPaperDrive::DrawUTF(int16_t x, int16_t y, String code) +{ + char buffer[200]; + code.toCharArray(buffer, 200); + DrawUTF(x, y, fontwidth, fontheight, (uint8_t *)buffer); +} +void EPaperDrive::DrawUTF(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code) +{ + int charcount; + charcount = UTFtoUNICODE((uint8_t *)code); + DrawUnicodeStr(x, y, width, height, charcount, (uint8_t *)UNICODEbuffer); +} +int EPaperDrive::UTFtoUNICODE(uint8_t *code) +{ + int i = 0; + int charcount = 0; + while (code[i] != '\0') + { + // Serial.println("current codei"); + // Serial.println(code[i],HEX); + // Serial.println(code[i]&0xf0,HEX); + if (code[i] <= 0x7f) // ascii + { + + UNICODEbuffer[charcount * 2] = 0x00; + UNICODEbuffer[charcount * 2 + 1] = code[i]; + // Serial.println("english or number"); + // Serial.println(UNICODEbuffer[charcount*2],HEX); + // Serial.println(UNICODEbuffer[charcount*2+1],HEX); + i++; + charcount++; + } + else if ((code[i] & 0xe0) == 0xc0) + { + + UNICODEbuffer[charcount * 2 + 1] = (code[i] << 6) + (code[i + 1] & 0x3f); + UNICODEbuffer[charcount * 2] = (code[i] >> 2) & 0x07; + i += 2; + charcount++; + // Serial.println("two bits utf-8"); + } + else if ((code[i] & 0xf0) == 0xe0) + { + + UNICODEbuffer[charcount * 2 + 1] = (code[i + 1] << 6) + (code[i + 2] & 0x7f); + UNICODEbuffer[charcount * 2] = (code[i] << 4) + ((code[i + 1] >> 2) & 0x0f); + + // Serial.println("three bits utf-8"); + // Serial.println(UNICODEbuffer[charcount*2],HEX); + // Serial.println(UNICODEbuffer[charcount*2+1],HEX); + i += 3; + charcount++; + } + else + { + return 0; + } + } + UNICODEbuffer[charcount * 2] = '\0'; + return charcount; +} +void EPaperDrive::DrawUnicodeChar(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code) +{ + + int offset; + int sizeofsinglechar; + if (height % 8 == 0) + sizeofsinglechar = (height / 8) * width; + else + sizeofsinglechar = (height / 8 + 1) * width; + offset = (code[0] * 0x100 + code[1]) * sizeofsinglechar; + // Serial.println("code[1]"); + // Serial.println(code[1]); + // Serial.println("sizeofsinglechar"); + // Serial.println(sizeofsinglechar); + File f = UserFS->open(fontname, "r"); + f.seek(offset, SeekSet); + char zi[sizeofsinglechar]; + f.readBytes(zi, sizeofsinglechar); + /*for(int i=0;i<32;i++) + { + + Serial.println(zi[i],HEX); + }*/ + // Serial.println("offset"); + // Serial.println(offset); + if (offset < 0xff * sizeofsinglechar && FontIndex < 10) + { + drawXbm(x, y, width, height, (uint8_t *)zi); + } + else + { + drawXbm(x, y, width, height, (uint8_t *)zi); + } + + // SPIFFS.end(); +} + +void EPaperDrive::DrawUnicodeStr(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t strlength, uint8_t *code) +{ + int ymax = yDot; + if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == WF42 || EPD_Type == GDEY042Z98) + { + ymax = xDot; + } + + CurrentCursor = 0; + uint8_t sizeofsinglechar; + if (height % 8 == 0) + sizeofsinglechar = (height / 8) * width; + else + sizeofsinglechar = (height / 8 + 1) * width; + int ymove = 0; + int xmove = 0; + strlength *= 2; + int i = 0; + while (i < strlength) + { + int offset; + offset = (code[i] * 0x100 + code[i + 1]) * sizeofsinglechar; + if (offset < 0xff * sizeofsinglechar && fontscale == 1) + { + + DrawUnicodeChar(x + xmove, y + ymove, width, height, (uint8_t *)code + i); + ymove += CurrentCursor + 1; + if ((y + ymove + width / 2) >= ymax - 1) + { + xmove += height + 1; + ymove = 0; + CurrentCursor = 0; + } + } + else if (offset < 0xff * sizeofsinglechar && fontscale == 2) + { + DrawUnicodeChar(x + xmove, y + ymove, width, height, (uint8_t *)code + i); + ymove += CurrentCursor + 2; + if ((y + ymove + width) >= ymax - 1) + { + xmove += height + 1; + ymove = 0; + CurrentCursor = 0; + } + } + else if (fontscale == 2) + { + DrawUnicodeChar(x + xmove, y + ymove, width, height, (uint8_t *)code + i); + ymove += width * 2; + if ((y + ymove + width * 2) >= ymax - 1) + { + xmove += height * 2 + 2; + ymove = 0; + CurrentCursor = 0; + } + } + else + { + DrawUnicodeChar(x + xmove, y + ymove, width, height, (uint8_t *)code + i); + ymove += width; + if ((y + ymove + width) >= ymax - 1) + { + xmove += height + 1; + ymove = 0; + CurrentCursor = 0; + } + } + i++; + i++; + } +} +void EPaperDrive::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t *xbm) +{ + int16_t heightInXbm = (height + 7) / 8; + uint8_t Data; + for (int16_t x = 0; x < width; x++) + { + for (int16_t y = 0; y < height; y++) + { + if (y & 7) + { + Data <<= 1; // Move a bit + } + else + { // Read new Data every 8 bit + Data = xbm[(y / 8) + x * heightInXbm]; + } + // if there is a bit draw it + if (((Data & 0x80) >> 7)) + { + if (fontscale == 1) + { + SetPixel(xMove + y, yMove + x); + CurrentCursor = x; + } + if (fontscale == 2) + { + SetPixel(xMove + y * 2, yMove + x * 2); + SetPixel(xMove + y * 2 + 1, yMove + x * 2); + SetPixel(xMove + y * 2, yMove + x * 2 + 1); + SetPixel(xMove + y * 2 + 1, yMove + x * 2 + 1); + CurrentCursor = x * 2; + } + // if(fontscale==2) {SetPixel(xMove + y*2, yMove + x*2);CurrentCursor=x*2;} + } + } + } +} + +void EPaperDrive::DrawXbm_P(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm) +{ + int16_t heightInXbm = (height + 7) / 8; + uint8_t Data; + // uint8_t temp[heightInXbm*width]; + // memcpy_P(temp, xbm, heightInXbm*width); + + for (int16_t x = 0; x < width; x++) + { + for (int16_t y = 0; y < height; y++) + { + if (y & 7) + { + Data <<= 1; // Move a bit + } + else + { // Read new Data every 8 bit + Data = pgm_read_byte(xbm + (y / 8) + x * heightInXbm); + } + // if there is a bit draw it + if (((Data & 0x80) >> 7)) + { + if (fontscale == 1) + { + SetPixel(xMove + y, yMove + x); + CurrentCursor = x; + } + if (fontscale == 2) + { + SetPixel(xMove + y * 2, yMove + x * 2); + SetPixel(xMove + y * 2 + 1, yMove + x * 2); + SetPixel(xMove + y * 2, yMove + x * 2 + 1); + SetPixel(xMove + y * 2 + 1, yMove + x * 2 + 1); + } + } + } + } +} +void EPaperDrive::DrawXbm_p_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm, uint8_t level) +{ + int16_t heightInXbm = (height + 1) / 2; + uint8_t Data; + + for (int16_t x = 0; x < width; x++) + { + for (int16_t y = 0; y < height; y++) + { + if (y % 2 != 0) + { + Data <<= 4; // Move a bit + } + else + { // Read new Data every 8 bit + Data = pgm_read_byte(xbm + (y / 2) + x * heightInXbm); + } + // if there is a bit draw it + if (((Data & 0xf0) >> 4 == level)) + { + SetPixel(xMove + y, yMove + x); + CurrentCursor = x; + } + } + } +} +void EPaperDrive::DrawXbm_spiff_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t level) +{ + File f = UserFS->open("/pic.xbm", "r"); + + int16_t heightInXbm = (height + 1) / 2; + uint8_t Data; + + for (int16_t x = 0; x < width; x++) + { + for (int16_t y = 0; y < height; y++) + { + if (y % 2 != 0) + { + Data <<= 4; // Move a bit + } + else + { // Read new Data every 8 bit + Data = ~f.read(); + } + // if there is a bit draw it + if (((Data & 0xf0) >> 4 == level)) + { + SetPixel(xMove + y, yMove + x); + CurrentCursor = x; + } + } + } + f.close(); +} +void EPaperDrive::SetPixel(int16_t x, int16_t y) +{ + + if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == WF42 || EPD_Type == GDEY042Z98) + { + int16_t temp = x; + x = y; + y = yDot - 1 - temp; + if (x < xDot && y < yDot) + EPDbuffer[x / 8 + y * xDot / 8] &= ~(0x80 >> x % 8); + } + else if (EPD_Type == WF29BZ03) + { + if (frame == 0) + { + if (x < (xDot * 2) && y < (yDot * 2)) + EPDbuffer[x / 4 + y * xDot / 4] &= ~(0x80 >> ((x % 4) * 2)); + } + else + { + if (x < (xDot * 2) && y < (yDot * 2)) + EPDbuffer[x / 4 + y * xDot / 4] &= ~(0x40 >> ((x % 4) * 2)); + } + } + else + { + if (x < xDot && y < yDot) + EPDbuffer[x / 8 + y * xDot / 8] &= ~(0x80 >> x % 8); + } +} +void EPaperDrive::InversePixel(int16_t x, int16_t y) +{ + + if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == WF42 || EPD_Type == GDEY042Z98) + { + int16_t temp = x; + x = y; + y = yDot - 1 - temp; + if (x < xDot && y < yDot) + EPDbuffer[x / 8 + y * xDot / 8] ^= (0x80 >> x % 8); + } + else if (EPD_Type == WF29BZ03) + { + if (frame == 0) + { + if (x < (xDot * 2) && y < (yDot * 2)) + EPDbuffer[x / 4 + y * xDot / 4] ^= (0x80 >> ((x % 4) * 2)); + } + else + { + if (x < (xDot * 2) && y < (yDot * 2)) + EPDbuffer[x / 4 + y * xDot / 4] ^= (0x40 >> ((x % 4) * 2)); + } + } + else + { + if (x < xDot && y < yDot) + EPDbuffer[x / 8 + y * xDot / 8] ^= (0x80 >> x % 8); + // Serial.printf("(%d,%d)\n",x,y); + } +} +void EPaperDrive::clearbuffer() +{ + + if (EPD_Type == WF29BZ03) + { + for (int i = 0; i < (xDot * yDot / 4); i++) + EPDbuffer[i] = 0xff; + } + else + for (int i = 0; i < (xDot * yDot / 8); i++) + EPDbuffer[i] = 0xff; +} +void EPaperDrive::EPD_Set_Model(uint8_t model) +{ + EPD_Type = epd_type(model); + + switch (model) + { + case 0: + xDot = 128; + yDot = 296; + break; // WX29 + case 1: + xDot = 128; + yDot = 296; + break; // WF29 + case 2: + xDot = 400; + yDot = 300; + break; // OPM4_2 + case 3: + xDot = 648; + yDot = 480; + break; // WF58 + case 4: + xDot = 128; + yDot = 296; + break; // WF29BZ03 + case 5: + xDot = 152; + yDot = 152; + break; // C154 + case 6: + xDot = 400; + yDot = 300; + break; // DKE42_3COLOR + case 7: + xDot = 128; + yDot = 296; + break; // DKE29_3COLOR + case 8: + xDot = 400; + yDot = 300; + break; // WF42 + case 9: + break; // WF32 + + case 10: + xDot = 128; + yDot = 296; + break; // WFT0290CZ10 + + case 11: + xDot = 400; + yDot = 300; + break; // GDEY042Z98 + + case 12: + xDot = 152; + yDot = 296; + break; + } +} +bool EPaperDrive::ReadBusy(void) +{ + unsigned long i = 0; + for (i = 0; i < 100; i++) + { + // println("isEPD_BUSY = %d\r\n",isEPD_CS); + if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + if (READ_EPD_BUSY == 0) + { + // Serial.println("Busy is Low \r\n"); + return 1; + } + } + if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10) + { + if (READ_EPD_BUSY != 0) + { + // Serial.println("Busy is H \r\n"); + return 1; + } + } + delay(2); + // Serial.println("epd is Busy"); + } + return 0; +} +bool EPaperDrive::ReadBusy_long(void) +{ + unsigned long i = 0; + for (i = 0; i < 2000; i++) + { + // println("isEPD_BUSY = %d\r\n",isEPD_CS); + if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + if (READ_EPD_BUSY == 0) + { + // Serial.println("Busy is Low \r\n"); + return 1; + } + } + if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10) + { + if (READ_EPD_BUSY != 0) + { + // Serial.println("Busy is H \r\n"); + return 1; + } + } + delay(2); + // Serial.println("epd is Busy"); + } + return 0; +} +void EPaperDrive::EPD_WriteCMD(uint8_t command) +{ + /*if(EPD_Type==WX29||EPD_Type==OPM42||EPD_Type==DKE42_3COLOR||EPD_Type==DKE29_3COLOR) + { + ReadBusy(); + } */ + // ReadBusy(); + EPD_CS_0; + EPD_DC_0; // command write + SPI_Write(command); + EPD_CS_1; +} +void EPaperDrive::EPD_WriteData(uint8_t Data) +{ + + EPD_CS_0; + EPD_DC_1; + SPI_Write(Data); + EPD_CS_1; +} + +void EPaperDrive::EPD_WriteCMD_p1(uint8_t command, uint8_t para) +{ + /*if(EPD_Type==WX29||EPD_Type==OPM42||EPD_Type==DKE42_3COLOR||EPD_Type==DKE29_3COLOR) + { + ReadBusy(); + }*/ + // ReadBusy(); + EPD_CS_0; + EPD_DC_0; // command write + SPI_Write(command); + EPD_DC_1; // command write + SPI_Write(para); + EPD_CS_1; +} + +void EPaperDrive::deepsleep(void) +{ + if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + ReadBusy_long(); + EPD_WriteCMD_p1(0x10, 0x01); + // EPD_WriteCMD_p1(0x22,0xc0);//power off + // EPD_WriteCMD(0x20); + } + if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10) + { + ReadBusy_long(); + EPD_WriteCMD(0x50); + EPD_WriteData(0xf7); // border floating + EPD_WriteCMD(0x02); // power off + // ReadBusy(); + EPD_WriteCMD(0x07); // sleep + EPD_WriteData(0xa5); + } +} + +void EPaperDrive::EPD_Write(uint8_t *value, uint8_t Datalen) +{ + + uint8_t i = 0; + uint8_t *ptemp; + ptemp = value; + + ReadBusy(); + + EPD_CS_0; + EPD_DC_0; // When DC is 0, write command + SPI_Write(*ptemp); // The first uint8_t is written with the command value + ptemp++; + EPD_DC_1; // When DC is 1, write Data + for (i = 0; i < Datalen - 1; i++) + { // sub the Data + SPI_Write(*ptemp); + ptemp++; + } + ReadBusy(); + EPD_CS_1; +} + +void EPaperDrive::EPD_WriteDispRam(unsigned int XSize, unsigned int YSize, uint8_t *Dispbuff, unsigned int offset, uint8_t label) +{ + + int i = 0, j = 0; + if (EPD_Type == WF29BZ03) + { + EPD_WriteCMD(0x10); + EPD_CS_0; + EPD_DC_1; + /* for(i=0;i<(YSize*2);i++){ + for(j=0;j<(XSize*2);j++){ + SPI_Write(*Dispbuff); + Dispbuff++; + } + } */ + if (label != 1) + { + for (i = 0; i < (YSize * 2); i++) + { + for (j = 0; j < (XSize * 2); j++) + { + SPI_Write(label); + } + } + } + else + { + Dispbuff += offset; + for (i = 0; i < (YSize * 2); i++) + { + for (j = 0; j < (XSize * 2); j++) + { + SPI_Write(*Dispbuff); + Dispbuff++; + } + } + } + EPD_CS_1; + return; + } + + /*if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == C154 || EPD_Type == WF42) + { + /*EPD_WriteCMD(0x10); + EPD_CS_0; + EPD_DC_1; + for(i=0;i400 + EPD_WriteCMD(0x45); + EPD_WriteData(0x2B); // RAM y address start at 12Bh + EPD_WriteData(0x01); + EPD_WriteData(0x00); // RAM y address end at 00h + EPD_WriteData(0x00); + EPD_WriteCMD(0x3C); // board + EPD_WriteData(0x01); // HIZ + + EPD_WriteCMD(0x18); + EPD_WriteData(0X80); + EPD_WriteCMD(0x22); + EPD_WriteData(0XB1); //Load Temperature and waveform setting. + EPD_WriteCMD(0x20); + ReadBusy(); + + + EPD_WriteCMD(0x4E); + EPD_WriteData(0x00); + EPD_WriteCMD(0x4F); + EPD_WriteData(0x2B); + EPD_WriteData(0x01); + + }*/ + else if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR) + { + EPD_WriteCMD(0x74); // + EPD_WriteData(0x54); // + EPD_WriteCMD(0x7E); // + EPD_WriteData(0x3B); // + EPD_WriteCMD(0x01); // + EPD_WriteData(0x2B); // + EPD_WriteData(0x01); + EPD_WriteData(0x00); // + + EPD_WriteCMD(0x0C); // + EPD_WriteData(0x8B); // + EPD_WriteData(0x9C); // + EPD_WriteData(0xD6); // + EPD_WriteData(0x0F); // + + EPD_WriteCMD(0x3A); // + EPD_WriteData(0x21); // + EPD_WriteCMD(0x3B); // + EPD_WriteData(0x06); // + EPD_WriteCMD(0x3C); // + EPD_WriteData(0x03); // + + EPD_WriteCMD(0x11); // data enter mode + EPD_WriteData(0x01); // 01 –Y decrement, X increment, + + EPD_WriteCMD(0x2C); // + EPD_WriteData(0x00); // fff + + EPD_WriteCMD(0x37); // + EPD_WriteData(0x00); // + EPD_WriteData(0x00); // + EPD_WriteData(0x00); // + EPD_WriteData(0x00); // + EPD_WriteData(0x80); // + + EPD_WriteCMD(0x21); // + EPD_WriteData(0x40); // + EPD_WriteCMD(0x22); + EPD_WriteData(0xc7); // c5forgraymode// + } + else if (EPD_Type == C154) + { + EPD_WriteCMD(0x01); + EPD_WriteData(0x03); + EPD_WriteData(0x00); + EPD_WriteData(0x2b); + EPD_WriteData(0x26); + EPD_WriteData(0x03); + + EPD_WriteCMD(0x06); // boost soft start + EPD_WriteData(0x17); + EPD_WriteData(0x17); + EPD_WriteData(0x17); + EPD_WriteCMD(0x04); + + ReadBusy(); + + EPD_WriteCMD(0x00); // panel setting + EPD_WriteData(0xff); // LUT from OTP,160x296 + EPD_WriteData(0x0d); // VCOM to 0V fast + + EPD_WriteCMD(0x61); // resolution setting + EPD_WriteData(0x98); // 152 + EPD_WriteData(0x00); // 152 + EPD_WriteData(0x98); + + EPD_WriteCMD(0X30); + EPD_WriteData(0x29); + + EPD_WriteCMD(0X50); // VCOM AND DATA INTERVAL SETTING + EPD_WriteData(0x97); // WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7 + ReadBusy(); + } + else if (EPD_Type == DKE29_3COLOR) + { + ReadBusy(); + EPD_WriteCMD(0x12); // SWRESET + ReadBusy(); + + EPD_WriteCMD(0x01); // Driver output control + EPD_WriteData(0x27); + EPD_WriteData(0x01); + EPD_WriteData(0x00); + + EPD_WriteCMD(0x11); // data entry mode + EPD_WriteData(0x01); + + EPD_WriteCMD(0x44); // set Ram-X address start/end position + EPD_WriteData(0x00); + EPD_WriteData(0x0F); // 0x0F-->(15+1)*8=128 + + EPD_WriteCMD(0x45); // set Ram-Y address start/end position + EPD_WriteData(0x27); // 0x0127-->(295+1)=296 + EPD_WriteData(0x01); + EPD_WriteData(0x00); + EPD_WriteData(0x00); + + EPD_WriteCMD(0x3C); // BorderWavefrom + EPD_WriteData(0x05); + + EPD_WriteCMD(0x18); // Read built-in temperature sensor + EPD_WriteData(0x80); + + EPD_WriteCMD(0x21); // Display update control + EPD_WriteData(0x00); + EPD_WriteData(0x80); + + EPD_WriteCMD(0x4E); // set RAM x address count to 0; + EPD_WriteData(0x00); + EPD_WriteCMD(0x4F); // set RAM y address count to 0X199; + EPD_WriteData(0x27); + EPD_WriteData(0x01); + ReadBusy(); + } + + else if (EPD_Type == WFT0290CZ10) + { + driver_delay_xms(10); + EPD_WriteCMD(0x06); // boost soft start + EPD_WriteData(0x17); // A + EPD_WriteData(0x17); // B + EPD_WriteData(0x17); // C + + EPD_WriteCMD(0x04); // Power on + ReadBusy(); + + EPD_WriteCMD(0x00); // panel setting + EPD_WriteData(0x97); // LUT from OTP£¬128x296 + // EPD_WriteData(0x0d); //实测这一句话没啥用,可能是兼容IC的锅 + + EPD_WriteCMD(0x61); // resolution setting + EPD_WriteData(0x80); + EPD_WriteData(0x01); + EPD_WriteData(0x28); + + EPD_WriteCMD(0x82); // vcom_DC setting + EPD_WriteData(0x12); + + EPD_WriteCMD(0X50); // VCOM AND DATA INTERVAL SETTING + EPD_WriteData(0x97); + } + + else if (EPD_Type == GDEY042Z98) + { + // Serial.printf("开始全刷初始化 \n"); + driver_delay_xms(10); + ReadBusy(); //读busy信号 + + EPD_WriteCMD(0x12); // 软件复位 soft reset + ReadBusy(); + + EPD_WriteCMD(0x01); // 驱动输出控制 drive output control + EPD_WriteData(0x2B); // Y 的低字节 + EPD_WriteData(0x01); // Y 的高字节 + EPD_WriteData(0x00); + + EPD_WriteCMD(0x11); // 数据 扫描设置 对数据地址设置有影响 以及对图片取模等也有影响 data entry mode + EPD_WriteData(0x01); // X模式 x加 y 减 X-mode x+ y- + + EPD_WriteCMD(0x44); // X 地址起始位 设置与扫描方式 有关 + EPD_WriteData(0x00); + EPD_WriteData(0x31); + + EPD_WriteCMD(0x45); // Y 地址起始位 设置与扫描方式 有关 + EPD_WriteData(0x2B); + EPD_WriteData(0x01); + EPD_WriteData(0x00); + EPD_WriteData(0x00); + + EPD_WriteCMD(0x3C); // Border 设置 黑白一般设置为跟随白波形即 0x01 Border setting + EPD_WriteData(0x01); + } + + else if (EPD_Type == HINKE0266A15A0) + { + driver_delay_xms(10); + ReadBusy(); + + EPD_WriteCMD(0x12); // 软件复位 soft reset + ReadBusy(); + + EPD_WriteCMD(0x01); // Driver output control + EPD_WriteData(0x27); + EPD_WriteData(0x01); + EPD_WriteData(0x00); + + EPD_WriteCMD(0x11); // data entry mode + EPD_WriteData(0x01); + + EPD_WriteCMD(0x44); // set Ram-X address start/end position + EPD_WriteData(0x00); + EPD_WriteData(0x12); // 0x0F-->(15+1)*8=128 + + EPD_WriteCMD(0x45); // set Ram-Y address start/end position + EPD_WriteData(0x27); // 0x0127-->(295+1)=296 + EPD_WriteData(0x01); + EPD_WriteData(0x00); + EPD_WriteData(0x00); + + EPD_WriteCMD(0x3C); // BorderWavefrom + EPD_WriteData(0x05); + + /*EPD_WriteCMD(0x18); // Read built-in temperature sensor + EPD_WriteData(0x80);*/ + + /*EPD_WriteCMD(0x21); // Display update control + EPD_WriteData(0x00); + EPD_WriteData(0x80);*/ + + EPD_WriteCMD(0x4E); // set RAM x address count to 0; + EPD_WriteData(0x00); + EPD_WriteCMD(0x4F); // set RAM y address count to 0X199; + EPD_WriteData(0x27); + EPD_WriteData(0x01); + ReadBusy(); + } +} +void EPaperDrive::EPD_Set_Contrast(uint8_t vcom) +{ + if (EPD_Type == OPM42) + { + EPD_WriteCMD(0x2C); // + EPD_WriteData(vcom); // fff + } +} + +void EPaperDrive::EPD_Update(void) +{ + if (EPD_Type == OPM42) + { + EPD_WriteCMD(0x20); + } + if (EPD_Type == DKE42_3COLOR) + { + EPD_WriteCMD(0x22); // Display Update Control + EPD_WriteData(0xC7); + EPD_WriteCMD(0x20); // Activate Display Update Sequence + } + if (EPD_Type == WX29) + { + EPD_WriteCMD_p1(0x22, 0x04); + EPD_WriteCMD(0x20); + } + if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10) + { + EPD_WriteCMD(0x12); + ReadBusy(); + } + if (EPD_Type == DKE29_3COLOR) + { + EPD_WriteCMD(0x22); // Display Update Control + EPD_WriteData(0xc7); + EPD_WriteCMD(0x20); // Activate Display Update Sequence + ReadBusy(); + } + else if (EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + EPD_WriteCMD(0x22); // Display Update Control + EPD_WriteData(0xC7); + EPD_WriteCMD(0x20); // Activate Display Update Sequence + ReadBusy(); + } +} +void EPaperDrive::EPD_Update_Part(void) +{ + if (EPD_Type == DKE29_3COLOR) + { + EPD_WriteCMD(0x22); // Display Update Control + EPD_WriteData(0xff); + EPD_WriteCMD(0x20); // Activate Display Update Sequence + } + else if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR) + { + EPD_WriteCMD(0x20); + } + else if (EPD_Type == WX29) + { + EPD_WriteCMD_p1(0x22, 0x04); + EPD_WriteCMD(0x20); + } + else if (EPD_Type == WF29 || EPD_Type == WF42) + { + EPD_WriteCMD(0x92); + EPD_WriteCMD(0x12); + } + else if (EPD_Type == WFT0290CZ10) + { + EPD_WriteCMD(0x91); + EPD_WriteCMD(0x12); + // ReadBusy(); + } + else if (EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + EPD_WriteCMD(0x22); // Display Update Control + EPD_WriteData(0xFF); + EPD_WriteCMD(0x20); // Activate Display Update Sequence + } +} + +void EPaperDrive::EPD_init_Full(void) +{ + EPD_Init(); +#ifdef debug + Serial.println("EPD_Init"); +#endif + + if (EPD_Type == WX29) + { + EPD_Write((uint8_t *)LUTDefault_full, sizeof(LUTDefault_full)); + } + else if (EPD_Type == OPM42) + { + EPD_Write((uint8_t *)LUTDefault_full_opm42, sizeof(LUTDefault_full_opm42)); + } + + else if (EPD_Type == DKE42_3COLOR) + { + EPD_Write((uint8_t *)LUTDefault_full_dke42, sizeof(LUTDefault_full_dke42)); + } + else if (EPD_Type == WF29BZ03) + { + EPD_Write((uint8_t *)lut_vcomDC_bz03, sizeof(lut_vcomDC_bz03)); + EPD_Write((uint8_t *)lut_ww_bz03, sizeof(lut_ww_bz03)); + EPD_Write((uint8_t *)lut_bw_bz03, sizeof(lut_bw_bz03)); + EPD_Write((uint8_t *)lut_wb_bz03, sizeof(lut_wb_bz03)); + EPD_Write((uint8_t *)lut_bb_bz03, sizeof(lut_bb_bz03)); + } + else if (EPD_Type == WF42) + { + EPD_Write((uint8_t *)lut_vcomDC, sizeof(lut_vcomDC)); + EPD_Write((uint8_t *)lut_ww, sizeof(lut_ww)); + EPD_Write((uint8_t *)lut_bw, sizeof(lut_bw)); + EPD_Write((uint8_t *)lut_wb, sizeof(lut_wb)); + EPD_Write((uint8_t *)lut_bb, sizeof(lut_bb)); + } + else if (EPD_Type == WF42) + { + EPD_Write((uint8_t *)lut_wf42_vcomDC, sizeof(lut_wf42_vcomDC)); + EPD_Write((uint8_t *)lut_wf42_ww, sizeof(lut_wf42_ww)); + EPD_Write((uint8_t *)lut_wf42_bw, sizeof(lut_wf42_bw)); + EPD_Write((uint8_t *)lut_wf42_wb, sizeof(lut_wf42_wb)); + EPD_Write((uint8_t *)lut_wf42_bb, sizeof(lut_wf42_bb)); + } + else if (EPD_Type == C154) + { + EPD_Write((uint8_t *)lut_vcomDC_154, sizeof(lut_vcomDC_154)); + EPD_Write((uint8_t *)lut_ww_154, sizeof(lut_ww_154)); + EPD_Write((uint8_t *)lut_bw_154, sizeof(lut_bw_154)); + EPD_Write((uint8_t *)lut_wb_154, sizeof(lut_wb_154)); + EPD_Write((uint8_t *)lut_bb_154, sizeof(lut_bb_154)); + } + else if (EPD_Type == DKE29_3COLOR) + { + EPD_Write((uint8_t *)LUTDefault_full_dke29, sizeof(LUTDefault_full_dke29)); + } + + else if (EPD_Type == WFT0290CZ10) + { + EPD_Write((uint8_t *)lut_vcomDC_WFT0290CZ10, sizeof(lut_vcomDC_WFT0290CZ10)); + EPD_Write((uint8_t *)lut_ww_WFT0290CZ10, sizeof(lut_ww_WFT0290CZ10)); + EPD_Write((uint8_t *)lut_bw_WFT0290CZ10, sizeof(lut_bw_WFT0290CZ10)); + EPD_Write((uint8_t *)lut_wb_WFT0290CZ10, sizeof(lut_wb_WFT0290CZ10)); + EPD_Write((uint8_t *)lut_bb_WFT0290CZ10, sizeof(lut_bb_WFT0290CZ10)); + } + + else if (EPD_Type == GDEY042Z98) + { + // Serial.printf("即将写入全刷波形 \n"); + EPD_Write((uint8_t *)LUTDefault_full_GDEY042Z98, sizeof(LUTDefault_full_GDEY042Z98)); + + EPD_WriteCMD(0x3F); + EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 227 + 1)); + + EPD_WriteCMD(0x03); //门电压 gate voltage + EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 228 + 1)); + + EPD_WriteCMD(0x04); //源电压 source voltage + EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 229 + 1)); + EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 230 + 1)); + EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 231 + 1)); + + EPD_WriteCMD(0x2C); /// vcom + EPD_WriteData(*(LUTDefault_full_GDEY042Z98 + 232 + 1)); + + EPD_WriteCMD(0x22); + EPD_WriteData(0xC0); + EPD_WriteCMD(0x20); + } + + else if (EPD_Type == HINKE0266A15A0) + { + EPD_Write((uint8_t *)LUTDefault_full_HINKE0266A15A0, sizeof(LUTDefault_full_HINKE0266A15A0)); + } +} + +void EPaperDrive::EPD_init_Part(void) +{ + + if (EPD_Type == WX29) + { + EPD_Init(); // display + EPD_Write((uint8_t *)LUTDefault_part, sizeof(LUTDefault_part)); + EPD_WriteCMD_p1(0x22, 0xc0); // poweron + EPD_WriteCMD(0x20); + } + else if (EPD_Type == OPM42) + { + EPD_Init(); + EPD_WriteCMD(0x21); + EPD_WriteData(0x00); + EPD_Write((uint8_t *)LUTDefault_part_opm42, sizeof(LUTDefault_part_opm42)); + } + else if (EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR) + { + EPD_Init(); + EPD_WriteCMD(0x21); + EPD_WriteData(0x00); + EPD_Write((uint8_t *)LUTDefault_part_dke42, sizeof(LUTDefault_part_dke42)); + } + else if (EPD_Type == WF29) + { + EPD_Init(); + EPD_WriteCMD(0x50); + EPD_WriteData(0xb7); + EPD_Write((uint8_t *)lut_vcomDC1, sizeof(lut_vcomDC1)); + EPD_Write((uint8_t *)lut_ww1, sizeof(lut_ww1)); + EPD_Write((uint8_t *)lut_bw1, sizeof(lut_bw1)); + EPD_Write((uint8_t *)lut_wb1, sizeof(lut_wb1)); + EPD_Write((uint8_t *)lut_bb1, sizeof(lut_bb1)); + } + else if (EPD_Type == WF42) + { + EPD_Init(); + // EPD_WriteCMD(0x50); + // EPD_WriteData(0xb7); + EPD_Write((uint8_t *)lut_part_wf42_vcomDC, sizeof(lut_part_wf42_vcomDC)); + EPD_Write((uint8_t *)lut_part_wf42_ww, sizeof(lut_part_wf42_ww)); + EPD_Write((uint8_t *)lut_part_wf42_bw, sizeof(lut_part_wf42_bw)); + EPD_Write((uint8_t *)lut_part_wf42_wb, sizeof(lut_part_wf42_wb)); + EPD_Write((uint8_t *)lut_part_wf42_bb, sizeof(lut_part_wf42_bb)); + } + else if (EPD_Type == DKE29_3COLOR) + { + EPD_Init(); + EPD_WriteCMD(0x21); + EPD_WriteData(0x00); + EPD_Write((uint8_t *)LUTDefault_part_dke29, sizeof(LUTDefault_part_dke29)); + } + else if (EPD_Type == WF29BZ03) + { + EPD_Init(); + EPD_Write((uint8_t *)lut_vcomDC_part_bz03, sizeof(lut_vcomDC_part_bz03)); + EPD_Write((uint8_t *)lut_ww_part_bz03, sizeof(lut_ww_part_bz03)); + EPD_Write((uint8_t *)lut_bw_part_bz03, sizeof(lut_bw_part_bz03)); + EPD_Write((uint8_t *)lut_wb_part_bz03, sizeof(lut_wb_part_bz03)); + EPD_Write((uint8_t *)lut_bb_part_bz03, sizeof(lut_wb_part_bz03)); + } + else if (EPD_Type == WFT0290CZ10) + { + // EPD_Init(); + // Serial.println("Will EPD Write"); + EPD_RST_0; + driver_delay_xms(10); + EPD_RST_1; + driver_delay_xms(10); + + EPD_WriteCMD(0x01); // POWER SETTING + EPD_WriteData(0x03); + EPD_WriteData(0x02); + EPD_WriteData(0x21); + EPD_WriteData(0x21); + + EPD_WriteCMD(0x06); // boost soft start + EPD_WriteData(0x17); // A + EPD_WriteData(0x17); // B + EPD_WriteData(0x17); // C + + EPD_WriteCMD(0x04); + ReadBusy(); + + EPD_WriteCMD(0x00); // panel setting + EPD_WriteData(0xA7); // LUT from OTP£¬128x296 + // EPD_WriteData(0x0d); // VCOM to 0V fast + + EPD_WriteCMD(0x30); // PLL setting + EPD_WriteData(0x3c); // 3a 100HZ 29 150Hz 39 200HZ 31 171HZ + + EPD_WriteCMD(0x61); // resolution setting + EPD_WriteData(0x80); + EPD_WriteData(0x01); + EPD_WriteData(0x28); + + EPD_WriteCMD(0x82); // vcom_DC setting + EPD_WriteData(0x08); + + EPD_WriteCMD(0X50); + EPD_WriteData(0xD7); + /*EPD_Write((uint8_t *)lut_vcomDC1, sizeof(lut_vcomDC1)); + EPD_Write((uint8_t *)lut_ww1, sizeof(lut_ww1)); + EPD_Write((uint8_t *)lut_bw1, sizeof(lut_bw1)); + EPD_Write((uint8_t *)lut_wb1, sizeof(lut_wb1)); + EPD_Write((uint8_t *)lut_bb1, sizeof(lut_bb1));*/ + + EPD_Write((uint8_t *)lut_vcomDC_part_WFT0290CZ10, sizeof(lut_vcomDC_part_WFT0290CZ10)); // Serial.println("vcom"); + EPD_Write((uint8_t *)lut_ww_part_WFT0290CZ10, sizeof(lut_ww_part_WFT0290CZ10)); // Serial.println("ww"); + EPD_Write((uint8_t *)lut_bw_part_WFT0290CZ10, sizeof(lut_bw_part_WFT0290CZ10)); // Serial.println("bw"); + EPD_Write((uint8_t *)lut_wb_part_WFT0290CZ10, sizeof(lut_wb_part_WFT0290CZ10)); // Serial.println("wb"); + EPD_Write((uint8_t *)lut_bb_part_WFT0290CZ10, sizeof(lut_bb_part_WFT0290CZ10)); // Serial.println("bb"); + // Serial.println("EPD Write OK"); + } + + else if (EPD_Type == GDEY042Z98) + { + EPD_Init(); + + EPD_WriteCMD(0x21); + EPD_WriteData(0x00); + EPD_Write((uint8_t *)LUTDefault_part_GDEY042Z98, sizeof(LUTDefault_part_GDEY042Z98)); + + EPD_WriteCMD(0x3F); + EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 227 + 1)); + + EPD_WriteCMD(0x03); //门电压 gate voltage + EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 228 + 1)); + + EPD_WriteCMD(0x04); //源电压 source voltage + EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 229 + 1)); + EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 230 + 1)); + EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 231 + 1)); + + EPD_WriteCMD(0x2C); /// vcom + EPD_WriteData(*(LUTDefault_part_GDEY042Z98 + 232 + 1)); + + EPD_WriteCMD(0x22); + EPD_WriteData(0xC0); + EPD_WriteCMD(0x20); + + ReadBusy(); + } + + else if (EPD_Type == HINKE0266A15A0) + { + EPD_Init(); + + EPD_Write((uint8_t *)LUTDefault_part_HINKE0266A15A0, sizeof(LUTDefault_part_HINKE0266A15A0)); + + /*EPD_WriteCMD(0x37); + EPD_WriteData(0x00); + EPD_WriteData(0x00); + EPD_WriteData(0x00); + EPD_WriteData(0x00); + EPD_WriteData(0x40); + EPD_WriteData(0x00); + EPD_WriteData(0x00);*/ + + // EPD_WriteCMD(0x22); // Display Update Control + // EPD_WriteData(0xC0); + // EPD_WriteCMD(0x20); // Activate Display Update Sequence + ReadBusy(); + } +} + +void EPaperDrive::EPD_Transfer_Full_BW(uint8_t *DisBuffer, uint8_t Label) +{ + if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == WFT0290CZ10 || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + unsigned int yStart = 0; + unsigned int yEnd = yDot - 1; + unsigned int xStart = 0; + unsigned int xEnd = xDot - 1; + unsigned long temp = yStart; + + yStart = yDot - 1 - yEnd; + yEnd = yDot - 1 - temp; + EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256); + EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256); + + if (Label == 2) + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // white + } + else if (Label == 3) + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // black + } + else if (Label == 4) + { + EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); // black + } + else + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + } + // EPD_Update(); + // ReadBusy_long(); + // EPD_WriteDispRam(xDot/8, yDot, (uint8_t *)DisBuffer,0,1); + } + else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10) + { + if (Label == 2) + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // white + } + else if (Label == 3) + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // black + } + else if (Label == 4) + { + EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); // black + } + else + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); // white + } + // EPD_Update(); + } +} +void EPaperDrive::EPD_Transfer_Full_RED(uint8_t *DisBuffer, uint8_t Label) +{ + if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + unsigned int yStart = 0; + unsigned int yEnd = yDot - 1; + unsigned int xStart = 0; + unsigned int xEnd = xDot - 1; + unsigned long temp = yStart; + + yStart = yDot - 1 - yEnd; + yEnd = yDot - 1 - temp; + EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256); + EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256); + + if (Label == 2) + { + EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // white + } + else if (Label == 3) + { + EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // black + } + else + { + EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + } + // EPD_Update(); + // ReadBusy_long(); + // EPD_WriteDispRam_Old(xDot/8, yDot, (uint8_t *)DisBuffer,0,1); + } + + if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10) + { + if (Label == 2) + { + EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // white + } + else if (Label == 3) + { + EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // black + } + else + { + EPD_WriteDispRam_RED(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); // white + } + // EPD_Update(); + } +} +void EPaperDrive::EPD_Dis_Full(uint8_t *DisBuffer, uint8_t Label) +{ + int nowtime = millis(); + if (EPD_Type == WX29 || EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + unsigned int yStart = 0; + unsigned int yEnd = yDot - 1; + unsigned int xStart = 0; + unsigned int xEnd = xDot - 1; + unsigned long temp = yStart; + + yStart = yDot - 1 - yEnd; + yEnd = yDot - 1 - temp; + + EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256); + EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256); + + if (EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + EPD_Transfer_Full_RED((uint8_t *)DisBuffer, 2); + } + + if (Label == 2) + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // white + } + else if (Label == 3) + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // black + } + else + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + } + nowtime = millis() - nowtime; + EPD_Update(); + nowtime = millis() - nowtime; + + int updatatime = nowtime; + //Serial.printf("开始全刷 \n"); + ReadBusy_long(); + ReadBusy_long(); + ReadBusy_long(); + ReadBusy_long(); + nowtime = millis() - nowtime; + //Serial.printf("全刷结束,耗时%dms", nowtime - updatatime); + if (EPD_Type == DKE29_3COLOR) + { + // EPD_Transfer_Full_RED((uint8_t *)EPDbuffer,1); + EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256); + // Serial.printf("即将写入的是全刷的0x26数据 \n"); + // EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + } + else if (EPD_Type == GDEY042Z98 || EPD_Type == HINKE0266A15A0) + { + EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256); + EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); //我也不知道啥情况,但是如果你不对这个寄存器写两遍一样的数据局刷无效 + // EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + } + else + { + EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256); + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + } + } + + else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF29BZ03 || EPD_Type == C154 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10) + { + if (Label == 2) + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0xff); // white + } + else if (Label == 3) + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 0x00); // black + } + else + { + EPD_WriteDispRam(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + } + ReadBusy_long(); + // EPD_WriteDispRam_Old(xDot/8, yDot, (uint8_t *)DisBuffer,0,1); + EPD_Update(); + /*if(EPD_Type==WF32) + { + WiFi.mode(WIFI_OFF); + wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); + gpio_pin_wakeup_enable(GPIO_ID_PIN(4), GPIO_PIN_INTR_HILEVEL); + wifi_fpm_open(); + wifi_fpm_do_sleep(0xFFFFFFF); // only 0xFFFFFFF, any other value and it won't disconnect the RTC timer + delay(10); + } */ + // ReadBusy_long(); + // ReadBusy_long(); + // ReadBusy_long(); + EPD_WriteDispRam_Old(xDot / 8, yDot, (uint8_t *)DisBuffer, 0, 1); + ReadBusy_long(); + } +} + +void EPaperDrive::EPD_Dis_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label) +{ + // EPD.EPD_Dis_Part(16,87,237,399,(uint8_t *)EPD.EPDbuffer,1); + if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == WF42 || EPD_Type == GDEY042Z98) + { + int temp1 = xStart, temp2 = xEnd; + xStart = yStart; + xEnd = yEnd; + yEnd = yDot - temp1 - 2; + yStart = yDot - temp2 - 3; + } + unsigned int Xsize = xEnd - xStart; + unsigned int Ysize = yEnd - yStart + 1; + if (Xsize % 8 != 0) + { + Xsize = Xsize + (8 - Xsize % 8); + } + Xsize = Xsize / 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) + { + unsigned long temp = yStart; + yStart = yDot - 1 - yEnd; + yEnd = yDot - 1 - temp; + + EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256); + EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256); + if (Label == 2) + EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0x00); + else if (Label == 3) + EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0xff); + else + EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1); + + EPD_Update_Part(); + ReadBusy_long(); + ReadBusy_long(); + if (EPD_Type == DKE29_3COLOR) + { + // Serial.printf("即将写入的是局刷的的0x26数据 \n"); + EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1); + } + else if (EPD_Type == GDEY042Z98) + { + + EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1); + } + + else if (EPD_Type == HINKE0266A15A0) + { + 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 == WF29 || EPD_Type == WF58 || EPD_Type == WF42 || EPD_Type == WFT0290CZ10) + { + + EPD_SetRamArea(xStart, xEnd, yStart / 256, yStart % 256, yEnd / 256, yEnd % 256); + ReadBusy_long(); + // EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer,offset,0x00); + if (Label == 2) + EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0xff); + else if (Label == 3) + EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0x00); + else + EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1); + + EPD_Update_Part(); + ReadBusy(); + ReadBusy(); + ReadBusy(); + EPD_WriteDispRam_Old(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1); + ReadBusy(); + } +} +void EPaperDrive::EPD_Transfer_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label) +{ + if (EPD_Type == OPM42 || EPD_Type == DKE42_3COLOR || EPD_Type == DKE29_3COLOR || EPD_Type == GDEY042Z98) + { + int temp1 = xStart, temp2 = xEnd; + xStart = yStart; + xEnd = yEnd; + yEnd = yDot - temp1 - 2; + yStart = yDot - temp2 - 3; + } + unsigned int Xsize = xEnd - xStart; + unsigned int Ysize = yEnd - yStart + 1; + if (Xsize % 8 != 0) + { + Xsize = Xsize + (8 - Xsize % 8); + } + Xsize = Xsize / 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) + { + + unsigned long temp = yStart; + yStart = yDot - 1 - yEnd; + yEnd = yDot - 1 - temp; + + EPD_SetRamArea(xStart, xEnd, yEnd % 256, yEnd / 256, yStart % 256, yStart / 256); + EPD_SetRamPointer(xStart / 8, yEnd % 256, yEnd / 256); + if (Label == 2) + EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0x00); + else if (Label == 3) + EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0xff); + else + EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1); + // EPD_Update_Part(); + ReadBusy(); + // EPD_WriteDispRam_Old(Xsize, Ysize,(uint8_t *)DisBuffer,offset,1); + // ReadBusy(); + // EPD_SetRamArea(xStart,xEnd,yEnd%256,yEnd/256,yStart%256,yStart/256); + // EPD_SetRamPointer(xStart/8,yEnd%256,yEnd/256); + // EPD_WriteDispRam(Xsize, Ysize,(uint8_t *)DisBuffer,offset,1); + } + + else if (EPD_Type == WF29 || EPD_Type == WF58 || EPD_Type == WF42 || EPD_Type == WF29BZ03 || EPD_Type == WFT0290CZ10) + { + + EPD_SetRamArea(xStart, xEnd, yStart / 256, yStart % 256, yEnd / 256, yEnd % 256); + if (Label == 2) + EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0xff); + else if (Label == 3) + EPD_WriteDispRam(xEnd - xStart, yEnd - yStart + 1, (uint8_t *)DisBuffer, offset, 0x00); + else + EPD_WriteDispRam(Xsize, Ysize, (uint8_t *)DisBuffer, offset, 1); + // EPD_Update_Part(); + } +} diff --git a/src/EPaperDrive.h b/src/EPaperDrive.h new file mode 100644 index 0000000..70516f3 --- /dev/null +++ b/src/EPaperDrive.h @@ -0,0 +1,489 @@ +#pragma once + +//#include "spline.h" + +#include +#include +#include "FS.h" +#include "WAVEFORM_SETTING_LUT.h" + +extern uint8_t UNICODEbuffer[200]; +extern String fontname; + +#define EPD_CS_0 digitalWrite(_CS, LOW) +#define EPD_CS_1 digitalWrite(_CS, HIGH) +#define isEPD_CS digitalRead(_CS) + +#define EPD_RST_0 digitalWrite(_RST, LOW) +#define EPD_RST_1 digitalWrite(_RST, HIGH) +#define isEPD_RST digitalRead(_RST) + +#define EPD_DC_0 digitalWrite(_DC, LOW) +#define EPD_DC_1 digitalWrite(_DC, HIGH) + +#define READ_EPD_BUSY digitalRead(_BUSY) + +#define EPD_CLK_0 digitalWrite(_CLK, LOW) +#define EPD_CLK_1 digitalWrite(_CLK, HIGH) + +#define EPD_DIN_0 digitalWrite(_DIN, LOW) +#define EPD_DIN_1 digitalWrite(_DIN, HIGH) + +enum FONT +{ + FONT16 = 0, + FONT32 = 1, + FONT10 = 2, + FONT12 = 3, + FONT70 = 5, + FONT12_NUM = 6, + FONT24 = 7, + FONT8 = 8, + DIGI_NUM_100 = 9, + ICON32 = 13, + ICON80 = 12, + ICON50 = 14, +}; +enum epd_type +{ + WX29 = 0, // SSD1608 + WF29 = 1, + OPM42 = 2, // SSD1619 + WF58 = 3, + WF29BZ03 = 4, + C154 = 5, + DKE42_3COLOR = 6, // SSD1619 + DKE29_3COLOR = 7, // SSD1680 + WF42 = 8, + WF32 = 9, + WFT0290CZ10 = 10, // UC8151C + GDEY042Z98 = 11, // SSD1683 + HINKE0266A15A0 = 12, // SSD1675 +}; +/* + * 典型使用流程 + * 1.EPD_init_Full/EPD_init_Part初始化 + * 2.clearbuffer清除缓存图像 + * 3.SetFont设置字体 + * 4.fontscale=1设置字体缩放 + * 5.DrawUTF 绘制文字。图像等 + * 6.EPD_DisFull/EPD_Dis_Part更新屏幕图像 + * 7.deepsleep睡眠 + * + * 屏幕有圆点的角为(0,0)点,x方向为垂直方向,y方向为水平方向 + */ +class EPaperDrive +{ +public: + /** + * @brief 构造函数,初始化软硬SPI及引脚定义 + * + * @param SPIMode 选择是硬件SPI还是软件SPI,0为软件,1为硬件(不采用硬件CS) + * @param CS CS脚 + * @param RST RST脚 + * @param DC DC脚 + * @param BUSY BUSY脚 + * @param CLK 时钟线,如果是硬件SPI可以不填 + * @param DIN 数据线,如果是硬件SPI可以不填 + */ + EPaperDrive(bool SPIMode, uint8_t CS, uint8_t RST, uint8_t DC, uint8_t BUSY, uint8_t CLK = 127, uint8_t DIN = 127); + + /** + * @brief 构析函数,暂无作用 + * + */ + ~EPaperDrive(); + + /** + * @brief 让墨水屏进入睡眠模式,节省功耗 + * + */ + void deepsleep(void); + + uint8_t fontscale; ///> 字体缩放,仅支持1,2 + uint8_t frame; //用于4灰度屏,fram=0,在2bit中的第一个bit中存储图像,frame=1在第二bit种存储图像 + uint8_t EPDbuffer[400 * 300 / 8]; ///>屏幕图像 + epd_type EPD_Type; + + /** + * @brief 设置采用什么文件系统 + * + * @param userFS 应当传入的文件系统的指针 + */ + void SetFS(FS *userFS); + + /** + * @brief 设置采用硬件spi的通道(用户请先初始化SPI之后再传入对应SPI的指针) + * + * @param spi 应当传入的SPI的指针 + */ + void SetHardSPI(SPIClass *spi); + + /** + * @brief 设置墨水屏的型号 + * + * @param model 墨水屏的型号,目前支持的在epd_type这个枚举里面 + */ + void EPD_Set_Model(uint8_t model); + + /** + * @brief 墨水屏全刷的初始化 + * + */ + void EPD_init_Full(void); + + /** + * @brief 墨水屏局刷的初始化 + * + */ + void EPD_init_Part(void); + + /** + * @brief 全刷传入的图像 + * + * @param DisBuffer 传入的图像缓存指针 + * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑 + */ + void EPD_Dis_Full(uint8_t *DisBuffer, uint8_t Label); // 1正常2全白3全黑 + + /** + * @brief 局刷传入的图像 + * + * @param xStart 局刷区域x开始的坐标 + * @param xEnd 局刷区域x结束的坐标 + * @param yStart 局刷区域y开始的坐标 + * @param yEnd 局刷区域y结束的坐标 + * @param DisBuffer 传入的图像缓存指针 + * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑 + */ + void EPD_Dis_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label); + + /** + * @brief 直接向RAM中写全刷的黑白图片 + * + * @param DisBuffer 应当写入的图像缓存指针 + * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑;4为向“OLD”RAM中写全黑 + */ + void EPD_Transfer_Full_BW(uint8_t *DisBuffer, uint8_t Label); + + /** + * @brief 直接向RAM中写全刷的红色图片 + * + * @param DisBuffer 应当写入的图像缓存指针 + * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑 + */ + void EPD_Transfer_Full_RED(uint8_t *DisBuffer, uint8_t Label); + + /** + * @brief 直接向RAM中写局刷的图像 + * + * @param xStart 局刷区域x开始的坐标 + * @param xEnd 局刷区域x结束的坐标 + * @param yStart 局刷区域y开始的坐标 + * @param yEnd 局刷区域y结束的坐标 + * @param DisBuffer 传入的图像缓存指针 + * @param Label 应该刷的图像,1为传入的缓存;2为全白;3为全黑 + */ + void EPD_Transfer_Part(int xStart, int xEnd, int yStart, int yEnd, uint8_t *DisBuffer, uint8_t Label); + + /** + * @brief 设置字体样式 + * + * @param fontindex 字体样式,目前仅支持FONT枚举里面的 + */ + void SetFont(FONT fontindex); + + /** + * @brief 在图像缓存中画字符串 + * + * @param x 字符串图像开始的x坐标 + * @param y 字符串图像开始的y坐标 + * @param code 字符串内容 + */ + void DrawUTF(int16_t x, int16_t y, String code); + + /** + * @brief 在图像缓存中画字符 + * + * @param x 开始的x坐标 + * @param y 开始的y坐标 + * @param width 字符的宽度 + * @param height 字符的高度 + * @param code 字符的指针 + */ + void DrawUnicodeChar(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code); + + /** + * @brief 在图像缓存中画指定长度的字符串 + * + * @param x 开始的x坐标 + * @param y 开始的y坐标 + * @param width 字符的宽度 + * @param height 字符的高度 + * @param strlength 字符串的长度 + * @param code 字符串指针 + */ + void DrawUnicodeStr(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t strlength, uint8_t *code); + + /** + * @brief 清除之前所绘的图像缓存 + * + */ + void clearbuffer(); + + /** + * @brief 在图像缓存中画竖线(一个像素) + * + * @param start 线开始的x坐标 + * @param end 线结束的x坐标 + * @param y 线的y坐标 + */ + void DrawYline(int start, int end, int y); //画竖线 + + /** + * @brief 在图像缓存中画横线(一个像素) + * + * @param start 线开始的y坐标 + * @param end 线结束的y坐标 + * @param x 线的x坐标 + */ + void DrawXline(int start, int end, int x); //画横线 + + /** + * @brief 在图像缓存中画直线 + * + * @param xstart 线开始的x坐标 + * @param ystart 线开始的y坐标 + * @param xend 线结束的x坐标 + * @param yend 线结束的y坐标 + */ + void DrawLine(int xstart, int ystart, int xend, int yend); + + /** + * @brief 反向一个区域的图像(黑变白,白变黑) + * + * @param xStart 这个区域开始的x坐标 + * @param xEnd 这个区域结束的x坐标 + * @param yStart 这个区域开始的y坐标 + * @param yEnd 这个区域结束的y坐标 + */ + void Inverse(int xStart, int xEnd, int yStart, int yEnd); + + /** + * @brief 绘制天气温度变化曲线 + * + * @param xmin 绘制区域中开始的x坐标 + * @param xmax 绘制区域中结束的x坐标 + * @param ymin 绘制区域中开始的y坐标 + * @param ymax 绘制区域中结束的y坐标 + * @param point_n 传入的天气数据的数量 + * @param show_n 需要显示的天气数据的数量 + * @param tmax 需要显示的这几天每天温度的最大值(如12,13,14,15) + * @param tmin 需要显示的这几天每天温度的最小值(如2,3,4,5) + * @param code_d 需要显示的这几天每天温度最大值的图标对应的字符 + * @param code_n 需要显示的这几天每天温度最小值的图标对应的字符 + * @param text_d 需要显示的这几天每天温度最大值对应的天气状况 + * @param text_n 需要显示的这几天每天温度最小值对应的天气状况 + * @param date 我也不知道这是啥,看函数定义里面好像没啥用 + * @param week 需要显示的这几天每天是星期几(例如1,2,3,4) + */ + void DrawWeatherChart(int xmin, int xmax, int ymin, int ymax, int point_n, int show_n, String tmax, String tmin, String code_d, String code_n, String text_d, String text_n, String date, String week); //绘制天气温度变化曲线 + + /** + * @brief 在图像缓存中画圆 + * + * @param x 圆心的x坐标 + * @param y 圆心的y坐标 + * @param r 半径长度 + * @param fill 0为空心圆;1为实心圆 + */ + void DrawCircle(int x, int y, int r, bool fill); //画圆圈,xy圆心,r半径 + + /** + * @brief 在图像缓存中画实心矩形 + * + * @param x 开始的x坐标 + * @param y 开始的y坐标 + * @param w 矩形的宽度 + * @param h 矩形的高度 + */ + void DrawBox(uint8_t x, int y, int w, int h); //画矩形,填充 + + /** + * @brief 在图像缓存中画空心矩形 + * + * @param x 开始的x坐标 + * @param y 开始的y坐标 + * @param w 矩形的宽度 + * @param h 矩形的高度 + */ + void DrawEmptyBox(int x, int y, int w, int h); //画矩形,空心 + + /** + * @brief 在图像缓存中画水平方向的柱状图(显示空气质量数据的,不建议使用) + * + * @param x 开始的x坐标 + * @param y 开始的y坐标 + * @param w 图表的宽度 + * @param c1 第1个数据 + * @param c2 第2个数据 + * @param c3 第3个数据 + * @param c4 第4个数据 + * @param c5 第5个数据 + * @param c6 第6个数据 + */ + void DrawChart(int x, int y, int w, int c1, int c2, int c3, int c4, int c5, int c6); //画水平方向的柱状图,w图表宽度,c1-C6变量 + + /** + * @brief 在图像缓存中画圆环图表(显示空气质量数据的,不建议使用) + * + * @param x 开始的x坐标 + * @param y 开始的y坐标 + * @param r 圆环的半径 + * @param w 圆环的宽度 + * @param c1 第1个数据 + * @param c2 第2个数据 + * @param c3 第3个数据 + */ + void DrawCircleChart(int x, int y, int r, int w, int c1, int c2, int c3); //画圆环图表,r半径,w圆环宽,c1-c3变量 + + /** + * @brief 在图像缓存中绘制图像 + * + * @param xMove 开始的x坐标 + * @param yMove 开始的y坐标 + * @param width 图像的宽度 + * @param height 图像的高度 + * @param xbm 图像的指针 + */ + void drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t *xbm); //绘制图像 + + /** + * @brief 在图像缓存中画以PROGMEM类型储存图片 + * + * @param xMove 开始的x坐标 + * @param yMove 开始的y坐标 + * @param width 图像的宽度 + * @param height 图像的高度 + * @param xbm 图像的指针 + */ + void DrawXbm_P(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm); + + /** + * @brief 在图像缓存中画以PROGMEM类型储存的灰度图片 + * + * @param xMove 开始的x坐标 + * @param yMove 开始的y坐标 + * @param width 图像的宽度 + * @param height 图像的高度 + * @param xbm 图像的指针 + * @param level 灰度的等级 + */ + void DrawXbm_p_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *xbm, uint8_t level); + + /** + * @brief 在图像缓存中画以文件系统储存的灰度图片 + * + * @param xMove 开始的x坐标 + * @param yMove 开始的y坐标 + * @param width 图像的宽度 + * @param height 图像的高度 + * @param level 灰度的等级 + */ + void DrawXbm_spiff_gray(int16_t xMove, int16_t yMove, int16_t width, int16_t height, uint8_t level); + + /** + * @brief 设置vcom(仅有OPM42这块屏需要在意,别的屏幕不用管) + * + * @param vcom vcom的等级 + */ + void EPD_Set_Contrast(uint8_t vcom); + + /** + * @brief 墨水屏全刷更新 + * + */ + void EPD_Update(void); + + /** + * @brief 墨水屏局刷更新 + * + */ + void EPD_Update_Part(void); + + /** + * @brief 等待BUSY信号变为空闲(最大200ms超时) + * + * @return bool 1代表成功,0代表超时 + */ + bool ReadBusy(void); + + /** + * @brief 等待BUSY信号变为空闲(最大2000ms超时) + * + * @return bool 1代表成功,0代表超时 + */ + bool ReadBusy_long(void); + + /** + * @brief 向墨水屏驱动芯片写入命令 + * + * @param command 命令的值 + */ + void EPD_WriteCMD(uint8_t command); + + /** + * @brief 向墨水屏驱动芯片写入数据 + * + * @param data 数据的值 + */ + void EPD_WriteData(uint8_t data); + + /** + * @brief 向墨水屏驱动芯片中写命令和数据(第一个字节为命令,剩下的均为数据) + * + * @param value 要写的所有字节的指针 + * @param datalen 要写的所有字节的长度 + */ + void EPD_Write(uint8_t *value, uint8_t datalen); + +private: + uint8_t _CS; + uint8_t _RST; + uint8_t _DC; + uint8_t _BUSY; + uint8_t _CLK; + uint8_t _DIN; + bool _SPIMode; + + FS *UserFS; + SPIClass *MySPI; + + uint8_t FontIndex; + + int xDot; + int yDot; + int16_t CurrentCursor; + uint8_t fontwidth; + uint8_t fontheight; + + void SPI_Write(uint8_t value); + 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(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_SetRamPointer(uint16_t addrX, uint8_t addrY, uint8_t addrY1); + void EPD_WirteLUT(uint8_t *LUTvalue, uint8_t Size); + + void EPD_Init(void); + 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); + + int getIcon(int weathercodeindex); + void SetPixel(int16_t x, int16_t y); + void InversePixel(int16_t x, int16_t y); + void DrawUTF(int16_t x, int16_t y, uint8_t width, uint8_t height, uint8_t *code); + int UTFtoUNICODE(uint8_t *code); +}; diff --git a/src/WAVEFORM_SETTING_LUT.h b/src/WAVEFORM_SETTING_LUT.h new file mode 100644 index 0000000..33c294d --- /dev/null +++ b/src/WAVEFORM_SETTING_LUT.h @@ -0,0 +1,952 @@ + static const uint8_t GDVol[] = {0x03,0x00}; // Gate voltage +15V/-15V + static uint8_t GDOControl[]={0x01,39,1,0x00}; //for 1.54inch + static uint8_t softstart[]={0x0c,0xd7,0xd6,0x9d}; + static uint8_t Rambypass[] = {0x21,0x8f}; // Display update + static uint8_t MAsequency[] = {0x22,0xf0}; // clock + static uint8_t SDVol[] = {0x04,0x0a}; // Source voltage +15V/-15V + static uint8_t VCOMVol[] = {0x2c,0xa8}; // VCOM 7c 0xa8 + static uint8_t GateVol[]={0x03,0xea}; + + static uint8_t BOOSTERFB[] = {0xf0,0x1f}; // Source voltage +15V/-15V + static uint8_t DummyLine[] = {0x3a,0x01}; // 4 dummy line per gate + static uint8_t Gatetime[] = {0x3b,B1000}; // 2us per line + static uint8_t BorderWavefrom[] = {0x3c,0x63}; // Border + static uint8_t RamDataEntryMode[] = {0x11,0x01}; // Ram data entry mode + static const uint8_t LUTDefault_part[31] = { + 0x32, // command + 0x10,0x18,0x18,0x08,0x18,0x18,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x13,0x14,0x44,0x12,0x00,0x00,0x00,0x00,0x00,0x00, + /* 10 wb 01 bw + * 10 H REPEAT 3 + * 10 H 01 L REPEAT 1 + * 10 H 01 L REPEAT 4 + * 01 L REPEAT 1 + * 10 H 01 L REPEAT 4 + * 10 H 01 L REPEAT 4 + * 01 L REPEAT 2 + + + */ + }; + static const uint8_t LUTDefault_full[31] = { + 0x32, // command + 0x02,0x02,0x01,0x11,0x12,0x12,0x22,0x22,0x66,0x69,0x69,0x59,0x58,0x99,0x99,0x88,0x00,0x00,0x00, + 0x00,0xF8,0xB4,0x13,0x51,0x35,0x51,0x51,0x19,0x01,0x00, + }; + //////////// + + +const uint8_t lut_vcomDC_154[] ={ +0x20, +0x00 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02, +0x60 ,0x13 ,0x14 ,0x00 ,0x00 ,0x05, +0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, +0x00 ,0x24 ,0x24 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 +,0x00 ,0x00, }; +const uint8_t lut_ww_154[] ={ +0x21, +// +0x40 ,0x16 ,0x00 ,0x00 ,0x00 ,0x01, +0x90 ,0x13 ,0x14 ,0x00 ,0x00 ,0x05, +0x40 ,0x02 ,0x00 ,0x00 ,0x00 ,0x01, +0xA0 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_wb_154[] ={ +0x23, +0x80 ,0x02 ,0x00 ,0x00 ,0x00 ,0x01, +0x90 ,0x13 ,0x14 ,0x00 ,0x00 ,0x05, +0x80 ,0x02 ,0x00 ,0x00 ,0x00 ,0x01, +0x50 ,0x24 ,0x24 ,0x00 ,0x00 ,0x05, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; + +const uint8_t lut_bw_154[] ={ +0x22, +0x40 ,0x17 ,0x00 ,0x00 ,0x00 ,0x02 , +0x90 ,0x0F ,0x0F ,0x00 ,0x00 ,0x03 , +0x40 ,0x0A ,0x01 ,0x00 ,0x00 ,0x01 , +0xA0 ,0x0E ,0x0E ,0x00 ,0x00 ,0x02 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , }; + +const uint8_t lut_bb_154[] ={ +0x24, +0x80 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02, +0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01, +0x80 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, +0x50 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; + + static const uint8_t LUTDefault_part_opm42[] = { + /* + 0x08,0x48,0x40,0x00,0x00,0x00,0x00,//L0 B low-high-low-high + 0x20,0x12,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low + 0x48,0x48,0x40,0x00,0x00,0x00,0x00, + 0x48,0x48,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM + 0x0c,0x08,0x0c,0x01,0x00, + 0x0c,0x10,0x0c,0x08,0x00, + 0x0c,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + */ + 0x32, // command + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L0 BB R0 B/W 0 + 0x82,0x00,0x00,0x00,0x00,0x00,0x00, //L1 BW R0 B/W 1 + 0x50,0x00,0x00,0x00,0x00,0x00,0x00, //L2 WB R1 B/W 0 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L3 WW R0 W/W 0 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L4 VCOM + //b1w1 b2 w2 + 0x08,0x08,0x00,0x08,0x01, + 0x00,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, + + + }; + static const uint8_t LUTDefault_full_opm42[] = { + 0x32, // command + /* + 0x08,0x48,0x40,0x00,0x00,0x00,0x00,//L0 B low-high-low-high + 0x08,0x48,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low + 0x48,0x48,0x40,0x00,0x00,0x00,0x00, + 0x48,0x48,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM + 0x0F,0x01,0x0F,0x01,0x00, + 0x0F,0x01,0x0F,0x01,0x00, + 0x0F,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + */ + /* + black + 0x08 vsl repeat f + 0x48 vsh1 repeat f vsl repeat f + 0x40 vshl repeat f + + white + 0x08 vsl repeat f + 0x48 vsh1 repeat f vsl repeat f + */ + + + 0x08,0x00,0x48,0x40,0x00,0x00,0x00,//L0 B low-high-low-high + 0x20,0x00,0x12,0x20,0x00,0x00,0x00,//L1 W low-high-low + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM + // w1白 b1白 + 0x05,0x20,0x20,0x05,0x00, + //wait + 0x0f,0x00,0x00,0x00,0x00, + //b2黑 w2黑 b3白 w3白 + 0x20,0x40,0x20,0x20,0x00, + //b4黑 w4白 + 0x20,0x00,0x00,0x00,0x00, + // + + 0x05,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, }; + static const uint8_t LUTDefault_part_dke42[] = { + + 0x32, // command + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L0 BB R0 B/W 0 + 0x82,0x00,0x00,0x00,0x00,0x00,0x00, //L1 BW R0 B/W 1 + 0x50,0x00,0x00,0x00,0x00,0x00,0x00, //L2 WB R1 B/W 0 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L3 WW R0 W/W 0 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L4 VCOM + //b1w1 b2 w2 + 0x20,0x00,0x00,0x05,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, + + + }; + static const uint8_t LUTDefault_full_dke42[] = { + 0x32, // command + + 0x08,0x66,0x48,0x40,0x00,0x00,0x00,//L0 B low-high-low-high + 0x20,0x66,0x12,0x20,0x00,0x00,0x00,//L1 W low-high-low + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM + // w1白 b1白 + 0x05,0x00,0x00,0x05,0x00, + //wait + 0x06,0x06,0x06,0x06,0x12, + //b2黑 w2黑 b3白 w3白 + 0x00,0x00,0x15,0x20,0x00, + //b4黑 w4白 + 0x25,0x00,0x00,0x00,0x00, + // + + 0x05,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, }; + static const uint8_t LUT_gray_opm42[]={ + 0x32, // command + 0x40,0x00,0x00,0x00,0x00,0x00,0x00, //L0 B low-high-low-high 40 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L1 W low-high + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L2 R + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L3 R + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L4 VCOM + 0x03,0x00,0x00,0x00,0x00,//[36] + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + }; +static const uint8_t LUT_gray_red_opm42[]={ + 0x32, // command + 0xc0,0x80,0x00,0x00,0x00,0x00,0x00, //L0 B low-high-low-high 40 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L1 W low-high + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L2 R + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L3 R + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //L4 VCOM + 0x20,0x01,0x00,0x00,0x00,//[36] + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + }; + static const uint8_t LUTDefault_full_dke29[] = { + 0x32, // command + 0x08,0x00,0x48,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L0 B low-high-low-high + 0x20,0x00,0x12,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low + 0x08,0x00,0x48,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L0 B low-high-low-high + 0x20,0x00,0x12,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM + // w1白 b1白 + 0x00,0x40,0x00,0x40,0x00,0x00,0x00, + //wait + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + //b2黑 w2黑 b3白 w3白 + 0x40,0x40,0x00,0x40,0x40,0x00,0x00, + //b4黑 w4白 + 0x40,0x05,0x00,0x00,0x00,0x00,0x00, + // + + 0x05,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,0x00, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + + 0x00, + 0x00, + 0x00, + + 0x00, + + }; +static const uint8_t LUTDefault_part_dke29[] = { + 0x32, // command + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L0 B low-high-low-high + 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L1 W low-high-low + 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM + // b1w1 b2 w2 + 0x80,0x00,0x00,0x00,0x00,0x00,0x00, + //wait + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + //b2黑 w2黑 b3白 w3白 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + //b4黑 w4白 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + // + + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + 0xff, + + 0x00, + 0x00, + 0x00, + + 0x00, + + }; +const uint8_t lut_wf42_vcomDC[] ={ +0x20, +0x00, 0x17, 0x00, 0x00, 0x00, 0x02, +0x00, 0x17, 0x17, 0x00, 0x00, 0x02, +0x00, 0x0A, 0x01, 0x00, 0x00, 0x01, +0x00, 0x0E, 0x0E, 0x00, 0x00, 0x02, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, +/*0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, */ + + +}; +const uint8_t lut_wf42_ww[] ={ +0x21, + 0x40, 0x17, 0x00, 0x00, 0x00, 0x02, + 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, + 0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, + 0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +const uint8_t lut_wf42_bw[] ={ +0x22, + 0x40, 0x17, 0x00, 0x00, 0x00, 0x02, + 0x90, 0x17, 0x17, 0x00, 0x00, 0x02, + 0x40, 0x0A, 0x01, 0x00, 0x00, 0x01, + 0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +const uint8_t lut_wf42_wb[] ={ +0x23, +0x80, 0x17, 0x00, 0x00, 0x00, 0x02, +0x90, 0x17, 0x17, 0x00, 0x00, 0x02, +0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, +0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +const uint8_t lut_wf42_bb[] ={ +0x24, +0x80, 0x17, 0x00, 0x00, 0x00, 0x02, +0x90, 0x17, 0x17, 0x00, 0x00, 0x02, +0x80, 0x0A, 0x01, 0x00, 0x00, 0x01, +0x50, 0x0E, 0x0E, 0x00, 0x00, 0x02, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; + + + +const uint8_t lut_vcomDC[] ={ +0x20, +0x00 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02, +0x60 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01, +0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, +0x00 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 +,0x00 ,0x00, }; +const uint8_t lut_ww[] ={ +0x21, +0x40 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02, +0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01, +0x40 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, +0xA0 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_bw[] ={ +0x22, +0x40 ,0x17 ,0x00 ,0x00 ,0x00 ,0x02 , +0x90 ,0x0F ,0x0F ,0x00 ,0x00 ,0x03 , +0x40 ,0x0A ,0x01 ,0x00 ,0x00 ,0x01 , +0xA0 ,0x0E ,0x0E ,0x00 ,0x00 ,0x02 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , }; +const uint8_t lut_wb[] ={ +0x23, +0x80 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02, +0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01, +0x80 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, +0x50 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_bb[] ={ +0x24, +0x80 ,0x08 ,0x00 ,0x00 ,0x00 ,0x02, +0x90 ,0x28 ,0x28 ,0x00 ,0x00 ,0x01, +0x80 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, +0x50 ,0x12 ,0x12 ,0x00 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; + +//////////////////////////////////////partial screen update LUT//////////////////////////////////////////// +const uint8_t lut_vcomDC1[] ={ +0x20, +0x00 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, //GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 + ,0x00 ,0x00, }; +const uint8_t lut_ww1[] ={ +0x21, +//level0 level 1 level 2 level 3 +//frame0 +//frame1 +//frame2 +//frame3 +//repeat +//level f0 f1 f2 f3 repeat +0x00 ,0x19 ,0x01 ,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,}; +const uint8_t lut_bw1[] ={ +0x22, +//level f0 f1 f2 f3 repeat +0x80 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01, //LOW - GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_wb1[] ={ + 0x23, +0x40 ,0x19 ,0x01 ,0x00 ,0x00 ,0x01,//HIGH - GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_bb1[] ={ + 0x24, +0x00 ,0x19 ,0x01 ,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, }; +//////////////////////////////////////partial screen update LUT//////////////////////////////////////////// +const uint8_t lut_part_wf42_vcomDC[] ={ +0x20, +0x02 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01, //GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 +,0x00 ,0x00, +/*0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, */ +}; +const uint8_t lut_part_wf42_ww[] ={ +0x21, +//level0 level 1 level 2 level 3 +//frame0 +//frame1 +//frame2 +//frame3 +//repeat +//level f0 f1 f2 f3 repeat +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00,}; +const uint8_t lut_part_wf42_bw[] ={ +0x22, +//level f0 f1 f2 f3 repeat +0x80 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01, //LOW - GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_part_wf42_wb[] ={ +0x23, +0x40 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01,//HIGH - GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_part_wf42_bb[] ={ +0x24, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; + +const uint8_t lut_vcomDCfast[] ={ +0x20, +0x01 ,0x01 ,0x02 , +0x01 ,0x01 ,0x02 , +0x41 ,0x41 ,0x02 , +0x41 ,0x41 ,0x02 , +0x02 ,0x02 ,0x19 }; +const uint8_t lut_wwfast[] ={//w +0x21, + +0x81 ,0x81 ,0x02, +0x81 ,0x81 ,0x02, +0x81 ,0x81 ,0x02, +0x81 ,0x81 ,0x02, +0x82 ,0xc2 ,0x0f, +}; +const uint8_t lut_bwfast[] ={//b +0x22, + +0x41 ,0x41 ,0x06 , +0x41 ,0x41 ,0x02 , +0x41 ,0x41 ,0x02 , +0x41 ,0x41 ,0x02 , +0x42 ,0xc2 ,0x02 ,}; + +const uint8_t lut_vcomDC2[] ={ +0x20, +0x0E ,0x14 ,0x01 , +0x0A ,0x06 ,0x04 , +0x0A ,0x0A ,0x0F , +0x03 ,0x03 ,0x0C , +0x06 ,0x0A ,0x00 }; +const uint8_t lut_ww2[] ={//w +0x21, +0x0E ,0x14 ,0x01, +0x0A ,0x46 ,0x04 , +0x8A ,0x4A ,0x0F , +0x83 ,0x43 ,0x0C , +0x86 ,0x0A ,0x04}; +const uint8_t lut_bw2[] ={//b + 0x22, +0x0E ,0x14 ,0x01 , +0x8A ,0x06 ,0x04 , +0x8A ,0x4A ,0x0F , +0x83 ,0x43 ,0x0C , +0x06 ,0x4A ,0x04}; +const uint8_t lut_wb2[] ={ + 0x23, +0x8E ,0x94 ,0x01 , +0x8A ,0x06 ,0x04 , +0x8A ,0x4A ,0x0F , +0x83 ,0x43 ,0x0C , +0x06 ,0x0A ,0x04 }; +const uint8_t lut_bb2[] ={ + 0x24, +0x8E ,0x94 ,0x01 , +0x8A ,0x06 ,0x04 , +0x8A ,0x4A ,0x0F , +0x83 ,0x43 ,0x0C , +0x06 ,0x0A ,0x04 }; +/* +const uint8_t lut_vcomDC_bz03[] ={ +0x20, +0x0E ,0x14 ,0x01 , +0x0A ,0x06 ,0x04 , +0x0A ,0x0A ,0x0F , +0x03 ,0x03 ,0x0C , +0x06 ,0x0A ,0x00 }; +const uint8_t lut_ww_bz03[] ={//w +0x21, +0x0E ,0x14 ,0x01, +0x0A ,0x46 ,0x04 , +0x8A ,0x4A ,0x0F , +0x83 ,0x43 ,0x0C , +0x86 ,0x0A ,0x04}; +const uint8_t lut_bw_bz03[] ={//b + 0x22, +0x0E ,0x14 ,0x01 , +0x8A ,0x06 ,0x04 , +0x8A ,0x4A ,0x0F , +0x83 ,0x43 ,0x0C , +0x06 ,0x4A ,0x04}; +const uint8_t lut_wb_bz03[] ={ + 0x23, +0x0E ,0x14 ,0x01 , +0x8A ,0x06 ,0x04 , +0x8A ,0x4A ,0x0F , +0x83 ,0x43 ,0x0C , +0x06 ,0x4A ,0x04 }; +const uint8_t lut_bb_bz03[] ={ + 0x24, +0x0E ,0x14 ,0x01 , +0x8A ,0x06 ,0x04 , +0x8A ,0x4A ,0x0F , +0x83 ,0x43 ,0x0C , +0x06 ,0x4A ,0x04}; +*/ +const uint8_t lut_vcomDC_bz03[] ={ +0x20, +0x0a ,0x00 ,0x06 , +0x0a ,0x00 ,0x06 , +0x0a ,0x00 ,0x06 , +0x0a ,0x00 ,0x06 , +0x00 ,0x00 ,0x00 }; +const uint8_t lut_ww_bz03[] ={//w +0x21, +0x4a ,0x00 ,0x06, +0x8a ,0x00 ,0x06 , +0x4A ,0x00 ,0x06 , +0x8a ,0x00 ,0x06 , +0x00 ,0x00 ,0x00}; +const uint8_t lut_bw_bz03[] ={//b + 0x22, +0x8a ,0x00 ,0x06 , +0x4A ,0x00 ,0x06 , +0x8A ,0x00 ,0x06 , +0x4a ,0x00 ,0x06 , +0x00 ,0x00 ,0x00}; +const uint8_t lut_wb_bz03[] ={ + 0x23, +0x8a ,0x00 ,0x06 , +0x4A ,0x00 ,0x06 , +0x8A ,0x00 ,0x06 , +0x4a ,0x00 ,0x06 , +0x00 ,0x00 ,0x00}; +const uint8_t lut_bb_bz03[] ={ + 0x24, +0x4a ,0x00 ,0x06, +0x8a ,0x00 ,0x06 , +0x4A ,0x00 ,0x06 , +0x8a ,0x00 ,0x06 , +0x00 ,0x00 ,0x00}; + +const uint8_t lut_vcomDC_part_bz03[] ={ +0x20, +0x0a ,0x00 ,0x04 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 }; +const uint8_t lut_ww_part_bz03[] ={//w +0x21, +0x0a ,0x00 ,0x04, +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 }; +const uint8_t lut_bb_part_bz03[] ={//01 +0x22, +0x0a ,0x00 ,0x04 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 }; +const uint8_t lut_bw_part_bz03[] ={//10 +0x23, +0x4a ,0x00 ,0x12 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 }; +const uint8_t lut_wb_part_bz03[] ={//10 +0x24, +0x8a ,0x00 ,0x12 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00}; + +const uint8_t lut_vcomDC_WFT0290CZ10[] = +{ +0x20, +0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, +0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, +0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, +0x00 ,0x13 ,0x0A ,0x01 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; +//R21 +const uint8_t lut_ww_WFT0290CZ10[]={ +0x21, +0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, +0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, +0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, +0xA0 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; +//R22H r +const uint8_t lut_bw_WFT0290CZ10[] ={ +0x22, +0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, +0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, +0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, +0x99 ,0x0C ,0x01 ,0x03 ,0x04 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; +//R23H w +const uint8_t lut_wb_WFT0290CZ10[] ={ +0x23, +0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, +0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, +0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, +0x99 ,0x0B ,0x04 ,0x04 ,0x01 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; +//R24H b +const uint8_t lut_bb_WFT0290CZ10[] ={ +0x24, +0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, +0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, +0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, +0x50 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; + +const uint8_t lut_vcomDC_part_WFT0290CZ10[]={ +0x20, +0x02 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01, //GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 +,0x00 ,0x00, }; +const uint8_t lut_ww_part_WFT0290CZ10[]={ +0x21, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_bw_part_WFT0290CZ10[]={ +0x22, +0x80 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01, //LOW - GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_wb_part_WFT0290CZ10[]={ +0x23, +0x40 ,0x30 ,0x00 ,0x00 ,0x00 ,0x01,//HIGH - GND +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; +const uint8_t lut_bb_part_WFT0290CZ10[]={ +0x24, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, }; + +const uint8_t LUTDefault_full_GDEY042Z98[] = { + 0x32, +//VCOM +0x01, 0x28, 0x28, 0x14, 0x3C, 0x01, 0x01, +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, +//RED +0x01, 0x28, 0x28, 0x94, 0xFC, 0x01, 0x01, +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, +//WHITE +0x01, 0x68, 0xA8, 0x14, 0x3C, 0x01, 0x01, +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, +//BLACK +0x01, 0xA8, 0x68, 0x14, 0x3C, 0x01, 0x01, +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, + +0x02, 0x00, 0x00, 0x22, 0x17, 0x41, 0xA8, +0x32, 0x48, + +}; + +const uint8_t LUTDefault_part_GDEY042Z98[] = { + 0x32, + //VCOM + //0x01, 0x0F, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x01, 0x19, 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, + + //WW + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + //BW + 0x01, 0x5E, 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, + + //WB + 0x01, 0x9E, 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, + + //BB + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + //Reserve + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + //Voltage + 0x02, 0x00, 0x00, 0x22, 0x17, 0x41, 0xA8, + 0x32, 0x08, + }; + +static const uint8_t LUTDefault_full_HINKE0266A15A0[] = { + 0x32, // command + + 0x08,0x66,0x48,0x40,0x00,0x00,0x00,//L0 B low-high-low-high + 0x20,0x66,0x12,0x20,0x00,0x00,0x00,//L1 W low-high-low + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,//L4 VCOM + // w1白 b1白 + 0x05,0x00,0x00,0x05,0x00, + //wait + 0x06,0x06,0x06,0x06,0x12, + //b2黑 w2黑 b3白 w3白 + 0x00,0x00,0x15,0x20,0x00, + //b4黑 w4白 + 0x25,0x00,0x00,0x00,0x00, + // + + 0x05,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00, + + 0x15,0x41,0xA8,0x32,0x30,0x0A, + }; + +static const uint8_t LUTDefault_part_HINKE0266A15A0[] = { + 0x32, +0X00,0x40,0x00,0x00,0x00,0x00,0x00, +0X80,0x80,0x00,0x00,0x00,0x00,0x00, +0X40,0x40,0x00,0x00,0x00,0x00,0x00, +0X00,0x80,0x00,0x00,0x00,0x00,0x00, +0X00,0x00,0x00,0x00,0x00,0x00,0x00, + +0x14,0x00,0x00,0x00,0x02, +0x04,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, + +0x15,0x41,0xA8,0x32,0x30,0x0A, +}; \ No newline at end of file