1.3.3: fix 2.66BWR refresh & pre-add new driver

This commit is contained in:
fsender
2023-11-12 04:08:29 +08:00
parent 2aca106448
commit 3ae6156886
41 changed files with 1570 additions and 118 deletions

View File

@@ -1,3 +1,19 @@
## Release 1.3.3 - 2023/11/12
1. 添加了2.66寸三色和黑白的不同驱动程序.
2. guy_epaper 文件夹内添加了一些文件. 为添加新版本驱动做准备.
3. 现在SD卡功能是可移除的. 可以自定义文件系统来初始化并使用. 但是对应的, SD卡引脚设定保留.
4. 优化按键手势的按动手感.
5. 重构了"固定引脚"(DYNAMIC_PIN_SETTINGS被注释)的宏定义逻辑代码. 现在如果在运行过"固定引脚"的程序之后, 再运行常规固件不需要二次配置.
6. 增大了S3的按钮任务栈空间, 避免因为stack overflow导致的任务终止.
7. 修复若干其他方面的bug, 比如配置引脚时, 屏幕没转向.
## Release 1.3.2 - 2023/11/8
1. 按键驱动 (guy_button) 获得新操作更新: (New button gesture)

View File

@@ -4,7 +4,11 @@
<img src="extra/artset/readguy_theme3.png" width="30%" height="auto">
**版本1.3.2正式发布欢迎分享、star和fork~** 上面的图是项目看板娘, 盖. 可爱的盖姐在等你哟~
**版本1.3.3正式发布欢迎分享、star和fork~** 上面的图是项目看板娘, 盖. 可爱的盖姐在等你哟~
**即将发布7个全新的屏幕驱动: 欢迎支持! (详见后面的驱动表格)**
**发布好的全新驱动程序版本号将会是2.0.0!**
欢迎克隆, 项目交流QQ群: 926824162 (萌新可以进来问问题的哟), 项目的 Bilibili 主页: [BV1f94y187wz](https://www.bilibili.com/video/BV1f94y187wz/) 记得三连+关注我这个宝藏up主哦~
@@ -53,14 +57,23 @@ Supported displays: 1.54-inch, 2.13-inch, 2.66-inch, 2.9-inch, 4.2-inch.
| 1 |1.54寸标准 |原创自研 |200*200| 16阶 | 不支持 | 1.3s | 0.35s |
| 2 |1.54寸Lilygo |原创自研 |200*200| 16阶 | 支持 | 2.3s | 0.6s |
| 3 |2.13寸汉朔价签 |原创自研 |122*250| 16阶 | 不支持 | 1.6s | 0.31s |
| 4 |2.13寸三色 |原创自研 |104*212| 16阶 | 支持 | 2s | 0.2s |
| 5 |2.66寸Vusion价签 |和4号相同|152*296| 16阶 | 支持 | 2s | 0.2s |
| 4 |2.13寸低分辨率版 |原创自研 |104*212| 16阶 | 支持 | 1.12s | 0.17s |
| 5 |2.66寸Vusion价签 |和4号相同|152*296| 16阶 | 支持 | 1.12s | 0.17s |
| 6 |2.7寸佳显触摸屏 |和2号相同|176*264| 16阶 | 支持 | 2.3s | 0.6s |
| 7 |2.9寸A01 |和1号相同|128*296| 16阶 | 不支持 | 1.8s | 0.55s |
| 8 |2.9寸T94背光 |和2号相同|128*296| 16阶 | 支持 | 2.3s | 0.6s |
| 9 |3.7寸高dpi墨水屏 |原创自研 |280*480| 16阶 | 不支持 | 1.3s | 0.5s |
|10 |4.2寸HINK黑白价签 |原创自研 |400*300| 16阶 | 支持 | 1.72s | 0.38s |
|11 |4.2寸WF丝印 |原创自研 |400*300| 16阶 | 不支持 | 3.6s | 0.8s |
|12 |2.13寸三色 |和4号相同|122*250| 16阶 | 支持 | 未知 | 未知 |
|13 |2.66寸三色价签 |和4号相同|152*296| 16阶 | 支持 | 2.48s | 0.65s |
|14 |M5 Core.Ink 1.54寸 |即将支持|200*200|/|/|/|/|
|15 |3.7寸低DPI版墨水屏 |即将支持|416*240|/|/|/|/|
|16 |4.26寸高分辨率墨水屏|即将支持|800*480|/|/|/|/|
|17 |5.83寸墨水屏幕 |即将支持|600*448|/|/|/|/|
|18 |5.83寸GDEQ0583T31 |即将支持|640*480|/|/|/|/|
|19 |7.5寸三色墨水屏幕 |即将支持|800*480|/|/|/|/|
|20 |10.2寸GDEQ102T90 |即将支持|960*640|/|/|/|/|
可以自己在代码中加入你想要的屏幕型号

View File

@@ -96,6 +96,7 @@ void setup(){
//guy.print("Hello Readguy!"); //使用这个函数也能显示出字符串, 但是需要提前使用setCursor确定显示坐标
guy.display(READGUY_FAST); // 快速刷新. 将屏幕缓存内的内容显示到墨水屏幕上
// 但是, 上电初始化之后的首次刷新必为慢速刷新
//guy.display(READGUY_SLOW); // 慢速刷新.
guy.setCursor(10,30); //设置显示的坐标

View File

@@ -0,0 +1,74 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_template.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 源代码模板
* 使用前, 先查找替换 template 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 template 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "guy_template.h"
#ifdef READGUY_DEV_template
namespace guydev_template{
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drv::drv_init(){ //初始化屏幕
//add driver code...
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
//add driver code...
}
void drv::drv_setDepth(uint8_t i){
epdFull=0; iLut = i?(i>15?15:i):15; //如果需要, 改成自己的代码
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新
if(m&1){//stage 1
if(lastRefresh) drv_dispWriter(f,2);
//add driver code...
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=epdFull?slowRefTime:fastRefTime; //全刷:局刷 busy时间
if(ms<u) guy_epdBusy(u-ms); //对于busy电平为低电平忙碌,高电平正常的屏幕则改为ms-u
lastRefresh=0;
//add driver code...
}
}
void drv::drv_sleep() { //开始屏幕睡眠
if(RST_PIN>=0){ //RST_PIN<0 无法唤醒
//add driver code...
}
epd_PowerOn = 0;
epdFull = 1; //强制设置为慢刷新模式
}
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,63 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_template.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 头文件模板
* 使用前, 先查找替换 template 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 template 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPDtemplate_H_FILE) && (defined(READGUY_DEV_template)))
#define _GUY_EPDtemplate_H_FILE
namespace guydev_template{
constexpr int GUY_D_WIDTH =200; //驱动屏幕宽度
constexpr int GUY_D_HEIGHT =200; //驱动屏幕高度
constexpr int slowRefTime =2000; //驱动屏幕慢刷时间, 单位毫秒
constexpr int fastRefTime =500; //驱动屏幕快刷时间, 单位毫秒
class drv : public readguyEpdBase {
public:
int drv_ID() const { return READGUY_DEV_template; }
void drv_init(); //初始化屏幕
void drv_fullpart(bool part); //切换慢刷/快刷功能
void drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m=3); //按照函数刷新
void drv_sleep() ; //开始屏幕睡眠
int drv_width() const { return GUY_D_WIDTH; }; //返回显示区域宽度
//int drv_panelwidth() const { return GUY_D_WIDTH; }; //返回缓存的数据宽度
int drv_height() const{ return GUY_D_HEIGHT; }; //返回显示区域高度
void drv_setDepth(uint8_t i); //设置显示颜色深度
int drv_supportGreyscaling() const { return 16; }
private:
uint8_t epd_PowerOn=1; //是否上电. 睡眠则设为0
uint8_t epdFull=0; //是partical模式/快速刷新模式 0快刷, 1慢刷
uint8_t iLut=15; //颜色深度
};
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,23 @@
# 添加新驱动程序
1. 将文件夹 guy_template 整个拷贝到 guy_epaper 文件夹下
2. 根据里面的模板文件, 添加自定义驱动.
3. 使用查找工具搜索 src 下的以下文本.
```
//添加新屏幕型号 add displays here
```
然后把新加入的屏幕驱动 define 给加上
4. 更新 `EPD_DRIVERS_NUM_MAX` 变量, 表明一共有多少个驱动可用.
5. 加好了之后, 应该就可以使用这个驱动了.
6. 记得更改项目根目录的 readme 文件
# 禁用驱动程序
前往 guy_epaper_config.h 文件, 注释掉不需要编译的驱动文件即可

View File

@@ -971,7 +971,11 @@ CONFIG_MBEDTLS_TLS_ENABLED=y
#
# TLS Key Exchange Methods
#
# CONFIG_MBEDTLS_PSK_MODES is not set
CONFIG_MBEDTLS_PSK_MODES=y
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y

View File

@@ -1012,7 +1012,11 @@ CONFIG_MBEDTLS_TLS_ENABLED=y
#
# TLS Key Exchange Methods
#
# CONFIG_MBEDTLS_PSK_MODES is not set
CONFIG_MBEDTLS_PSK_MODES=y
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y

View File

@@ -978,7 +978,11 @@ CONFIG_MBEDTLS_TLS_ENABLED=y
#
# TLS Key Exchange Methods
#
# CONFIG_MBEDTLS_PSK_MODES is not set
CONFIG_MBEDTLS_PSK_MODES=y
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y

View File

@@ -11,7 +11,7 @@
"type": "git",
"url": "https://github.com/fsender/readguy"
},
"version": "1.3.2",
"version": "1.3.3",
"frameworks": "arduino",
"platforms": ["espressif32", "espressif8266"],
"headers": "readguy.h",

View File

@@ -1,5 +1,5 @@
name=readguy
version=1.3.2
version=1.3.3
author=fsender <f_ender@163.com>
maintainer=fsender <f_ender@163.com>
sentence=A free E-paper display driver library supports 16-level greyscale.

View File

