1.5.0 rewrite several (Pre 2.0 update)
17
CHANGELOG.md
@@ -1,4 +1,19 @@
|
||||
1.4.2
|
||||
# 1.5.0
|
||||
|
||||
## Release 1.5.0 - 2025/4/7
|
||||
|
||||
1. 重构较多代码, 为2.0做准备. 现在可以通过包含文件来自定义配置了
|
||||
|
||||
2. 修复bug
|
||||
|
||||
## Release 1.4.3 - 2025/4/3
|
||||
|
||||
1. 加入了更多可选配置项, 如 AP 配网地址等
|
||||
|
||||
2. 为ESP32S3优先选择调用 SDIO_1Bit 来驱动SD卡
|
||||
|
||||
4. 修复bug
|
||||
|
||||
## Release 1.4.2 - 2025/3/11
|
||||
|
||||
1. 现在程序可以在Arduino-ESP32的版本高于3.0.0的Arduino集成环境和ESP-IDF (仍需依赖Arduino component, 但不依赖PlatformIO) 中编译成功
|
||||
|
||||
31
README.md
@@ -2,9 +2,30 @@
|
||||
|
||||
[](https://www.ardu-badge.com/readguy)
|
||||
|
||||
<img src="extra/artset/readguy_theme3.png" width="30%" height="auto">
|
||||
## ReadGuy 2.0 预告
|
||||
|
||||
**版本1.4.2正式发布!欢迎分享、star和fork~** 上面的图是项目看板娘, 盖. 可爱的盖姐在等你哟~
|
||||
1. 内置驱动,无其他 不跨平台 多平台
|
||||
|
||||
2. 自定义脚本驱动 不跨平台 多平台
|
||||
|
||||
3. 内置 不自定义 带脚本 跨平台 数据存eeprom或者nvs. 支持从文件系统加载
|
||||
|
||||
4. 文件系统接口优化
|
||||
|
||||
5. 灰度显示优化
|
||||
|
||||
6. 按键逻辑优化: 双按键:按键1点按下一个 长按上一个 长按过程中点按2则功能5 按键2点按确定 长按取消
|
||||
三按键 左键点按松开时候结算: 上一个, 左键长按也是上一个 右键点按长按都是下一个 按住左键按中间功能5 中键点按确定 长按取消
|
||||
|
||||
7. 支持pre_init post_init 等设备限定的脚本,在初始化设备时和设备休眠时都可以执行类似功能. 此外readguy2.0的二进制是兼容1.x的
|
||||
|
||||
8. 摒弃默认刷屏方式使用dispWriter函数 速度太慢, 改为使用两种示例, 正常读取显示和函数读取显示都支持调用
|
||||
|
||||
敬请期待
|
||||
|
||||
<img src="https://github.com/fsender/readguy/blob/1.4.2/extra/artset/readguy_theme3.png?raw=true" width="30%" height="auto">
|
||||
|
||||
**版本1.5.0正式发布!欢迎分享、star和fork~** 上面的图是项目看板娘, 盖. 可爱的盖姐在等你哟~
|
||||
|
||||
**即将发布7个全新的屏幕驱动: 欢迎支持! (详见后面的驱动表格)**
|
||||
|
||||
@@ -20,9 +41,9 @@
|
||||
|
||||
### 一次编译即可使程序兼容多种屏幕!
|
||||
|
||||
<img src="extra/artset/readguy_girl.png" width="25%" height="auto">
|
||||
<img src="https://github.com/fsender/readguy/blob/1.4.2/extra/artset/readguy_girl.png?raw=true" width="25%" height="auto">
|
||||
|
||||
<img src="extra/artset/view.jpg" width="auto" height="auto">
|
||||
<img src="https://github.com/fsender/readguy/blob/1.4.2/extra/artset/view.jpg?raw=true" width="auto" height="auto">
|
||||
|
||||
#### 目前支持ESP芯片平台、多种屏幕型号、1~3个按钮操控、SD卡、前置光亮度控制!
|
||||
|
||||
@@ -227,7 +248,7 @@ firmware.bin 0x10000
|
||||
|
||||
5. 编译目标是`ESP32`且使用`ESP-IDF arduino component`时, 需要单独安装[`LittleFS`](https://github.com/joltwallet/esp_littlefs)库来实现相关功能. 在项目内新建文件夹`components`, 在`components`文件夹内放入刚刚克隆的`LittleFS`库. *详见下图**上**方红框*. (使用纯arduino时跳过此步骤)
|
||||
|
||||
<img src="extra/artset/build_dir_structure.png" width="20%" height="auto">
|
||||
<img src="https://github.com/fsender/readguy/blob/1.4.2/extra/artset/build_dir_structure.png?raw=true" width="20%" height="auto">
|
||||
|
||||
6. 把`readguy`的`extra`文件夹内的`platformio`文件夹内所有文件都放在当前目录. 这些文件包含推荐的ESP32 sdkconfig, flash分区表等文件. 使用`pio run -t menuconfig`可以更改项目的menuconfig数据. (使用纯arduino时跳过此步骤)
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 578 KiB |
|
Before Width: | Height: | Size: 600 KiB |
|
Before Width: | Height: | Size: 339 KiB |
@@ -11,7 +11,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/fsender/readguy"
|
||||
},
|
||||
"version": "1.4.2",
|
||||
"version": "1.5.0",
|
||||
"frameworks": "arduino",
|
||||
"platforms": ["espressif32", "espressif8266"],
|
||||
"headers": "readguy.h",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=readguy
|
||||
version=1.4.2
|
||||
version=1.5.0
|
||||
author=fsender <f_ender@163.com>
|
||||
maintainer=fsender <f_ender@163.com>
|
||||
sentence=A free E-paper display driver library supports 16-level greyscale.
|
||||
|
||||
@@ -59,7 +59,7 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
#include "guy_button.h"
|
||||
#include "guy_driver_config.h"
|
||||
#include "guy_config_host.h"
|
||||
|
||||
// initalize static counter
|
||||
|
||||
|
||||
@@ -63,10 +63,6 @@ SOFTWARE.
|
||||
|
||||
#include "Arduino.h"
|
||||
#include <stdint.h>
|
||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP8266)
|
||||
#include <functional>
|
||||
#endif
|
||||
#include <Arduino.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
* 如果有条件请到 extra/artset/reward 中扫描打赏,否则请在 Bilibili 上支持我.
|
||||
* 项目交流QQ群: 926824162 (萌新可以进来问问题的哟)
|
||||
* 郑重声明: 未经授权还请不要商用本开源项目编译出的程序.
|
||||
* @file guy_epaper_config.h
|
||||
* @file guy_config_host.h
|
||||
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
|
||||
* @brief EPD驱动基础配置文件. 用户可以根据自己对库的编译需求来修改此文件.
|
||||
* @brief readguy 配置主文件. 如果要修改配置请移步 guy_driver_config.h
|
||||
* @version 1.0
|
||||
* @date 2023-09-21
|
||||
* @date create: 2025/4/7
|
||||
* last modify: 2025/4/7
|
||||
|
||||
* @attention
|
||||
* Copyright (c) 2022-2023 FriendshipEnder
|
||||
* Copyright (c) 2022-2025 FriendshipEnder
|
||||
*
|
||||
* Apache License, Version 2.0
|
||||
*
|
||||
@@ -26,14 +27,107 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _READGUY_CONFIG_HOST_H_FILE
|
||||
#define _READGUY_CONFIG_HOST_H_FILE
|
||||
|
||||
#ifndef _GUY_E_PAPER_CONFIG_H_FILE
|
||||
#define _GUY_E_PAPER_CONFIG_H_FILE
|
||||
#if __has_include("readguy_user_config.h")
|
||||
|
||||
#undef DYNAMIC_PIN_SETTINGS
|
||||
#undef READGUY_NVS_PROJECTNAME
|
||||
#undef READGUY_NVS_CONFIGKEY
|
||||
#undef READGUY_NVS_DRIVERKEY
|
||||
#undef READGUY_ENABLE_WIFI
|
||||
#undef READGUY_ESP_ENABLE_WIFI
|
||||
#undef READGUY_CONF_AP_SSID
|
||||
#undef READGUY_CONF_AP_PASS
|
||||
#undef READGUY_USE_DEFAULT_ICON
|
||||
#undef READGUY_MDNS_SERVICE
|
||||
#undef READGUY_UPDATE_SERVER
|
||||
#undef READGUY_ENABLE_I2C
|
||||
#undef READGUY_ENABLE_SD
|
||||
#undef READGUY_USE_LITTLEFS
|
||||
#undef READGUY_ESP8266_EEPROM_OFFSET
|
||||
#undef READGUY_ALLOW_DC_AS_BUTTON
|
||||
#undef READGUY_ALLOW_EPDCS_AS_BUTTON
|
||||
#undef READGUY_ALLOW_SDCS_AS_BUTTON
|
||||
#undef READGUY_DEFAULT_MIN_DEBOUNCE_MS
|
||||
#undef READGUY_LONG_PRESS_MS
|
||||
#undef READGUY_DOUBLE_PRESS_MS
|
||||
#undef READGUY_LONG_REPEAT_MS
|
||||
#undef BTN_LOOPTASK_STACK
|
||||
#undef BTN_LOOPTASK_CORE_ID
|
||||
#undef BTN_LOOPTASK_PRIORITY
|
||||
#undef BTN_LOOPTASK_DELAY
|
||||
#undef ESP8266_SPI_FREQUENCY
|
||||
#undef ESP32_DISP_FREQUENCY
|
||||
#undef ESP32_SD_SPI_FREQUENCY
|
||||
#undef ESP32_SD_MMC_FREQUENCY
|
||||
#undef READGUY_SERIAL_DEBUG
|
||||
#undef READGUY_shareSpi
|
||||
#undef READGUY_epd_type
|
||||
#undef READGUY_epd_mosi
|
||||
#undef READGUY_epd_sclk
|
||||
#undef READGUY_epd_cs
|
||||
#undef READGUY_epd_dc
|
||||
#undef READGUY_epd_rst
|
||||
#undef READGUY_epd_busy
|
||||
#undef READGUY_sd_miso
|
||||
#undef READGUY_sd_mosi
|
||||
#undef READGUY_sd_sclk
|
||||
#undef READGUY_sd_cs
|
||||
#undef READGUY_i2c_sda
|
||||
#undef READGUY_i2c_scl
|
||||
#undef READGUY_btn1
|
||||
#undef READGUY_btn2
|
||||
#undef READGUY_btn3
|
||||
#undef READGUY_bl_pin
|
||||
#undef READGUY_user1
|
||||
#undef READGUY_user2
|
||||
#undef READGUY_user3
|
||||
#undef READGUY_user4
|
||||
#undef READGUY_user5
|
||||
#undef READGUY_user6
|
||||
#undef READGUY_user7
|
||||
#undef READGUY_user8
|
||||
#undef READGUY_user9
|
||||
#undef READGUY_user10
|
||||
#undef READGUY_rtc_type
|
||||
#undef MEPD_DEBUG_WAVE
|
||||
#undef MEPD_DEBUG_WAITTIME
|
||||
#undef FLOYD_STEINBERG_DITHERING
|
||||
#undef FLOYD_DITHERING_16GREY
|
||||
#undef READGUY_583A_DUAL_BUFFER
|
||||
#include "readguy_user_config.h"
|
||||
#else
|
||||
#include "guy_driver_config.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ESP8266 //应用于
|
||||
#define _READGUY_PLATFORM "ESP8266"
|
||||
//#define READGUY_IDF_TARGET_WITHOUT_FSPI //该器件不能使用fspi
|
||||
#else
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define _READGUY_PLATFORM "ESP32"
|
||||
#define READGUY_IDF_TARGET_WITH_VSPI //该器件拥有vspi
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
#define _READGUY_PLATFORM "ESP32S2"
|
||||
#define READGUY_IDF_TARGET_MATRIX_SDIO //该器件支持矩阵SDIO
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#define _READGUY_PLATFORM "ESP32S3"
|
||||
#define READGUY_IDF_TARGET_MATRIX_SDIO //该器件支持矩阵SDIO
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#define _READGUY_PLATFORM "ESP32C3"
|
||||
#define READGUY_IDF_TARGET_MATRIX_SDIO //该器件支持矩阵SDIO
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6) //新增 ESP32C6 (暂未测试)
|
||||
#define _READGUY_PLATFORM "ESP32C6"
|
||||
#define READGUY_IDF_TARGET_MATRIX_SDIO //该器件支持矩阵SDIO
|
||||
#else
|
||||
#define _READGUY_PLATFORM "Unknown" //Prepare for ESP32-C6, H7, etc.
|
||||
#warning Unknown platform! Readguy will run with unexpected (maybe hardware) errors!
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define MEPD_DEBUG_WAVE 16 //取消此行注释来监视SPI的通信数据 (用于debug), 可以查看主控和屏幕的通信数据
|
||||
//#define MEPD_DEBUG_WAITTIME //显示墨水屏的刷新时间, 单位是毫秒
|
||||
#define FLOYD_STEINBERG_DITHERING //默认使用更好的floyd steinberg抖动算法,取消注释则用bayer图案抖动算法
|
||||
#define FLOYD_DITHERING_16GREY //使用更好的floyd steinberg抖动算法显示16阶灰度,取消注释则使用阈值填充
|
||||
|
||||
// ***********************************************************************
|
||||
|
||||
@@ -68,7 +162,5 @@
|
||||
|
||||
#define EPD_DRIVERS_NUM_MAX 21 //此选项请不要取消注释掉, 有几个屏幕就写多少.
|
||||
|
||||
#define READGUY_583A_DUAL_BUFFER //对于单缓存的5.83屏幕,启用双缓存支持. 相当不建议注释掉,否则不能刷白色
|
||||
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
Copyright (C) 2023 FriendshipEnder. */
|
||||
Copyright (C) 2025 FriendshipEnder. */
|
||||
@@ -7,15 +7,17 @@
|
||||
* @author FriendshipEnder (f_ender@163.com), Bilibili: FriendshipEnder
|
||||
* @brief readguy 基础配置文件. 用户可以根据自己对库的编译需求来修改此文件.
|
||||
*
|
||||
* 1.5.0 新增!
|
||||
* 在项目目录里拷贝本文件并重命名为 "readguy_user_config.h" 即可使本配置文件仅在当前项目有效
|
||||
*
|
||||
* 如果你希望在程序代码内包含引脚定义, 请参考此文件下方的注释来确定并编译
|
||||
* 这样就可以只针对你设计的这一个硬件来设定引脚功能.
|
||||
* 关于屏幕配置, 请参考 guy_epaper/guy_epaper_config.h 文件来配置到底哪些屏幕型号的屏幕会被包含进来
|
||||
* 关于屏幕配置, 请参考最下方(284行到文件末尾)来配置到底哪些屏幕型号的屏幕会被包含进来
|
||||
|
||||
* 可以禁用WiFi功能来减少程序的flash消耗
|
||||
|
||||
* @version 1.1
|
||||
* @date create: 2023-09-21
|
||||
* last modify: 2023-11-11
|
||||
* last modify: 2025/4/7
|
||||
|
||||
* @attention
|
||||
* Copyright (c) 2022-2023 FriendshipEnder
|
||||
@@ -73,8 +75,42 @@
|
||||
/ 关闭此选项自动禁用wifi功能. 如需wifi功能需要自己在程序里加. 但也可以大幅减少flash的占用 */
|
||||
#define DYNAMIC_PIN_SETTINGS
|
||||
|
||||
/// @brief NVS存储配置数据时用的项目名. 必须小于8个字符, 为节省内存, 项目依赖此处的内存块仅分配了8字节.
|
||||
#define READGUY_NVS_PROJECTNAME "readguy"
|
||||
|
||||
/// @brief NVS存储配置数据时用的配置数据键名. 必须小于8个字符, 为节省内存, 项目依赖此处的内存块仅分配了8字节.
|
||||
#define READGUY_NVS_CONFIGKEY "hwconf"
|
||||
|
||||
/// @brief 当使用自定义驱动 (customDriver) 时会通过NVS访问驱动代码. 必须小于8个字符.
|
||||
/// @note 有关自定义驱动, 可以参考 readme 中提到的在 2.0 版本即将到来的特性.
|
||||
#define READGUY_NVS_DRIVERKEY "driver"
|
||||
|
||||
/// @brief 启用WIFI配网功能.必须先启用 #define DYNAMIC_PIN_SETTINGS. 此选项对 ESP32xx 会减少大量可用flash.
|
||||
#define READGUY_ENABLE_WIFI //会破坏跨平台特性
|
||||
/// @note 注释掉它会破坏跨平台特性
|
||||
#define READGUY_ENABLE_WIFI
|
||||
|
||||
/// @brief AP配网热点的名称和密码. 不可注释
|
||||
#define READGUY_CONF_AP_SSID "readguy"
|
||||
#define READGUY_CONF_AP_PASS "12345678"
|
||||
|
||||
/** @brief 使用服务器或者WIFI配网时, 在网页上显示项目默认的图标, 默认图标会额外占用1150字节的flash空间
|
||||
/ 如果想用自己的图标数据库, 请参考配网示例, 在配置时候加入下方的代码. 此处提供了代码.
|
||||
``` C++
|
||||
typedef ReadguyDriver::ReadguyWebServer* server_t; //类型名太长太繁琐, 使用typedef减短
|
||||
typedef ReadguyDriver::serveFunc event_t ; //存储一个WiFi功能事件.
|
||||
const uint8_t icon[] = {}; //你的图标数据. 可直接把 *.ico 格式图标文件转化为字节数组, 拷贝到此处
|
||||
void sendIcon(server_t sv){ sv->send_P(200, "image/x-icon", (const char *)icon,sizeof(icon)); }
|
||||
event_t server_event={"","/favicon",sendIcon};
|
||||
guy.server_setup(String("Custom Icon"),&server_event,1); //初始化服务器.
|
||||
``` */
|
||||
//#define READGUY_USE_DEFAULT_ICON
|
||||
|
||||
/** @brief 使用MDNS域名服务. 在设备联网或者打开热点之后, 可以通过域名 readguy.local 来访问配网主页
|
||||
/ 关闭本功能可节省少许flash. 如需自定义服务名称, 则您可更改此处的字符串, 访问 <自定义名称>.local */
|
||||
//#define READGUY_MDNS_SERVICE "readguy"
|
||||
|
||||
/// @brief 使用固件更新服务. 关闭本功能可节省少许flash. 如需自定义链接名称, 则您可更改此处的字符串.
|
||||
//#define READGUY_UPDATE_SERVER "固件更新"
|
||||
|
||||
/** @brief 启用I2C功能. 可用于联网时钟, 温度计, 陀螺仪等外设. 目前暂不支持库内使用类似函数. 仅可以提供引脚定义
|
||||
/ @note 现在库提供了获取已存的I2C引脚的接口, 使用时请使用 getI2cSda() 和 getI2cScl() 函数获取I2C的引脚.
|
||||
@@ -151,6 +187,7 @@
|
||||
|
||||
/// @brief ESP32驱动SD卡的速率. 当ESP32在与SD卡共享SPI时, 屏幕依据此处的速率.
|
||||
#define ESP32_SD_SPI_FREQUENCY 20000000
|
||||
#define ESP32_SD_MMC_FREQUENCY 40000
|
||||
|
||||
/// @brief debug专用, 请保持处于注释状态. 正常开机从NVS读取引脚配置数据, 取消注释则每次开机需要重新配置
|
||||
//#define READGUY_INDEV_DEBUG 1
|
||||
@@ -158,6 +195,21 @@
|
||||
/// @brief 串口显示刷屏功能等的信息. 如果是对flash大小要求十分敏感, 或者希望减少串口数据, 可以关闭
|
||||
#define READGUY_SERIAL_DEBUG
|
||||
|
||||
/// @brief 对于单缓存的5.83屏幕,启用双缓存支持. 相当不建议注释掉,否则不能刷白色
|
||||
#define READGUY_583A_DUAL_BUFFER
|
||||
|
||||
/// @brief 取消此行注释来监视SPI的通信数据 (用于debug), 可以查看主控和屏幕的通信数据
|
||||
//#define MEPD_DEBUG_WAVE 16
|
||||
|
||||
/// @brief 显示墨水屏的刷新时间, 单位是毫秒
|
||||
//#define MEPD_DEBUG_WAITTIME
|
||||
|
||||
/// @brief 默认使用更好的floyd steinberg抖动算法,取消注释则用bayer图案抖动算法
|
||||
#define FLOYD_STEINBERG_DITHERING
|
||||
|
||||
/// @brief 使用更好的floyd steinberg抖动算法显示16阶灰度,取消注释则使用阈值填充
|
||||
#define FLOYD_DITHERING_16GREY
|
||||
|
||||
#ifndef DYNAMIC_PIN_SETTINGS
|
||||
#ifdef ESP8266
|
||||
#define READGUY_shareSpi 1 //EPD和SD卡是否共享SPI,对于ESP8266必须设置为1
|
||||
@@ -233,7 +285,7 @@
|
||||
#define READGUY_user10 -1 //useless
|
||||
#endif
|
||||
|
||||
#define READGUY_rtc_type 0 //使用的RTC型号. 现已弃用 RTC 功能. 保留是为了兼容性 让代码更简单维护
|
||||
#define READGUY_rtc_type 0 //使用的RTC型号. RTC 将在2.0实装 保留是为了兼容性 让代码更简单维护
|
||||
|
||||
// ******************************************************************
|
||||
// ********************** 以下内容不建议用户更改 **********************
|
||||
@@ -243,26 +295,5 @@
|
||||
#endif
|
||||
#undef READGUY_ENABLE_WIFI
|
||||
|
||||
#ifdef ESP8266 //应用于
|
||||
#define _READGUY_PLATFORM "ESP8266"
|
||||
#define READGUY_IDF_TARGET_WITHOUT_FSPI //该器件不能使用fspi
|
||||
#else
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define _READGUY_PLATFORM "ESP32"
|
||||
#define READGUY_IDF_TARGET_WITH_VSPI //该器件拥有vspi
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
#define _READGUY_PLATFORM "ESP32S2"
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#define _READGUY_PLATFORM "ESP32S3"
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
#define _READGUY_PLATFORM "ESP32C3"
|
||||
#define READGUY_IDF_TARGET_WITHOUT_FSPI //该器件不能使用fspi
|
||||
#else
|
||||
#define _READGUY_PLATFORM "Unknown" //Prepare for ESP32-C6, H7, etc.
|
||||
#warning Unknown platform! Readguy will run with unexpected (maybe hardware) errors!
|
||||
#define READGUY_IDF_TARGET_WITHOUT_FSPI //该器件不能使用fspi
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
Copyright (C) 2023 FriendshipEnder. */
|
||||
@@ -35,7 +35,8 @@
|
||||
#include <FS.h>
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
#include "guy_epaper_config.h"
|
||||
#include "../guy_config_host.h"
|
||||
#include <functional>
|
||||
|
||||
#define FILL_WHITE ([](int)->uint8_t{return 0xff;})
|
||||
#define FILL_BLACK ([](int)->uint8_t{return 0x00;})
|
||||
|
||||
@@ -128,12 +128,16 @@ public:
|
||||
auto cfg = _bus_instance.config(); // 获取总线配置的结构。
|
||||
#ifndef ESP8266
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
cfg.spi_host = SPI3_HOST; // 选择要使用的 SPI (VSPI_HOST or HSPI_HOST)
|
||||
cfg.spi_host = VSPI_HOST; // 选择要使用的 SPI (VSPI_HOST or HSPI_HOST)
|
||||
#else
|
||||
cfg.spi_host = SPI1_HOST; // 选择要使用的 SPI (VSPI_HOST or HSPI_HOST)
|
||||
#endif
|
||||
cfg.use_lock = true; // 使用锁时设置为 True
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
|
||||
cfg.dma_channel = SPI_DMA_CH_AUTO; // Set the DMA channel (1 or 2. 0=disable) 设置要打开的 DMA 通道 (0=DMA关闭)
|
||||
#else
|
||||
cfg.dma_channel = 0; // Auto DMA channel isn't supported. Don't use DMA by default.
|
||||
#endif
|
||||
#endif
|
||||
cfg.spi_mode = 0; // SPI设置通讯模式 (0 ~ 3)
|
||||
#if (defined(DISPLAY_TYPE_ST7789_240320) || defined(DISPLAY_TYPE_ST7789_240240) || defined(DISPLAY_TYPE_ST7789_135240))
|
||||
|
||||
@@ -40,10 +40,10 @@
|
||||
//务必保证这些版本号是一致的.
|
||||
//另外, 在提交新版本之前, 不要忘记在github上创建release, 否则Arduino IDE会读不到
|
||||
#define READGUY_V_MAJOR 1
|
||||
#define READGUY_V_MINOR 4
|
||||
#define READGUY_V_PATCH 2
|
||||
#define READGUY_V_MINOR 5
|
||||
#define READGUY_V_PATCH 0
|
||||
#define READGUY_VERSION_VAL (READGUY_V_MAJOR*1000+READGUY_V_MINOR*100+READGUY_V_PATCH*10)
|
||||
#define READGUY_VERSION "1.4.2"
|
||||
#define READGUY_VERSION "1.5.0"
|
||||
|
||||
#define _GITHUB_LINK "https://github.com/fsender/readguy"
|
||||
#define _BILIBILI_LINK "https://www.bilibili.com/video/BV1f94y187wz"
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
|
||||
#include "readguy.h"
|
||||
#if (!defined(ESP8266)) //for ESP32, ESP32S2, ESP32S3, ESP32C3
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
|
||||
#include "esp_flash.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
static const PROGMEM char NOT_SUPPORTED[] = "(不支持此屏幕)";
|
||||
@@ -186,7 +188,7 @@ const char *ReadguyDriver::epd_drivers_list[EPD_DRIVERS_NUM_MAX]={
|
||||
//x==62 -> _
|
||||
//#define R2CHAR(x) (((x)==63)?42:(((x)==62)?95:(((x)>=36)?((x)+61):(((x)>=10)?((x)+55):((x)+48)))))
|
||||
void ReadguyDriver::ap_setup(){
|
||||
return ap_setup("readguy","12345678");
|
||||
return ap_setup(READGUY_CONF_AP_SSID,READGUY_CONF_AP_PASS);
|
||||
}
|
||||
void ReadguyDriver::ap_setup(const char *ssid, const char *pass, int m){
|
||||
//初始化WiFi AP模式, 用于将来的连接WiFi 处于已连接状态下会断开原本的连接
|
||||
@@ -203,7 +205,9 @@ void ReadguyDriver::ap_setup(const char *ssid, const char *pass, int m){
|
||||
void ReadguyDriver::server_setup(const String ¬ify, const serveFunc *serveFuncs, int funcs){
|
||||
//启动WiFi服务器端, 这样就可以进行配网工作
|
||||
if(sfuncs!=-1) server_end(); //避免重复服务器setup
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
httpUpdater.setup(&sv);
|
||||
#endif
|
||||
sv.on("/", HTTP_GET, std::bind(&ReadguyDriver::handleInit ,this));
|
||||
sv.on("/verify", HTTP_POST, std::bind(&ReadguyDriver::handleInitPost ,this)); //此时已经完成了引脚初始化
|
||||
sv.on("/pinsetup", HTTP_GET, std::bind(&ReadguyDriver::handlePinSetup ,this));
|
||||
@@ -231,17 +235,16 @@ void ReadguyDriver::server_setup(const String ¬ify, const serveFunc *serveFun
|
||||
}
|
||||
else { sfnames=nullptr; sfevents=nullptr; }
|
||||
|
||||
|
||||
/*sv.on("/favicon.ico", HTTP_GET, [&](){
|
||||
sv.client().write_P(PSTR("HTTP/1.1 200 OK\r\n"
|
||||
"Content-Type: image/x-icon\r\n"
|
||||
"Content-Length: 1150\r\n"
|
||||
"Connection: close\r\n\r\n"),89);
|
||||
sv.client().write_P((const char *)faviconData,sizeof(faviconData));
|
||||
});*/
|
||||
#ifdef READGUY_USE_DEFAULT_ICON
|
||||
sv.on("/favicon.ico", HTTP_GET, [&](){
|
||||
sv.send_P(200,"image/x-icon",(const char *)faviconData,sizeof(faviconData));
|
||||
});
|
||||
#endif
|
||||
sv.begin();
|
||||
MDNS.begin("readguy");
|
||||
//MDNS.addService("http","tcp",80);
|
||||
#ifdef READGUY_MDNS_SERVICE
|
||||
MDNS.begin(READGUY_MDNS_SERVICE);
|
||||
MDNS.addService("http","tcp",80);
|
||||
#endif
|
||||
#ifdef READGUY_SERIAL_DEBUG
|
||||
Serial.print(F("[Guy server] Done! visit "));
|
||||
if(WiFi.getMode() == WIFI_AP) Serial.println(F("192.168.4.1"));
|
||||
@@ -288,7 +291,9 @@ bool ReadguyDriver::server_loop(){ //此时等待网页操作完成响应...
|
||||
}
|
||||
void ReadguyDriver::server_end(){
|
||||
sv.stop();
|
||||
#ifdef READGUY_MDNS_SERVICE
|
||||
MDNS.end();
|
||||
#endif
|
||||
sfuncs=-1;
|
||||
delete [] sfnames;
|
||||
delete [] sfevents;
|
||||
@@ -318,11 +323,17 @@ void ReadguyDriver::handleInitPost(){
|
||||
btnTask.detach();
|
||||
#else
|
||||
#ifdef READGUY_ENABLE_SD
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
if(READGUY_shareSpi) SD.end(); else SD_MMC.end();
|
||||
#else
|
||||
SD.end();//关闭SD卡
|
||||
#endif
|
||||
#ifdef READGUY_IDF_TARGET_WITH_VSPI
|
||||
if(sd_spi != epd_spi) { //共线时, 不要删除SD
|
||||
delete sd_spi;
|
||||
sd_spi=nullptr;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
vTaskDelete(btn_handle);
|
||||
#endif
|
||||
@@ -353,7 +364,7 @@ void ReadguyDriver::handleInitPost(){
|
||||
else if(i==19&&btn_count_>2) config_data[17]=sv.arg(FPSTR(args_name[19])).toInt()+1;
|
||||
else if(i==20&&btn_count_>2) config_data[17]=-config_data[17];
|
||||
else if(i==21) config_data[18] = sv.arg(FPSTR(args_name[21])).toInt();
|
||||
else if(i==22) config_data[19] = sv.arg(FPSTR(args_name[22])).toInt(); //现已弃用 RTC 功能.
|
||||
else if(i==22) config_data[19] = sv.arg(FPSTR(args_name[22])).toInt(); //RTC 将在2.0实装
|
||||
else if(i>22){ //用户数据
|
||||
config_data[i-1] = sv.arg(a_name).toInt();
|
||||
}
|
||||
@@ -367,16 +378,16 @@ void ReadguyDriver::handleInitPost(){
|
||||
}
|
||||
}
|
||||
//尝试初始化各个硬件, 可能失败, 然后显示一些东西
|
||||
#if (defined(ESP8266) || defined(READGUY_IDF_TARGET_WITHOUT_FSPI))
|
||||
#if (defined(ESP8266))
|
||||
if(config_data[3]==-1) config_data[3] = config_data[10];
|
||||
else config_data[10] = config_data[3];
|
||||
if(config_data[4]==-1) config_data[4] = config_data[11];
|
||||
else config_data[11] = config_data[4];
|
||||
READGUY_shareSpi = true;
|
||||
#else
|
||||
if(config_data[10] == config_data[3] && config_data[11] == config_data[4]) //检测到SPI共线
|
||||
if(config_data[10] == config_data[3] || config_data[11] == config_data[4]) //检测到SPI共线
|
||||
READGUY_shareSpi = true;
|
||||
else if(READGUY_shareSpi){
|
||||
if(READGUY_shareSpi){
|
||||
if(config_data[3]==-1) config_data[3] = config_data[10];
|
||||
else config_data[10] = config_data[3];
|
||||
if(config_data[4]==-1) config_data[4] = config_data[11];
|
||||
@@ -423,6 +434,9 @@ void ReadguyDriver::handleInitPost(){
|
||||
Serial.println(F("[Guy] Init details..."));
|
||||
#endif
|
||||
setTextSize(1);
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
SD_MMC.end();
|
||||
#endif
|
||||
drawCenterString(setSDcardDriver()?"SD Init OK!":"SD Init failed!",
|
||||
guy_dev->drv_width()>>1,(guy_dev->drv_height()>>1)+20);
|
||||
setButtonDriver(); //初始化按钮..
|
||||
@@ -514,7 +528,7 @@ void ReadguyDriver::handlePinSetup(){
|
||||
"甘草半糖板","微雪例程"
|
||||
};
|
||||
*/
|
||||
#elif (defined(READGUY_IDF_TARGET_WITHOUT_FSPI))
|
||||
#elif (defined(CONFIG_IDF_TARGET_ESP32C3))
|
||||
#define DRIVER_TEMPLATE_N 0
|
||||
#define DRIVER_TEMPLATE_ARRAY_L 16
|
||||
/*
|
||||
@@ -574,10 +588,10 @@ void ReadguyDriver::handlePinSetup(){
|
||||
#else
|
||||
for(int i=0;i<12;i++){
|
||||
s += F("<br/>");
|
||||
#if defined(READGUY_IDF_TARGET_WITHOUT_FSPI)
|
||||
#if (!(defined(READGUY_IDF_TARGET_WITH_VSPI) || defined(READGUY_IDF_TARGET_MATRIX_SDIO)))
|
||||
if(i==7) {
|
||||
i+=2; //优化ESP32C3的SPI配置体验 (C3只能共线)
|
||||
s += F("(ESP32C3不支持SD卡独立SPI总线! SD_MOSI和SD_SCLK沿用EPDMOSI和EPDSCLK)<br/>");
|
||||
s += F("(" _READGUY_PLATFORM "不支持SD卡独立SPI总线! SD_MOSI和SD_SCLK沿用EPDMOSI和EPDSCLK)<br/>");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -671,16 +685,32 @@ void ReadguyDriver::handleFinal(){
|
||||
else s+=F("SD卡已插入.<br/>"); //对于大容量(>2GB)卡, SDFS.info64(*sdInfo)函数调用速度太慢(17秒)
|
||||
#else
|
||||
else{
|
||||
auto cardType = SD.cardType();
|
||||
uint32_t sz;
|
||||
uint32_t usesz;
|
||||
sdcard_type_t cardType;
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
if(READGUY_shareSpi){
|
||||
#endif
|
||||
sz=(uint32_t)(SD.cardSize()/1024);
|
||||
usesz=(uint32_t)(SD.usedBytes()/1024);
|
||||
cardType=SD.cardType();
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
}
|
||||
else{
|
||||
sz=(uint32_t)(SD_MMC.cardSize()/1024);
|
||||
usesz=(uint32_t)(SD_MMC.usedBytes()/1024);
|
||||
cardType=SD_MMC.cardType();
|
||||
}
|
||||
#endif
|
||||
s+=F("SD Card Type: ");
|
||||
if(cardType == CARD_MMC) s+=F("MMC");
|
||||
else if(cardType == CARD_SD) s+=F("SDSC");
|
||||
else if(cardType == CARD_SDHC) s+=F("SDHC");
|
||||
else s+=F("UNKNOWN");
|
||||
s+=F(", SD card size: ");
|
||||
s+=(uint32_t)(SD.cardSize()/1024);
|
||||
s+=sz;
|
||||
s+=F(", used size: ");
|
||||
s+=(uint32_t)(SD.usedBytes()/1024);
|
||||
s+=usesz;
|
||||
s+=F("KB.<br/>");
|
||||
}
|
||||
#endif
|
||||
@@ -701,11 +731,17 @@ void ReadguyDriver::handleFinal(){
|
||||
char cbuf[20]="";
|
||||
#if (defined(ESP8266))
|
||||
sprintf(cbuf, "0x%08x", ESP.getChipId());
|
||||
#else
|
||||
#elif (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0))
|
||||
uint64_t gotID;
|
||||
esp_flash_read_unique_chip_id(esp_flash_default_chip,&gotID);
|
||||
//sprintf(cbuf, "%016llx", gotID);
|
||||
sprintf(cbuf, "%08x%08x",(unsigned int)(gotID>>32),(unsigned int)(gotID&0xffffffffu));
|
||||
#else
|
||||
uint32_t chipId = 0;
|
||||
for(int i=0; i<17; i=i+8) {
|
||||
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
|
||||
}
|
||||
sprintf(cbuf, "0x%08x",chipId);
|
||||
#endif
|
||||
s+=cbuf;
|
||||
s+=F("<br/>闪存容量: ");
|
||||
@@ -771,7 +807,7 @@ const PROGMEM char ReadguyDriver::index_cn_html[] = // then write EpdMOSI pin
|
||||
"将引脚配置输入到框内, 即可成功点亮屏幕.</p><hr/><h2>引脚定义设定</h2><form "
|
||||
"name=\"input\" action=\"/verify\" method=\"POST\">";
|
||||
const PROGMEM char ReadguyDriver::index_cn_html2[] =
|
||||
#if (!defined(ESP8266) && !defined(READGUY_IDF_TARGET_WITHOUT_FSPI))
|
||||
#if (defined(READGUY_IDF_TARGET_WITH_VSPI) || defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
"<input type=\"checkbox\" name=\"share\" value=\"1\">墨水屏和SD卡共享SPI<br/>"
|
||||
#endif
|
||||
"E-paper 型号<select id=\"et\" onchange=\"ct()\" name=\"epdtype\">";
|
||||
@@ -785,14 +821,18 @@ const PROGMEM char ReadguyDriver::verify_html[] =
|
||||
const PROGMEM char ReadguyDriver::verify2_html[] =
|
||||
"<br/><hr/>完成上述4个操作之后屏幕上将会展现出验证码,输入验证码即可完成硬件配置.<br/></p><form action=\"/fin"
|
||||
"al\" method=\"POST\"><input type=\'text\' name=\'t_verify\' maxlength=\"6";
|
||||
const PROGMEM char ReadguyDriver::verifybtn_html[3][224] = {
|
||||
const PROGMEM char *ReadguyDriver::verifybtn_html[3] = {verifybtn_html1,verifybtn_html2,verifybtn_html3};
|
||||
|
||||
const PROGMEM char ReadguyDriver::verifybtn_html1[] =
|
||||
"一个按键, 功能全保留, 操作可能比较繁琐.<br/>点按:下一个/向下翻页<br/>双击:确定/选择<br/>三连击:返回/退格<br/>"
|
||||
"长按半秒:上一个/向上翻页<br/>点按紧接着长按: 特殊操作",
|
||||
"长按半秒:上一个/向上翻页<br/>点按紧接着长按: 特殊操作";
|
||||
const PROGMEM char ReadguyDriver::verifybtn_html2[] =
|
||||
"两个按键, 操作可以满足需求.<br/>按键1点按:下一个/向下翻页<br/>按键1长按:上一个/向上翻页<br/>按键2点按:确定/选"
|
||||
"择<br/>按键2长按:返回/退格<br/>按住按键1点按2:特殊操作",
|
||||
"择<br/>按键2长按:返回/退格<br/>按住按键1点按2:特殊操作";
|
||||
const PROGMEM char ReadguyDriver::verifybtn_html3[] =
|
||||
"三个按键, 操作非常方便流畅.<br/>按键1:上一个/向上翻页<br/>按键2点按:确定/选择<br/>按键2长按: 返回/退格<br/>按"
|
||||
"键3:下一个/向下翻页<br/>双击点按2:切换输入法等特殊操作"
|
||||
};
|
||||
"键3:下一个/向下翻页<br/>双击点按2:切换输入法等特殊操作";
|
||||
|
||||
const PROGMEM char ReadguyDriver::final_html[] =
|
||||
"欢迎使用 readguy</title></head><body><h1>readguy ";
|
||||
const PROGMEM char ReadguyDriver::afterConfig_html[] =
|
||||
@@ -808,10 +848,14 @@ const PROGMEM char ReadguyDriver::final2_html[] =
|
||||
"钥<input type=\'text\' name=\'psk\' maxlength=\"63";
|
||||
*/
|
||||
const PROGMEM char ReadguyDriver::end_html[] =
|
||||
"<p>ReadGuy on device " _READGUY_PLATFORM " <a href=\"/pinsetup\">重新配置引脚</a> <a href=\"/update\">固件更新"
|
||||
"</a><br/>Copyright © FriendshipEnder <a href=\"" _GITHUB_LINK "\">GitHub</a> <a href=\"" _BILIBILI_LINK "\">"
|
||||
"<p>ReadGuy on device " _READGUY_PLATFORM " <a href=\"/pinsetup\">重新配置引脚</a>"
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
" <a href=\"/update\">" READGUY_UPDATE_SERVER "</a>"
|
||||
#endif
|
||||
"<br/>Copyright © FriendshipEnder <a href=\"" _GITHUB_LINK "\">GitHub</a> <a href=\"" _BILIBILI_LINK "\">"
|
||||
"Bilibili</a><br/>版本: " READGUY_VERSION " ,编译日期: " __DATE__ " " __TIME__ "</p></body></html>";
|
||||
/*const PROGMEM uint8_t ReadguyDriver::faviconData[1150]={
|
||||
#ifdef READGUY_USE_DEFAULT_ICON
|
||||
const PROGMEM uint8_t ReadguyDriver::faviconData[1150]={
|
||||
0x0,0x0,0x1,0x0,0x1,0x0,0x10,0x10,0x0,0x0,0x1,0x0,0x20,0x0,0x68,0x4,0x0,0x0,0x16,0x0,0x0,0x0,0x28,0x0,
|
||||
0x0,0x0,0x10,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x1,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x40,0x4,0x0,0x0,0x0,0x0,
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9d,0xaa,0xe8,0xff,0x74,0x73,0x77,0xff,0x74,0x73,
|
||||
@@ -860,6 +904,7 @@ const PROGMEM char ReadguyDriver::end_html[] =
|
||||
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1,
|
||||
0x0,0x0,0x0,0x1,0x0,0x0,0x80,0x1,0x0,0x0,0x80,0x0,0x0,0x0,0x80,0x1,0x0,0x0,0x80,0x1,0x0,0x0,0xc0,0x1,
|
||||
0x0,0x0,0xc0,0x3,0x0,0x0,0xe0,0x3,0x0,0x0,0xf0,0x7,0x0,0x0,0xfc,0x1f,0x0,0x0,0xf0,0xff,0x0,0x0
|
||||
};*/
|
||||
};
|
||||
#endif
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
Copyright (C) 2023 FriendshipEnder. */
|
||||
@@ -49,8 +49,9 @@ uint8_t ReadguyDriver::static_sd_cs=0x7f;
|
||||
volatile uint8_t ReadguyDriver::sd_cs_busy=0;
|
||||
#endif
|
||||
|
||||
const PROGMEM char ReadguyDriver::projname[8] = "readguy";
|
||||
const PROGMEM char ReadguyDriver::tagname[7] = "hwconf";
|
||||
|
||||
const PROGMEM char ReadguyDriver::projname[8] = READGUY_NVS_PROJECTNAME;
|
||||
const PROGMEM char ReadguyDriver::tagname[8] = READGUY_NVS_CONFIGKEY;
|
||||
volatile uint8_t ReadguyDriver::spibz=0;
|
||||
#ifndef DYNAMIC_PIN_SETTINGS
|
||||
const int8_t ReadguyDriver::config_data[32] = {
|
||||
@@ -77,7 +78,7 @@ const int8_t ReadguyDriver::config_data[32] = {
|
||||
READGUY_btn2 ,
|
||||
READGUY_btn3 ,
|
||||
READGUY_bl_pin ,//前置光接口引脚IO
|
||||
READGUY_rtc_type ,//使用的RTC型号. 现已弃用 RTC 功能. 保留是为了兼容性 让代码更简单维护
|
||||
READGUY_rtc_type ,//使用的RTC型号. RTC 将在2.0实装 保留是为了兼容性 让代码更简单维护
|
||||
0 ,//READGUY_sd_ok SD卡已经成功初始化
|
||||
0 ,//READGUY_buttons 按钮个数, 0-3都有可能
|
||||
-1, //用户自定义变量 同时用于esp32s3使用SDIO卡数据的DAT1 为-1代表不使用SDIO
|
||||
@@ -86,7 +87,9 @@ const int8_t ReadguyDriver::config_data[32] = {
|
||||
};
|
||||
#endif
|
||||
#ifndef ESP8266
|
||||
#ifdef READGUY_IDF_TARGET_WITH_VSPI
|
||||
SPIClass *ReadguyDriver::sd_spi =nullptr;
|
||||
#endif
|
||||
SPIClass *ReadguyDriver::epd_spi=nullptr;
|
||||
TaskHandle_t ReadguyDriver::btn_handle;
|
||||
#endif
|
||||
@@ -172,7 +175,7 @@ uint8_t ReadguyDriver::checkEpdDriver(){
|
||||
#define TEST_ONLY_VALUE 3
|
||||
#endif
|
||||
#ifdef READGUY_SERIAL_DEBUG
|
||||
Serial.printf_P(PSTR("[Guy SPI] shareSpi? %d\n"),READGUY_shareSpi);
|
||||
if(READGUY_shareSpi) Serial.println(F("[Guy SPI] share EPD and SD SPI."));
|
||||
#endif
|
||||
for(int i=TEST_ONLY_VALUE;i<8;i++){
|
||||
if(i<7 && config_data[i]<0) return 125;//必要的引脚没连接
|
||||
@@ -312,11 +315,13 @@ uint8_t ReadguyDriver::checkEpdDriver(){
|
||||
else epd_spi->end();
|
||||
//epd_spi ->setFrequency(ESP32_DISP_FREQUENCY);
|
||||
//Serial.println("deleting guy_dev");
|
||||
#ifdef READGUY_IDF_TARGET_WITH_VSPI
|
||||
if(READGUY_shareSpi) sd_spi = epd_spi;
|
||||
else {
|
||||
if(sd_spi!=nullptr && sd_spi!=&SPI) { sd_spi->end(); delete sd_spi; } //防止SPI被delete掉
|
||||
sd_spi=nullptr;
|
||||
}
|
||||
#endif
|
||||
epd_spi->begin(READGUY_epd_sclk,READGUY_shareSpi?READGUY_sd_miso:-1,READGUY_epd_mosi);
|
||||
guy_dev->IfInit(*epd_spi, READGUY_epd_cs, READGUY_epd_dc, READGUY_epd_rst, READGUY_epd_busy);
|
||||
#endif
|
||||
@@ -359,13 +364,18 @@ bool ReadguyDriver::setSDcardDriver(){
|
||||
对于esp32也要注意这个引脚是否是一个合法的引脚
|
||||
对于esp8266真的要重写, 比如esp8266需要允许某些引脚是可以复用的
|
||||
此处的函数必须是可以反复调用的, 即 "可重入函数" 而不会造成任何线程危险 */
|
||||
if(READGUY_sd_cs>=0
|
||||
#ifndef ESP8266
|
||||
&&READGUY_sd_miso!=READGUY_sd_mosi&&READGUY_sd_miso!=READGUY_sd_sclk&&READGUY_sd_miso!=READGUY_sd_cs&&READGUY_sd_mosi!=READGUY_sd_sclk
|
||||
#ifdef ESP8266
|
||||
if( READGUY_sd_cs>=0 && READGUY_sd_cs!=READGUY_epd_cs && READGUY_sd_cs!=READGUY_epd_dc\
|
||||
&& READGUY_sd_cs!=READGUY_epd_rst && READGUY_sd_cs!=READGUY_epd_busy )
|
||||
#else
|
||||
if(READGUY_sd_miso!=READGUY_sd_mosi&&READGUY_sd_miso!=READGUY_sd_sclk&&READGUY_sd_miso!=READGUY_sd_cs&&READGUY_sd_mosi!=READGUY_sd_sclk
|
||||
&& READGUY_sd_mosi!=READGUY_sd_cs && READGUY_sd_sclk!=READGUY_sd_cs && READGUY_sd_miso>=0 && READGUY_sd_mosi>=0 && READGUY_sd_sclk>=0
|
||||
#if (!defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
&& READGUY_sd_cs>=0 && READGUY_sd_cs!=READGUY_epd_cs && READGUY_sd_cs!=READGUY_epd_dc && READGUY_sd_cs!=READGUY_epd_rst && READGUY_sd_cs!=READGUY_epd_busy
|
||||
#endif
|
||||
&& READGUY_sd_cs!=READGUY_epd_cs && READGUY_sd_cs!=READGUY_epd_dc && READGUY_sd_cs!=READGUY_epd_rst && READGUY_sd_cs!=READGUY_epd_busy
|
||||
){ //SD卡的CS检测程序和按键检测程序冲突, 故删掉 (可能引发引脚无冲突但是显示冲突的bug)
|
||||
)
|
||||
#endif
|
||||
{ //SD卡的CS检测程序和按键检测程序冲突, 故删掉 (可能引发引脚无冲突但是显示冲突的bug)
|
||||
#if (defined(READGUY_ALLOW_SDCS_AS_BUTTON))
|
||||
setSDbusy(1);
|
||||
#endif
|
||||
@@ -374,15 +384,36 @@ bool ReadguyDriver::setSDcardDriver(){
|
||||
SDFS.setConfig(SDFSConfig(READGUY_sd_cs));
|
||||
READGUY_sd_ok = SDFS.begin();
|
||||
#else
|
||||
if(sd_spi == nullptr) {
|
||||
#if (defined(READGUY_IDF_TARGET_WITH_VSPI))
|
||||
sd_spi = new SPIClass(VSPI);
|
||||
#else
|
||||
sd_spi = new SPIClass(FSPI); //ESP32S2和S3和C3 不支持VSPI, C3不支持FSPI
|
||||
if(READGUY_shareSpi) sd_spi = epd_spi;
|
||||
else{
|
||||
#ifdef READGUY_SERIAL_DEBUG
|
||||
Serial.printf_P(PSTR("[Guy SD] SD-VSPI sclk%3d|mosi%3d|miso%3d|ss%5d\n"),\
|
||||
READGUY_sd_sclk,READGUY_sd_mosi,READGUY_sd_miso,READGUY_sd_cs);
|
||||
#endif
|
||||
if(sd_spi == nullptr) sd_spi = new SPIClass(VSPI);
|
||||
else sd_spi->end();
|
||||
sd_spi->begin(READGUY_sd_sclk,READGUY_sd_miso,READGUY_sd_mosi); //初始化SPI
|
||||
}
|
||||
READGUY_sd_ok = SD.begin(READGUY_sd_cs,*sd_spi,ESP32_SD_SPI_FREQUENCY); //初始化频率为20MHz
|
||||
READGUY_sd_ok = SD.begin(READGUY_sd_cs,*(READGUY_shareSpi?epd_spi:sd_spi),ESP32_SD_SPI_FREQUENCY);
|
||||
#elif (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
if(READGUY_shareSpi){
|
||||
READGUY_sd_ok = SD.begin(READGUY_sd_cs,*epd_spi,ESP32_SD_SPI_FREQUENCY);
|
||||
}
|
||||
else{
|
||||
//if(getReadguyUseSdio()){ //4-wire SDIO
|
||||
#ifdef READGUY_SERIAL_DEBUG
|
||||
Serial.printf_P(PSTR("[Guy SD] SDMMC clk%3d|cmd%3d|d0 %3d|d1 %3d|d2 %3d|d3 %3d\n"),\
|
||||
READGUY_sd_sclk,READGUY_sd_mosi,READGUY_sd_miso,READGUY_user1,READGUY_user2,READGUY_sd_cs);
|
||||
#endif
|
||||
if(READGUY_sd_cs>=0) pinMode(READGUY_sd_cs, INPUT_PULLUP); //默认上拉
|
||||
SD_MMC.setPins(READGUY_sd_sclk,READGUY_sd_mosi,READGUY_sd_miso,READGUY_user1,READGUY_user2,READGUY_sd_cs);
|
||||
//#else //不支持独立总线, 所以不会执行
|
||||
// sd_spi = new SPIClass(FSPI); //ESP32S2和S3和C3 不支持VSPI, C3不支持FSPI
|
||||
// sd_spi->begin(READGUY_sd_sclk,READGUY_sd_miso,READGUY_sd_mosi); //初始化SPI
|
||||
READGUY_sd_ok = SD_MMC.begin("/sd",!getReadguyUseSdio(),false,ESP32_SD_MMC_FREQUENCY); //初始化频率为20MHz
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#if (defined(READGUY_ALLOW_SDCS_AS_BUTTON))
|
||||
setSDbusy(0);
|
||||
@@ -550,6 +581,9 @@ fs::FS &ReadguyDriver::guyFS(uint8_t initSD){
|
||||
#ifdef ESP8266
|
||||
return SDFS;
|
||||
#else
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
if(!READGUY_shareSpi) return SD_MMC;
|
||||
#endif
|
||||
return SD;
|
||||
#endif
|
||||
}
|
||||
|
||||
138
src/readguy.h
@@ -35,6 +35,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <SPI.h>
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
|
||||
#define LGFX_USE_V1
|
||||
#include <LovyanGFX.hpp>
|
||||
@@ -91,7 +92,7 @@
|
||||
|
||||
#include "guy_button.h" //改自Button2精简而来
|
||||
#include "guy_version.h"
|
||||
#include "guy_driver_config.h" //config
|
||||
#include "guy_config_host.h" //config
|
||||
#ifdef READGUY_USE_LITTLEFS
|
||||
#include <LittleFS.h>
|
||||
#else
|
||||
@@ -105,9 +106,13 @@
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#ifdef READGUY_MDNS_SERVICE
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
#include "ESP8266HTTPUpdateServer.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef READGUY_ENABLE_SD
|
||||
#include <SDFS.h>
|
||||
#endif
|
||||
@@ -117,10 +122,17 @@
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
#include <WiFi.h>
|
||||
#include <WebServer.h>
|
||||
#ifdef READGUY_MDNS_SERVICE
|
||||
#include <ESPmDNS.h>
|
||||
#endif
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
#include "HTTPUpdateServer.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef READGUY_ENABLE_SD
|
||||
#if (defined(READGUY_IDF_TARGET_MATRIX_SDIO))
|
||||
#include <SD_MMC.h>
|
||||
#endif
|
||||
#include <SD.h>
|
||||
#endif
|
||||
#include <freertos/FreeRTOS.h>
|
||||
@@ -151,7 +163,7 @@
|
||||
#define READGUY_btn2 (config_data[16])
|
||||
#define READGUY_btn3 (config_data[17])
|
||||
#define READGUY_bl_pin (config_data[18])//前置光接口引脚IO
|
||||
#define READGUY_rtc_type (config_data[19])//现已弃用 RTC 功能. 保留是为了兼容性 让代码更简单维护
|
||||
#define READGUY_rtc_type (config_data[19])//RTC 将在2.0实装 保留是为了兼容性 让代码更简单维护
|
||||
#define READGUY_sd_ok (config_data[20]) //SD卡已经成功初始化
|
||||
#define READGUY_buttons (config_data[21]) //按钮个数, 0-3都有可能
|
||||
|
||||
@@ -184,15 +196,25 @@
|
||||
#define GUY_BTN_OK 4 //返回/退出
|
||||
#define GUY_BTN_BACK 8 //特殊操作(如切换输入法)
|
||||
|
||||
#if __cplusplus >= 201304L
|
||||
#define RG_IL_CONEXP constexpr inline
|
||||
#else
|
||||
#define RG_IL_CONEXP inline
|
||||
#endif
|
||||
|
||||
class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
public:
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
#ifdef ESP8266
|
||||
typedef ESP8266WebServer ReadguyWebServer;
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
typedef ESP8266HTTPUpdateServer ReadguyUpdateServer;
|
||||
#endif
|
||||
#else
|
||||
typedef WebServer ReadguyWebServer;
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
typedef HTTPUpdateServer ReadguyUpdateServer;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
ReadguyDriver();
|
||||
@@ -361,7 +383,7 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
//以下是支持的所有屏幕型号 Add devices here!
|
||||
//添加屏幕驱动范例: 直接添加对应屏幕的类就可以用了
|
||||
static const char projname[8];
|
||||
static const char tagname[7];
|
||||
static const char tagname[8];
|
||||
//uint8_t config_wifi=0; //是否强行在初始化期间设置WiFi.
|
||||
void nvs_init(); //初始化持久存储器.
|
||||
void nvs_deinit();//保存持久存储器的内容
|
||||
@@ -404,7 +426,9 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
#endif
|
||||
#ifdef READGUY_ESP_ENABLE_WIFI
|
||||
ReadguyWebServer sv;
|
||||
#ifdef READGUY_UPDATE_SERVER
|
||||
ReadguyUpdateServer httpUpdater;
|
||||
#endif
|
||||
String guy_notify=emptyString; //嵌入在网页中的自定义标语
|
||||
int sfuncs=-1;
|
||||
String* sfnames=nullptr;
|
||||
@@ -444,12 +468,17 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
static const PROGMEM char index_cn_html16[];
|
||||
static const PROGMEM char verify_html[];
|
||||
static const PROGMEM char verify2_html[];
|
||||
static const PROGMEM char verifybtn_html[3][224];
|
||||
static const PROGMEM char *verifybtn_html[3];
|
||||
static const PROGMEM char verifybtn_html1[];
|
||||
static const PROGMEM char verifybtn_html2[];
|
||||
static const PROGMEM char verifybtn_html3[];
|
||||
static const PROGMEM char final_html[];
|
||||
static const PROGMEM char afterConfig_html[];
|
||||
static const PROGMEM char home_html[];
|
||||
static const PROGMEM char end_html[];
|
||||
//static const PROGMEM uint8_t faviconData[1150];
|
||||
#ifdef READGUY_USE_DEFAULT_ICON
|
||||
static const PROGMEM uint8_t faviconData[1150];
|
||||
#endif
|
||||
#endif
|
||||
static void looptask(); //按键服务函数
|
||||
static uint8_t rd_btn_f(uint8_t btn, bool activeLow);
|
||||
@@ -481,67 +510,67 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
#endif
|
||||
}
|
||||
public: //增加了一些返回系统状态变量的函数, 它们是静态的, 而且不会对程序造成任何影响.
|
||||
constexpr int getShareSpi() const { return READGUY_shareSpi; }
|
||||
constexpr int getEpdType () const { return READGUY_epd_type; } // 对应的epd驱动程序代号, -1为未指定
|
||||
RG_IL_CONEXP int getShareSpi() const { return READGUY_shareSpi; }
|
||||
RG_IL_CONEXP int getEpdType () const { return READGUY_epd_type; } // 对应的epd驱动程序代号, -1为未指定
|
||||
//显示驱动部分, 显示默认使用vspi (vspi也是默认SPI库的通道)
|
||||
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 引脚
|
||||
RG_IL_CONEXP int getEpdMosi () const { return READGUY_epd_mosi; } // 目标显示器的 MOSI 引脚
|
||||
RG_IL_CONEXP int getEpdSclk () const { return READGUY_epd_sclk; } // 目标显示器的 SCLK 引脚
|
||||
RG_IL_CONEXP int getEpdCs () const { return READGUY_epd_cs; } // 目标显示器的 CS 引脚
|
||||
RG_IL_CONEXP int getEpdDc () const { return READGUY_epd_dc; } // 目标显示器的 DC 引脚
|
||||
RG_IL_CONEXP int getEpdRst () const { return READGUY_epd_rst; } // 目标显示器的 RST 引脚
|
||||
RG_IL_CONEXP int getEpdBusy () const { return READGUY_epd_busy; } // 目标显示器的 BUSY 引脚
|
||||
//sd卡驱动部分, 默认使用hspi (sd卡建议用hspi)
|
||||
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总线时才生效
|
||||
RG_IL_CONEXP int getSdMiso () const { return READGUY_sd_miso; } // 目标sd卡的 MISO 引脚, sd_share_spi == 1 时无效
|
||||
RG_IL_CONEXP int getSdMosi () const { return READGUY_sd_mosi; }// 目标sd卡的 MOSI 引脚, sd_share_spi == 1 时无效
|
||||
RG_IL_CONEXP int getSdSclk () const { return READGUY_sd_sclk; }// 目标sd卡的 SCLK 引脚, sd_share_spi == 1 时无效
|
||||
RG_IL_CONEXP int getSdCs () const { return READGUY_sd_cs; }// 目标sd卡的CS引脚. 对ESP32S3, 返回127代表使用SDMMC
|
||||
RG_IL_CONEXP int getI2cSda () const { return READGUY_i2c_sda; }// 目标i2c总线的SDA引脚, 当且仅当启用i2c总线时才生效
|
||||
RG_IL_CONEXP int getI2cScl () const { return READGUY_i2c_scl; }// 目标i2c总线的SCL引脚, 当且仅当启用i2c总线时才生效
|
||||
//按键驱动部分, 为负代表高触发, 否则低触发,
|
||||
//注意, 这里的io编号是加1的, 即 1或-1 代表 gpio0 的低触发/高触发
|
||||
constexpr int getBtn1Pin () const { return abs((int)READGUY_btn1)-1; }
|
||||
constexpr int getBtn2Pin () const { return abs((int)READGUY_btn2)-1; }
|
||||
constexpr int getBtn3Pin () const { return abs((int)READGUY_btn3)-1; }
|
||||
constexpr int getBtn1Info() const { return READGUY_btn1; }
|
||||
constexpr int getBtn2Info() const { return READGUY_btn2; }
|
||||
constexpr int getBtn3Info() 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 getReadguy_user1 () const { return READGUY_user1; } //用户变量
|
||||
constexpr int getReadguy_user2 () const { return READGUY_user2; } //用户变量
|
||||
constexpr int getReadguy_user3 () const { return READGUY_user3; } //用户变量
|
||||
constexpr int getReadguy_user4 () const { return READGUY_user4; } //用户变量
|
||||
constexpr int getReadguy_user5 () const { return READGUY_user5; } //用户变量
|
||||
constexpr int getReadguy_user6 () const { return READGUY_user6; } //用户变量
|
||||
constexpr int getReadguy_user7 () const { return READGUY_user7; } //用户变量
|
||||
constexpr int getReadguy_user8 () const { return READGUY_user8; } //用户变量
|
||||
constexpr int getReadguy_user9 () const { return READGUY_user9; } //用户变量
|
||||
constexpr int getReadguy_user10() const { return READGUY_user10;} //用户变量
|
||||
constexpr int getReadguyUseSdio() const { //返回程序调用SD卡时 是否使用了SDIO
|
||||
RG_IL_CONEXP int getBtn1Pin () const { return abs((int)READGUY_btn1)-1; }
|
||||
RG_IL_CONEXP int getBtn2Pin () const { return abs((int)READGUY_btn2)-1; }
|
||||
RG_IL_CONEXP int getBtn3Pin () const { return abs((int)READGUY_btn3)-1; }
|
||||
RG_IL_CONEXP int getBtn1Info() const { return READGUY_btn1; }
|
||||
RG_IL_CONEXP int getBtn2Info() const { return READGUY_btn2; }
|
||||
RG_IL_CONEXP int getBtn3Info() const { return READGUY_btn3; }
|
||||
RG_IL_CONEXP int getBlPin () const { return READGUY_bl_pin; } //前置光接口引脚IO
|
||||
RG_IL_CONEXP int getRtcType () const { return READGUY_rtc_type; } //RTC 将在2.0实装 保留是为了兼容性 让代码更简单维护
|
||||
RG_IL_CONEXP int getButtonsCount() const { return READGUY_buttons; } //按钮个数, 0-3都有可能
|
||||
RG_IL_CONEXP int getReadguy_user1 () const { return READGUY_user1; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user2 () const { return READGUY_user2; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user3 () const { return READGUY_user3; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user4 () const { return READGUY_user4; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user5 () const { return READGUY_user5; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user6 () const { return READGUY_user6; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user7 () const { return READGUY_user7; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user8 () const { return READGUY_user8; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user9 () const { return READGUY_user9; } //用户变量
|
||||
RG_IL_CONEXP int getReadguy_user10() const { return READGUY_user10;} //用户变量
|
||||
RG_IL_CONEXP bool getReadguyUseSdio() const { //返回程序调用SD卡时 是否使用了SDIO
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S3 //仅对ESP32S3可用
|
||||
return (READGUY_user1 != -1) && (READGUY_user2 != -1);
|
||||
return (READGUY_user1 != -1) && (READGUY_user2 != -1) && (READGUY_sd_cs != -1);
|
||||
#else
|
||||
return 0; //非ESP32S3平台不可用SDIO
|
||||
#endif
|
||||
} //用于esp32s3使用SDIO卡数据的DAT2
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S3 //仅对ESP32S3可用
|
||||
constexpr int getSdio_dat0 () const { return getReadguyUseSdio()?READGUY_sd_miso:-1; } //用于esp32s3使用SDIO卡数据的DAT0
|
||||
constexpr int getSdio_dat1 () const { return getReadguyUseSdio()?READGUY_user1 :-1; } //用于esp32s3使用SDIO卡数据的DAT1
|
||||
constexpr int getSdio_dat2 () const { return getReadguyUseSdio()?READGUY_user2 :-1; } //用于esp32s3使用SDIO卡数据的DAT2
|
||||
constexpr int getSdio_dat3 () const { return getReadguyUseSdio()?READGUY_sd_cs :-1; } //用于esp32s3使用SDIO卡数据的DAT3
|
||||
constexpr int getSdio_clk () const { return getReadguyUseSdio()?READGUY_sd_sclk:-1; } //用于esp32s3使用SDIO卡数据的CLK
|
||||
constexpr int getSdio_cmd () const { return getReadguyUseSdio()?READGUY_sd_mosi:-1; } //用于esp32s3使用SDIO卡数据的CMD
|
||||
RG_IL_CONEXP int getSdio_dat0 () const { return getReadguyUseSdio()?READGUY_sd_miso:-1; } //用于esp32s3使用SDIO卡数据的DAT0
|
||||
RG_IL_CONEXP int getSdio_dat1 () const { return getReadguyUseSdio()?READGUY_user1 :-1; } //用于esp32s3使用SDIO卡数据的DAT1
|
||||
RG_IL_CONEXP int getSdio_dat2 () const { return getReadguyUseSdio()?READGUY_user2 :-1; } //用于esp32s3使用SDIO卡数据的DAT2
|
||||
RG_IL_CONEXP int getSdio_dat3 () const { return getReadguyUseSdio()?READGUY_sd_cs :-1; } //用于esp32s3使用SDIO卡数据的DAT3
|
||||
RG_IL_CONEXP int getSdio_clk () const { return getReadguyUseSdio()?READGUY_sd_sclk:-1; } //用于esp32s3使用SDIO卡数据的CLK
|
||||
RG_IL_CONEXP int getSdio_cmd () const { return getReadguyUseSdio()?READGUY_sd_mosi:-1; } //用于esp32s3使用SDIO卡数据的CMD
|
||||
#else
|
||||
constexpr int getSdio_dat0 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT0
|
||||
constexpr int getSdio_dat1 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT1
|
||||
constexpr int getSdio_dat2 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT2
|
||||
constexpr int getSdio_dat3 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT3
|
||||
constexpr int getSdio_clk () const { return -1; } //用于esp32s3使用SDIO卡数据的CLK
|
||||
constexpr int getSdio_cmd () const { return -1; } //用于esp32s3使用SDIO卡数据的CMD
|
||||
RG_IL_CONEXP int getSdio_dat0 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT0
|
||||
RG_IL_CONEXP int getSdio_dat1 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT1
|
||||
RG_IL_CONEXP int getSdio_dat2 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT2
|
||||
RG_IL_CONEXP int getSdio_dat3 () const { return -1; } //用于esp32s3使用SDIO卡数据的DAT3
|
||||
RG_IL_CONEXP int getSdio_clk () const { return -1; } //用于esp32s3使用SDIO卡数据的CLK
|
||||
RG_IL_CONEXP int getSdio_cmd () const { return -1; } //用于esp32s3使用SDIO卡数据的CMD
|
||||
#endif
|
||||
//constexpr int memWidth () const { return guy_width ; } //返回显存宽度(不是画幅宽度),不会随着画布旋转改变
|
||||
//constexpr int memHeight () const { return guy_height ; } //返回显存高度(不是画幅高度),不会随着画布旋转改变
|
||||
//RG_IL_CONEXP int memWidth () const { return guy_width ; } //返回显存宽度(不是画幅宽度),不会随着画布旋转改变
|
||||
//RG_IL_CONEXP int memHeight () const { return guy_height ; } //返回显存高度(不是画幅高度),不会随着画布旋转改变
|
||||
int drvWidth () const { return READGUY_cali==127?guy_dev->drv_width():0; } //返回显示屏硬件宽度(不是画幅宽度)
|
||||
int drvHeight() const { return READGUY_cali==127?guy_dev->drv_height():0; } //返回显示屏硬件高度(不是画幅高度)
|
||||
//int width () const { return (getRotation()&1)?drvHeight():drvWidth(); }
|
||||
@@ -562,5 +591,6 @@ class ReadguyDriver: public LGFX_Sprite{ // readguy 基础类
|
||||
void drawImageStage(LGFX_Sprite &sprbase,LGFX_Sprite &spr,int32_t x,int32_t y,
|
||||
uint8_t stage,uint8_t totalstage,int32_t zoomw=0,int32_t zoomh=0);
|
||||
};
|
||||
#undef RG_IL_CONEXP
|
||||
#endif /* END OF FILE. ReadGuy project.
|
||||
Copyright (C) 2023 FriendshipEnder. */
|
||||