@@ -6,11 +6,16 @@
* @file guy_driver_config.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief readguy 基础配置文件. 用户可以根据自己对库的编译需求来修改此文件.
*
* 如果你希望在程序代码内包含引脚定义, 请参考此文件下方的注释来确定并编译
* !!!但是这样编译得到的程序不具备跨平台特性.!!!
* 可以禁用WiFi功能来减少ESP32的flash消耗
* @version 1.0
* @date 2023-09-21
* 这样就可以只针对你设计的这一个硬件来设定引脚功能.
* 关于屏幕配置, 请参考 guy_epaper/guy_epaper_config.h 文件来配置到底哪些屏幕型号的屏幕会被包含进来
* 可以禁用WiFi功能来减少程序的flash消耗
* @version 1.1
* @date create: 2023-09-21
* last modify: 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
@@ -61,6 +66,7 @@
/// @brief 使用静态的数据 !!!注意:注释此选项编写的程序是不支持跨平台运行的!!!
/// @note 相比于禁用WiFi配网功能, 禁用此功能减少的flash并不多, 为保证程序可在不同屏幕上运行, 请不要注释此选项
// 关闭此选项自动禁用wifi功能. 如需wifi功能需要自己在程序里加.
#define DYNAMIC_PIN_SETTINGS
/// @brief 启用WIFI配网功能.必须先启用 #define DYNAMIC_PIN_SETTINGS. 此选项对 ESP32xx 会减少大量flash.
@@ -69,11 +75,20 @@
/// @brief 启用I2C功能. 可用于联网时钟, 温度计, 陀螺仪等外设. 目前暂不支持库内使用类似函数. 仅可以提供引脚定义
#define READGUY_ENABLE_I2C
/** @brief (即将推出) 启用SD卡功能. 开启此功能将会使用内置SD卡管理功能. 关闭后仅可保存SD卡用到的引脚.
@note 会破坏兼容性. 若没有启用通用的SD卡驱动程序, 那么那些跨屏台编译的程序将无法用guyFS读取到SD卡.
若用户程序希望能从外部加载SD卡, 可以使用getSdMiso()等函数获取SD卡的Miso等引脚, 再由用户程序初始化SD卡. */
#define READGUY_ENABLE_SD
/// @brief 使用LittleFS作为片上文件系统, 注释此行则用SPIFFS(功能少, 不好用)
#define READGUY_USE_LITTLEFS 1
/// @brief ESP32按键服务任务的栈空间大小, 不建议普通用户更改. 默认值1024字节. 小于此大小会使程序栈溢出.
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define BTN_LOOPTASK_STACK 1280
#else
#define BTN_LOOPTASK_STACK 1024
#endif
/// @brief ESP32按键服务任务运行在哪个核心. 通常运行在核心0上.
#define BTN_LOOPTASK_CORE_ID 0

View File

@@ -0,0 +1,74 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_1020A.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 源代码模板
* 使用前, 先查找替换 1020A 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 1020A 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "guy_1020A.h"
#ifdef READGUY_DEV_1020A
namespace guydev_1020A{
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drv::drv_init(){ //初始化屏幕
//add driver code...
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
//add driver code...
}
void drv::drv_setDepth(uint8_t i){
epdFull=0; iLut = i?(i>15?15:i):15; //如果需要, 改成自己的代码
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新
if(m&1){//stage 1
if(lastRefresh) drv_dispWriter(f,2);
//add driver code...
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=epdFull?slowRefTime:fastRefTime; //全刷:局刷 busy时间
if(ms<u) guy_epdBusy(u-ms); //对于busy电平为低电平忙碌,高电平正常的屏幕则改为ms-u
lastRefresh=0;
//add driver code...
}
}
void drv::drv_sleep() { //开始屏幕睡眠
if(RST_PIN>=0){ //RST_PIN<0 无法唤醒
//add driver code...
}
epd_PowerOn = 0;
epdFull = 1; //强制设置为慢刷新模式
}
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,63 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_1020A.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 头文件模板
* 使用前, 先查找替换 1020A 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 1020A 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPD1020A_H_FILE) && (defined(READGUY_DEV_1020A)))
#define _GUY_EPD1020A_H_FILE
namespace guydev_1020A{
constexpr int GUY_D_WIDTH =200; //驱动屏幕宽度
constexpr int GUY_D_HEIGHT =200; //驱动屏幕高度
constexpr int slowRefTime =2000; //驱动屏幕慢刷时间, 单位毫秒
constexpr int fastRefTime =500; //驱动屏幕快刷时间, 单位毫秒
class drv : public readguyEpdBase {
public:
int drv_ID() const { return READGUY_DEV_1020A; }
void drv_init(); //初始化屏幕
void drv_fullpart(bool part); //切换慢刷/快刷功能
void drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m=3); //按照函数刷新
void drv_sleep() ; //开始屏幕睡眠
int drv_width() const { return GUY_D_WIDTH; }; //返回显示区域宽度
//int drv_panelwidth() const { return GUY_D_WIDTH; }; //返回缓存的数据宽度
int drv_height() const{ return GUY_D_HEIGHT; }; //返回显示区域高度
void drv_setDepth(uint8_t i); //设置显示颜色深度
int drv_supportGreyscaling() const { return 16; }
private:
uint8_t epd_PowerOn=1; //是否上电. 睡眠则设为0
uint8_t epdFull=0; //是partical模式/快速刷新模式 0快刷, 1慢刷
uint8_t iLut=15; //颜色深度
};
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,69 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_154c.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 1.54英寸墨水屏 驱动库函数
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "guy_154C.h"
#ifdef READGUY_DEV_154C
namespace guydev_154C{
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drv::drv_init(){ //初始化屏幕
//add driver code...
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
//add driver code...
}
void drv::drv_setDepth(uint8_t i){
epdFull=0; iLut = i?(i>15?15:i):15; //如果需要, 改成自己的代码
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新
if(m&1){//stage 1
if(lastRefresh) drv_dispWriter(f,2);
//add driver code...
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=epdFull?slowRefTime:fastRefTime; //全刷:局刷 busy时间
if(ms<u) guy_epdBusy(u-ms); //对于busy电平为低电平忙碌,高电平正常的屏幕则改为ms-u
lastRefresh=0;
//add driver code...
}
}
void drv::drv_sleep() { //开始屏幕睡眠
if(RST_PIN>=0){ //RST_PIN<0 无法唤醒
//add driver code...
}
epd_PowerOn = 0;
epdFull = 1; //强制设置为慢刷新模式
}
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,58 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_154c.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 1.54英寸墨水屏 驱动库函数 头文件
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPD154C_H_FILE) && (defined(READGUY_DEV_154C)))
#define _GUY_EPD154C_H_FILE
namespace guydev_154C{
constexpr int GUY_D_WIDTH =200; //驱动屏幕宽度
constexpr int GUY_D_HEIGHT =200; //驱动屏幕高度
constexpr int slowRefTime =2000; //驱动屏幕慢刷时间, 单位毫秒
constexpr int fastRefTime =500; //驱动屏幕快刷时间, 单位毫秒
class drv : public readguyEpdBase {
public:
int drv_ID() const { return READGUY_DEV_154C; }
void drv_init(); //初始化屏幕
void drv_fullpart(bool part); //切换慢刷/快刷功能
void drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m=3); //按照函数刷新
void drv_sleep() ; //开始屏幕睡眠
int drv_width() const { return GUY_D_WIDTH; }; //返回显示区域宽度
//int drv_panelwidth() const { return GUY_D_WIDTH; }; //返回缓存的数据宽度
int drv_height() const{ return GUY_D_HEIGHT; }; //返回显示区域高度
void drv_setDepth(uint8_t i); //设置显示颜色深度
int drv_supportGreyscaling() const { return 16; }
private:
uint8_t epd_PowerOn=1; //是否上电. 睡眠则设为0
uint8_t epdFull=0; //是partical模式/快速刷新模式 0快刷, 1慢刷
uint8_t iLut=15; //颜色深度
};
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -98,6 +98,7 @@ void drvBase::drv_init(){ //new init method can init without freshing.
//drv_color(0xffu); //睡眠模式下始终需要慢刷
}
void drvBase::drv_fullpart(bool part){ //切换慢刷/快刷功能
if(lastRefresh) return;
if(!part) iLut=15;
if(sleeping) iLut=15;
else Init(part?lut_fast:lut_slow);

View File

@@ -144,6 +144,7 @@ void drvSSD168x::drv_init(){
//drv_color(0xffu);
}
void drvSSD168x::drv_fullpart(bool part){ //切换慢刷/快刷功能
if(lastRefresh) return;
if(!epd_PowerOn) part=0; //未上电 无法局刷
if(!part) { iLut=15; greyScaling=0; }
_part=part;

View File

@@ -113,6 +113,7 @@ void drv::drv_init(){ //初始化屏幕
//drv_color(0xff);
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
if(!epd_PowerOn) part=0; //未上电 无法局刷
//if(part==epdFull) return;
if(!part) iLut=15; //恢复默认的灰度模式

View File

@@ -30,7 +30,8 @@
#include <stdlib.h>
#include "guy_213b_266a.h"
// #define MEPD_DEBUG_WAVE
#ifdef READGUY_DEV_266A
#if (defined(READGUY_DEV_213B) || defined(READGUY_DEV_213B3C) \
|| defined(READGUY_DEV_266A) || defined(READGUY_DEV_266A3C))
namespace guydev_213B_266A{
static const PROGMEM unsigned char lutSlow_vcom0[] ={
0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
@@ -68,21 +69,30 @@ static const PROGMEM unsigned char lutSlow_b_b[] ={
static const PROGMEM unsigned char lutFast_[]={
0x00,0x18,0x5a,0xa5,0x24
};
static const PROGMEM unsigned char greyLutLevel[]={
0, 3, 6, 9,12,15,18,21,24,28,31,34,37,42,48,54, //for BWR displays
0, 3, 5, 7,10,13,16,19,22,25,29,32,35,38,43,49,
0, 3, 5, 6, 8,11,14,17,20,23,26,29,32,35,39,44,
0, 2, 4, 5, 6, 8,10,13,15,18,21,24,27,31,35,39,
0, 2, 3, 5, 6, 7, 8,10,12,15,17,19,22,24,27,30,
0, 2, 3, 4, 5, 6, 7, 8,10,12,14,16,18,20,22,24,
0, 3, 3, 3, 4, 4, 5, 6, 7, 9,12,16,21,28,36,48,
};
drv_base::drv_base(){
guy_lutArray[0] = lutSlow_vcom0;
guy_lutArray[1] = lutSlow_w_w;
guy_lutArray[2] = lutSlow_b_w;
guy_lutArray[3] = lutSlow_w_b;
guy_lutArray[4] = lutSlow_b_b;
guy_lutArray[5] = lutFast_;
}
void drv_base::epd_init(){
//if(!Power_is_on) Reset();
guy_epdCmd(0x01);
guy_epdParam(0x03);
guy_epdParam(0x00);
guy_epdParam(0x2b);
guy_epdParam(0x2b);
guy_epdParam(0x10);
guy_epdParam(isBWR?0x3f:0x2b);
guy_epdParam(isBWR?0x3f:0x2b);
guy_epdParam(0x03);
guy_epdCmd(0x06);
guy_epdParam(0x17);
@@ -92,7 +102,7 @@ void drv_base::epd_init(){
guy_epdParam(0xbf);
guy_epdParam(0x0d);
guy_epdCmd(0x30);
guy_epdParam(0x29); //0x3a:100Hz, 0x29:150Hz
guy_epdParam(isBWR?0x3b:0x29); //0x3a:100Hz, 0x29:150Hz
guy_epdCmd(0x61);
guy_epdParam(0x98);
guy_epdParam(0x01);
@@ -118,9 +128,9 @@ void drv_base::SendLuts(bool part_lut){
guy_epdCmd(i+0x20);
for(int j=0;j<(i==0?44:42);j++){
if(part_lut){
if(j==4 && ((i==2) || (greyHQ==3 && i==4))) guy_epdParam(15);
else if(j==greyHQ) guy_epdParam(greyLut);
else if(j==0) guy_epdParam(pgm_read_byte(guy_lutArray[5]+(i)));
if(j==4 && ((i==2) || (greyHQ==3 && i==4))) guy_epdParam(isBWR?0x2f:0x0f); //刷黑->白
else if(j==greyHQ) guy_epdParam(isBWR?pgm_read_byte(greyLutLevel+(greyLut+refTime*16)):greyLut);
else if(j==0) guy_epdParam(pgm_read_byte(lutFast_+(i)));
else if(j==5) guy_epdParam(1);
else guy_epdParam(0x0);
}
@@ -141,6 +151,7 @@ void drv_base::drv_init(){
//drv_color(0xff);
}
void drv_base::drv_fullpart(bool part){ //切换慢刷/快刷功能
if(lastRefresh) return;
if(!Power_is_on) part=0;
if(!part) greyLut=15; //恢复默认的灰度模式
part_mode = part;
@@ -167,31 +178,28 @@ void drv_base::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色
guy_epdCmd(0x92);
if(part_mode){
guy_epdCmd(0x30);
guy_epdParam(0x3a); //0x3a:100Hz, 0x29:150Hz
//guy_epdParam(0x3a); //黑白色用此行, 三色用下一行
guy_epdParam(isBWR?0x19:(refTime?0x21:0x3a)); //0x3a:100Hz, 0x29:150Hz
send_zoneInfo();
guy_epdCmd(0x12);
EndTransfer();
}
else{
guy_epdCmd(0x12);
EndTransfer();
}
guy_epdCmd(0x12);
EndTransfer();
lastRefresh=millis();
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
if(part_mode){
if(ms<200) guy_epdBusy(ms-200);
//guy_epdBusy(-200);
if((int32_t)ms<fastRefTime) guy_epdBusy((int32_t)ms-fastRefTime);
refTime+=(refTime<5);
}
else{
if(ms<2000) guy_epdBusy(ms-2000);
//guy_epdBusy(-2000);
if((int32_t)ms<slowRefTime) guy_epdBusy((int32_t)ms-slowRefTime);
BeginTransfer();
epd_init();
SendLuts(1);
guy_epdCmd(0x92);
EndTransfer();
refTime=0;
}
lastRefresh=0;
}
@@ -213,6 +221,7 @@ void drv_base::drv_draw16grey_step(std::function<uint8_t(int)> f, int step){
if(_quality&1) return readguyEpdBase::drv_draw16grey_step(f,step);
if(step==1){
greyHQ=3;
refTime=6;
drv_setDepth(3);
drv_fullpart(1); //开始快刷
}
@@ -221,6 +230,7 @@ void drv_base::drv_draw16grey_step(std::function<uint8_t(int)> f, int step){
drv_dispWriter(f);
if(step==15){
greyHQ=4;
refTime=5;
drv_setDepth(15);
}
} //据说可以设置灰度渲染方式. 好像是调用setGreyQuality函数就行来着

View File

@@ -6,8 +6,10 @@
* @file guy_213b_266a.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 2.13英寸B型墨水屏和 2.66英寸墨水屏 驱动库函数 头文件
* @version 1.0
* @date 2023-09-21
* 增加了对三色屏幕的支持
* @version 1.1
* @date create: 2023-09-21
* last modify: 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
@@ -29,7 +31,8 @@
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPD213B_266A_H_FILE) && \
(defined(READGUY_DEV_266A) || defined(READGUY_DEV_213B)))
(defined(READGUY_DEV_213B) || defined(READGUY_DEV_213B3C) \
|| defined(READGUY_DEV_266A) || defined(READGUY_DEV_266A3C)))
#define _GUY_EPD213B_266A_H_FILE
namespace guydev_213B_266A{
@@ -49,7 +52,6 @@ public:
protected:
int epdWidth;
int epdHeight;
private:
void epd_init();
void send_zoneInfo();
void SendLuts(bool part_lut);
@@ -57,22 +59,40 @@ private:
uint8_t Power_is_on = 2; //初始为未上电
uint8_t greyLut=15;
uint8_t greyHQ=4; // greyHQ==3 时 为高品质刷新灰度 否则为常规方式刷新灰度
const uint8_t *guy_lutArray[6];
uint8_t refTime=0;
uint8_t isBWR=0; //三色2.66将此屏幕数值改为1.
int16_t slowRefTime;
int16_t fastRefTime;
const uint8_t *guy_lutArray[5];
};
#ifdef READGUY_DEV_213B
class dev213B : public drv_base {
public:
dev213B(){ epdWidth=104; epdHeight=212; }
dev213B(){ epdWidth=104; epdHeight=212; slowRefTime=1300; fastRefTime=200; }
int drv_ID() const { return READGUY_DEV_213B; }
};
#endif
#ifdef READGUY_DEV_213B3C
class dev213B3C : public drv_base {
public:
dev213B3C(){ epdWidth=104; epdHeight=212; isBWR=1; slowRefTime=2800; fastRefTime=800; }
int drv_ID() const { return READGUY_DEV_213B3C; }
};
#endif
#ifdef READGUY_DEV_266A
class dev266A : public drv_base {
public:
dev266A(){ epdWidth=152; epdHeight=296; }
dev266A(){ epdWidth=152; epdHeight=296; slowRefTime=1300; fastRefTime=200; }
int drv_ID() const { return READGUY_DEV_266A; }
};
#endif
#ifdef READGUY_DEV_266A3C
class dev266A3C : public drv_base {
public:
dev266A3C(){ epdWidth=152; epdHeight=296; isBWR=1; slowRefTime=2800; fastRefTime=800; }
int drv_ID() const { return READGUY_DEV_266A3C; }
};
#endif
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,74 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_370B.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 源代码模板
* 使用前, 先查找替换 370B 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 370B 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "guy_370B.h"
#ifdef READGUY_DEV_370B
namespace guydev_370B{
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drv::drv_init(){ //初始化屏幕
//add driver code...
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
//add driver code...
}
void drv::drv_setDepth(uint8_t i){
epdFull=0; iLut = i?(i>15?15:i):15; //如果需要, 改成自己的代码
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新
if(m&1){//stage 1
if(lastRefresh) drv_dispWriter(f,2);
//add driver code...
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=epdFull?slowRefTime:fastRefTime; //全刷:局刷 busy时间
if(ms<u) guy_epdBusy(u-ms); //对于busy电平为低电平忙碌,高电平正常的屏幕则改为ms-u
lastRefresh=0;
//add driver code...
}
}
void drv::drv_sleep() { //开始屏幕睡眠
if(RST_PIN>=0){ //RST_PIN<0 无法唤醒
//add driver code...
}
epd_PowerOn = 0;
epdFull = 1; //强制设置为慢刷新模式
}
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,63 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_370B.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 头文件模板
* 使用前, 先查找替换 370B 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 370B 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPD370B_H_FILE) && (defined(READGUY_DEV_370B)))
#define _GUY_EPD370B_H_FILE
namespace guydev_370B{
constexpr int GUY_D_WIDTH =200; //驱动屏幕宽度
constexpr int GUY_D_HEIGHT =200; //驱动屏幕高度
constexpr int slowRefTime =2000; //驱动屏幕慢刷时间, 单位毫秒
constexpr int fastRefTime =500; //驱动屏幕快刷时间, 单位毫秒
class drv : public readguyEpdBase {
public:
int drv_ID() const { return READGUY_DEV_370B; }
void drv_init(); //初始化屏幕
void drv_fullpart(bool part); //切换慢刷/快刷功能
void drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m=3); //按照函数刷新
void drv_sleep() ; //开始屏幕睡眠
int drv_width() const { return GUY_D_WIDTH; }; //返回显示区域宽度
//int drv_panelwidth() const { return GUY_D_WIDTH; }; //返回缓存的数据宽度
int drv_height() const{ return GUY_D_HEIGHT; }; //返回显示区域高度
void drv_setDepth(uint8_t i); //设置显示颜色深度
int drv_supportGreyscaling() const { return 16; }
private:
uint8_t epd_PowerOn=1; //是否上电. 睡眠则设为0
uint8_t epdFull=0; //是partical模式/快速刷新模式 0快刷, 1慢刷
uint8_t iLut=15; //颜色深度
};
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -110,7 +110,7 @@ void drv::drv_init(){ //初始化屏幕
//drv_color(0xff);
}
void drv::drv_fullpart(bool part){ //切换慢刷/快刷功能
if(sleeping) return;
if(lastRefresh || sleeping) return;
if(!part) {
greyScaling=15; //恢复默认的灰度模式
BeginTransfer();

View File

@@ -182,6 +182,7 @@ void drv::drv_init(){ //初始化屏幕
//drv_color(0xff);
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
if(epdFull<=1) epdFull = !part; //epdFull==2代表睡眠中, 不能快刷
if(epdFull) GreyScaling=0;
}

View File

@@ -187,8 +187,8 @@ void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=part_mode?800:3600;
if(ms<u) guy_epdBusy(ms-u);
int32_t u=part_mode?800:3600;
if((int32_t)ms<u) guy_epdBusy((int32_t)ms-u);
lastRefresh=0;
BeginTransfer();
if(part_mode){
@@ -224,6 +224,7 @@ void drv::drv_init(){
//drv_color(0xffu);
}
void drv::drv_fullpart(bool part){ //切换慢刷/快刷功能
if(lastRefresh) return;
if(Power_is_on) {
if(!part) customLut = CUSTOM_LUT_DISABLE;
part_mode = part;

View File

@@ -0,0 +1,74 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_426A.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 源代码模板
* 使用前, 先查找替换 426A 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 426A 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "guy_426A.h"
#ifdef READGUY_DEV_426A
namespace guydev_426A{
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drv::drv_init(){ //初始化屏幕
//add driver code...
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
//add driver code...
}
void drv::drv_setDepth(uint8_t i){
epdFull=0; iLut = i?(i>15?15:i):15; //如果需要, 改成自己的代码
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新
if(m&1){//stage 1
if(lastRefresh) drv_dispWriter(f,2);
//add driver code...
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=epdFull?slowRefTime:fastRefTime; //全刷:局刷 busy时间
if(ms<u) guy_epdBusy(u-ms); //对于busy电平为低电平忙碌,高电平正常的屏幕则改为ms-u
lastRefresh=0;
//add driver code...
}
}
void drv::drv_sleep() { //开始屏幕睡眠
if(RST_PIN>=0){ //RST_PIN<0 无法唤醒
//add driver code...
}
epd_PowerOn = 0;
epdFull = 1; //强制设置为慢刷新模式
}
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,63 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_426A.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 头文件模板
* 使用前, 先查找替换 426A 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 426A 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPD426A_H_FILE) && (defined(READGUY_DEV_426A)))
#define _GUY_EPD426A_H_FILE
namespace guydev_426A{
constexpr int GUY_D_WIDTH =200; //驱动屏幕宽度
constexpr int GUY_D_HEIGHT =200; //驱动屏幕高度
constexpr int slowRefTime =2000; //驱动屏幕慢刷时间, 单位毫秒
constexpr int fastRefTime =500; //驱动屏幕快刷时间, 单位毫秒
class drv : public readguyEpdBase {
public:
int drv_ID() const { return READGUY_DEV_426A; }
void drv_init(); //初始化屏幕
void drv_fullpart(bool part); //切换慢刷/快刷功能
void drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m=3); //按照函数刷新
void drv_sleep() ; //开始屏幕睡眠
int drv_width() const { return GUY_D_WIDTH; }; //返回显示区域宽度
//int drv_panelwidth() const { return GUY_D_WIDTH; }; //返回缓存的数据宽度
int drv_height() const{ return GUY_D_HEIGHT; }; //返回显示区域高度
void drv_setDepth(uint8_t i); //设置显示颜色深度
int drv_supportGreyscaling() const { return 16; }
private:
uint8_t epd_PowerOn=1; //是否上电. 睡眠则设为0
uint8_t epdFull=0; //是partical模式/快速刷新模式 0快刷, 1慢刷
uint8_t iLut=15; //颜色深度
};
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,74 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_583A.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 源代码模板
* 使用前, 先查找替换 583A 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 583A 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "guy_583A.h"
#ifdef READGUY_DEV_583A
namespace guydev_583A{
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drv::drv_init(){ //初始化屏幕
//add driver code...
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
//add driver code...
}
void drv::drv_setDepth(uint8_t i){
epdFull=0; iLut = i?(i>15?15:i):15; //如果需要, 改成自己的代码
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新
if(m&1){//stage 1
if(lastRefresh) drv_dispWriter(f,2);
//add driver code...
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=epdFull?slowRefTime:fastRefTime; //全刷:局刷 busy时间
if(ms<u) guy_epdBusy(u-ms); //对于busy电平为低电平忙碌,高电平正常的屏幕则改为ms-u
lastRefresh=0;
//add driver code...
}
}
void drv::drv_sleep() { //开始屏幕睡眠
if(RST_PIN>=0){ //RST_PIN<0 无法唤醒
//add driver code...
}
epd_PowerOn = 0;
epdFull = 1; //强制设置为慢刷新模式
}
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,63 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_583A.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 头文件模板
* 使用前, 先查找替换 583A 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 583A 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPD583A_H_FILE) && (defined(READGUY_DEV_583A)))
#define _GUY_EPD583A_H_FILE
namespace guydev_583A{
constexpr int GUY_D_WIDTH =200; //驱动屏幕宽度
constexpr int GUY_D_HEIGHT =200; //驱动屏幕高度
constexpr int slowRefTime =2000; //驱动屏幕慢刷时间, 单位毫秒
constexpr int fastRefTime =500; //驱动屏幕快刷时间, 单位毫秒
class drv : public readguyEpdBase {
public:
int drv_ID() const { return READGUY_DEV_583A; }
void drv_init(); //初始化屏幕
void drv_fullpart(bool part); //切换慢刷/快刷功能
void drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m=3); //按照函数刷新
void drv_sleep() ; //开始屏幕睡眠
int drv_width() const { return GUY_D_WIDTH; }; //返回显示区域宽度
//int drv_panelwidth() const { return GUY_D_WIDTH; }; //返回缓存的数据宽度
int drv_height() const{ return GUY_D_HEIGHT; }; //返回显示区域高度
void drv_setDepth(uint8_t i); //设置显示颜色深度
int drv_supportGreyscaling() const { return 16; }
private:
uint8_t epd_PowerOn=1; //是否上电. 睡眠则设为0
uint8_t epdFull=0; //是partical模式/快速刷新模式 0快刷, 1慢刷
uint8_t iLut=15; //颜色深度
};
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,74 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_583B.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 源代码模板
* 使用前, 先查找替换 583B 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 583B 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "guy_583B.h"
#ifdef READGUY_DEV_583B
namespace guydev_583B{
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drv::drv_init(){ //初始化屏幕
//add driver code...
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
//add driver code...
}
void drv::drv_setDepth(uint8_t i){
epdFull=0; iLut = i?(i>15?15:i):15; //如果需要, 改成自己的代码
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新
if(m&1){//stage 1
if(lastRefresh) drv_dispWriter(f,2);
//add driver code...
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=epdFull?slowRefTime:fastRefTime; //全刷:局刷 busy时间
if(ms<u) guy_epdBusy(u-ms); //对于busy电平为低电平忙碌,高电平正常的屏幕则改为ms-u
lastRefresh=0;
//add driver code...
}
}
void drv::drv_sleep() { //开始屏幕睡眠
if(RST_PIN>=0){ //RST_PIN<0 无法唤醒
//add driver code...
}
epd_PowerOn = 0;
epdFull = 1; //强制设置为慢刷新模式
}
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,63 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_583B.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 头文件模板
* 使用前, 先查找替换 583B 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 583B 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPD583B_H_FILE) && (defined(READGUY_DEV_583B)))
#define _GUY_EPD583B_H_FILE
namespace guydev_583B{
constexpr int GUY_D_WIDTH =200; //驱动屏幕宽度
constexpr int GUY_D_HEIGHT =200; //驱动屏幕高度
constexpr int slowRefTime =2000; //驱动屏幕慢刷时间, 单位毫秒
constexpr int fastRefTime =500; //驱动屏幕快刷时间, 单位毫秒
class drv : public readguyEpdBase {
public:
int drv_ID() const { return READGUY_DEV_583B; }
void drv_init(); //初始化屏幕
void drv_fullpart(bool part); //切换慢刷/快刷功能
void drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m=3); //按照函数刷新
void drv_sleep() ; //开始屏幕睡眠
int drv_width() const { return GUY_D_WIDTH; }; //返回显示区域宽度
//int drv_panelwidth() const { return GUY_D_WIDTH; }; //返回缓存的数据宽度
int drv_height() const{ return GUY_D_HEIGHT; }; //返回显示区域高度
void drv_setDepth(uint8_t i); //设置显示颜色深度
int drv_supportGreyscaling() const { return 16; }
private:
uint8_t epd_PowerOn=1; //是否上电. 睡眠则设为0
uint8_t epdFull=0; //是partical模式/快速刷新模式 0快刷, 1慢刷
uint8_t iLut=15; //颜色深度
};
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,74 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_750A.cpp
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 源代码模板
* 使用前, 先查找替换 750A 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 750A 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdlib.h>
#include "guy_750A.h"
#ifdef READGUY_DEV_750A
namespace guydev_750A{
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drv::drv_init(){ //初始化屏幕
//add driver code...
}
void drv::drv_fullpart(bool part){ //初始化慢刷功能
if(lastRefresh) return;
//add driver code...
}
void drv::drv_setDepth(uint8_t i){
epdFull=0; iLut = i?(i>15?15:i):15; //如果需要, 改成自己的代码
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新
if(m&1){//stage 1
if(lastRefresh) drv_dispWriter(f,2);
//add driver code...
}
if(m&2){//stage 2
uint32_t ms=millis()-lastRefresh;
uint32_t u=epdFull?slowRefTime:fastRefTime; //全刷:局刷 busy时间
if(ms<u) guy_epdBusy(u-ms); //对于busy电平为低电平忙碌,高电平正常的屏幕则改为ms-u
lastRefresh=0;
//add driver code...
}
}
void drv::drv_sleep() { //开始屏幕睡眠
if(RST_PIN>=0){ //RST_PIN<0 无法唤醒
//add driver code...
}
epd_PowerOn = 0;
epdFull = 1; //强制设置为慢刷新模式
}
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -0,0 +1,63 @@
/******************** F r i e n d s h i p E n d e r ********************
* 本程序隶属于 Readguy 开源项目, 请尊重开源开发者, 也就是我FriendshipEnder.
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
* @file guy_750A.h
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
* @brief 墨水屏 驱动库函数 头文件模板
* 使用前, 先查找替换 750A 改为你需要的驱动名称
* 比如3英寸的屏幕驱动程序应该叫 guy_dev_300a
* 此时需要将 750A 替换为300A.
* 替换好之后, 改文件名, 大小写也要注意改 (文件名最好不要出现大写)
* 最后把这个brief替换掉
* @version 1.0
* @date 2023-11-11
* @attention
* Copyright (c) 2022-2023 FriendshipEnder
*
* Apache License, Version 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../guy_epdbase.h"
#if (!defined(_GUY_EPD750A_H_FILE) && (defined(READGUY_DEV_750A)))
#define _GUY_EPD750A_H_FILE
namespace guydev_750A{
constexpr int GUY_D_WIDTH =200; //驱动屏幕宽度
constexpr int GUY_D_HEIGHT =200; //驱动屏幕高度
constexpr int slowRefTime =2000; //驱动屏幕慢刷时间, 单位毫秒
constexpr int fastRefTime =500; //驱动屏幕快刷时间, 单位毫秒
class drv : public readguyEpdBase {
public:
int drv_ID() const { return READGUY_DEV_750A; }
void drv_init(); //初始化屏幕
void drv_fullpart(bool part); //切换慢刷/快刷功能
void drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m=3); //按照函数刷新
void drv_sleep() ; //开始屏幕睡眠
int drv_width() const { return GUY_D_WIDTH; }; //返回显示区域宽度
//int drv_panelwidth() const { return GUY_D_WIDTH; }; //返回缓存的数据宽度
int drv_height() const{ return GUY_D_HEIGHT; }; //返回显示区域高度
void drv_setDepth(uint8_t i); //设置显示颜色深度
int drv_supportGreyscaling() const { return 16; }
private:
uint8_t epd_PowerOn=1; //是否上电. 睡眠则设为0
uint8_t epdFull=0; //是partical模式/快速刷新模式 0快刷, 1慢刷
uint8_t iLut=15; //颜色深度
};
}
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -44,7 +44,7 @@
#define READGUY_DEV_154A 0 //1.54寸标准, 甘草酸不酸使用的1.54默认屏幕型号. 1.54汉朔价签也选这个
#define READGUY_DEV_154B 1 //1.54寸Lilygo, lilygo的1.54触摸和1.54背光墨水屏. GDEH0154D67
#define READGUY_DEV_213A 2 //2.13寸汉朔价签, 价格便宜, 兼容性好. 夏襄居士单词卡用 GDE0213B1
#define READGUY_DEV_213B 3 //2.13寸三色, 分辨率低212x104, 部分价签也用这个屏 易老化
#define READGUY_DEV_213B 3 //2.13寸, 分辨率低212x104, 部分2.13驱动不了的情况下用这个屏驱动
#define READGUY_DEV_266A 4 //2.66寸Vusion价签, 黑白双色.
#define READGUY_DEV_270B 5 //2.7寸佳显触摸墨水屏, 佳显官方店有售: 2.7寸触摸墨水屏.
#define READGUY_DEV_290A 6 //2.9寸A01, 甘草酸不酸2.9寸A01型号. 显示性能一般
@@ -53,6 +53,20 @@
#define READGUY_DEV_420A 9 //4.2寸HINK黑白价签, 汉朔价签, 汉朔三色价签通用. 速度快, 但效果一般
#define READGUY_DEV_420B 10 //4.2寸WF丝印, 部分价签也用此型号屏, 排线有WF开头的丝印
#define MEPD_DEBUG_DISPLAY 11 //使用LCD显示屏幕来debug. 前往ctg_stack_c_defines.h修改兼容的屏幕.
#define READGUY_DEV_213B3C 12 //2.13寸三色, 分辨率低212x104, 部分价签也用这个屏 易老化
#define READGUY_DEV_266A3C 13 //2.66寸三色. 驱动只能支持黑白色, 分辨率 296x152,
//#define READGUY_DEV_154C 14 //(即将推出) 1.54寸M09墨水屏 (M5Stack Core-Ink 同款; GDEW0154M09)
//#define READGUY_DEV_370B 15 //(即将推出) 3.7寸低DPI墨水屏, 分辨率416*240, b站 @叫我武哒哒 的项目用
//#define READGUY_DEV_426A 16 //(即将推出) 4.26寸高分辨率墨水屏, 800*480. GDEQ0426T82 支持硬件四灰
//#define READGUY_DEV_583A 17 //(即将推出) 5.83寸墨水屏幕, 分辨率为600*448. 有黑白有三色
//#define READGUY_DEV_583B 18 //(即将推出) 5.83寸高分辨率, 640*480. GDEQ0583T31 只有黑白
//#define READGUY_DEV_750A 19 //(即将推出) 7.5 寸墨水屏幕, 800*480. 只有三色(买不到黑白)
//#define READGUY_DEV_1020A 20 //(即将推出) 10.2寸墨水屏GDEQ102T90, 芯片SSD1677. 黑白色分辨率960*640
//添加新屏幕型号 add displays here
#define EPD_DRIVERS_NUM_MAX 21 //此选项请不要取消注释掉, 有几个屏幕就写多少.
#endif /* END OF FILE. ReadGuy project.
Copyright (C) 2023 FriendshipEnder. */

View File

@@ -36,7 +36,6 @@
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include "guy_epaper_config.h"
#define EPD_DRIVERS_NUM_MAX 12 //此选项请不要取消注释掉
#define FILL_WHITE ([](int)->uint8_t{return 0xff;})
#define FILL_BLACK ([](int)->uint8_t{return 0x00;})
@@ -114,8 +113,6 @@ public:
#ifdef MEPD_DEBUG_DISPLAY
friend class LGFX;
#endif
private:
int16_t guy_width=0,guy_height=0;
};
#endif /* END OF FILE. ReadGuy project.

View File

@@ -38,6 +38,7 @@ void drv::drv_init(){
ips.fillScreen(0xffff);
}
void drv::drv_fullpart(bool part){
if(lastRefresh) return;
partMode=part;
}
void drv::drv_dispWriter(std::function<uint8_t(int)> f,uint8_t m){ //单色刷新

View File

@@ -41,9 +41,9 @@
//另外, 在提交新版本之前, 不要忘记在github上创建release, 否则Arduino IDE会读不到
#define READGUY_V_MAJOR 1
#define READGUY_V_MINOR 3
#define READGUY_V_PATCH 2
#define READGUY_V_PATCH 3
#define READGUY_VERSION_VAL (READGUY_V_MAJOR*1000+READGUY_V_MINOR*100+READGUY_V_PATCH*10)
#define READGUY_VERSION "1.3.2"
#define READGUY_VERSION "1.3.3"
#ifdef ESP8266
#define _READGUY_PLATFORM "ESP8266"

View File

@@ -59,7 +59,7 @@ static const PROGMEM char args_name[23][8]={
static const char *NAME_guyDev266=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_213B
static const PROGMEM char NAME_guyDev213M21[]="2.13寸三色";
static const PROGMEM char NAME_guyDev213M21[]="2.13寸低分辨率版";
#else
static const char *NAME_guyDev213M21=NOT_SUPPORTED;
#endif
@@ -98,6 +98,53 @@ static const PROGMEM char args_name[23][8]={
#else
static const char *NAME_guyDev270_V2=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_213B3C
static const PROGMEM char NAME_guyDev213B3C[]="2.13寸三色";
#else
static const char *NAME_guyDev213B3C=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_266A3C
static const PROGMEM char NAME_guyDev266A3C[]="2.66寸三色价签";
#else
static const char *NAME_guyDev266A3C=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_154C
static const PROGMEM char NAME_guyDev154M5CoreInk[]="1.54寸Core.Ink";
#else
static const char *NAME_guyDev154M5CoreInk=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_370B
static const PROGMEM char NAME_guyDev370LoRes[]="3.7寸低分版本416x240";
#else
static const char *NAME_guyDev370LoRes=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_426A
static const PROGMEM char NAME_guyDev426HiRes[]="4.26寸GDEQ0426T82高分辨率";
#else
static const char *NAME_guyDev426HiRes=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_583A
static const PROGMEM char NAME_guyDev583Normal[]="5.83寸黑白/三色价签";
#else
static const char *NAME_guyDev583Normal=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_583B
static const PROGMEM char NAME_guyDev583HiResBW[]="5.83寸高分辨率版本";
#else
static const char *NAME_guyDev583HiResBW=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_750A
static const PROGMEM char NAME_guyDev750A3C[]="7.5寸三色价签";
#else
static const char *NAME_guyDev750A3C=NOT_SUPPORTED;
#endif
#ifdef READGUY_DEV_1020A
static const PROGMEM char NAME_guyDev1020BW[]="10.2寸黑白";
#else
static const char *NAME_guyDev1020BW=NOT_SUPPORTED;
#endif
//添加新屏幕型号 add displays here
const char *ReadguyDriver::epd_drivers_list[EPD_DRIVERS_NUM_MAX]={
NAME_guyDev154, //此处的顺序必须和 guy_epaper_config.h 里面的一样
NAME_guyDev154_V2,
@@ -110,7 +157,18 @@ const char *ReadguyDriver::epd_drivers_list[EPD_DRIVERS_NUM_MAX]={
NAME_guyDev370,
NAME_guyDev420Hink,
NAME_guyDev420WF,
NAME_epdLcd
NAME_epdLcd,
NAME_guyDev213B3C,
NAME_guyDev266A3C,
NAME_guyDev154M5CoreInk,
NAME_guyDev370LoRes,
NAME_guyDev426HiRes,
NAME_guyDev583Normal,
NAME_guyDev583HiResBW,
NAME_guyDev750A3C,
NAME_guyDev1020BW
//添加新屏幕型号 add displays here
};
//static const char *index_cn_html;
//static const uint8_t faviconData[1150];
@@ -223,14 +281,18 @@ void ReadguyDriver::handleInitPost(){
READGUY_sd_ok=0;
#if defined(ESP8266)
//Esp8266无视SPI的设定, 固定为唯一的硬件SPI (D5=SCK, D6=MISO, D7=MOSI)
#ifdef READGUY_ENABLE_SD
SDFS.end();//关闭SD卡
#endif
btnTask.detach();
#else
#ifdef READGUY_ENABLE_SD
SD.end();//关闭SD卡
if(sd_spi != epd_spi) { //共线时, 不要删除SD
delete sd_spi;
sd_spi=nullptr;
}
#endif
vTaskDelete(btn_handle);
#endif
}
@@ -516,6 +578,7 @@ void ReadguyDriver::handleFinal(){
}
s+=F("<br/><hr/>"); //换行
}
#ifdef READGUY_ENABLE_SD
if(!READGUY_sd_ok) s+=F("SD卡不可用!!!<br/>");
#if (defined(ESP8266)) //此函数速度太慢了, 因此删掉不用了
/*else{
@@ -545,6 +608,7 @@ void ReadguyDriver::handleFinal(){
s+=(uint32_t)(SD.usedBytes()/1024);
s+=F("KB.<br/>");
}
#endif
#endif
s+=F("当前WiFi模式: ");
s+=(WiFi.getMode()==WIFI_STA)?F("正常联网模式"):F("AP配网模式");

View File

@@ -38,6 +38,36 @@ int8_t ReadguyDriver::pin_cmx=-1;
const PROGMEM char ReadguyDriver::projname[8] = "readguy";
const PROGMEM char ReadguyDriver::tagname[7] = "hwconf";
volatile uint8_t ReadguyDriver::spibz=0;
#ifndef DYNAMIC_PIN_SETTINGS
const int8_t ReadguyDriver::config_data[22] = {
127 , //READGUY_cali
READGUY_shareSpi ,
READGUY_epd_type ,// 对应的epd驱动程序代号, -1为未指定
//显示驱动部分, 显示默认使用vspi (vspi也是默认SPI库的通道)
READGUY_epd_mosi ,// 目标显示器的 MOSI 引脚
READGUY_epd_sclk ,// 目标显示器的 SCLK 引脚
READGUY_epd_cs ,// 目标显示器的 CS 引脚
READGUY_epd_dc ,// 目标显示器的 DC 引脚
READGUY_epd_rst ,// 目标显示器的 RST 引脚
READGUY_epd_busy ,// 目标显示器的 BUSY 引脚
//sd卡驱动部分, 默认使用hspi (sd卡建议用hspi)
READGUY_sd_miso ,// 目标sd卡的 MISO 引脚, sd_share_spi == 1 时无效
READGUY_sd_mosi ,// 目标sd卡的 MOSI 引脚, sd_share_spi == 1 时无效
READGUY_sd_sclk ,// 目标sd卡的 SCLK 引脚, sd_share_spi == 1 时无效
READGUY_sd_cs ,// 目标sd卡的 CS 引脚.
READGUY_i2c_sda ,// 目标i2c总线的SDA引脚, 当且仅当启用i2c总线时才生效
READGUY_i2c_scl ,// 目标i2c总线的SCL引脚, 当且仅当启用i2c总线时才生效
//按键驱动部分, 为负代表高触发, 否则低触发,
//注意, 这里的io编号是加1的, 即 1或-1 代表 gpio0 的低触发/高触发
READGUY_btn1 ,
READGUY_btn2 ,
READGUY_btn3 ,
READGUY_bl_pin ,//前置光接口引脚IO
READGUY_rtc_type ,//使用的RTC型号(待定, 还没用上)
0 ,//READGUY_sd_ok SD卡已经成功初始化
0 //READGUY_buttons 按钮个数, 0-3都有可能
};
#endif
#ifndef ESP8266
SPIClass *ReadguyDriver::sd_spi =nullptr;
SPIClass *ReadguyDriver::epd_spi=nullptr;
@@ -85,10 +115,15 @@ uint8_t ReadguyDriver::init(uint8_t WiFiSet, bool initepd){
#endif
nvs_deinit();
#else
nvs_init();
if(checkEpdDriver()!=127) setEpdDriver(initepd/* ,g_width,g_height */); //初始化屏幕
else for(;;); //此处可能添加程序rollback等功能操作(比如返回加载上一个程序)
setSDcardDriver();
setButtonDriver();
if(!nvs_read()){
nvs_write(); //全部成功之后, 写入引脚信息到NVS.
}
nvs_deinit();
#endif
Serial.println(F("[Guy init] init done."));
READGUY_cali=127;
@@ -111,47 +146,124 @@ uint8_t ReadguyDriver::checkEpdDriver(){
#endif
if(guy_dev != nullptr && READGUY_epd_type!=guy_dev->drv_ID()) delete guy_dev; //释放多余的内存
//Serial.printf("initing epd %s...\n",epd_drivers_list[READGUY_epd_type]);
#ifdef DYNAMIC_PIN_SETTINGS
switch (READGUY_epd_type){
#ifdef READGUY_DEV_154A
case READGUY_DEV_154A: guy_dev = new guydev_154A_290A ::dev154A; break; //适用于一般的价签黑白屏
case READGUY_DEV_154A: guy_dev = new guydev_154A_290A ::dev154A; break; //适用于一般的价签黑白屏
#endif
#ifdef READGUY_DEV_154B
case READGUY_DEV_154B: guy_dev = new guydev_154B_270B_290B ::dev154B; break; //适用于
case READGUY_DEV_154B: guy_dev = new guydev_154B_270B_290B ::dev154B; break; //适用于
#endif
#ifdef READGUY_DEV_213A
case READGUY_DEV_213A: guy_dev = new guydev_213A ::drv; break;
case READGUY_DEV_213A: guy_dev = new guydev_213A ::drv; break;
#endif
#ifdef READGUY_DEV_266A
case READGUY_DEV_266A: guy_dev = new guydev_213B_266A ::dev266A; break;
case READGUY_DEV_266A: guy_dev = new guydev_213B_266A ::dev266A; break;
#endif
#ifdef READGUY_DEV_213B
case READGUY_DEV_213B: guy_dev = new guydev_213B_266A ::dev213B; break;
case READGUY_DEV_213B: guy_dev = new guydev_213B_266A ::dev213B; break;
#endif
#ifdef READGUY_DEV_290A
case READGUY_DEV_290A: guy_dev = new guydev_154A_290A ::dev290A; break;
case READGUY_DEV_290A: guy_dev = new guydev_154A_290A ::dev290A; break;
#endif
#ifdef READGUY_DEV_290B
case READGUY_DEV_290B: guy_dev = new guydev_154B_270B_290B ::dev290B; break;
case READGUY_DEV_290B: guy_dev = new guydev_154B_270B_290B ::dev290B; break;
#endif
#ifdef READGUY_DEV_420A
case READGUY_DEV_420A: guy_dev = new guydev_420A ::drv; break;
case READGUY_DEV_420A: guy_dev = new guydev_420A ::drv; break;
#endif
#ifdef READGUY_DEV_420B
case READGUY_DEV_420B: guy_dev = new guydev_420B ::drv; break;
case READGUY_DEV_420B: guy_dev = new guydev_420B ::drv; break;
#endif
#ifdef READGUY_DEV_370A
case READGUY_DEV_370A: guy_dev = new guydev_370A ::drv; break;
case READGUY_DEV_370A: guy_dev = new guydev_370A ::drv; break;
#endif
#ifdef MEPD_DEBUG_DISPLAY
case MEPD_DEBUG_DISPLAY:guy_dev = new EpdLcdDebug ::drv; break;
case MEPD_DEBUG_DISPLAY: guy_dev = new EpdLcdDebug ::drv; break;
#endif
#ifdef READGUY_DEV_270B
case READGUY_DEV_270B: guy_dev = new guydev_154B_270B_290B ::dev270B; break;
case READGUY_DEV_270B: guy_dev = new guydev_154B_270B_290B ::dev270B; break;
#endif
#ifdef READGUY_DEV_213B3C
case READGUY_DEV_213B3C: guy_dev = new guydev_213B_266A ::dev213B3C; break;
#endif
#ifdef READGUY_DEV_266A3C
case READGUY_DEV_266A3C: guy_dev = new guydev_213B_266A ::dev266A3C; break;
#endif
#ifdef READGUY_DEV_154C
case READGUY_DEV_154C: guy_dev = new guydev_154C ::drv; break;
#endif
#ifdef READGUY_DEV_370B
case READGUY_DEV_370B: guy_dev = new guydev_370B ::drv; break;
#endif
#ifdef READGUY_DEV_426A
case READGUY_DEV_426A: guy_dev = new guydev_426A ::drv; break;
#endif
#ifdef READGUY_DEV_583A
case READGUY_DEV_583A: guy_dev = new guydev_583A ::drv; break;
#endif
#ifdef READGUY_DEV_583B
case READGUY_DEV_583B: guy_dev = new guydev_583B ::drv; break;
#endif
#ifdef READGUY_DEV_750A
case READGUY_DEV_750A: guy_dev = new guydev_750A ::drv; break;
#endif
#ifdef READGUY_DEV_1020A
case READGUY_DEV_1020A: guy_dev = new guydev_1020A ::drv; break;
#endif
//添加新屏幕型号 add displays here
default:
Serial.println(F("[GUY ERR] EPD DRIVER IC NOT SUPPORTED!\n"));
return 127;
}
#else
#if (defined(READGUY_DEV_154A) && (READGUY_epd_type==READGUY_DEV_154A))
guy_dev = new guydev_154A_290A ::dev154A; //适用于一般的价签黑白屏
#elif (defined(READGUY_DEV_154B) && (READGUY_epd_type==READGUY_DEV_154B))
guy_dev = new guydev_154B_270B_290B ::dev154B; //适用于
#elif (defined(READGUY_DEV_213A) && (READGUY_epd_type==READGUY_DEV_213A))
guy_dev = new guydev_213A ::drv;
#elif (defined(READGUY_DEV_266A) && (READGUY_epd_type==READGUY_DEV_266A))
guy_dev = new guydev_213B_266A ::dev266A;
#elif (defined(READGUY_DEV_213B) && (READGUY_epd_type==READGUY_DEV_213B))
guy_dev = new guydev_213B_266A ::dev213B;
#elif (defined(READGUY_DEV_290A) && (READGUY_epd_type==READGUY_DEV_290A))
guy_dev = new guydev_154A_290A ::dev290A;
#elif (defined(READGUY_DEV_290B) && (READGUY_epd_type==READGUY_DEV_290B))
guy_dev = new guydev_154B_270B_290B ::dev290B;
#elif (defined(READGUY_DEV_420A) && (READGUY_epd_type==READGUY_DEV_420A))
guy_dev = new guydev_420A ::drv;
#elif (defined(READGUY_DEV_420B) && (READGUY_epd_type==READGUY_DEV_420B))
guy_dev = new guydev_420B ::drv;
#elif (defined(READGUY_DEV_370A) && (READGUY_epd_type==READGUY_DEV_370A))
guy_dev = new guydev_370A ::drv;
#elif (defined(MEPD_DEBUG_DISPLAY) && (READGUY_epd_type==MEPD_DEBUG_DISPLAY))
guy_dev = new EpdLcdDebug ::drv;
#elif (defined(READGUY_DEV_270B) && (READGUY_epd_type==READGUY_DEV_270B))
guy_dev = new guydev_154B_270B_290B ::dev270B;
#elif (defined(READGUY_DEV_213B3C) && (READGUY_epd_type==READGUY_DEV_213B3C))
guy_dev = new guydev_213B_266A ::dev213B3C;
#elif (defined(READGUY_DEV_266A3C) && (READGUY_epd_type==READGUY_DEV_266A3C))
guy_dev = new guydev_213B_266A ::dev266B3C;
#elif (defined(READGUY_DEV_154C) && (READGUY_epd_type==READGUY_DEV_154C))
guy_dev = new guydev_154C ::drv;
#elif (defined(READGUY_DEV_370B) && (READGUY_epd_type==READGUY_DEV_370B))
guy_dev = new guydev_370B ::drv;
#elif (defined(READGUY_DEV_426A) && (READGUY_epd_type==READGUY_DEV_426A))
guy_dev = new guydev_426A ::drv;
#elif (defined(READGUY_DEV_583A) && (READGUY_epd_type==READGUY_DEV_583A))
guy_dev = new guydev_583A ::drv;
#elif (defined(READGUY_DEV_583B) && (READGUY_epd_type==READGUY_DEV_583B))
guy_dev = new guydev_583B ::drv;
#elif (defined(READGUY_DEV_750A) && (READGUY_epd_type==READGUY_DEV_750A))
guy_dev = new guydev_750A ::drv;
#elif (defined(READGUY_DEV_1020A) && (READGUY_epd_type==READGUY_DEV_1020A))
guy_dev = new guydev_1020A ::drv;
#endif
//添加新屏幕型号 add displays here
#endif
#if (defined(ESP8266))
SPI.begin();
SPI.setFrequency(ESP8266_SPI_FREQUENCY); ///< 1MHz
@@ -172,7 +284,7 @@ uint8_t ReadguyDriver::checkEpdDriver(){
Serial.println(F("[Guy SPI] drvBase Init OK"));
return READGUY_epd_type;
}
void ReadguyDriver::setEpdDriver(bool initepd/* ,int g_width,int g_height */){
void ReadguyDriver::setEpdDriver(bool initepd, bool initGFX){
guy_dev->spi_tr_release = in_release;
guy_dev->spi_tr_press = in_press;
if(initepd) guy_dev->drv_init(); //初始化epd驱动层
@@ -181,21 +293,23 @@ void ReadguyDriver::setEpdDriver(bool initepd/* ,int g_width,int g_height */){
//if(g_height) guy_height = g_height;
//else guy_height = guy_dev->drv_height();
//以下依赖于你的图形驱动
setColorDepth(1); //单色模式
createPalette(); //初始化颜色系统
Serial.printf_P(PSTR("[Guy EPD] EPD init OK: w: %d, h: %d\n"),guy_dev->drv_width(),guy_dev->drv_height());
//创建画布. 根据LovyanGFX的特性, 如果以前有画布会自动重新生成新画布
//此外, 即使画布宽度不是8的倍数(如2.13寸单色),也支持自动补全8的倍数 ( 250x122 => 250x128 )
//为了保证图片显示功能的正常使用, 高度也必须是8的倍数.
createSprite(guy_dev->drv_width(),guy_dev->drv_height());
//这里发现如果用自定义的内存分配方式会更好一些. 不会导致返回的height不对. 但是因为LovyanGFX库未更新 暂时不能这么用.
//setRotation(1); //旋转之后操作更方便
setRotation(0);
setFont(&fonts::Font0);
setCursor(0,0);
setTextColor(0);
fillScreen(1); //开始先全屏白色
if(initGFX){
setColorDepth(1); //单色模式
createPalette(); //初始化颜色系统
//创建画布. 根据LovyanGFX的特性, 如果以前有画布会自动重新生成新画布
//此外, 即使画布宽度不是8的倍数(如2.13寸单色),也支持自动补全8的倍数 ( 250x122 => 250x128 )
//为了保证图片显示功能的正常使用, 高度也必须是8的倍数.
createSprite(guy_dev->drv_width(),guy_dev->drv_height());
//这里发现如果用自定义的内存分配方式会更好一些. 不会导致返回的height不对. 但是因为LovyanGFX库未更新 暂时不能这么用.
setRotation(0); //默认的旋转方向就是0咯
setFont(&fonts::Font0);
setCursor(0,0);
setTextColor(0);
fillScreen(1); //开始先全屏白色
}
Serial.printf_P(PSTR("[Guy EPD] EPD init OK(%d): w: %d, h: %d\n"),guy_dev->drv_ID(),guy_dev->drv_width(),guy_dev->drv_height());
}
#ifdef READGUY_ENABLE_SD
bool ReadguyDriver::setSDcardDriver(){
/*重要信息: 有些引脚冲突是难以避免的, 比如8266 尤其需要重写这部分代码
对于esp32也要注意这个引脚是否是一个合法的引脚
@@ -236,6 +350,17 @@ bool ReadguyDriver::setSDcardDriver(){
}
return READGUY_sd_ok;
}
#else
bool ReadguyDriver::setSDcardDriver(){
READGUY_sd_ok=0;
#ifdef READGUY_USE_LITTLEFS
LittleFS.begin();
#else
SPIFFS.begin();
#endif
return false;
}
#endif
void ReadguyDriver::setButtonDriver(){
if(READGUY_btn1) { //初始化按键. 注意高电平触发的引脚在初始化时要设置为下拉
int8_t btn_pin=abs(READGUY_btn1)-1;
@@ -289,11 +414,11 @@ void ReadguyDriver::setButtonDriver(){
btn_rd[1].setLongRepeatMode(0);
}
else if(READGUY_buttons==3){
btn_rd[0].long_press_ms = 150; //不识别双击三击, 只有按一下或者长按, 并且开启连按
btn_rd[0].long_press_ms = 50; //不识别双击三击, 只有按一下或者长按, 并且开启连按
//btn_rd[0].setLongRepeatMode(1);
btn_rd[1].setMultiBtn(1); //设置为多个按钮,不识别双击或三击
btn_rd[1].setLongRepeatMode(0);
btn_rd[2].long_press_ms = 1; //不识别双击三击, 只有按一下或者长按, 并且开启连按
btn_rd[2].long_press_ms = 50; //不识别双击三击, 只有按一下或者长按, 并且开启连按
btn_rd[2].setLongRepeatMode(1);
}
#ifdef ESP8266 //对于esp8266, 需要注册到ticker. 这是因为没freertos.
@@ -343,6 +468,7 @@ void ReadguyDriver::setButtonDriver(){
}
} //关于按键策略, 我们在此使用多个Button2的类, 然后在一个task共享变量来确定上一个按键状态
}
#ifdef READGUY_ENABLE_SD
fs::FS &ReadguyDriver::guyFS(uint8_t initSD){
if(initSD==2 || (!READGUY_sd_ok && initSD)) setSDcardDriver();
if(READGUY_sd_ok){
@@ -358,6 +484,16 @@ fs::FS &ReadguyDriver::guyFS(uint8_t initSD){
return SPIFFS;
#endif
}
#else
fs::FS &ReadguyDriver::guyFS(uint8_t initSD){
(void)initSD; //avoid GCC warning
#ifdef READGUY_USE_LITTLEFS
return LittleFS;
#else
return SPIFFS;
#endif
}
#endif
void ReadguyDriver::setBright(int d){
if(currentBright>=0 && d>=0 && d<=255){
currentBright=d;
@@ -440,8 +576,7 @@ void ReadguyDriver::sleepEPD(){
if(READGUY_cali==127) guy_dev->drv_sleep();
}
#if (!defined(DYNAMIC_PIN_SETTINGS)) //do nothing here.
#elif (defined(INDEV_DEBUG))
#if (defined(INDEV_DEBUG))
void ReadguyDriver::nvs_init(){
}
void ReadguyDriver::nvs_deinit(){
@@ -461,12 +596,19 @@ void ReadguyDriver::nvs_deinit(){
}
bool ReadguyDriver::nvs_read(){
char s[8];
for(unsigned int i=0;i<sizeof(config_data)+8;i++){
for(unsigned int i=0;i<
#ifdef DYNAMIC_PIN_SETTINGS
sizeof(config_data)+
#endif
8;i++){
int8_t rd=(int8_t)EEPROM.read(2+i);
#ifdef DYNAMIC_PIN_SETTINGS
if(i>=8) config_data[i-8] = rd;
else s[i]=(char)rd;
else
#endif
s[i]=(char)rd;
}
Serial.printf("[Guy NVS] Get NVS...%d\n", config_data[0]);
Serial.printf("[Guy NVS] Get EEPROM...%d\n", config_data[0]);
return !(strcmp_P(s,projname));
}
void ReadguyDriver::nvs_write(){
@@ -483,6 +625,7 @@ void ReadguyDriver::nvs_deinit(){
}
bool ReadguyDriver::nvs_read(){ //此处需要处理一些有关I2C的内容
if(!nvsData.isKey(tagname)) return 0; //没有这个键值
#ifdef DYNAMIC_PIN_SETTINGS
size_t len=nvsData.getBytes(tagname,config_data,sizeof(config_data)); //读取的数据长度
/*if(len<sizeof(config_data)){ //旧版本格式无法获取I2C相关数据, 设置为-1.
for(int i=sizeof(config_data)-1;i>=15;i--) //使用新版本格式来存储相关数据
@@ -492,6 +635,9 @@ bool ReadguyDriver::nvs_read(){ //此处需要处理一些有关I2C的内容
nvsData.putBytes(tagname,config_data,sizeof(config_data)); //用新版本格式保存
}*/
return len==sizeof(config_data);
#else
return 1;
#endif
}
void ReadguyDriver::nvs_write(){
if(nvsData.isKey(tagname)) nvsData.remove(tagname);

View File

@@ -49,7 +49,8 @@
#ifdef READGUY_DEV_213A
#include "guy_epaper/guy_213a/guy_213a.h"
#endif
#if (defined(READGUY_DEV_213B) || defined(READGUY_DEV_266A))
#if (defined(READGUY_DEV_213B) || defined(READGUY_DEV_213B3C) \
|| defined(READGUY_DEV_266A) || defined(READGUY_DEV_266A3C))
#include "guy_epaper/guy_213b_266a/guy_213b_266a.h"
#endif
#ifdef READGUY_DEV_370A
@@ -65,6 +66,29 @@
#include "guy_epaper/lcdDebug/lcdDebug.h"
#endif
#ifdef READGUY_DEV_154C
#include "guy_epaper/guy_154C/guy_154C.h"
#endif
#ifdef READGUY_DEV_370B
#include "guy_epaper/guy_370B/guy_370B.h"
#endif
#ifdef READGUY_DEV_426A
#include "guy_epaper/guy_426A/guy_426A.h"
#endif
#ifdef READGUY_DEV_583A
#include "guy_epaper/guy_583A/guy_583A.h"
#endif
#ifdef READGUY_DEV_583B
#include "guy_epaper/guy_583B/guy_583B.h"
#endif
#ifdef READGUY_DEV_750A
#include "guy_epaper/guy_750A/guy_750A.h"
#endif
#ifdef READGUY_DEV_1020A
#include "guy_epaper/guy_1020A/guy_1020A.h"
#endif
//添加新屏幕型号 add displays here
#include "guy_button.h" //改自Button2精简而来
#include "guy_version.h"
#include "guy_driver_config.h" //config
@@ -77,28 +101,28 @@
#endif
#if defined(ESP8266) //for ESP8266
#ifdef DYNAMIC_PIN_SETTINGS
#include <EEPROM.h> //ESP32需要NVS才可以读取引脚信息
#endif
#include <EEPROM.h> //ESP32需要NVS才可以读取引脚信息,
#ifdef READGUY_ESP_ENABLE_WIFI
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include "ESP8266HTTPUpdateServer.h"
#endif
#ifdef READGUY_ENABLE_SD
#include <SDFS.h>
#endif
#include <Ticker.h>
#else //for ESP32
#ifdef DYNAMIC_PIN_SETTINGS
#include <Preferences.h> //ESP32需要NVS才可以读取引脚信息
#endif
#ifdef READGUY_ESP_ENABLE_WIFI
#include <WiFi.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include "HTTPUpdateServer.h"
#endif
#ifdef READGUY_ENABLE_SD
#include <SD.h>
#endif
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#endif
@@ -213,13 +237,13 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
void invertDisplay();
/// @brief 进入EPD的低功耗模式
void sleepEPD(void);
#ifdef READGUY_ESP_ENABLE_WIFI
/// @brief ap配网设置页面
typedef struct {
String linkname;
String event; //链接名称 事件URI
std::function<void(ReadguyWebServer*)> func; //触发时执行的函数
} serveFunc;
#ifdef READGUY_ESP_ENABLE_WIFI
/// @brief 初始化WiFi AP模式, 用于将来的连接WiFi 处于已连接状态下会断开原本的连接
void ap_setup();
/// @brief 初始化WiFi AP模式, 用于将来的连接WiFi 处于已连接状态下会断开原本的连接
@@ -227,6 +251,12 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
bool server_loop();
void server_end();
#else
/// @brief ap配网设置页面
typedef struct {
String linkname;
String event; //链接名称 事件URI
std::function<void(void*)> func; //触发时执行的函数
} serveFunc;
/// @brief 初始化WiFi AP模式, 用于将来的连接WiFi 处于已连接状态下会断开原本的连接
void ap_setup(){}
/// @brief 初始化服务器模式, 用于将来的连接WiFi 处于已连接状态下会断开原本的连接
@@ -239,7 +269,7 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
/** @brief 初始化屏幕, 设置驱动代号, 引脚排列顺序. 过程会检验引脚可用性.
* @param g_width, g_height 显示区域的宽度和高度. 为0表示直接使用屏幕的宽度和高度
* @note 这两个参数转专为指定分辨率的程序画面设计, 其他分辨率的画面会自动拉伸. [1.2新增] */
void setEpdDriver(bool initepd = 1/* ,int g_width = 0,int g_height = 0 */);
void setEpdDriver(bool initepd = 1, bool initGFX = 1);
/** @brief 初始化SD卡, 设置驱动代号, 引脚排列顺序. 过程会检验引脚可用性.
* @return SD卡初始化成功与否 */
bool setSDcardDriver();
@@ -250,7 +280,7 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
bool SDinside(bool check=true) { return check?setSDcardDriver():READGUY_sd_ok; };
/// @brief 检查按钮. 当配置未完成时,按钮不可用, 返回0.
uint8_t getBtn() { return (READGUY_cali==127)?getBtn_impl():0; }
/// @brief 根据按钮ID来检查按钮. 注意这里如果按下返回0, 没按下或者按钮无效返回1
/// @brief [此函数已弃用 非常不建议使用] 根据按钮ID来检查按钮. 注意这里如果按下返回0, 没按下或者按钮无效返回1
//uint8_t getBtn(unsigned int btnID){return btnID<getButtonsCount()?(!(btn_rd[0].isPressedRaw())):1;}
/** @brief 返回可用的文件系统. 当SD卡可用时, 返回SD卡. 否则根据情况返回最近的可用文件系统
* @param initSD 2:总是重新初始化SD卡; 1:若SD卡不可用则初始化; 0:SD卡不可用则返回LittleFS. */
@@ -263,14 +293,15 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
static const char projname[8];
static const char tagname[7];
//uint8_t config_wifi=0; //是否强行在初始化期间设置WiFi.
#ifdef DYNAMIC_PIN_SETTINGS//数据是否已经校准
int8_t config_data[22];
char randomch[4]; //校验用字符串
void nvs_init(); //初始化持久存储器.
void nvs_deinit();//保存持久存储器的内容
bool nvs_read(); //从持久存储器读取, 返回是否读取成功
void nvs_write(); //写入到持久存储器
#ifdef DYNAMIC_PIN_SETTINGS//数据是否已经校准
int8_t config_data[22];
char randomch[4]; //校验用字符串
#else
static const int8_t config_data[22];
int8_t READGUY_sd_ok = 0;
int8_t READGUY_cali = 0;
int8_t READGUY_buttons = 0; //按钮个数, 0-3都有可能
@@ -289,10 +320,8 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
//对于esp8266, 需要注册到ticker
Ticker btnTask;
#else
#ifdef DYNAMIC_PIN_SETTINGS
//NVS数据操作函数, 无NVS的使用EEProm的最后几个字节块
Preferences nvsData;
#endif
static SPIClass *sd_spi;
static SPIClass *epd_spi;
static TaskHandle_t btn_handle;
@@ -356,30 +385,30 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
#endif
}
public: //增加了一些返回系统状态变量的函数, 它们是静态的, 而且不会对程序造成任何影响.
constexpr int getShareSpi() const { return config_data[1]; }
constexpr int getEpdType () const { return config_data[2]; } // 对应的epd驱动程序代号, -1为未指定
constexpr int getShareSpi() const { return READGUY_shareSpi; }
constexpr int getEpdType () const { return READGUY_epd_type; } // 对应的epd驱动程序代号, -1为未指定
//显示驱动部分, 显示默认使用vspi (vspi也是默认SPI库的通道)
constexpr int getEpdMosi () const { return config_data[3]; } // 目标显示器的 MOSI 引脚
constexpr int getEpdSclk () const { return config_data[4]; } // 目标显示器的 SCLK 引脚
constexpr int getEpdCs () const { return config_data[5]; } // 目标显示器的 CS 引脚
constexpr int getEpdDc () const { return config_data[6]; } // 目标显示器的 DC 引脚
constexpr int getEpdRst () const { return config_data[7]; } // 目标显示器的 RST 引脚
constexpr int getEpdBusy () const { return config_data[8]; } // 目标显示器的 BUSY 引脚
constexpr int getEpdMosi () const { return READGUY_epd_mosi; } // 目标显示器的 MOSI 引脚
constexpr int getEpdSclk () const { return READGUY_epd_sclk; } // 目标显示器的 SCLK 引脚
constexpr int getEpdCs () const { return READGUY_epd_cs; } // 目标显示器的 CS 引脚
constexpr int getEpdDc () const { return READGUY_epd_dc; } // 目标显示器的 DC 引脚
constexpr int getEpdRst () const { return READGUY_epd_rst; } // 目标显示器的 RST 引脚
constexpr int getEpdBusy () const { return READGUY_epd_busy; } // 目标显示器的 BUSY 引脚
//sd卡驱动部分, 默认使用hspi (sd卡建议用hspi)
constexpr int getSdMiso () const { return config_data[9]; } // 目标sd卡的 MISO 引脚, sd_share_spi == 1 时无效
constexpr int getSdMosi () const { return config_data[10]; }// 目标sd卡的 MOSI 引脚, sd_share_spi == 1 时无效
constexpr int getSdSclk () const { return config_data[11]; }// 目标sd卡的 SCLK 引脚, sd_share_spi == 1 时无效
constexpr int getSdCs () const { return config_data[12]; }// 目标sd卡的 CS 引脚.
constexpr int getI2cSda () const { return config_data[13]; }// 目标i2c总线的SDA引脚, 当且仅当启用i2c总线时才生效
constexpr int getI2cScl () const { return config_data[14]; }// 目标i2c总线的SCL引脚, 当且仅当启用i2c总线时才生效
constexpr int getSdMiso () const { return READGUY_sd_miso; } // 目标sd卡的 MISO 引脚, sd_share_spi == 1 时无效
constexpr int getSdMosi () const { return READGUY_sd_mosi; }// 目标sd卡的 MOSI 引脚, sd_share_spi == 1 时无效
constexpr int getSdSclk () const { return READGUY_sd_sclk; }// 目标sd卡的 SCLK 引脚, sd_share_spi == 1 时无效
constexpr int getSdCs () const { return READGUY_sd_cs; }// 目标sd卡的CS引脚. 对ESP32S3, 返回127代表使用SDMMC
constexpr int getI2cSda () const { return READGUY_i2c_sda; }// 目标i2c总线的SDA引脚, 当且仅当启用i2c总线时才生效
constexpr int getI2cScl () const { return READGUY_i2c_scl; }// 目标i2c总线的SCL引脚, 当且仅当启用i2c总线时才生效
//按键驱动部分, 为负代表高触发, 否则低触发,
//注意, 这里的io编号是加1的, 即 1或-1 代表 gpio0 的低触发/高触发
constexpr int getBtn1Pin () const { return config_data[15]; }
constexpr int getBtn2Pin () const { return config_data[16]; }
constexpr int getBtn3Pin () const { return config_data[17]; }
constexpr int getBlPin () const { return config_data[18]; } //前置光接口引脚IO
constexpr int getRtcType () const { return config_data[19]; } //使用的RTC型号(待定, 还没用上)
constexpr int getButtonsCount() const { return config_data[21]; } //按钮个数, 0-3都有可能
constexpr int getBtn1Pin () const { return READGUY_btn1; }
constexpr int getBtn2Pin () const { return READGUY_btn2; }
constexpr int getBtn3Pin () const { return READGUY_btn3; }
constexpr int getBlPin () const { return READGUY_bl_pin; } //前置光接口引脚IO
constexpr int getRtcType () const { return READGUY_rtc_type; } //使用的RTC型号(待定, 还没用上)
constexpr int getButtonsCount() const { return READGUY_buttons; } //按钮个数, 0-3都有可能
//constexpr int memWidth () const { return guy_width ; } //返回显存宽度(不是画幅宽度),不会随着画布旋转改变
//constexpr int memHeight () const { return guy_height ; } //返回显存高度(不是画幅高度),不会随着画布旋转改变
int drvWidth () const { return READGUY_cali==127?guy_dev->drv_width():0; } //返回显示屏硬件宽度(不是画幅宽度)