├── .gitignore ├── LICENSE ├── README.md ├── Version_CN.txt ├── Version_EN.txt ├── c ├── CMakeLists.txt ├── ReadmeCN.txt ├── ReadmeEN.txt ├── examples │ ├── CMakeLists.txt │ ├── EPD_2in13_V2_test.c │ ├── EPD_2in13_V3_test.c │ ├── EPD_2in13_V4_test.c │ ├── EPD_2in13b_V3_test.c │ ├── EPD_2in13b_V4_test.c │ ├── EPD_2in13bc_test.c │ ├── EPD_2in13d_test.c │ ├── EPD_2in66_test.c │ ├── EPD_2in66b_test.c │ ├── EPD_2in7_V2_test.c │ ├── EPD_2in7_test.c │ ├── EPD_2in9_V2_test.c │ ├── EPD_2in9b_V3_test.c │ ├── EPD_2in9b_V4_test.c │ ├── EPD_2in9bc_test.c │ ├── EPD_2in9d_test.c │ ├── EPD_3in7_test.c │ ├── EPD_4in2_V2_test.c │ ├── EPD_4in2_test.c │ ├── EPD_4in2b_V2_test.c │ ├── EPD_4in2b_V2_test_old.c │ ├── EPD_5in65f_test.c │ ├── EPD_5in83_V2_test.c │ ├── EPD_5in83b_V2_test.c │ ├── EPD_7in5_V2_test.c │ ├── EPD_7in5_V2_test_old.c │ ├── EPD_7in5b_V2_test.c │ ├── EPD_7in5b_V2_test_old.c │ ├── EPD_Test.h │ ├── ImageData.c │ └── ImageData.h ├── extra_uf2 │ ├── 2.13-B │ │ ├── epd-V4.uf2 │ │ └── epd.uf2 │ ├── 2.13-C │ │ └── epd.uf2 │ ├── 2.13-D │ │ └── epd.uf2 │ ├── 2.13 │ │ ├── 2in13_V4.uf2 │ │ ├── epd-V3.uf2 │ │ └── epd.uf2 │ ├── 2.66-B │ │ └── epd.uf2 │ ├── 2.66 │ │ └── epd.uf2 │ ├── 2.7 │ │ ├── epd-V2.uf2 │ │ └── epd.uf2 │ ├── 2.9-B-V4 │ │ └── epd.uf2 │ ├── 2.9-B │ │ └── epd.uf2 │ ├── 2.9-C │ │ └── epd.uf2 │ ├── 2.9-D │ │ └── epd.uf2 │ ├── 2.9 │ │ └── epd.uf2 │ ├── 3.7 │ │ └── epd.uf2 │ ├── 4.2-B │ │ └── epd.uf2 │ ├── 4.2 │ │ ├── 4in2_V2.uf2 │ │ └── epd.uf2 │ ├── 5.65 │ │ └── epd.uf2 │ ├── 5.83-B │ │ └── epd.uf2 │ ├── 5.83 │ │ └── epd.uf2 │ ├── 7.5-B │ │ └── epd.uf2 │ ├── 7.5 │ │ └── epd.uf2 │ ├── Readme.txt │ ├── pico │ │ ├── 2.13-B │ │ │ ├── epd-V4.uf2 │ │ │ └── epd.uf2 │ │ ├── 2.13-C │ │ │ └── epd.uf2 │ │ ├── 2.13-D │ │ │ └── epd.uf2 │ │ ├── 2.13 │ │ │ ├── 2in13_V4.uf2 │ │ │ ├── epd-V3.uf2 │ │ │ └── epd.uf2 │ │ ├── 2.66-B │ │ │ └── epd.uf2 │ │ ├── 2.66 │ │ │ └── epd.uf2 │ │ ├── 2.7 │ │ │ ├── epd-V2.uf2 │ │ │ └── epd.uf2 │ │ ├── 2.9-B-V4 │ │ │ └── epd.uf2 │ │ ├── 2.9-B │ │ │ └── epd.uf2 │ │ ├── 2.9-C │ │ │ └── epd.uf2 │ │ ├── 2.9-D │ │ │ └── epd.uf2 │ │ ├── 2.9 │ │ │ └── epd.uf2 │ │ ├── 3.7 │ │ │ └── epd.uf2 │ │ ├── 4.2-B │ │ │ └── epd.uf2 │ │ ├── 4.2 │ │ │ ├── 4in2_V2.uf2 │ │ │ └── epd.uf2 │ │ ├── 5.65 │ │ │ └── epd.uf2 │ │ ├── 5.83-B │ │ │ └── epd.uf2 │ │ ├── 5.83 │ │ │ └── epd.uf2 │ │ ├── 7.5-B │ │ │ └── epd.uf2 │ │ ├── 7.5 │ │ │ └── epd.uf2 │ │ └── Readme.txt │ └── pico2 │ │ ├── 2.13-B │ │ └── epd-V4.uf2 │ │ ├── 2.13-C │ │ └── epd.uf2 │ │ ├── 2.13-D │ │ └── epd.uf2 │ │ ├── 2.13 │ │ ├── 2in13_V2.uf2 │ │ ├── 2in13_V3.uf2 │ │ └── 2in13_V4.uf2 │ │ ├── 2.66-B │ │ └── epd.uf2 │ │ ├── 2.66 │ │ └── epd.uf2 │ │ ├── 2.7 │ │ ├── epd-V2.uf2 │ │ └── epd.uf2 │ │ ├── 2.9-B-V4 │ │ └── epd.uf2 │ │ ├── 2.9-B │ │ └── epd.uf2 │ │ ├── 2.9-C │ │ └── epd.uf2 │ │ ├── 2.9-D │ │ └── epd.uf2 │ │ ├── 2.9 │ │ └── epd.uf2 │ │ ├── 3.7 │ │ └── epd.uf2 │ │ ├── 4.2-B │ │ └── epd.uf2 │ │ ├── 4.2 │ │ └── 4in2_V2.uf2 │ │ ├── 5.65 │ │ └── epd.uf2 │ │ ├── 5.83-B │ │ └── epd.uf2 │ │ ├── 5.83 │ │ └── epd.uf2 │ │ ├── 7.5-B │ │ └── epd.uf2 │ │ ├── 7.5 │ │ └── epd.uf2 │ │ └── Readme.txt ├── lib │ ├── Config │ │ ├── CMakeLists.txt │ │ ├── DEV_Config.c │ │ ├── DEV_Config.h │ │ └── Debug.h │ ├── Fonts │ │ ├── CMakeLists.txt │ │ ├── font12.c │ │ ├── font12CN.c │ │ ├── font16.c │ │ ├── font20.c │ │ ├── font24.c │ │ ├── font24CN.c │ │ ├── font8.c │ │ └── fonts.h │ ├── GUI │ │ ├── CMakeLists.txt │ │ ├── GUI_Paint.c │ │ └── GUI_Paint.h │ └── e-Paper │ │ ├── CMakeLists.txt │ │ ├── EPD_2in13_V2.c │ │ ├── EPD_2in13_V2.h │ │ ├── EPD_2in13_V3.c │ │ ├── EPD_2in13_V3.h │ │ ├── EPD_2in13_V4.c │ │ ├── EPD_2in13_V4.h │ │ ├── EPD_2in13b_V3.c │ │ ├── EPD_2in13b_V3.h │ │ ├── EPD_2in13b_V4.c │ │ ├── EPD_2in13b_V4.h │ │ ├── EPD_2in13bc.c │ │ ├── EPD_2in13bc.h │ │ ├── EPD_2in13d.c │ │ ├── EPD_2in13d.h │ │ ├── EPD_2in66.c │ │ ├── EPD_2in66.h │ │ ├── EPD_2in66b.c │ │ ├── EPD_2in66b.h │ │ ├── EPD_2in7.c │ │ ├── EPD_2in7.h │ │ ├── EPD_2in7_V2.c │ │ ├── EPD_2in7_V2.h │ │ ├── EPD_2in9_V2.c │ │ ├── EPD_2in9_V2.h │ │ ├── EPD_2in9b_V3.c │ │ ├── EPD_2in9b_V3.h │ │ ├── EPD_2in9b_V4.c │ │ ├── EPD_2in9b_V4.h │ │ ├── EPD_2in9bc.c │ │ ├── EPD_2in9bc.h │ │ ├── EPD_2in9d.c │ │ ├── EPD_2in9d.h │ │ ├── EPD_3in7.c │ │ ├── EPD_3in7.h │ │ ├── EPD_4in2.c │ │ ├── EPD_4in2.h │ │ ├── EPD_4in2_V2.c │ │ ├── EPD_4in2_V2.h │ │ ├── EPD_4in2b_V2.c │ │ ├── EPD_4in2b_V2.h │ │ ├── EPD_4in2b_V2_old.c │ │ ├── EPD_4in2b_V2_old.h │ │ ├── EPD_5in65f.c │ │ ├── EPD_5in65f.h │ │ ├── EPD_5in83_V2.c │ │ ├── EPD_5in83_V2.h │ │ ├── EPD_5in83b_V2.c │ │ ├── EPD_5in83b_V2.h │ │ ├── EPD_7in5_V2.c │ │ ├── EPD_7in5_V2.h │ │ ├── EPD_7in5_V2_old.c │ │ ├── EPD_7in5_V2_old.h │ │ ├── EPD_7in5b_V2.c │ │ ├── EPD_7in5b_V2.h │ │ ├── EPD_7in5b_V2_old.c │ │ └── EPD_7in5b_V2_old.h ├── main.c └── pico_sdk_import.cmake ├── python ├── Pico 2.uf2 ├── Pico-ePaper-2.7.py ├── Pico-ePaper-2.7_V2.py ├── Pico-ePaper-3.7.py ├── Pico-ePaper-4.2-B.py ├── Pico-ePaper-4.2-B_old.py ├── Pico-ePaper-4.2.py ├── Pico-ePaper-4.2_V2.py ├── Pico-ePaper-5.65f.py ├── Pico-ePaper-5.83-B.py ├── Pico-ePaper-5.83.py ├── Pico-ePaper-7.5-B.py ├── Pico-ePaper-7.5-B_old.py ├── Pico-ePaper-7.5.py ├── Pico-ePaper-7.5_old.py ├── Pico.uf2 ├── Pico_ePaper-2.13-B.py ├── Pico_ePaper-2.13-B_V4.py ├── Pico_ePaper-2.13-C.py ├── Pico_ePaper-2.13-D.py ├── Pico_ePaper-2.13.py ├── Pico_ePaper-2.13_V3.py ├── Pico_ePaper-2.13_V4.py ├── Pico_ePaper-2.66-B.py ├── Pico_ePaper-2.66.py ├── Pico_ePaper-2.9-B.py ├── Pico_ePaper-2.9-B_V4.py ├── Pico_ePaper-2.9-C.py ├── Pico_ePaper-2.9.py ├── Pico_ePaper-2.9_D.py ├── ReadmeCN.txt ├── ReadmeEN.txt ├── Resetting Flash memory │ └── flash_nuke.uf2 └── rp2-pico-20220117-v1.18.uf2 ├── pythonNanoGui ├── ReadMe_CN.txt ├── ReadMe_EN.txt ├── Resetting Flash memory │ └── flash_nuke.uf2 ├── color_setup.py ├── demos │ ├── __init__.py │ ├── ePaper2in9_test_async.py │ ├── ePaper2in9_test_sync.py │ ├── ePaper_test.py │ └── ePaper_test_B.py ├── drivers │ ├── boolpalette.py │ ├── ePaper2in13V3.py │ ├── ePaper2in13V4.py │ ├── ePaper2in13bV4.py │ ├── ePaper2in7.py │ ├── ePaper2in7V2.py │ ├── ePaper2in9.py │ ├── ePaper3in7.py │ ├── ePaper4in2.py │ ├── ePaper4in2V2.py │ └── ePaper7in5b.py ├── gui │ ├── core │ │ ├── __init__.py │ │ ├── colors.py │ │ ├── fplot.py │ │ ├── nanogui.py │ │ └── writer.py │ ├── fonts │ │ ├── arial10.py │ │ ├── arial35.py │ │ ├── arial_50.py │ │ ├── courier20.py │ │ ├── font10.py │ │ ├── font6.py │ │ └── freesans20.py │ └── widgets │ │ ├── __init__.py │ │ ├── dial.py │ │ ├── label.py │ │ ├── led.py │ │ ├── meter.py │ │ ├── scale.py │ │ └── textbox.py └── rp2-pico-20220117-v1.18.uf2 └── waveshare_logo.png /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pico_ePaper_Code 2 | ## waveshare electronics 3 | ![waveshare_logo.png](waveshare_logo.png) 4 | 5 | ## 中文: 6 | 微雪电子 Pico-ePaper 系列驱动代码,支持C和Python 7 | 8 | 更多资料请在官网搜索相关产品: 9 | > https://www.waveshare.net or https://www.waveshare.net/wiki 10 | *** 11 | ## English: 12 | Waveshrae Pico-ePaper series drivers code, Support C and Python. 13 | 14 | For more information, please search on the official website: 15 | > https://www.waveshare.com or https://www.waveshare.com/wiki/Main_Page -------------------------------------------------------------------------------- /Version_CN.txt: -------------------------------------------------------------------------------- 1 | 2021-02-04:新创建,添加2.13 & 2.9程序 2 | 2021-03-17:新添加2.13-B、2.13-C、2.9-B、2.9-C程序 3 | 2021-05-12:新添加2.66程序,解决python程序自启动乱码的问题 4 | 2021-05-14:新添加2.66-B、2.13-D、2.9-D程序 5 | 2021-05-27:新添加5.83、5.83-B、7.5、7.5-B程序 6 | 2021-06-01:新添加3.7程序 7 | 2021-06-15:新添加2.7程序 8 | 2021-07-13:新添加4.2、4.2-B、5.65程序 9 | 2021-11-01:添加新程序2.13inch V3 e-Paper例程。 10 | 2022-08-22:添加新程序2.13Binch V4 e-Paper例程。 11 | 2023-03-16:添加新程序2.7inch V2 e-Paper例程。 12 | 2023-08-12:添加新程序2.13inch V4 e-Paper例程。 13 | 2023-08-31:更新 2.9inch V2 e-Paper 的例程,添加四灰度显示 14 | 2023-09-13:添加新程序4.2inch V2 e-Paper例程。 15 | 2024-04-22:添加新程序2.9inch e-Paper (B) V4 例程。 16 | 2024-04-22:更新4.2inch e-Paper (B) V2 例程。 -------------------------------------------------------------------------------- /Version_EN.txt: -------------------------------------------------------------------------------- 1 | 2021-02-04: newly built, add 2.13 & 2.9 programs. 2 | 2021-03-17: add 2.13-B & 2.13-C & 2.9-B & 2.9-C programs. 3 | 2021-05-12: add 2.66 program, Solve the Python program to start the problem of garbled code 4 | 2021-05-14: add 2.66-B & 2.13-D & 2.9-D programs. 5 | 2021-05-27:add 5.83 & 5.83-B & 7.5 & 7.5-B programs. 6 | 2021-06-01:add 3.7 programs. 7 | 2021-06-15:add 2.7 programs. 8 | 2021-07-13:add 4.2 & 4.2-B & 5.65 programs. 9 | 2021-11-01: Added new program 2.13inch V3 e-Paper routine. 10 | 2022-08-22: Added new program 2.13Binch V4 e-Paper routine. 11 | 2023-03-16: Added new program 2.7inch V2 e-Paper routine. 12 | 2023-08-12: Added new program 2.13inch V4 e-Paper routine. 13 | 2023-08-31: Update the routines of the 2.9inch V2 e-Paper to add a four-grayscale display 14 | 2023-09-13: Added new program 4.2inch V2 e-Paper routine. 15 | 2024-04-22: Added new program 2.9inch e-Paper (B) V4 routine added. 16 | 2024-04-22: Update 4.2inch e-Paper (B) V2 routine. -------------------------------------------------------------------------------- /c/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | include(pico_sdk_import.cmake) 3 | project(Pico_ePaper_Code) 4 | pico_sdk_init() 5 | 6 | # add a compilation subdirectory 7 | add_subdirectory(lib/Config) 8 | add_subdirectory(lib/e-Paper) 9 | add_subdirectory(lib/Fonts) 10 | add_subdirectory(lib/GUI) 11 | add_subdirectory(examples) 12 | 13 | # add a header directory 14 | include_directories(examples) 15 | include_directories(./lib/Config) 16 | include_directories(./lib/GUI) 17 | 18 | # generate an executable file 19 | add_executable(epd 20 | main.c 21 | ) 22 | 23 | # enable usb output, disable uart output 24 | pico_enable_stdio_usb(epd 1) 25 | pico_enable_stdio_uart(epd 0) 26 | 27 | # create map/bin/hex/uf2 file etc. 28 | pico_add_extra_outputs(epd) 29 | 30 | target_link_libraries(epd examples ePaper GUI Fonts Config pico_stdlib hardware_spi) -------------------------------------------------------------------------------- /c/ReadmeCN.txt: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : Readme_CN.txt 3 | * | Author : Waveshare team 4 | * | Function : Help with use 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2021-02-04 9 | * | Info : 在这里提供一个中文版本的使用文档,以便你的快速使用 10 | ******************************************************************************/ 11 | 这个文件是帮助您使用本例程。 12 | 由于我们的墨水屏越来越多,不便于我们的维护,因此把所有的墨水屏程序做成一个工程。 13 | 在这里简略的描述本工程的使用: 14 | 15 | 1.基本信息: 16 | 本例程使用相对应的模块搭配Pico进行了验证,你可以在工程的examples\中查看对应的测试例程; 17 | 18 | 2.管脚连接: 19 | 管脚连接你可以在\lib\Config目录下查看DEV_Config.c/h中查看,这里也再重述一次: 20 | EPD => Pico 21 | VCC -> VSYS 22 | GND -> GND 23 | DIN -> 11 24 | CLK -> 10 25 | CS -> 9 26 | DC -> 8 27 | RST -> 12 28 | BUSY -> 13 29 | 30 | 3.基本使用: 31 | 由于本工程是一个综合工程,对于使用而言,你可能需要阅读以下内容: 32 | 你可以在main.c中的12行到22行看到已经进行了注释的9个函数, 33 | 请注意你购买的是哪一款的墨水屏。 34 | 栗子1: 35 | 如果你购买的 Pico-ePaper-2.13,那么你应该把对应的18(或19,取决于您屏幕的版本)行代码的注释去掉,即: 36 | // EPD_2in13_V2_test(); 37 | 修改成: 38 | EPD_2in13_V2_test(); 39 | 栗子2: 40 | 如果你购买的 Pico-ePaper-2.9-B,那么你应该把对应的21行代码的注释去掉,即: 41 | // EPD_2in13b_V3_test(); 42 | 修改成: 43 | EPD_2in13b_V3_test(); 44 | 注意:对于屏幕的版本请注意你的屏幕背面是否贴有V2/V3等标识。 45 | 46 | 然后你需要执行: 47 | 创建build目录:打开终端,在 Pico_ePaper_Code/c 目录下输入: 48 | mkdir build 49 | 进入build目录,在终端输入: 50 | cd build 51 | 执行cmake,自动生成Makefile文件,在终端输入: 52 | cmake .. 53 | 执行make,生成可执行文件,在终端输入: 54 | make -j4 55 | 56 | 4.目录结构(选读): 57 | 如果你经常使用我们的产品,对我们的程序目录结构会十分熟悉,关于具体的函数的我们有一份 58 | 函数的API手册,你可以在我们的WIKI上下载或像售后客服索取,这里简单介绍一次: 59 | \lib\Config\:此目录为硬件接口层文件,在DEV_Config.c(.h)可以看到很多定义,包括: 60 | 数据类型; 61 | GPIO; 62 | 读写GPIO; 63 | 延时:注意:此延时函数并未使用示波器测量具体数值,因此会不准; 64 | 模块初始化与退出的处理: 65 | void DEV_Module_Init(void); 66 | void DEV_Module_Exit(void); 67 | 注意:1.这里是处理使用墨水屏前与使用完之后一些GPIO的处理。 68 | 2.对于PCB带有Rev2.1的,DEV_Module_Exit()之后整个模块会进入低功耗,经过测试这个功耗基本为0; 69 | 70 | \lib\GUI\:此目录为一些基本的图像处理函数,在GUI_Paint.c(.h)中: 71 | 常用图像处理:创建图形、翻转图形、镜像图形、设置像素点、清屏等; 72 | 常用画图处理:画点、线、框、圆、中文字符、英文字符、数字等; 73 | 常用时间显示:提供一个常用的显示时间函数; 74 | 常用显示图片:提供一个显示位图的函数; 75 | 76 | \lib\Fonts\:为一些常用的字体: 77 | Ascii: 78 | font8: 5*8 79 | font12: 7*12 80 | font16: 11*16 81 | font20: 14*20 82 | font24: 17*24 83 | 中文: 84 | font12CN: 16*21 85 | font24CN: 32*41 86 | 87 | \lib\e-paper\:此目录下为墨水屏驱动函数; 88 | examples\:此目录下为墨水屏的测试程序,你可在其中看到具体的使用方法; -------------------------------------------------------------------------------- /c/ReadmeEN.txt: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : Readme_EN.txt 3 | * | Author : Waveshare team 4 | * | Function : Help with use 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2021-02-04 9 | * | Info : Here is an English version of the documentation for your quick use. 10 | ******************************************************************************/ 11 | This file is to help you use this routine. 12 | Since our ink screens are getting more and more, it is not convenient for our maintenance, so all the ink screen programs are made into one project. 13 | A brief description of the use of this project is here: 14 | 15 | 1. Basic information: 16 | This routine is verified using the corresponding module with the PICO. 17 | You can see the corresponding test routine in the examples\ of the project. 18 | 19 | 2. Pin connection: 20 | Pin connection You can look at dev_config.c/h in \lib\Config. Again, here: 21 | EPD => Pico 22 | VCC -> VSYS 23 | GND -> GND 24 | DIN -> 11 25 | CLK -> 10 26 | CS -> 9 27 | DC -> 8 28 | RST -> 12 29 | BUSY -> 13 30 | 31 | 3. Basic use: 32 | As this project is a comprehensive project, for use, you may need to read the following: 33 | You can see the nine functions that have been commented in main.c on lines 12 through 22, 34 | Please pay attention to which type of ink screen you buy. 35 | eg.1: 36 | If you purchased pico-epaper 2.13, 37 | then you should uncomment the corresponding 18(or 19, depending on the version of your screen) lines of code, i.e. : 38 | // EPD_2in13_V2_test(); 39 | change to: 40 | EPD_2in13_V2_test(); 41 | eg.2: 42 | If you bought pico-epaper 2.9-b, 43 | then you should uncomment the corresponding 21 lines of code, i.e. : 44 | // EPD_2in13b_V3_test(); 45 | change to: 46 | EPD_2in13b_V3_test(); 47 | Note: For the version of the screen, please pay attention to whether the back of your screen is labeled with V2/V3 etc. 48 | 49 | Then you need to implement: 50 | Create the build directory: Open the terminal and type in the Pico_ePaper_Code/c directory: 51 | mkdir build 52 | Go to the build directory and type: 53 | cd build 54 | Execute cmake to automatically generate the Makefile file and type: 55 | cmake .. 56 | To create an executable file, type: 57 | make -j4 58 | 59 | 4. Directory structure (selection): 60 | If you use our products frequently, we will be very familiar with our program directory structure. We have a copy of the specific function. 61 | The API manual for the function, you can download it on our WIKI or request it as an after-sales customer service. Here is a brief introduction: 62 | Config\: This directory is a hardware interface layer file. You can see many definitions in DEV_Config.c(.h), including: 63 | type of data; 64 | GPIO; 65 | Read and write GPIO; 66 | Delay: Note: This delay function does not use an oscilloscope to measure specific values. 67 | Module Init and exit processing: 68 | void DEV_Module_Init(void); 69 | void DEV_Module_Exit(void); 70 | Note: 1. Here is the processing of some GPIOs before and after using the ink screen. 71 | 2. For the PCB with Rev2.1, the entire module will enter low power consumption after DEV_Module_Exit(). After testing, the power consumption is basically 0; 72 | 73 | \lib\GUI\: This directory is some basic image processing functions, in GUI_Paint.c(.h): 74 | Common image processing: creating graphics, flipping graphics, mirroring graphics, setting pixels, clearing screens, etc. 75 | Common drawing processing: drawing points, lines, boxes, circles, Chinese characters, English characters, numbers, etc.; 76 | Common time display: Provide a common display time function; 77 | Commonly used display pictures: provide a function to display bitmaps; 78 | 79 | \lib\Fonts\: for some commonly used fonts: 80 | Ascii: 81 | Font8: 5*8 82 | Font12: 7*12 83 | Font16: 11*16 84 | Font20: 14*20 85 | Font24: 17*24 86 | Chinese: 87 | font12CN: 16*21 88 | font24CN: 32*41 89 | 90 | \lib\e-paper\: This screen is the ink screen driver function; 91 | examples\: This is the test program for the ink screen. You can see the specific usage method in it. -------------------------------------------------------------------------------- /c/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find all source files in a single current directory 2 | # Save the name to DIR_examples_SRCS 3 | aux_source_directory(. DIR_examples_SRCS) 4 | 5 | include_directories(../lib/Config) 6 | include_directories(../lib/GUI) 7 | include_directories(../lib/e-Paper) 8 | 9 | # Generate the link library 10 | add_library(examples ${DIR_examples_SRCS}) 11 | target_link_libraries(examples PUBLIC Config) -------------------------------------------------------------------------------- /c/examples/EPD_2in13_V2_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in13_V2_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in13_V3_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in13_V3_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in13_V4_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in13_V4_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in13b_V3_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in13b_V3_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in13b_V4_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in13b_V4_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in13bc_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in13bc_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in13d_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in13d_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in66_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in66_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in66b_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in66b_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in7_V2_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in7_V2_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in7_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in7_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in9_V2_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in9_V2_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in9b_V3_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in9b_V3_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in9b_V4_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in9b_V4_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in9bc_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in9bc_test.c -------------------------------------------------------------------------------- /c/examples/EPD_2in9d_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_2in9d_test.c -------------------------------------------------------------------------------- /c/examples/EPD_3in7_test.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_3IN7_test.c 3 | * | Author : Waveshare team 4 | * | Function : 3.7inch e-paper test demo 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-07-16 9 | * | Info : 10 | # 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | ******************************************************************************/ 30 | #include "EPD_Test.h" 31 | #include "EPD_3in7.h" 32 | 33 | int EPD_3in7_test(void) 34 | { 35 | printf("EPD_3IN7_test Demo\r\n"); 36 | if(DEV_Module_Init()!=0){ 37 | return -1; 38 | } 39 | 40 | printf("e-Paper Init and Clear...\r\n"); 41 | EPD_3IN7_4Gray_Init(); 42 | EPD_3IN7_4Gray_Clear(); 43 | DEV_Delay_ms(500); 44 | 45 | //Create a new image cache 46 | UBYTE *BlackImage; 47 | /* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */ 48 | UWORD Imagesize = ((EPD_3IN7_WIDTH % 4 == 0)? (EPD_3IN7_WIDTH / 4 ): (EPD_3IN7_WIDTH / 4 + 1)) * EPD_3IN7_HEIGHT; 49 | if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) { 50 | printf("Failed to apply for black memory...\r\n"); 51 | return -1; 52 | } 53 | 54 | printf("Paint_NewImage\r\n"); 55 | Paint_NewImage(BlackImage, EPD_3IN7_WIDTH, EPD_3IN7_HEIGHT, 90, WHITE); 56 | Paint_SetScale(4); 57 | Paint_Clear(WHITE); 58 | 59 | #if 1 // Drawing on the image, partial display 60 | //1.Select Image 61 | printf("SelectImage:BlackImage\r\n"); 62 | Paint_SelectImage(BlackImage); 63 | Paint_SetScale(4); 64 | Paint_Clear(WHITE); 65 | 66 | // 2.Drawing on the image 67 | printf("Drawing:BlackImage\r\n"); 68 | Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT); 69 | Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT); 70 | Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); 71 | Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID); 72 | Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID); 73 | Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); 74 | Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL); 75 | Paint_DrawCircle(45, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); 76 | Paint_DrawCircle(105, 95, 20, WHITE, DOT_PIXEL_1X1, DRAW_FILL_FULL); 77 | Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED); 78 | Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED); 79 | Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE); 80 | Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK); 81 | Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE); 82 | Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK); 83 | Paint_DrawString_EN(10, 150, "GRAY1 with black background", &Font24, BLACK, GRAY1); 84 | Paint_DrawString_EN(10, 175, "GRAY2 with white background", &Font24, WHITE, GRAY2); 85 | Paint_DrawString_EN(10, 200, "GRAY3 with white background", &Font24, WHITE, GRAY3); 86 | Paint_DrawString_EN(10, 225, "GRAY4 with white background", &Font24, WHITE, GRAY4); 87 | printf("EPD_Display\r\n"); 88 | EPD_3IN7_4Gray_Display(BlackImage); 89 | DEV_Delay_ms(4000); 90 | #endif 91 | 92 | #if 1 // partial update, just 1 Gray mode 93 | Paint_NewImage(BlackImage, 50, 120, 90, WHITE); 94 | EPD_3IN7_1Gray_Init(); //init 1 Gray mode 95 | EPD_3IN7_1Gray_Clear(); 96 | Paint_SelectImage(BlackImage); 97 | Paint_SetScale(2); 98 | Paint_Clear(WHITE); 99 | printf("show time, partial update, just 1 Gary mode\r\n"); 100 | PAINT_TIME sPaint_time; 101 | sPaint_time.Hour = 12; 102 | sPaint_time.Min = 34; 103 | sPaint_time.Sec = 56; 104 | UBYTE num = 15; 105 | for (;;) { 106 | sPaint_time.Sec = sPaint_time.Sec + 1; 107 | if (sPaint_time.Sec == 60) { 108 | sPaint_time.Min = sPaint_time.Min + 1; 109 | sPaint_time.Sec = 0; 110 | if (sPaint_time.Min == 60) { 111 | sPaint_time.Hour = sPaint_time.Hour + 1; 112 | sPaint_time.Min = 0; 113 | if (sPaint_time.Hour == 24) { 114 | sPaint_time.Hour = 0; 115 | sPaint_time.Min = 0; 116 | sPaint_time.Sec = 0; 117 | } 118 | } 119 | } 120 | Paint_Clear(WHITE); 121 | Paint_DrawRectangle(1, 1, 120, 50, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); 122 | Paint_DrawTime(10, 15, &sPaint_time, &Font20, WHITE, BLACK); 123 | 124 | num = num - 1; 125 | if(num == 0) { 126 | break; 127 | } 128 | 129 | printf("Part refresh...\r\n"); 130 | EPD_3IN7_1Gray_Display_Part(BlackImage, 210, 340, 260, 460); // Xstart must be a multiple of 8 131 | DEV_Delay_ms(500); 132 | } 133 | 134 | #endif 135 | EPD_3IN7_4Gray_Init(); 136 | printf("Clear...\r\n"); 137 | EPD_3IN7_4Gray_Clear(); 138 | 139 | // Sleep & close 5V 140 | printf("Goto Sleep...\r\n"); 141 | EPD_3IN7_Sleep(); 142 | 143 | free(BlackImage); 144 | BlackImage = NULL; 145 | DEV_Delay_ms(2000);//important, at least 2s 146 | printf("close 5V, Module enters 0 power consumption ...\r\n"); 147 | DEV_Module_Exit(); 148 | 149 | return 0; 150 | } 151 | 152 | -------------------------------------------------------------------------------- /c/examples/EPD_4in2b_V2_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_4in2b_V2_test.c -------------------------------------------------------------------------------- /c/examples/EPD_4in2b_V2_test_old.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_4in2b_V2_test_old.c -------------------------------------------------------------------------------- /c/examples/EPD_5in65f_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_5in65f_test.c -------------------------------------------------------------------------------- /c/examples/EPD_5in83_V2_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_5in83_V2_test.c -------------------------------------------------------------------------------- /c/examples/EPD_5in83b_V2_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_5in83b_V2_test.c -------------------------------------------------------------------------------- /c/examples/EPD_7in5_V2_test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_7in5_V2_test.c -------------------------------------------------------------------------------- /c/examples/EPD_7in5_V2_test_old.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_7in5_V2_test_old.c -------------------------------------------------------------------------------- /c/examples/EPD_7in5b_V2_test.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_7in5b_V2_test.c 3 | * | Author : Waveshare team 4 | * | Function : 7.5inch B e-paper test demo 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-11-30 9 | * | Info : 10 | # 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | ******************************************************************************/ 30 | #include "EPD_Test.h" 31 | #include "EPD_7in5b_V2.h" 32 | 33 | int EPD_7in5b_V2_test(void) 34 | { 35 | printf("EPD_7IN5B_V2_test Demo\r\n"); 36 | if(DEV_Module_Init()!=0){ 37 | return -1; 38 | } 39 | 40 | printf("e-Paper Init and Clear...\r\n"); 41 | EPD_7IN5B_V2_Init(); 42 | 43 | EPD_7IN5B_V2_Clear(); 44 | DEV_Delay_ms(500); 45 | 46 | //Create a new image cache named IMAGE_BW and fill it with white 47 | UBYTE *BlackImage, *RYImage; 48 | UWORD Imagesize = ((EPD_7IN5B_V2_WIDTH % 8 == 0)? (EPD_7IN5B_V2_WIDTH / 8 ): (EPD_7IN5B_V2_WIDTH / 8 + 1)) * EPD_7IN5B_V2_HEIGHT; 49 | if((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) { 50 | printf("Failed to apply for black memory...\r\n"); 51 | return -1; 52 | } 53 | if((RYImage = (UBYTE *)malloc(Imagesize)) == NULL) { 54 | printf("Failed to apply for red memory...\r\n"); 55 | return -1; 56 | } 57 | printf("NewImage:BlackImage and RYImage\r\n"); 58 | Paint_NewImage(BlackImage, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT , 0, WHITE); 59 | Paint_NewImage(RYImage, EPD_7IN5B_V2_WIDTH, EPD_7IN5B_V2_HEIGHT , 0, WHITE); 60 | 61 | //Select Image 62 | Paint_SelectImage(BlackImage); 63 | Paint_Clear(WHITE); 64 | Paint_SelectImage(RYImage); 65 | Paint_Clear(WHITE); 66 | 67 | #if 1 // show image for array 68 | printf("show image for array\r\n"); 69 | EPD_7IN5B_V2_Display(gImage_7in5_V2_b, gImage_7in5_V2_ry); 70 | DEV_Delay_ms(2000); 71 | #endif 72 | 73 | #if 1 // Drawing on the image 74 | /*Horizontal screen*/ 75 | //1.Draw black image 76 | Paint_SelectImage(BlackImage); 77 | Paint_Clear(WHITE); 78 | Paint_DrawPoint(10, 80, BLACK, DOT_PIXEL_1X1, DOT_STYLE_DFT); 79 | Paint_DrawPoint(10, 90, BLACK, DOT_PIXEL_2X2, DOT_STYLE_DFT); 80 | Paint_DrawPoint(10, 100, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); 81 | Paint_DrawPoint(10, 110, BLACK, DOT_PIXEL_3X3, DOT_STYLE_DFT); 82 | Paint_DrawLine(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID); 83 | Paint_DrawLine(70, 70, 20, 120, BLACK, DOT_PIXEL_1X1, LINE_STYLE_SOLID); 84 | Paint_DrawRectangle(20, 70, 70, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); 85 | Paint_DrawRectangle(80, 70, 130, 120, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL); 86 | Paint_DrawString_EN(10, 0, "waveshare", &Font16, BLACK, WHITE); 87 | Paint_DrawString_CN(130, 20, "微雪电子", &Font24CN, WHITE, BLACK); 88 | Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK); 89 | 90 | //2.Draw red image 91 | Paint_SelectImage(RYImage); 92 | Paint_Clear(WHITE); 93 | Paint_DrawCircle(160, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_EMPTY); 94 | Paint_DrawCircle(210, 95, 20, BLACK, DOT_PIXEL_1X1, DRAW_FILL_FULL); 95 | Paint_DrawLine(85, 95, 125, 95, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED); 96 | Paint_DrawLine(105, 75, 105, 115, BLACK, DOT_PIXEL_1X1, LINE_STYLE_DOTTED); 97 | Paint_DrawString_CN(130, 0,"你好Abc", &Font12CN, BLACK, WHITE); 98 | Paint_DrawString_EN(10, 20, "hello world", &Font12, WHITE, BLACK); 99 | Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE); 100 | 101 | printf("EPD_Display\r\n"); 102 | EPD_7IN5B_V2_Display(BlackImage, RYImage); 103 | DEV_Delay_ms(2000); 104 | #endif 105 | 106 | #if 1 //Partial refresh, example shows time 107 | EPD_7IN5B_V2_Init_Part(); 108 | EPD_7IN5B_V2_Display_Base_color(WHITE); 109 | Paint_NewImage(BlackImage, Font20.Width * 7, Font20.Height, 0, WHITE); 110 | Debug("Partial refresh\r\n"); 111 | Paint_SelectImage(BlackImage); 112 | Paint_Clear(WHITE); 113 | 114 | PAINT_TIME sPaint_time; 115 | sPaint_time.Hour = 12; 116 | sPaint_time.Min = 34; 117 | sPaint_time.Sec = 56; 118 | UBYTE num = 10; 119 | for (;;) { 120 | sPaint_time.Sec = sPaint_time.Sec + 1; 121 | if (sPaint_time.Sec == 60) { 122 | sPaint_time.Min = sPaint_time.Min + 1; 123 | sPaint_time.Sec = 0; 124 | if (sPaint_time.Min == 60) { 125 | sPaint_time.Hour = sPaint_time.Hour + 1; 126 | sPaint_time.Min = 0; 127 | if (sPaint_time.Hour == 24) { 128 | sPaint_time.Hour = 0; 129 | sPaint_time.Min = 0; 130 | sPaint_time.Sec = 0; 131 | } 132 | } 133 | } 134 | Paint_ClearWindows(0, 0, Font20.Width * 7, Font20.Height, WHITE); 135 | Paint_DrawTime(0, 0, &sPaint_time, &Font20, WHITE, BLACK); 136 | 137 | num = num - 1; 138 | if(num == 0) { 139 | break; 140 | } 141 | EPD_7IN5B_V2_Display_Partial(BlackImage, 10, 130, 10 + Font20.Width * 7, 130 + Font20.Height); 142 | DEV_Delay_ms(500);//Analog clock 1s 143 | } 144 | #endif 145 | 146 | printf("Clear...\r\n"); 147 | EPD_7IN5B_V2_Init(); 148 | EPD_7IN5B_V2_Clear(); 149 | 150 | printf("Goto Sleep...\r\n"); 151 | EPD_7IN5B_V2_Sleep(); 152 | free(BlackImage); 153 | free(RYImage); 154 | BlackImage = NULL; 155 | RYImage = NULL; 156 | DEV_Delay_ms(2000);//important, at least 2s 157 | // close 5V 158 | printf("close 5V, Module enters 0 power consumption ...\r\n"); 159 | DEV_Module_Exit(); 160 | 161 | return 0; 162 | } 163 | 164 | -------------------------------------------------------------------------------- /c/examples/EPD_7in5b_V2_test_old.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/examples/EPD_7in5b_V2_test_old.c -------------------------------------------------------------------------------- /c/examples/EPD_Test.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_Test.h 3 | * | Author : Waveshare team 4 | * | Function : e-Paper test Demo 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2019-06-11 9 | * | Info : 10 | # 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | ******************************************************************************/ 30 | #ifndef _EPD_TEST_H_ 31 | #define _EPD_TEST_H_ 32 | 33 | #include "DEV_Config.h" 34 | #include "GUI_Paint.h" 35 | #include "ImageData.h" 36 | #include "Debug.h" 37 | #include // malloc() free() 38 | 39 | int EPD_2in9_V2_test(void); 40 | int EPD_2in9bc_test(void); 41 | int EPD_2in9b_V3_test(void); 42 | int EPD_2in9b_V4_test(void); 43 | int EPD_2in9d_test(void); 44 | 45 | int EPD_2in13_V2_test(void); 46 | int EPD_2in13_V3_test(void); 47 | int EPD_2in13_V4_test(void); 48 | int EPD_2in13bc_test(void); 49 | int EPD_2in13b_V3_test(void); 50 | int EPD_2in13b_V4_test(void); 51 | int EPD_2in13d_test(void); 52 | 53 | int EPD_2in66_test(void); 54 | int EPD_2in66b_test(void); 55 | 56 | int EPD_2in7_test(void); 57 | int EPD_2in7_V2_test(void); 58 | 59 | int EPD_3in7_test(void); 60 | 61 | int EPD_4in2_test(void); 62 | int EPD_4in2_V2_test(void); 63 | int EPD_4in2b_V2_test(void); 64 | int EPD_4in2b_V2_test_old(void); 65 | 66 | int EPD_5in65f_test(void); 67 | 68 | int EPD_5in83_V2_test(void); 69 | int EPD_5in83b_V2_test(void); 70 | 71 | int EPD_7in5_V2_test(void); 72 | int EPD_7in5_V2_test_old(void); 73 | int EPD_7in5b_V2_test(void); 74 | int EPD_7in5b_V2_test_old(void); 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /c/examples/ImageData.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : ImageData.h 3 | * | Author : Waveshare team 4 | * | Function : 5 | *---------------- 6 | * | This version: V1.0 7 | * | Date : 2018-10-23 8 | * | Info : 9 | * 10 | # 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | 30 | ******************************************************************************/ 31 | 32 | #ifndef _IMAGEDATA_H_ 33 | #define _IMAGEDATA_H_ 34 | 35 | extern const unsigned char flagimage[]; 36 | 37 | extern const unsigned char gImage_2in13_2[]; 38 | extern const unsigned char gImage_2in9[]; 39 | extern const unsigned char gImage_2in9_4gray[]; 40 | extern const unsigned char gImage_2in9bc_b[]; 41 | extern const unsigned char gImage_2in9bc_ry[]; 42 | 43 | extern const unsigned char gImage_2in13[]; 44 | extern const unsigned char gImage_2in13b_V4b[]; 45 | extern const unsigned char gImage_2in13b_V4r[]; 46 | extern const unsigned char gImage_2in13b_b[]; 47 | extern const unsigned char gImage_2in13b_r[]; 48 | extern const unsigned char gImage_2in13c_b[]; 49 | extern const unsigned char gImage_2in13c_y[]; 50 | extern const unsigned char gImage_2in13d[]; 51 | 52 | extern const unsigned char gImage_2in66[]; 53 | extern const unsigned char gImage_2in66br[]; 54 | extern const unsigned char gImage_2in66bb[]; 55 | 56 | extern const unsigned char gImage_2in7[]; 57 | extern const unsigned char gImage_2in7b_Black[5808]; 58 | extern const unsigned char gImage_2in7b_Red[5808]; 59 | extern const unsigned char gImage_2in7b_Black_V2[5808]; 60 | extern const unsigned char gImage_2in7b_Red_V2[5808]; 61 | extern const unsigned char gImage_2in7_4Gray[]; 62 | extern const unsigned char gImage_2in7_4Gray_1[]; 63 | 64 | extern const unsigned char gImage_4in2[]; 65 | extern const unsigned char gImage_4in2_4Gray[]; 66 | extern const unsigned char gImage_4in2_4Gray1[]; 67 | extern const unsigned char gImage_4in2bc_b[]; 68 | extern const unsigned char gImage_4in2bc_ry[]; 69 | 70 | extern const unsigned char gImage_5in65f[]; 71 | 72 | extern const unsigned char gImage_5in83_V2[]; 73 | extern const unsigned char gImage_5in83b_V2_b[]; 74 | extern const unsigned char gImage_5in83b_V2_r[]; 75 | 76 | extern const unsigned char gImage_7in5_V2[]; 77 | extern const unsigned char gImage_7in5_V2_b[]; 78 | extern const unsigned char gImage_7in5_V2_ry[]; 79 | 80 | #endif 81 | /* FILE END */ 82 | 83 | 84 | -------------------------------------------------------------------------------- /c/extra_uf2/2.13-B/epd-V4.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.13-B/epd-V4.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.13-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.13-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.13-C/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.13-C/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.13-D/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.13-D/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.13/2in13_V4.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.13/2in13_V4.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.13/epd-V3.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.13/epd-V3.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.13/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.13/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.66-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.66-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.66/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.66/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.7/epd-V2.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.7/epd-V2.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.7/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.7/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.9-B-V4/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.9-B-V4/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.9-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.9-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.9-C/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.9-C/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.9-D/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.9-D/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/2.9/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/2.9/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/3.7/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/3.7/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/4.2-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/4.2-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/4.2/4in2_V2.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/4.2/4in2_V2.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/4.2/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/4.2/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/5.65/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/5.65/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/5.83-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/5.83-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/5.83/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/5.83/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/7.5-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/7.5-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/7.5/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/7.5/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/Readme.txt: -------------------------------------------------------------------------------- 1 | English: 2 | This directory holds our pre-compiled sample programs. 3 | You can use them for evaluation if you have trouble setting up your environment. 4 | 5 | 中文: 6 | 本目录存放的是我们预先编译好的示例程序。如果您在环境搭建时遇到了麻烦,可以使用它们进行评估。 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.13-B/epd-V4.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.13-B/epd-V4.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.13-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.13-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.13-C/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.13-C/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.13-D/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.13-D/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.13/2in13_V4.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.13/2in13_V4.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.13/epd-V3.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.13/epd-V3.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.13/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.13/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.66-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.66-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.66/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.66/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.7/epd-V2.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.7/epd-V2.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.7/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.7/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.9-B-V4/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.9-B-V4/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.9-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.9-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.9-C/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.9-C/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.9-D/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.9-D/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/2.9/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/2.9/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/3.7/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/3.7/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/4.2-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/4.2-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/4.2/4in2_V2.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/4.2/4in2_V2.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/4.2/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/4.2/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/5.65/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/5.65/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/5.83-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/5.83-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/5.83/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/5.83/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/7.5-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/7.5-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/7.5/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico/7.5/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico/Readme.txt: -------------------------------------------------------------------------------- 1 | English: 2 | This directory holds our pre-compiled sample programs. 3 | You can use them for evaluation if you have trouble setting up your environment. 4 | 5 | 中文: 6 | 本目录存放的是我们预先编译好的示例程序。如果您在环境搭建时遇到了麻烦,可以使用它们进行评估。 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.13-B/epd-V4.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.13-B/epd-V4.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.13-C/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.13-C/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.13-D/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.13-D/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.13/2in13_V2.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.13/2in13_V2.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.13/2in13_V3.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.13/2in13_V3.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.13/2in13_V4.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.13/2in13_V4.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.66-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.66-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.66/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.66/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.7/epd-V2.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.7/epd-V2.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.7/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.7/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.9-B-V4/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.9-B-V4/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.9-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.9-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.9-C/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.9-C/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.9-D/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.9-D/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/2.9/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/2.9/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/3.7/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/3.7/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/4.2-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/4.2-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/4.2/4in2_V2.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/4.2/4in2_V2.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/5.65/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/5.65/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/5.83-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/5.83-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/5.83/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/5.83/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/7.5-B/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/7.5-B/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/7.5/epd.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/extra_uf2/pico2/7.5/epd.uf2 -------------------------------------------------------------------------------- /c/extra_uf2/pico2/Readme.txt: -------------------------------------------------------------------------------- 1 | English: 2 | This directory holds our pre-compiled sample programs. 3 | You can use them for evaluation if you have trouble setting up your environment. 4 | 5 | 中文: 6 | 本目录存放的是我们预先编译好的示例程序。如果您在环境搭建时遇到了麻烦,可以使用它们进行评估。 -------------------------------------------------------------------------------- /c/lib/Config/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find all source files in a single current directory 2 | # Save the name to DIR_Config_SRCS 3 | aux_source_directory(. DIR_Config_SRCS) 4 | 5 | # Generate the link library 6 | add_library(Config ${DIR_Config_SRCS}) 7 | target_link_libraries(Config PUBLIC pico_stdlib hardware_spi) -------------------------------------------------------------------------------- /c/lib/Config/DEV_Config.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : DEV_Config.c 3 | * | Author : Waveshare team 4 | * | Function : Hardware underlying interface 5 | * | Info : 6 | *---------------- 7 | * | This version: V3.0 8 | * | Date : 2019-07-31 9 | * | Info : 10 | # 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of theex Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | ******************************************************************************/ 30 | #include "DEV_Config.h" 31 | 32 | #define SPI_PORT spi1 33 | 34 | /** 35 | * GPIO 36 | **/ 37 | int EPD_RST_PIN; 38 | int EPD_DC_PIN; 39 | int EPD_CS_PIN; 40 | int EPD_BUSY_PIN; 41 | int EPD_CLK_PIN; 42 | int EPD_MOSI_PIN; 43 | 44 | /** 45 | * GPIO read and write 46 | **/ 47 | void DEV_Digital_Write(UWORD Pin, UBYTE Value) 48 | { 49 | gpio_put(Pin, Value); 50 | } 51 | 52 | UBYTE DEV_Digital_Read(UWORD Pin) 53 | { 54 | return gpio_get(Pin); 55 | } 56 | 57 | /** 58 | * SPI 59 | **/ 60 | void DEV_SPI_WriteByte(uint8_t Value) 61 | { 62 | spi_write_blocking(SPI_PORT, &Value, 1); 63 | } 64 | 65 | void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len) 66 | { 67 | spi_write_blocking(SPI_PORT, pData, Len); 68 | } 69 | 70 | /** 71 | * GPIO Mode 72 | **/ 73 | void DEV_GPIO_Mode(UWORD Pin, UWORD Mode) 74 | { 75 | gpio_init(Pin); 76 | if(Mode == 0 || Mode == GPIO_IN) { 77 | gpio_set_dir(Pin, GPIO_IN); 78 | } else { 79 | gpio_set_dir(Pin, GPIO_OUT); 80 | } 81 | } 82 | 83 | /** 84 | * delay x ms 85 | **/ 86 | void DEV_Delay_ms(UDOUBLE xms) 87 | { 88 | sleep_ms(xms); 89 | } 90 | 91 | void DEV_GPIO_Init(void) 92 | { 93 | 94 | EPD_RST_PIN = 12; 95 | EPD_DC_PIN = 8; 96 | EPD_BUSY_PIN = 13; 97 | 98 | EPD_CS_PIN = 9; 99 | EPD_CLK_PIN = 10; 100 | EPD_MOSI_PIN = 11; 101 | 102 | DEV_GPIO_Mode(EPD_RST_PIN, 1); 103 | DEV_GPIO_Mode(EPD_DC_PIN, 1); 104 | DEV_GPIO_Mode(EPD_CS_PIN, 1); 105 | DEV_GPIO_Mode(EPD_BUSY_PIN, 0); 106 | 107 | DEV_Digital_Write(EPD_CS_PIN, 1); 108 | } 109 | /****************************************************************************** 110 | function: Module Initialize, the library and initialize the pins, SPI protocol 111 | parameter: 112 | Info: 113 | ******************************************************************************/ 114 | UBYTE DEV_Module_Init(void) 115 | { 116 | stdio_init_all(); 117 | 118 | // GPIO Config 119 | DEV_GPIO_Init(); 120 | 121 | spi_init(SPI_PORT, 4000 * 1000); 122 | gpio_set_function(EPD_CLK_PIN, GPIO_OUT); 123 | gpio_set_function(EPD_MOSI_PIN, GPIO_OUT); 124 | 125 | printf("DEV_Module_Init OK \r\n"); 126 | return 0; 127 | } 128 | 129 | void DEV_GPIO_Init_1(void) 130 | { 131 | spi_deinit(SPI_PORT); 132 | gpio_set_function(EPD_CLK_PIN, GPIO_FUNC_SPI); 133 | gpio_set_function(EPD_MOSI_PIN, GPIO_FUNC_SPI); 134 | } 135 | 136 | void DEV_SPI_Init(void) 137 | { 138 | spi_init(SPI_PORT, 4000 * 1000); 139 | gpio_set_function(EPD_CLK_PIN, GPIO_FUNC_SPI); 140 | gpio_set_function(EPD_MOSI_PIN, GPIO_FUNC_SPI); 141 | } 142 | 143 | 144 | void DEV_SPI_SendData(UBYTE Reg) 145 | { 146 | UBYTE i,j=Reg; 147 | DEV_GPIO_Mode(EPD_MOSI_PIN, 1); 148 | DEV_GPIO_Mode(EPD_CLK_PIN, 1); 149 | DEV_Digital_Write(EPD_CS_PIN, 0); 150 | for(i = 0; i<8; i++) 151 | { 152 | DEV_Digital_Write(EPD_CLK_PIN, 0); 153 | if (j & 0x80) 154 | { 155 | DEV_Digital_Write(EPD_MOSI_PIN, 1); 156 | } 157 | else 158 | { 159 | DEV_Digital_Write(EPD_MOSI_PIN, 0); 160 | } 161 | 162 | DEV_Digital_Write(EPD_CLK_PIN, 1); 163 | j = j << 1; 164 | } 165 | DEV_Digital_Write(EPD_CLK_PIN, 0); 166 | DEV_Digital_Write(EPD_CS_PIN, 1); 167 | } 168 | 169 | UBYTE DEV_SPI_ReadData(void) 170 | { 171 | UBYTE i,j=0xff; 172 | DEV_GPIO_Mode(EPD_MOSI_PIN, 0); 173 | DEV_GPIO_Mode(EPD_CLK_PIN, 1); 174 | DEV_Digital_Write(EPD_CS_PIN, 0); 175 | for(i = 0; i<8; i++) 176 | { 177 | DEV_Digital_Write(EPD_CLK_PIN, 0); 178 | j = j << 1; 179 | if (DEV_Digital_Read(EPD_MOSI_PIN)) 180 | { 181 | j = j | 0x01; 182 | } 183 | else 184 | { 185 | j= j & 0xfe; 186 | } 187 | DEV_Digital_Write(EPD_CLK_PIN, 1); 188 | } 189 | DEV_Digital_Write(EPD_CLK_PIN, 0); 190 | DEV_Digital_Write(EPD_CS_PIN, 1); 191 | return j; 192 | } 193 | 194 | 195 | /****************************************************************************** 196 | function: Module exits, closes SPI and BCM2835 library 197 | parameter: 198 | Info: 199 | ******************************************************************************/ 200 | void DEV_Module_Exit(void) 201 | { 202 | 203 | } 204 | -------------------------------------------------------------------------------- /c/lib/Config/DEV_Config.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : DEV_Config.h 3 | * | Author : Waveshare team 4 | * | Function : Hardware underlying interface 5 | * | Info : 6 | * Used to shield the underlying layers of each master 7 | * and enhance portability 8 | *---------------- 9 | * | This version: V2.0 10 | * | Date : 2018-10-30 11 | * | Info : 12 | * 1.add: 13 | * UBYTE\UWORD\UDOUBLE 14 | * 2.Change: 15 | * EPD_RST -> EPD_RST_PIN 16 | * EPD_DC -> EPD_DC_PIN 17 | * EPD_CS -> EPD_CS_PIN 18 | * EPD_BUSY -> EPD_BUSY_PIN 19 | * 3.Remote: 20 | * EPD_RST_1\EPD_RST_0 21 | * EPD_DC_1\EPD_DC_0 22 | * EPD_CS_1\EPD_CS_0 23 | * EPD_BUSY_1\EPD_BUSY_0 24 | * 3.add: 25 | * #define DEV_Digital_Write(_pin, _value) bcm2835_GPIOI_write(_pin, _value) 26 | * #define DEV_Digital_Read(_pin) bcm2835_GPIOI_lev(_pin) 27 | * #define DEV_SPI_WriteByte(__value) bcm2835_spi_transfer(__value) 28 | # 29 | # Permission is hereby granted, free of charge, to any person obtaining a copy 30 | # of this software and associated documnetation files (the "Software"), to deal 31 | # in the Software without restriction, including without limitation the rights 32 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 33 | # copies of the Software, and to permit persons to whom the Software is 34 | # furished to do so, subject to the following conditions: 35 | # 36 | # The above copyright notice and this permission notice shall be included in 37 | # all copies or substantial portions of the Software. 38 | # 39 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 40 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 41 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 42 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 43 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 44 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 45 | # THE SOFTWARE. 46 | # 47 | ******************************************************************************/ 48 | #ifndef _DEV_CONFIG_H_ 49 | #define _DEV_CONFIG_H_ 50 | 51 | #include "pico/stdlib.h" 52 | #include "hardware/spi.h" 53 | #include "stdio.h" 54 | 55 | /** 56 | * data 57 | **/ 58 | #define UBYTE uint8_t 59 | #define UWORD uint16_t 60 | #define UDOUBLE uint32_t 61 | 62 | /** 63 | * GPIOI config 64 | **/ 65 | extern int EPD_RST_PIN; 66 | extern int EPD_DC_PIN; 67 | extern int EPD_CS_PIN; 68 | extern int EPD_BUSY_PIN; 69 | extern int EPD_CLK_PIN; 70 | extern int EPD_MOSI_PIN; 71 | 72 | /*------------------------------------------------------------------------------------------------------*/ 73 | void DEV_Digital_Write(UWORD Pin, UBYTE Value); 74 | UBYTE DEV_Digital_Read(UWORD Pin); 75 | 76 | void DEV_SPI_WriteByte(UBYTE Value); 77 | void DEV_SPI_Write_nByte(uint8_t *pData, uint32_t Len); 78 | void DEV_Delay_ms(UDOUBLE xms); 79 | 80 | UBYTE DEV_Module_Init(void); 81 | void DEV_Module_Exit(void); 82 | void DEV_GPIO_Init_1(void); 83 | void DEV_SPI_Init(void); 84 | void DEV_SPI_SendData(UBYTE Reg); 85 | UBYTE DEV_SPI_ReadData(void); 86 | 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /c/lib/Config/Debug.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : Debug.h 3 | * | Author : Waveshare team 4 | * | Function : debug with printf 5 | * | Info : 6 | * Image scanning 7 | * Please use progressive scanning to generate images or fonts 8 | *---------------- 9 | * | This version: V2.0 10 | * | Date : 2018-10-30 11 | * | Info : 12 | * 1.USE_DEBUG -> DEBUG, If you need to see the debug information, 13 | * clear the execution: make DEBUG=-DDEBUG 14 | # 15 | # Permission is hereby granted, free of charge, to any person obtaining a copy 16 | # of this software and associated documnetation files (the "Software"), to deal 17 | # in the Software without restriction, including without limitation the rights 18 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | # copies of the Software, and to permit persons to whom the Software is 20 | # furished to do so, subject to the following conditions: 21 | # 22 | # The above copyright notice and this permission notice shall be included in 23 | # all copies or substantial portions of the Software. 24 | # 25 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | # THE SOFTWARE. 32 | # 33 | 34 | ******************************************************************************/ 35 | #ifndef __DEBUG_H 36 | #define __DEBUG_H 37 | 38 | #include 39 | 40 | #if DEBUG 41 | #define Debug(__info,...) printf("Debug: " __info,##__VA_ARGS__) 42 | #else 43 | #define Debug(__info,...) 44 | #endif 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /c/lib/Fonts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find all source files in a single current directory 2 | # Save the name to DIR_Fonts_SRCS 3 | aux_source_directory(. DIR_Fonts_SRCS) 4 | 5 | # Generate the link library 6 | add_library(Fonts ${DIR_Fonts_SRCS}) -------------------------------------------------------------------------------- /c/lib/Fonts/font12CN.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/lib/Fonts/font12CN.c -------------------------------------------------------------------------------- /c/lib/Fonts/font24CN.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/lib/Fonts/font24CN.c -------------------------------------------------------------------------------- /c/lib/Fonts/fonts.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/lib/Fonts/fonts.h -------------------------------------------------------------------------------- /c/lib/GUI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find all source files in a single current directory 2 | # Save the name to DIR_GUI_SRCS 3 | aux_source_directory(. DIR_GUI_SRCS) 4 | 5 | include_directories(../Config) 6 | 7 | # Generate the link library 8 | add_library(GUI ${DIR_GUI_SRCS}) 9 | target_link_libraries(GUI PUBLIC Config) -------------------------------------------------------------------------------- /c/lib/e-Paper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find all source files in a single current directory 2 | # Save the name to DIR_ePaper_SRCS 3 | aux_source_directory(. DIR_ePaper_SRCS) 4 | 5 | include_directories(../Config) 6 | 7 | # Generate the link library 8 | add_library(ePaper ${DIR_ePaper_SRCS}) 9 | target_link_libraries(ePaper PUBLIC Config) -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in13_V2.h 3 | * | Author : Waveshare team 4 | * | Function : 2.13inch e-paper V2 5 | * | Info : 6 | *---------------- 7 | * | This version: V3.0 8 | * | Date : 2019-06-13 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | * V3.0(2019-06-13): 12 | * 1.Change name: 13 | * EPD_Reset() => EPD_2IN13_V2_Reset() 14 | * EPD_SendCommand() => EPD_2IN13_V2_SendCommand() 15 | * EPD_SendData() => EPD_2IN13_V2_SendData() 16 | * EPD_WaitUntilIdle() => EPD_2IN13_V2_ReadBusy() 17 | * EPD_Init() => EPD_2IN13_V2_Init() 18 | * EPD_Clear() => EPD_2IN13_V2_Clear() 19 | * EPD_Display() => EPD_2IN13_V2_Display() 20 | * EPD_Sleep() => EPD_2IN13_V2_Sleep() 21 | * 2.add: 22 | * EPD_2IN13_V2_DisplayPartBaseImage() 23 | * ----------------------------------------------------------------------------- 24 | * V2.0(2018-11-14): 25 | * 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] 26 | * 2.Change:EPD_2IN13_V2_Display(UBYTE *Image) 27 | * Need to pass parameters: pointer to cached data 28 | * 3.Change: 29 | * EPD_RST -> EPD_RST_PIN 30 | * EPD_DC -> EPD_DC_PIN 31 | * EPD_CS -> EPD_CS_PIN 32 | * EPD_BUSY -> EPD_BUSY_PIN 33 | # 34 | # Permission is hereby granted, free of charge, to any person obtaining a copy 35 | # of this software and associated documnetation files (the "Software"), to deal 36 | # in the Software without restriction, including without limitation the rights 37 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 38 | # copies of the Software, and to permit persons to whom the Software is 39 | # furished to do so, subject to the following conditions: 40 | # 41 | # The above copyright notice and this permission notice shall be included in 42 | # all copies or substantial portions of the Software. 43 | # 44 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 45 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 46 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 47 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 48 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 49 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 50 | # THE SOFTWARE. 51 | # 52 | ******************************************************************************/ 53 | #ifndef _EPD_2IN13_V2_H_ 54 | #define _EPD_2IN13_V2_H_ 55 | 56 | #include "DEV_Config.h" 57 | 58 | // Display resolution 59 | #define EPD_2IN13_V2_WIDTH 122 60 | #define EPD_2IN13_V2_HEIGHT 250 61 | 62 | #define EPD_2IN13_V2_FULL 0 63 | #define EPD_2IN13_V2_PART 1 64 | 65 | void EPD_2IN13_V2_Init(UBYTE Mode); 66 | void EPD_2IN13_V2_Clear(void); 67 | void EPD_2IN13_V2_Display(UBYTE *Image); 68 | void EPD_2IN13_V2_DisplayPart(UBYTE *Image); 69 | void EPD_2IN13_V2_DisplayPartBaseImage(UBYTE *Image); 70 | void EPD_2IN13_V2_Sleep(void); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13_V3.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2Iin13_V3.h 3 | * | Author : Waveshare team 4 | * | Function : 2.13inch e-paper V3 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.1 8 | * | Date : 2021-10-30 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2in13_V3_H_ 32 | #define __EPD_2in13_V3_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_2in13_V3_WIDTH 122 38 | #define EPD_2in13_V3_HEIGHT 250 39 | 40 | void EPD_2in13_V3_Init(void); 41 | void EPD_2in13_V3_Clear(void); 42 | void EPD_2in13_V3_Display(UBYTE *Image); 43 | void EPD_2in13_V3_Display_Base(UBYTE *Image); 44 | void EPD_2in13_V3_Display_Partial(UBYTE *Image); 45 | void EPD_2in13_V3_Sleep(void); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13_V4.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2Iin13_V4.h 3 | * | Author : Waveshare team 4 | * | Function : 2.13inch e-paper V4 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2023-08-12 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2in13_V4_H_ 32 | #define __EPD_2in13_V4_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | 37 | // Display resolution 38 | #define EPD_2in13_V4_WIDTH 122 39 | #define EPD_2in13_V4_HEIGHT 250 40 | 41 | void EPD_2in13_V4_Init(void); 42 | void EPD_2in13_V4_Init_Fast(void); 43 | void EPD_2in13_V4_Init_GUI(void); 44 | void EPD_2in13_V4_Clear(void); 45 | void EPD_2in13_V4_Clear_Black(void); 46 | void EPD_2in13_V4_Display(UBYTE *Image); 47 | void EPD_2in13_V4_Display_Fast(UBYTE *Image); 48 | void EPD_2in13_V4_Display_Base(UBYTE *Image); 49 | void EPD_2in13_V4_Display_Partial(UBYTE *Image); 50 | void EPD_2in13_V4_Sleep(void); 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13b_V3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/lib/e-Paper/EPD_2in13b_V3.c -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13b_V3.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in13b_V3.h 3 | * | Author : Waveshare team 4 | * | Function : 2.13inch e-paper b V3 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-04-13 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2IN13B_V3_H_ 32 | #define __EPD_2IN13B_V3_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_2IN13B_V3_WIDTH 104 38 | #define EPD_2IN13B_V3_HEIGHT 212 39 | 40 | void EPD_2IN13B_V3_Init(void); 41 | void EPD_2IN13B_V3_Clear(void); 42 | void EPD_2IN13B_V3_Display(const UBYTE *blackimage, const UBYTE *ryimage); 43 | void EPD_2IN13B_V3_Sleep(void); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13b_V4.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in13b_V4.h 3 | * | Author : Waveshare team 4 | * | Function : 2.13inch e-paper B V4 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2022-04-25 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2IN13B_V4_H_ 32 | #define __EPD_2IN13B_V4_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_2IN13B_V4_WIDTH 122 38 | #define EPD_2IN13B_V4_HEIGHT 250 39 | 40 | void EPD_2IN13B_V4_Init(void); 41 | void EPD_2IN13B_V4_Clear(void); 42 | void EPD_2IN13B_V4_Display(const UBYTE *blackImage, const UBYTE *redImage); 43 | void EPD_2IN13B_V4_Sleep(void); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13bc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in13bc.h 3 | * | Author : Waveshare team 4 | * | Function : 2.13inch e-paper b&c 5 | * | Info : 6 | *---------------- 7 | * | This version: V3.0 8 | * | Date : 2019-06-13 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | * V3.0(2019-06-13): 12 | * 1.Change: 13 | * EPD_Reset() => EPD_2IN13BC_Reset() 14 | * EPD_SendCommand() => EPD_2IN13BC_SendCommand() 15 | * EPD_SendData() => EPD_2IN13BC_SendData() 16 | * EPD_WaitUntilIdle() => EPD_2IN13BC_ReadBusy() 17 | * EPD_Init() => EPD_2IN13BC_Init() 18 | * EPD_Clear() => EPD_2IN13BC_Clear() 19 | * EPD_Display() => EPD_2IN13BC_Display() 20 | * EPD_Sleep() => EPD_2IN13BC_Sleep() 21 | * 2.remove commands define: 22 | * #define PANEL_SETTING 0x00 23 | * #define POWER_SETTING 0x01 24 | * #define POWER_OFF 0x02 25 | * #define POWER_OFF_SEQUENCE_SETTING 0x03 26 | * #define POWER_ON 0x04 27 | * #define POWER_ON_MEASURE 0x05 28 | * #define BOOSTER_SOFT_START 0x06 29 | * #define DEEP_SLEEP 0x07 30 | * #define DATA_START_TRANSMISSION_1 0x10 31 | * #define DATA_STOP 0x11 32 | * #define DISPLAY_REFRESH 0x12 33 | * #define DATA_START_TRANSMISSION_2 0x13 34 | * #define VCOM_LUT 0x20 35 | * #define W2W_LUT 0x21 36 | * #define B2W_LUT 0x22 37 | * #define W2B_LUT 0x23 38 | * #define B2B_LUT 0x24 39 | * #define PLL_CONTROL 0x30 40 | * #define TEMPERATURE_SENSOR_CALIBRATION 0x40 41 | * #define TEMPERATURE_SENSOR_SELECTION 0x41 42 | * #define TEMPERATURE_SENSOR_WRITE 0x42 43 | * #define TEMPERATURE_SENSOR_READ 0x43 44 | * #define VCOM_AND_DATA_INTERVAL_SETTING 0x50 45 | * #define LOW_POWER_DETECTION 0x51 46 | * #define TCON_SETTING 0x60 47 | * #define RESOLUTION_SETTING 0x61 48 | * #define GET_STATUS 0x71 49 | * #define AUTO_MEASURE_VCOM 0x80 50 | * #define READ_VCOM_VALUE 0x81 51 | * #define VCM_DC_SETTING 0x82 52 | * #define PARTIAL_WINDOW 0x90 53 | * #define PARTIAL_IN 0x91 54 | * #define PARTIAL_OUT 0x92 55 | * #define PROGRAM_MODE 0xA0 56 | * #define ACTIVE_PROGRAM 0xA1 57 | * #define READ_OTP_DATA 0xA2 58 | * #define POWER_SAVING 0xE3 59 | * V2.0(2018-11-13): 60 | * 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] 61 | * 2.Change:EPD_Display(UBYTE *Image) 62 | * Need to pass parameters: pointer to cached data 63 | # 64 | # Permission is hereby granted, free of charge, to any person obtaining a copy 65 | # of this software and associated documnetation files (the "Software"), to deal 66 | # in the Software without restriction, including without limitation the rights 67 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 68 | # copies of the Software, and to permit persons to whom the Software is 69 | # furished to do so, subject to the following conditions: 70 | # 71 | # The above copyright notice and this permission notice shall be included in 72 | # all copies or substantial portions of the Software. 73 | # 74 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 75 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 76 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 77 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 78 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 79 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 80 | # THE SOFTWARE. 81 | # 82 | ******************************************************************************/ 83 | #ifndef __EPD_2IN13BC_H_ 84 | #define __EPD_2IN13BC_H_ 85 | 86 | #include "DEV_Config.h" 87 | 88 | // Display resolution 89 | #define EPD_2IN13BC_WIDTH 104 90 | #define EPD_2IN13BC_HEIGHT 212 91 | 92 | void EPD_2IN13BC_Init(void); 93 | void EPD_2IN13BC_Clear(void); 94 | void EPD_2IN13BC_Display(const UBYTE *blackimage, const UBYTE *ryimage); 95 | void EPD_2IN13BC_Sleep(void); 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13d.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/lib/e-Paper/EPD_2in13d.c -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in13d.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in13d.h 3 | * | Author : Waveshare team 4 | * | Function : 2.13inch e-paper d 5 | * | Info : 6 | *---------------- 7 | * | This version: V3.0 8 | * | Date : 2019-06-12 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | * V3.0(2019-06-12): 12 | * 1.Change: 13 | * lut_vcomDC[] => EPD_2IN13D_lut_vcomDC[] 14 | * lut_ww[] => EPD_2IN13D_lut_ww[] 15 | * lut_bw[] => EPD_2IN13D_lut_bw[] 16 | * lut_wb[] => EPD_2IN13D_lut_wb[] 17 | * lut_bb[] => EPD_2IN13D_lut_bb[] 18 | * lut_vcom1[] => EPD_2IN13D_lut_vcom1[] 19 | * lut_ww1[] => EPD_2IN13D_lut_ww1[] 20 | * lut_bw1[] => EPD_2IN13D_lut_bw1[] 21 | * lut_wb1[] => EPD_2IN13D_lut_wb1[] 22 | * lut_bb1[] => EPD_2IN13D_lut_bb1[] 23 | * EPD_Reset() => EPD_2IN13D_Reset() 24 | * EPD_SendCommand() => EPD_2IN13D_SendCommand() 25 | * EPD_SendData() => EPD_2IN13D_SendData() 26 | * EPD_WaitUntilIdle() => EPD_2IN13D_ReadBusy() 27 | * EPD_SetFullReg() => EPD_2IN13D_SetFullReg() 28 | * EPD_SetPartReg() => EPD_2IN13D_SetPartReg() 29 | * EPD_TurnOnDisplay() => EPD_2IN13D_TurnOnDisplay() 30 | * EPD_Init() => EPD_2IN13D_Init() 31 | * EPD_Clear() => EPD_2IN13D_Clear() 32 | * EPD_Display() => EPD_2IN13D_Display() 33 | * EPD_Sleep() => EPD_2IN13D_Sleep() 34 | * V2.0(2018-11-13): 35 | * 1.Remove:ImageBuff[EPD_2IN13D_HEIGHT * EPD_2IN13D_WIDTH / 8] 36 | * 2.Change:EPD_Display(UBYTE *Image) 37 | * Need to pass parameters: pointer to cached data 38 | * 3.Change: 39 | * EPD_RST -> EPD_RST_PIN 40 | * EPD_DC -> EPD_DC_PIN 41 | * EPD_CS -> EPD_CS_PIN 42 | * EPD_BUSY -> EPD_BUSY_PIN 43 | # 44 | # Permission is hereby granted, free of charge, to any person obtaining a copy 45 | # of this software and associated documnetation files (the "Software"), to deal 46 | # in the Software without restriction, including without limitation the rights 47 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 48 | # copies of the Software, and to permit persons to whom the Software is 49 | # furished to do so, subject to the following conditions: 50 | # 51 | # The above copyright notice and this permission notice shall be included in 52 | # all copies or substantial portions of the Software. 53 | # 54 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 55 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 56 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 57 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 58 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 59 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 60 | # THE SOFTWARE. 61 | # 62 | ******************************************************************************/ 63 | #ifndef __EPD_2IN13D_H_ 64 | #define __EPD_2IN13D_H_ 65 | 66 | #include "DEV_Config.h" 67 | 68 | // Display resolution 69 | #define EPD_2IN13D_WIDTH 104 70 | #define EPD_2IN13D_HEIGHT 212 71 | 72 | void EPD_2IN13D_Init(void); 73 | void EPD_2IN13D_Clear(void); 74 | void EPD_2IN13D_Display(UBYTE *Image); 75 | void EPD_2IN13D_DisplayPart(UBYTE *Image); 76 | void EPD_2IN13D_Sleep(void); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in66.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in66.h 3 | * | Author : Waveshare team 4 | * | Function : 2.66inch e-paper 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-07-29 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | ******************************************************************************/ 30 | #ifndef __EPD_2IN66_H_ 31 | #define __EPD_2IN66_H_ 32 | 33 | #include "DEV_Config.h" 34 | 35 | // Display resolution 36 | #define EPD_2IN66_WIDTH 152 37 | #define EPD_2IN66_HEIGHT 296 38 | 39 | 40 | void EPD_2IN66_Init(void); 41 | void EPD_2IN66_Init_Partial(void); 42 | void EPD_2IN66_Clear(void); 43 | void EPD_2IN66_Display(UBYTE *Image); 44 | void EPD_2IN66_Sleep(void); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in66b.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in66b.h 3 | * | Author : Waveshare team 4 | * | Function : 2.66inch e-paper b 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-12-02 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | ******************************************************************************/ 30 | #ifndef __EPD_2IN66B_H_ 31 | #define __EPD_2IN66B_H_ 32 | 33 | #include "DEV_Config.h" 34 | 35 | // Display resolution 36 | #define EPD_2IN66B_WIDTH 152 37 | #define EPD_2IN66B_HEIGHT 296 38 | 39 | 40 | void EPD_2IN66B_Init(void); 41 | void EPD_2IN66B_Display(UBYTE *ImageBlack, UBYTE*ImageRed); 42 | void EPD_2IN66B_Clear(void); 43 | void EPD_2IN66B_Sleep(void); 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in7.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in7.h 3 | * | Author : Waveshare team 4 | * | Function : 2.9inch e-paper V2 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2021-06-03 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2IN7_H_ 32 | #define __EPD_2IN7_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_2IN7_WIDTH 176 38 | #define EPD_2IN7_HEIGHT 264 //46464 39 | 40 | #define KEY0 15 41 | #define KEY1 17 42 | #define KEY2 2 43 | 44 | void EPD_2IN7_Init(void); 45 | void EPD_2IN7_Clear(void); 46 | void EPD_2IN7_Display(const UBYTE *Image); 47 | void EPD_2IN7_Sleep(void); 48 | 49 | void EPD_2IN7_Init_4Gray(void); 50 | void EPD_2IN7_4GrayDisplay(const UBYTE *Image); 51 | #endif 52 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in7_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in7_V2.h 3 | * | Author : Waveshare team 4 | * | Function : 2.7inch V2 e-paper 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2022-08-18 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2IN7_V2_H_ 32 | #define __EPD_2IN7_V2_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_2IN7_V2_WIDTH 176 38 | #define EPD_2IN7_V2_HEIGHT 264 39 | 40 | #define KEY0 15 41 | #define KEY1 17 42 | #define KEY2 2 43 | 44 | void EPD_2IN7_V2_Init(void); 45 | void EPD_2IN7_V2_Init_Fast(void); 46 | void EPD_2IN7_V2_Init_4GRAY(void); 47 | void EPD_2IN7_V2_Clear(void); 48 | void EPD_2IN7_V2_Display(UBYTE *Image); 49 | void EPD_2IN7_V2_Display_Fast(const UBYTE *Image); 50 | void EPD_2IN7_V2_Display_Base(UBYTE *Image); 51 | void EPD_2IN7_V2_Display_Base_color(UBYTE color); 52 | void EPD_2IN7_V2_Display_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yende); 53 | void EPD_2IN7_V2_4GrayDisplay(const UBYTE *Image); 54 | void EPD_2IN7_V2_Sleep(void); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in9_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in9_V2.h 3 | * | Author : Waveshare team 4 | * | Function : 2.9inch e-paper V2 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.1 8 | * | Date : 2023-08-30 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2IN9_V2_H_ 32 | #define __EPD_2IN9_V2_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_2IN9_V2_WIDTH 128 38 | #define EPD_2IN9_V2_HEIGHT 296 39 | 40 | void EPD_2IN9_V2_Init(void); 41 | void EPD_2IN9_V2_Gray4_Init(void); 42 | void EPD_2IN9_V2_Clear(void); 43 | void EPD_2IN9_V2_Display(UBYTE *Image); 44 | void EPD_2IN9_V2_Display_Base(UBYTE *Image); 45 | void EPD_2IN9_V2_4GrayDisplay(UBYTE *Image); 46 | void EPD_2IN9_V2_Display_Partial(UBYTE *Image); 47 | void EPD_2IN9_V2_Sleep(void); 48 | #endif 49 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in9b_V3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/lib/e-Paper/EPD_2in9b_V3.c -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in9b_V3.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in9b V3.h 3 | * | Author : Waveshare team 4 | * | Function : 2.9inch e-paper b V3 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.1 8 | * | Date : 2020-12-03 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2IN9B_V3_H_ 32 | #define __EPD_2IN9B_V3_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_2IN9B_V3_WIDTH 128 38 | #define EPD_2IN9B_V3_HEIGHT 296 39 | 40 | void EPD_2IN9B_V3_Init(void); 41 | void EPD_2IN9B_V3_Clear(void); 42 | void EPD_2IN9B_V3_Display(const UBYTE *blackimage, const UBYTE *ryimage); 43 | void EPD_2IN9B_V3_Sleep(void); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in9b_V4.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in9b V4.h 3 | * | Author : Waveshare team 4 | * | Function : 2.9inch e-paper b V4 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2023-12-18 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_2IN9B_V4_H_ 32 | #define __EPD_2IN9B_V4_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_2IN9B_V4_WIDTH 128 38 | #define EPD_2IN9B_V4_HEIGHT 296 39 | 40 | void EPD_2IN9B_V4_Init(void); 41 | void EPD_2IN9B_V4_Init_Fast(void); 42 | void EPD_2IN9B_V4_Clear_Fast(void); 43 | void EPD_2IN9B_V4_Clear_Black_Fast(void); 44 | void EPD_2IN9B_V4_Clear_Red_Fast(void); 45 | void EPD_2IN9B_V4_Clear(void); 46 | void EPD_2IN9B_V4_Display(const UBYTE *blackimage, const UBYTE *ryimage); 47 | void EPD_2IN9B_V4_Display_Fast(const UBYTE *blackimage, const UBYTE *ryimage); 48 | void EPD_2IN9B_V4_Display_Base(const UBYTE *blackimage, const UBYTE *ryimage); 49 | void EPD_2IN9B_V4_Display_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend); 50 | void EPD_2IN9B_V4_Sleep(void); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in9bc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in9bc.h 3 | * | Author : Waveshare team 4 | * | Function : 2.9inch e-paper b&c 5 | * | Info : 6 | *---------------- 7 | * | This version: V3.0 8 | * | Date : 2019-06-12 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | * V3.0(2019-06-12): 12 | * 1.Change: 13 | * EPD_Reset() => EPD_2IN9BC_Reset() 14 | * EPD_SendCommand() => EPD_2IN9BC_SendCommand() 15 | * EPD_SendData() => EPD_2IN9BC_SendData() 16 | * EPD_WaitUntilIdle() => EPD_2IN9BC_ReadBusy() 17 | * EPD_Init() => EPD_2IN9BC_Init() 18 | * EPD_Clear() => EPD_2IN9BC_Clear() 19 | * EPD_Display() => EPD_2IN9BC_Display() 20 | * EPD_Sleep() => EPD_2IN9BC_Sleep() 21 | * 2.remove commands define: 22 | * #define PANEL_SETTING 0x00 23 | * #define POWER_SETTING 0x01 24 | * #define POWER_OFF 0x02 25 | * #define POWER_OFF_SEQUENCE_SETTING 0x03 26 | * #define POWER_ON 0x04 27 | * #define POWER_ON_MEASURE 0x05 28 | * #define BOOSTER_SOFT_START 0x06 29 | * #define DEEP_SLEEP 0x07 30 | * #define DATA_START_TRANSMISSION_1 0x10 31 | * #define DATA_STOP 0x11 32 | * #define DISPLAY_REFRESH 0x12 33 | * #define DATA_START_TRANSMISSION_2 0x13 34 | * #define PLL_CONTROL 0x30 35 | * #define TEMPERATURE_SENSOR_COMMAND 0x40 36 | * #define TEMPERATURE_SENSOR_CALIBRATION 0x41 37 | * #define TEMPERATURE_SENSOR_WRITE 0x42 38 | * #define TEMPERATURE_SENSOR_READ 0x43 39 | * #define VCOM_AND_DATA_INTERVAL_SETTING 0x50 40 | * #define LOW_POWER_DETECTION 0x51 41 | * #define TCON_SETTING 0x60 42 | * #define TCON_RESOLUTION 0x61 43 | * #define GET_STATUS 0x71 44 | * #define AUTO_MEASURE_VCOM 0x80 45 | * #define VCOM_VALUE 0x81 46 | * #define VCM_DC_SETTING_REGISTER 0x82 47 | * #define PARTIAL_WINDOW 0x90 48 | * #define PARTIAL_IN 0x91 49 | * #define PARTIAL_OUT 0x92 50 | * #define PROGRAM_MODE 0xA0 51 | * #define ACTIVE_PROGRAM 0xA1 52 | * #define READ_OTP_DATA 0xA2 53 | * #define POWER_SAVING 0xE3 54 | * ----------------------------------------------------------------------------- 55 | * V2.0(2018-11-06): 56 | * 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] 57 | * 2.Change:EPD_Display(UBYTE *Image) 58 | * Need to pass parameters: pointer to cached data 59 | * 3.Change: 60 | * EPD_RST -> EPD_RST_PIN 61 | * EPD_DC -> EPD_DC_PIN 62 | * EPD_CS -> EPD_CS_PIN 63 | * EPD_BUSY -> EPD_BUSY_PIN 64 | # 65 | # Permission is hereby granted, free of charge, to any person obtaining a copy 66 | # of this software and associated documnetation files (the "Software"), to deal 67 | # in the Software without restriction, including without limitation the rights 68 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 69 | # copies of the Software, and to permit persons to whom the Software is 70 | # furished to do so, subject to the following conditions: 71 | # 72 | # The above copyright notice and this permission notice shall be included in 73 | # all copies or substantial portions of the Software. 74 | # 75 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 76 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 77 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 78 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 79 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 80 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 81 | # THE SOFTWARE. 82 | # 83 | ******************************************************************************/ 84 | #ifndef __EPD_2IN9BC_H_ 85 | #define __EPD_2IN9BC_H_ 86 | 87 | #include "DEV_Config.h" 88 | 89 | // Display resolution 90 | #define EPD_2IN9BC_WIDTH 128 91 | #define EPD_2IN9BC_HEIGHT 296 92 | 93 | void EPD_2IN9BC_Init(void); 94 | void EPD_2IN9BC_Clear(void); 95 | void EPD_2IN9BC_Display(const UBYTE *blackimage, const UBYTE *ryimage); 96 | void EPD_2IN9BC_Sleep(void); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in9d.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/c/lib/e-Paper/EPD_2in9d.c -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_2in9d.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in9d.c 3 | * | Author : Waveshare team 4 | * | Function : 2.9inch e-paper d 5 | * | Info : 6 | *---------------- 7 | * | This version: V2.0 8 | * | Date : 2019-06-12 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | * V3.0(2019-06-12): 12 | * 1.Change: 13 | * lut_vcomDC[] => EPD_2IN9D_lut_vcomDC[] 14 | * lut_ww[] => EPD_2IN9D_lut_ww[] 15 | * lut_bw[] => EPD_2IN9D_lut_bw[] 16 | * lut_wb[] => EPD_2IN9D_lut_wb[] 17 | * lut_bb[] => EPD_2IN9D_lut_bb[] 18 | * lut_vcom1[] => EPD_2IN9D_lut_vcom1[] 19 | * lut_ww1[] => EPD_2IN9D_lut_ww1[] 20 | * lut_bw1[] => EPD_2IN9D_lut_bw1[] 21 | * lut_wb1[] => EPD_2IN9D_lut_wb1[] 22 | * lut_bb1[] => EPD_2IN9D_lut_bb1[] 23 | * EPD_Reset() => EPD_2IN9D_Reset() 24 | * EPD_SendCommand() => EPD_2IN9D_SendCommand() 25 | * EPD_SendData() => EPD_2IN9D_SendData() 26 | * EPD_WaitUntilIdle() => EPD_2IN9D_ReadBusy() 27 | * EPD_SetFullReg() => EPD_2IN9D_SetFullReg() 28 | * EPD_SetPartReg() => EPD_2IN9D_SetPartReg() 29 | * EPD_TurnOnDisplay() => EPD_2IN9D_TurnOnDisplay() 30 | * EPD_Init() => EPD_2IN9D_Init() 31 | * EPD_Clear() => EPD_2IN9D_Clear() 32 | * EPD_Display() => EPD_2IN9D_Display() 33 | * EPD_Sleep() => EPD_2IN9D_Sleep() 34 | * 35 | # Permission is hereby granted, free of charge, to any person obtaining a copy 36 | # of this software and associated documnetation files (the "Software"), to deal 37 | # in the Software without restriction, including without limitation the rights 38 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | # copies of the Software, and to permit persons to whom the Software is 40 | # furished to do so, subject to the following conditions: 41 | # 42 | # The above copyright notice and this permission notice shall be included in 43 | # all copies or substantial portions of the Software. 44 | # 45 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 51 | # THE SOFTWARE. 52 | # 53 | ******************************************************************************/ 54 | #ifndef __EPD_2IN9D_H_ 55 | #define __EPD_2IN9D_H_ 56 | 57 | #include "DEV_Config.h" 58 | 59 | // Display resolution 60 | #define EPD_2IN9D_WIDTH 128 61 | #define EPD_2IN9D_HEIGHT 296 62 | 63 | void EPD_2IN9D_Init(void); 64 | void EPD_2IN9D_Clear(void); 65 | void EPD_2IN9D_Display(UBYTE *Image); 66 | void EPD_2IN9D_DisplayPart(UBYTE *Image); 67 | void EPD_2IN9D_Sleep(void); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_3in7.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_3IN7.h 3 | * | Author : Waveshare team 4 | * | Function : 3.7inch e-paper 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-07-16 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_3IN7_H_ 32 | #define __EPD_3IN7_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_3IN7_WIDTH 280 38 | #define EPD_3IN7_HEIGHT 480 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | void EPD_3IN7_4Gray_Clear(void); 45 | void EPD_3IN7_4Gray_Init(void); 46 | void EPD_3IN7_4Gray_Display(const UBYTE *Image); 47 | 48 | void EPD_3IN7_1Gray_Clear(void); 49 | void EPD_3IN7_1Gray_Init(void); 50 | void EPD_3IN7_1Gray_Display(const UBYTE *Image); 51 | void EPD_3IN7_1Gray_Display_Part(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend); 52 | 53 | void EPD_3IN7_Sleep(void); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_4in2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_4in2.h 3 | * | Author : Waveshare team 4 | * | Function : 4.2inch e-paper 5 | * | Info : 6 | *---------------- 7 | * | This version: V3.1 8 | * | Date : 2019-11-14 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | * V3.1(2019-11-14): 12 | * 1.Add 4 grayscale drive and display program 13 | * Add EPD_4IN2_4Gray_lut_vcom[] 14 | * Add EPD_4IN2_4Gray_lut_ww[] 15 | * Add EPD_4IN2_4Gray_lut_bw[] 16 | * Add EPD_4IN2_4Gray_lut_wb 17 | * Add EPD_4IN2_4Gray_lut_bb 18 | * Add EPD_4IN2_Partial_SetLut() 19 | * Add EPD_4IN2_4Gray_lut() 20 | * Add EPD_4IN2_Init_4Gray() 21 | * Add EPD_4IN2_4GrayDisplay(....) 22 | * 2.Add partial refresh display 23 | * Add EPD_4IN2_Partial_lut_vcom1[] 24 | * Add EPD_4IN2_Partial_lut_ww1[] 25 | * Add EPD_4IN2_Partial_lut_bw1[] 26 | * Add EPD_4IN2_Partial_lut_wb1[] 27 | * Add EPD_4IN2_Partial_lut_bb1[] 28 | * Add EPD_4IN2_Partial_SetLut() 29 | * Add EPD_4IN2_PartialDisplay(...) 30 | * Poor display, no display function by default 31 | * 32 | * V3.0(2019-06-13): 33 | * 1.Change: 34 | * lut_vcomDC[] => EPD_4IN2_lut_vcomDC[] 35 | * lut_ww[] => EPD_4IN2_lut_ww[] 36 | * lut_bw[] => EPD_4IN2_lut_bw[] 37 | * lut_wb[] => EPD_4IN2_lut_wb[] 38 | * lut_bb[] => EPD_4IN2_lut_bb[] 39 | * EPD_Reset() => EPD_4IN2_Reset() 40 | * EPD_SendCommand() => EPD_4IN2_SendCommand() 41 | * EPD_SendData() => EPD_4IN2_SendData() 42 | * EPD_WaitUntilIdle() => EPD_4IN2_ReadBusy() 43 | * EPD_SetFullReg() => EPD_4IN2_SetFullReg() 44 | * EPD_SetPartReg() => EPD_4IN2_SetPartReg() 45 | * EPD_TurnOnDisplay() => EPD_4IN2_TurnOnDisplay() 46 | * EPD_Init() => EPD_4IN2_Init() 47 | * EPD_Clear() => EPD_4IN2_Clear() 48 | * EPD_Display() => EPD_4IN2_Display() 49 | * EPD_Sleep() => EPD_4IN2_Sleep() 50 | * 2.remove commands define: 51 | * #define PANEL_SETTING 0x00 52 | * #define POWER_SETTING 0x01 53 | * #define POWER_OFF 0x02 54 | * #define POWER_OFF_SEQUENCE_SETTING 0x03 55 | * #define POWER_ON 0x04 56 | * #define POWER_ON_MEASURE 0x05 57 | * #define BOOSTER_SOFT_START 0x06 58 | * #define DEEP_SLEEP 0x07 59 | * #define DATA_START_TRANSMISSION_1 0x10 60 | * #define DATA_STOP 0x11 61 | * #define DISPLAY_REFRESH 0x12 62 | * #define DATA_START_TRANSMISSION_2 0x13 63 | * #define VCOM_LUT 0x20 64 | * #define W2W_LUT 0x21 65 | * #define B2W_LUT 0x22 66 | * #define W2B_LUT 0x23 67 | * #define B2B_LUT 0x24 68 | * #define PLL_CONTROL 0x30 69 | * #define TEMPERATURE_SENSOR_CALIBRATION 0x40 70 | * #define TEMPERATURE_SENSOR_SELECTION 0x41 71 | * #define TEMPERATURE_SENSOR_WRITE 0x42 72 | * #define TEMPERATURE_SENSOR_READ 0x43 73 | * #define VCOM_AND_DATA_INTERVAL_SETTING 0x50 74 | * #define LOW_POWER_DETECTION 0x51 75 | * #define TCON_SETTING 0x60 76 | * #define RESOLUTION_SETTING 0x61 77 | * #define GET_STATUS 0x71 78 | * #define AUTO_MEASURE_VCOM 0x80 79 | * #define READ_VCOM_VALUE 0x81 80 | * #define VCM_DC_SETTING 0x82 81 | * #define PARTIAL_WINDOW 0x90 82 | * #define PARTIAL_IN 0x91 83 | * #define PARTIAL_OUT 0x92 84 | * #define PROGRAM_MODE 0xA0 85 | * #define ACTIVE_PROGRAM 0xA1 86 | * #define READ_OTP_DATA 0xA2 87 | * #define POWER_SAVING 0xE3 88 | * V2.0(2018-10-30): 89 | * 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] 90 | * 2.Change:EPD_Display(UBYTE *Image) 91 | * Need to pass parameters: pointer to cached data 92 | # 93 | # Permission is hereby granted, free of charge, to any person obtaining a copy 94 | # of this software and associated documnetation files (the "Software"), to deal 95 | # in the Software without restriction, including without limitation the rights 96 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 97 | # copies of the Software, and to permit persons to whom the Software is 98 | # furished to do so, subject to the following conditions: 99 | # 100 | # The above copyright notice and this permission notice shall be included in 101 | # all copies or substantial portions of the Software. 102 | # 103 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 104 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 105 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 106 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 107 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 108 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 109 | # THE SOFTWARE. 110 | # 111 | ******************************************************************************/ 112 | #ifndef _EPD_4IN2_H_ 113 | #define _EPD_4IN2_H_ 114 | 115 | #include "DEV_Config.h" 116 | 117 | // Display resolution 118 | #define EPD_4IN2_WIDTH 400 119 | #define EPD_4IN2_HEIGHT 300 120 | 121 | void EPD_4IN2_Init_Fast(void); 122 | void EPD_4IN2_Init_Partial(void); 123 | void EPD_4IN2_Clear(void); 124 | void EPD_4IN2_Display(UBYTE *Image); 125 | void EPD_4IN2_Sleep(void); 126 | void EPD_4IN2_PartialDisplay(UWORD X_start,UWORD Y_start,UWORD X_end,UWORD Y_end, UBYTE *Image); 127 | 128 | void EPD_4IN2_Init_4Gray(void); 129 | void EPD_4IN2_4GrayDisplay(const UBYTE *Image); 130 | 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_4in2_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_4in2_V2.h 3 | * | Author : Waveshare team 4 | * | Function : 4.2inch e-paper V2 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2023-09-12 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef _EPD_4IN2_V2_H_ 32 | #define _EPD_4IN2_V2_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_4IN2_V2_WIDTH 400 38 | #define EPD_4IN2_V2_HEIGHT 300 39 | 40 | #define Seconds_1_5S 0 41 | #define Seconds_1S 1 42 | 43 | #define KEY0 15 44 | #define KEY1 17 45 | 46 | void EPD_4IN2_V2_Init(void); 47 | void EPD_4IN2_V2_Init_Fast(UBYTE Mode); 48 | void EPD_4IN2_V2_Init_4Gray(void); 49 | void EPD_4IN2_V2_Clear(void); 50 | void EPD_4IN2_V2_Display(UBYTE *Image); 51 | void EPD_4IN2_V2_Display_Fast(UBYTE *Image); 52 | void EPD_4IN2_V2_Display_4Gray(UBYTE *Image); 53 | void EPD_4IN2_V2_PartialDisplay(UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend); 54 | void EPD_4IN2_V2_Sleep(void); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_4in2b_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_4in2b_V2.h 3 | * | Author : Waveshare team 4 | * | Function : 4.2inch e-paper b&c 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-11-25 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_4IN2B_V2_H_ 32 | #define __EPD_4IN2B_V2_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_4IN2B_V2_WIDTH 400 38 | #define EPD_4IN2B_V2_HEIGHT 300 39 | 40 | #define KEY0 15 41 | #define KEY1 17 42 | 43 | void EPD_4IN2B_V2_Init(void); 44 | void EPD_4IN2B_V2_Clear(void); 45 | void EPD_4IN2B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage); 46 | void EPD_4IN2B_V2_Sleep(void); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_4in2b_V2_old.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_4in2b_V2.h 3 | * | Author : Waveshare team 4 | * | Function : 4.2inch e-paper b&c 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-11-25 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_4IN2B_V2_OLD_H_ 32 | #define __EPD_4IN2B_V2_OLD_H_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | // Display resolution 37 | #define EPD_4IN2B_V2_WIDTH 400 38 | #define EPD_4IN2B_V2_HEIGHT 300 39 | 40 | void EPD_4IN2B_V2_Init_1(void); 41 | void EPD_4IN2B_V2_Clear_1(void); 42 | void EPD_4IN2B_V2_Display_1(const UBYTE *blackimage, const UBYTE *ryimage); 43 | void EPD_4IN2B_V2_Sleep_1(void); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_5in65f.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_2in9_V2.h 3 | * | Author : Waveshare team 4 | * | Function : 2.9inch e-paper V2 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2021-06-03 9 | * | Info : 10 | * ----------------------------------------------------------------------------- 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef __EPD_5IN65F_H__ 32 | #define __EPD_5IN65F_H__ 33 | 34 | #include "DEV_Config.h" 35 | 36 | /********************************** 37 | Color Index 38 | **********************************/ 39 | #define EPD_5IN65F_BLACK 0x0 /// 000 40 | #define EPD_5IN65F_WHITE 0x1 /// 001 41 | #define EPD_5IN65F_GREEN 0x2 /// 010 42 | #define EPD_5IN65F_BLUE 0x3 /// 011 43 | #define EPD_5IN65F_RED 0x4 /// 100 44 | #define EPD_5IN65F_YELLOW 0x5 /// 101 45 | #define EPD_5IN65F_ORANGE 0x6 /// 110 46 | #define EPD_5IN65F_CLEAN 0x7 /// 111 unavailable Afterimage 47 | 48 | #define EPD_5IN65F_WIDTH 600 49 | #define EPD_5IN65F_HEIGHT 448 50 | 51 | #define KEY0 15 52 | #define KEY1 17 53 | #define KEY2 2 54 | 55 | 56 | void EPD_5IN65F_Clear(UBYTE color); 57 | void EPD_5IN65F_Sleep(void); 58 | void EPD_5IN65F_Display(const UBYTE *image); 59 | void EPD_5IN65F_Init(void); 60 | void EPD_5IN65F_Display_part(const UBYTE *image, UWORD xstart, UWORD ystart, UWORD image_width, UWORD image_heigh); 61 | 62 | #endif 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_5in83_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_5in83_V2.h 3 | * | Author : Waveshare team 4 | * | Function : 5.83inch e-paper V2 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-11-23 9 | * | Info : 10 | # 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | ******************************************************************************/ 30 | #ifndef __EPD_5in83_V2_H_ 31 | #define __EPD_5in83_V2_H_ 32 | 33 | #include "DEV_Config.h" 34 | 35 | // Display resolution 36 | #define EPD_5in83_V2_WIDTH 648 37 | #define EPD_5in83_V2_HEIGHT 480 38 | 39 | void EPD_5in83_V2_Init(void); 40 | void EPD_5in83_V2_Clear(void); 41 | void EPD_5in83_V2_Display(UBYTE *Image); 42 | void EPD_5in83_V2_Sleep(void); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_5in83b_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_5in83b_V2.h 3 | * | Author : Waveshare team 4 | * | Function : Electronic paper driver 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2020-07-04 9 | * | Info : 10 | ****************************************************************************** 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documnetation files (the "Software"), to deal 14 | # in the Software without restriction, including without limitation the rights 15 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the Software is 17 | # furished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | # THE SOFTWARE. 29 | # 30 | ******************************************************************************/ 31 | #ifndef _EPD_5IN83B_V2_h_ 32 | #define _EPD_5IN83B_V2_h_ 33 | 34 | #include "DEV_Config.h" 35 | 36 | 37 | // Display resolution 38 | #define EPD_5IN83B_V2_WIDTH 648 39 | #define EPD_5IN83B_V2_HEIGHT 480 40 | 41 | UBYTE EPD_5IN83B_V2_Init(void); 42 | void EPD_5IN83B_V2_Clear(void); 43 | void EPD_5IN83B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage); 44 | void EPD_5IN83B_V2_Sleep(void); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_7in5_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_7in5_V2.h 3 | * | Author : Waveshare team 4 | * | Function : Electronic paper driver 5 | * | Info : 6 | *---------------- 7 | * | This version: V3.0 8 | * | Date : 2023-12-18 9 | * | Info : 10 | * 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] 11 | * 2.Change:EPD_Display(UBYTE *Image) 12 | * Need to pass parameters: pointer to cached data 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy 15 | # of this software and associated documnetation files (the "Software"), to deal 16 | # in the Software without restriction, including without limitation the rights 17 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | # copies of the Software, and to permit persons to whom the Software is 19 | # furished to do so, subject to the following conditions: 20 | # 21 | # The above copyright notice and this permission notice shall be included in 22 | # all copies or substantial portions of the Software. 23 | # 24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | # THE SOFTWARE. 31 | # 32 | ******************************************************************************/ 33 | #ifndef _EPD_7IN5_V2_H_ 34 | #define _EPD_7IN5_V2_H_ 35 | 36 | #include "DEV_Config.h" 37 | 38 | 39 | // Display resolution 40 | #define EPD_7IN5_V2_WIDTH 800 41 | #define EPD_7IN5_V2_HEIGHT 480 42 | 43 | UBYTE EPD_7IN5_V2_Init(void); 44 | UBYTE EPD_7IN5_V2_Init_Fast(void); 45 | UBYTE EPD_7IN5_V2_Init_Part(void); 46 | UBYTE EPD_7IN5_V2_Init_4Gray(void); 47 | void EPD_7IN5_V2_Clear(void); 48 | void EPD_7IN5_V2_ClearBlack(void); 49 | void EPD_7IN5_V2_Display(UBYTE *blackimage); 50 | void EPD_7IN5_V2_Display_Part(UBYTE *blackimage,UDOUBLE x_start, UDOUBLE y_start, UDOUBLE x_end, UDOUBLE y_end); 51 | void EPD_7IN5_V2_Display_4Gray(const UBYTE *Image); 52 | void EPD_7IN5_V2_Sleep(void); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_7in5_V2_old.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_7in5_V2.h 3 | * | Author : Waveshare team 4 | * | Function : Electronic paper driver 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2023-12-18 9 | * | Info : 10 | * 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] 11 | * 2.Change:EPD_Display(UBYTE *Image) 12 | * Need to pass parameters: pointer to cached data 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy 15 | # of this software and associated documnetation files (the "Software"), to deal 16 | # in the Software without restriction, including without limitation the rights 17 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | # copies of the Software, and to permit persons to whom the Software is 19 | # furished to do so, subject to the following conditions: 20 | # 21 | # The above copyright notice and this permission notice shall be included in 22 | # all copies or substantial portions of the Software. 23 | # 24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | # THE SOFTWARE. 31 | # 32 | ******************************************************************************/ 33 | #ifndef _EPD_7IN5_V2_OLD_H_ 34 | #define _EPD_7IN5_V2_OLD_H_ 35 | 36 | #include "Debug.h" 37 | #include "DEV_Config.h" 38 | 39 | 40 | // Display resolution 41 | #define EPD_7IN5_V2_WIDTH 800 42 | #define EPD_7IN5_V2_HEIGHT 480 43 | 44 | UBYTE EPD_7IN5_V2_Init_old(void); 45 | UBYTE EPD_7IN5_V2_Init_Fast_old(void); 46 | UBYTE EPD_7IN5_V2_Init_Partial_old(void); 47 | void EPD_7IN5_V2_Clear_old(void); 48 | void EPD_7IN5_V2_ClearBlack_old(void); 49 | void EPD_7IN5_V2_Display_old(const UBYTE *blackimage); 50 | void EPD_7IN5_V2_SendHalfImage_old(const UBYTE *Image); 51 | void EPD_7IN5_V2_WritePicture_old(const UBYTE *Image); 52 | void EPD_7IN5_V2_DisplayPart_old(const UBYTE *Image, UWORD xstart, UWORD ystart, UWORD image_width, UWORD image_heigh); 53 | void EPD_7IN5_V2_Display_Partial_old(UBYTE *blackimage,UDOUBLE x_start, UDOUBLE y_start, UDOUBLE x_end, UDOUBLE y_end); 54 | void EPD_7IN5_V2_Sleep_old(void); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_7in5b_V2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_7in5_B.h 3 | * | Author : Waveshare team 4 | * | Function : Electronic paper driver 5 | * | Info : 6 | *---------------- 7 | * | This version: V2.0 8 | * | Date : 2024-08-07 9 | * | Info : 10 | * 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] 11 | * 2.Change:EPD_Display(UBYTE *Image) 12 | * Need to pass parameters: pointer to cached data 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy 15 | # of this software and associated documnetation files (the "Software"), to deal 16 | # in the Software without restriction, including without limitation the rights 17 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | # copies of the Software, and to permit persons to whom the Software is 19 | # furished to do so, subject to the following conditions: 20 | # 21 | # The above copyright notice and this permission notice shall be included in 22 | # all copies or substantial portions of the Software. 23 | # 24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | # THE SOFTWARE. 31 | # 32 | ******************************************************************************/ 33 | #ifndef _EPD_7IN5B_V2_H_ 34 | #define _EPD_7IN5B_V2_H_ 35 | 36 | #include "DEV_Config.h" 37 | 38 | 39 | // Display resolution 40 | #define EPD_7IN5B_V2_WIDTH 800 41 | #define EPD_7IN5B_V2_HEIGHT 480 42 | 43 | UBYTE EPD_7IN5B_V2_Init(void); 44 | UBYTE EPD_7IN5B_V2_Init_Fast(void); 45 | UBYTE EPD_7IN5B_V2_Init_Part(void); 46 | void EPD_7IN5B_V2_Clear(void); 47 | void EPD_7IN5B_V2_ClearRed(void); 48 | void EPD_7IN5B_V2_ClearBlack(void); 49 | void EPD_7IN5B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage); 50 | void EPD_7IN5B_V2_Display_Fast(const UBYTE *blackimage); 51 | void EPD_7IN5B_V2_Display_Base_color(UBYTE color); 52 | void EPD_7IN5B_V2_Display_Partial(const UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend); 53 | void EPD_7IN5B_V2_Sleep(void); 54 | #endif 55 | -------------------------------------------------------------------------------- /c/lib/e-Paper/EPD_7in5b_V2_old.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : EPD_7in5.h 3 | * | Author : Waveshare team 4 | * | Function : Electronic paper driver 5 | * | Info : 6 | *---------------- 7 | * | This version: V2.0 8 | * | Date : 2018-11-09 9 | * | Info : 10 | * 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] 11 | * 2.Change:EPD_Display(UBYTE *Image) 12 | * Need to pass parameters: pointer to cached data 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy 15 | # of this software and associated documnetation files (the "Software"), to deal 16 | # in the Software without restriction, including without limitation the rights 17 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | # copies of the Software, and to permit persons to whom the Software is 19 | # furished to do so, subject to the following conditions: 20 | # 21 | # The above copyright notice and this permission notice shall be included in 22 | # all copies or substantial portions of the Software. 23 | # 24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | # THE SOFTWARE. 31 | # 32 | ******************************************************************************/ 33 | #ifndef _EPD_7IN5B_V2_OLD_H_ 34 | #define _EPD_7IN5B_V2_OLD_H_ 35 | 36 | #include "DEV_Config.h" 37 | 38 | 39 | // Display resolution 40 | #define EPD_7IN5B_V2_WIDTH 800 41 | #define EPD_7IN5B_V2_HEIGHT 480 42 | 43 | UBYTE EPD_7IN5B_V2_Init_old(void); 44 | void EPD_7IN5B_V2_Clear_old(void); 45 | void EPD_7IN5B_V2_ClearRed_old(void); 46 | void EPD_7IN5B_V2_ClearBlack_old(void); 47 | void EPD_7IN5B_V2_Display_old(const UBYTE *blackimage, const UBYTE *ryimage); 48 | void EPD_7IN5B_V2_Sleep_old(void); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /c/main.c: -------------------------------------------------------------------------------- 1 | #include "EPD_Test.h" //Examples 2 | 3 | int main(void) 4 | { 5 | // while(1) { 6 | 7 | // DEV_Delay_ms(10000); 8 | // } 9 | DEV_Delay_ms(500); 10 | // EPD_2in9_V2_test(); 11 | // EPD_2in9bc_test(); 12 | // EPD_2in9b_V3_test(); 13 | // EPD_2in9b_V4_test(); 14 | // EPD_2in9d_test(); 15 | 16 | // EPD_2in13_V2_test(); 17 | // EPD_2in13_V3_test(); 18 | // EPD_2in13_V4_test(); 19 | // EPD_2in13bc_test(); 20 | // EPD_2in13b_V3_test(); 21 | // EPD_2in13b_V4_test(); 22 | // EPD_2in13d_test(); 23 | 24 | // EPD_2in66_test(); 25 | // EPD_2in66b_test(); 26 | 27 | // EPD_2in7_test(); 28 | // EPD_2in7_V2_test(); 29 | 30 | // EPD_3in7_test(); 31 | 32 | // EPD_4in2_test(); 33 | // EPD_4in2_V2_test(); 34 | // EPD_4in2b_V2_test(); 35 | EPD_4in2b_V2_test_old(); 36 | // EPD_5in65f_test(); 37 | 38 | // EPD_5in83_V2_test(); 39 | // EPD_5in83b_V2_test(); 40 | 41 | // EPD_7in5_V2_test(); 42 | // EPD_7in5_V2_test_old(); 43 | // EPD_7in5b_V2_test(); 44 | // EPD_7in5b_V2_test_old(); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /c/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /python/Pico 2.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/python/Pico 2.uf2 -------------------------------------------------------------------------------- /python/Pico.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/python/Pico.uf2 -------------------------------------------------------------------------------- /python/Pico_ePaper-2.13-C.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # * | File : Pico_ePaper-2.13-C.py 3 | # * | Author : Waveshare team 4 | # * | Function : Electronic paper driver 5 | # * | Info : 6 | # *---------------- 7 | # * | This version: V1.0 8 | # * | Date : 2021-03-16 9 | # # | Info : python demo 10 | # ----------------------------------------------------------------------------- 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | 30 | from machine import Pin, SPI 31 | import framebuf 32 | import utime 33 | 34 | 35 | EPD_WIDTH = 104 36 | EPD_HEIGHT = 212 37 | 38 | RST_PIN = 12 39 | DC_PIN = 8 40 | CS_PIN = 9 41 | BUSY_PIN = 13 42 | 43 | class EPD_2in13_C: 44 | def __init__(self): 45 | self.reset_pin = Pin(RST_PIN, Pin.OUT) 46 | 47 | self.busy_pin = Pin(BUSY_PIN, Pin.IN, Pin.PULL_UP) 48 | self.cs_pin = Pin(CS_PIN, Pin.OUT) 49 | self.width = EPD_WIDTH 50 | self.height = EPD_HEIGHT 51 | 52 | self.spi = SPI(1) 53 | self.spi.init(baudrate=4000_000) 54 | self.dc_pin = Pin(DC_PIN, Pin.OUT) 55 | 56 | 57 | self.buffer_black = bytearray(self.height * self.width // 8) 58 | self.buffer_yellow = bytearray(self.height * self.width // 8) 59 | self.imageblack = framebuf.FrameBuffer(self.buffer_black, self.width, self.height, framebuf.MONO_HLSB) 60 | self.imageyellow = framebuf.FrameBuffer(self.buffer_yellow, self.width, self.height, framebuf.MONO_HLSB) 61 | self.init() 62 | 63 | def digital_write(self, pin, value): 64 | pin.value(value) 65 | 66 | def digital_read(self, pin): 67 | return pin.value() 68 | 69 | def delay_ms(self, delaytime): 70 | utime.sleep(delaytime / 1000.0) 71 | 72 | def spi_writebyte(self, data): 73 | self.spi.write(bytearray(data)) 74 | 75 | def module_exit(self): 76 | self.digital_write(self.reset_pin, 0) 77 | 78 | # Hardware reset 79 | def reset(self): 80 | self.digital_write(self.reset_pin, 1) 81 | self.delay_ms(50) 82 | self.digital_write(self.reset_pin, 0) 83 | self.delay_ms(5) 84 | self.digital_write(self.reset_pin, 1) 85 | self.delay_ms(50) 86 | 87 | 88 | def send_command(self, command): 89 | self.digital_write(self.dc_pin, 0) 90 | self.digital_write(self.cs_pin, 0) 91 | self.spi_writebyte([command]) 92 | self.digital_write(self.cs_pin, 1) 93 | 94 | def send_data(self, data): 95 | self.digital_write(self.dc_pin, 1) 96 | self.digital_write(self.cs_pin, 0) 97 | self.spi_writebyte([data]) 98 | self.digital_write(self.cs_pin, 1) 99 | 100 | def send_data1(self, buf): 101 | self.digital_write(self.dc_pin, 1) 102 | self.digital_write(self.cs_pin, 0) 103 | self.spi.write(bytearray(buf)) 104 | self.digital_write(self.cs_pin, 1) 105 | 106 | def ReadBusy(self): 107 | print('busy') 108 | while(self.digital_read(self.busy_pin) == 0): 109 | self.delay_ms(10) 110 | print('busy release') 111 | 112 | def TurnOnDisplay(self): 113 | self.send_command(0x12) 114 | self.ReadBusy() 115 | 116 | def init(self): 117 | print('init') 118 | self.reset() 119 | 120 | self.send_command(0x06) # BOOSTER_SOFT_START 121 | self.send_data(0x17) 122 | self.send_data(0x17) 123 | self.send_data(0x17) 124 | 125 | self.send_command(0x04) # POWER_ON 126 | self.ReadBusy() 127 | 128 | self.send_command(0x00) # PANEL_SETTING 129 | self.send_data(0x8F) 130 | 131 | self.send_command(0x50) # VCOM_AND_DATA_INTERVAL_SETTING 132 | self.send_data(0xF0) 133 | 134 | self.send_command(0x61) # RESOLUTION_SETTING 135 | self.send_data(self.width & 0xff) 136 | self.send_data(self.height >> 8) 137 | self.send_data(self.height & 0xff) 138 | return 0 139 | 140 | def display(self): 141 | self.send_command(0x10) 142 | self.send_data1(self.buffer_black) 143 | self.send_command(0x13) 144 | self.send_data1(self.buffer_yellow) 145 | 146 | self.TurnOnDisplay() 147 | 148 | 149 | def Clear(self, colorblack, colorred): 150 | self.send_command(0x10) 151 | self.send_data1([colorred] * self.height * int(self.width / 8)) 152 | 153 | self.send_command(0x13) 154 | self.send_data1([colorred] * self.height * int(self.width / 8)) 155 | 156 | self.TurnOnDisplay() 157 | 158 | def sleep(self): 159 | self.send_command(0x02) # POWER_OFF 160 | self.ReadBusy() 161 | self.send_command(0x07) # DEEP_SLEEP 162 | self.send_data(0xA5) # check code 163 | 164 | self.delay_ms(2000) 165 | self.module_exit() 166 | 167 | 168 | if __name__=='__main__': 169 | epd = EPD_2in13_C() 170 | epd.Clear(0xff, 0xff) 171 | 172 | epd.imageblack.fill(0xff) 173 | epd.imageyellow.fill(0xff) 174 | epd.imageblack.text("Waveshare", 0, 10, 0x00) 175 | epd.imageyellow.text("ePaper-2.13", 0, 25, 0x00) 176 | epd.imageblack.text("RPi Pico", 0, 40, 0x00) 177 | epd.imageyellow.text("Hello World", 0, 55, 0x00) 178 | epd.display() 179 | epd.delay_ms(2000) 180 | 181 | epd.imageyellow.vline(10, 90, 40, 0x00) 182 | epd.imageyellow.vline(90, 90, 40, 0x00) 183 | epd.imageblack.hline(10, 90, 80, 0x00) 184 | epd.imageblack.hline(10, 130, 80, 0x00) 185 | epd.imageyellow.line(10, 90, 90, 130, 0x00) 186 | epd.imageblack.line(90, 90, 10, 130, 0x00) 187 | epd.display() 188 | epd.delay_ms(2000) 189 | 190 | epd.imageblack.rect(10, 150, 40, 40, 0x00) 191 | epd.imageyellow.fill_rect(60, 150, 40, 40, 0x00) 192 | epd.display() 193 | epd.delay_ms(2000) 194 | 195 | epd.Clear(0xff, 0xff) 196 | epd.delay_ms(2000) 197 | print("sleep") 198 | epd.sleep() -------------------------------------------------------------------------------- /python/Pico_ePaper-2.9-C.py: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** 2 | # * | File : Pico_ePaper-2.9-C.py 3 | # * | Author : Waveshare team 4 | # * | Function : Electronic paper driver 5 | # * | Info : 6 | # *---------------- 7 | # * | This version: V1.0 8 | # * | Date : 2021-03-16 9 | # # | Info : python demo 10 | # ----------------------------------------------------------------------------- 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documnetation files (the "Software"), to deal 13 | # in the Software without restriction, including without limitation the rights 14 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | # copies of the Software, and to permit persons to whom the Software is 16 | # furished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | # THE SOFTWARE. 28 | # 29 | 30 | from machine import Pin, SPI 31 | import framebuf 32 | import utime 33 | 34 | # Display resolution 35 | EPD_WIDTH = 128 36 | EPD_HEIGHT = 296 37 | 38 | RST_PIN = 12 39 | DC_PIN = 8 40 | CS_PIN = 9 41 | BUSY_PIN = 13 42 | 43 | class EPD_2in9_C: 44 | def __init__(self): 45 | self.reset_pin = Pin(RST_PIN, Pin.OUT) 46 | 47 | self.busy_pin = Pin(BUSY_PIN, Pin.IN, Pin.PULL_UP) 48 | self.cs_pin = Pin(CS_PIN, Pin.OUT) 49 | self.width = EPD_WIDTH 50 | self.height = EPD_HEIGHT 51 | 52 | self.spi = SPI(1) 53 | self.spi.init(baudrate=4000_000) 54 | self.dc_pin = Pin(DC_PIN, Pin.OUT) 55 | 56 | self.buffer_black = bytearray(self.height * self.width // 8) 57 | self.buffer_red = bytearray(self.height * self.width // 8) 58 | self.imageblack = framebuf.FrameBuffer(self.buffer_black, self.width, self.height, framebuf.MONO_HLSB) 59 | self.imagered = framebuf.FrameBuffer(self.buffer_red, self.width, self.height, framebuf.MONO_HLSB) 60 | self.init() 61 | 62 | def digital_write(self, pin, value): 63 | pin.value(value) 64 | 65 | def digital_read(self, pin): 66 | return pin.value() 67 | 68 | def delay_ms(self, delaytime): 69 | utime.sleep(delaytime / 1000.0) 70 | 71 | def spi_writebyte(self, data): 72 | self.spi.write(bytearray(data)) 73 | 74 | def module_exit(self): 75 | self.digital_write(self.reset_pin, 0) 76 | 77 | # Hardware reset 78 | def reset(self): 79 | self.digital_write(self.reset_pin, 1) 80 | self.delay_ms(50) 81 | self.digital_write(self.reset_pin, 0) 82 | self.delay_ms(2) 83 | self.digital_write(self.reset_pin, 1) 84 | self.delay_ms(50) 85 | 86 | 87 | def send_command(self, command): 88 | self.digital_write(self.dc_pin, 0) 89 | self.digital_write(self.cs_pin, 0) 90 | self.spi_writebyte([command]) 91 | self.digital_write(self.cs_pin, 1) 92 | 93 | def send_data(self, data): 94 | self.digital_write(self.dc_pin, 1) 95 | self.digital_write(self.cs_pin, 0) 96 | self.spi_writebyte([data]) 97 | self.digital_write(self.cs_pin, 1) 98 | 99 | def send_data1(self, buf): 100 | self.digital_write(self.dc_pin, 1) 101 | self.digital_write(self.cs_pin, 0) 102 | self.spi.write(bytearray(buf)) 103 | self.digital_write(self.cs_pin, 1) 104 | 105 | def ReadBusy(self): 106 | print('busy') 107 | self.send_command(0x71) 108 | while(self.digital_read(self.busy_pin) == 0): 109 | self.send_command(0x71) 110 | self.delay_ms(10) 111 | print('busy release') 112 | 113 | def TurnOnDisplay(self): 114 | self.send_command(0x12) 115 | self.ReadBusy() 116 | 117 | def init(self): 118 | print('init') 119 | self.reset() 120 | self.send_command(0x06) # boost 121 | self.send_data (0x17) 122 | self.send_data (0x17) 123 | self.send_data (0x17) 124 | self.send_command(0x04) # POWER_ON 125 | self.ReadBusy() 126 | self.send_command(0X00) # PANEL_SETTING 127 | self.send_data(0x8F) 128 | self.send_command(0X50) # VCOM_AND_DATA_INTERVAL_SETTING 129 | self.send_data(0x77) 130 | self.send_command(0x61) # TCON_RESOLUTION 131 | self.send_data (0x80) 132 | self.send_data (0x01) 133 | self.send_data (0x28) 134 | return 0 135 | 136 | def display(self): 137 | self.send_command(0x10) 138 | self.send_data1(self.buffer_black) 139 | 140 | self.send_command(0x13) 141 | self.send_data1(self.buffer_red) 142 | 143 | self.TurnOnDisplay() 144 | 145 | 146 | def Clear(self, colorblack, colorred): 147 | self.send_command(0x10) 148 | self.send_data1([colorred] * self.height * int(self.width / 8)) 149 | 150 | self.send_command(0x13) 151 | self.send_data1([colorred] * self.height * int(self.width / 8)) 152 | 153 | self.TurnOnDisplay() 154 | 155 | def sleep(self): 156 | self.send_command(0X02) # power off 157 | self.ReadBusy() 158 | self.send_command(0X07) # deep sleep 159 | self.send_data(0xA5) 160 | 161 | self.delay_ms(2000) 162 | self.module_exit() 163 | 164 | 165 | if __name__=='__main__': 166 | epd = EPD_2in9_C() 167 | epd.Clear(0xff, 0xff) 168 | 169 | epd.imageblack.fill(0xff) 170 | epd.imagered.fill(0xff) 171 | epd.imageblack.text("Waveshare", 0, 10, 0x00) 172 | epd.imagered.text("ePaper-2.9-C", 0, 25, 0x00) 173 | epd.imageblack.text("RPi Pico", 0, 40, 0x00) 174 | epd.imagered.text("Hello World", 0, 55, 0x00) 175 | epd.display() 176 | epd.delay_ms(2000) 177 | 178 | epd.imagered.vline(10, 90, 40, 0x00) 179 | epd.imagered.vline(90, 90, 40, 0x00) 180 | epd.imageblack.hline(10, 90, 80, 0x00) 181 | epd.imageblack.hline(10, 130, 80, 0x00) 182 | epd.imagered.line(10, 90, 90, 130, 0x00) 183 | epd.imageblack.line(90, 90, 10, 130, 0x00) 184 | epd.display() 185 | epd.delay_ms(2000) 186 | 187 | epd.imageblack.rect(10, 150, 40, 40, 0x00) 188 | epd.imagered.fill_rect(60, 150, 40, 40, 0x00) 189 | epd.display() 190 | epd.delay_ms(2000) 191 | 192 | epd.Clear(0xff, 0xff) 193 | epd.delay_ms(2000) 194 | print("sleep") 195 | epd.sleep() -------------------------------------------------------------------------------- /python/ReadmeCN.txt: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : Readme_CN.txt 3 | * | Author : 4 | * | Function : Help with use 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2021-03-17 9 | * | Info : 在这里提供一个中文版本的使用文档,以便你的快速使用 10 | ******************************************************************************/ 11 | 这个文件是帮助您使用本例程。 12 | 在这里简略的描述本工程的使用: 13 | 14 | 1.基本信息: 15 | 本例程使用相对应的模块搭配Pico进行了验证,你可以在工程的中查看对应的测试例程; 16 | 17 | 2.管脚连接: 18 | 管脚连接你可以在Pico_ePaper-xxx.py查看,这里也再重述一次: 19 | EPD => Pico 20 | VCC -> VSYS 21 | GND -> GND 22 | DIN -> 11 23 | CLK -> 10 24 | CS -> 9 25 | DC -> 8 26 | RST -> 12 27 | BUSY -> 13 28 | 29 | 3.基本使用: 30 | 1): 按住Pico板上的按键,将pico通过Micro USB线接到电脑的USB接口,然后松开按键。 31 | 接入之后,电脑会自动识别到一个可移动盘(RPI-RP2) 32 | 33 | 2): 将python目录中Pico.uf2 / Pico 2.uf2 文件复制到识别的可移动盘(RPI-RP2)中 34 | 35 | 3): 更新Thonny IDE 36 | sudo apt upgrade thonny 37 | 38 | 4): 打开Thonny IDE (点击树莓logo -> Programming -> Thonny Python IDE ) 39 | 选择Tools -> Options... -> Interpreter 40 | 选择MicroPython(Raspberry Pi Pico 和ttyACM0端口 41 | 42 | 5): 在Thonny IDE中打开python/Pico_ePaper-xxx.py文件 43 | 然后运行当前脚本(绿色小三角)即可 44 | -------------------------------------------------------------------------------- /python/ReadmeEN.txt: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * | File : Readme_EN.txt 3 | * | Author : 4 | * | Function : Help with use 5 | * | Info : 6 | *---------------- 7 | * | This version: V1.0 8 | * | Date : 2021-03-17 9 | * | Info : Here is an English version of the documentation for your quick use. 10 | ******************************************************************************/ 11 | This file is to help you use this routine. 12 | Here is a brief description of the use of this project: 13 | 14 | 1. Basic information: 15 | This routine has been verified using the corresponding module with Pico, 16 | you can view the corresponding test routine in the project; 17 | 18 | 2. Pin connection: 19 | You can check the pin connection at Pico_ePaper-xxx.py, and repeat it here: 20 | EPD => Pico 21 | VCC -> VSYS 22 | GND -> GND 23 | DIN -> 11 24 | CLK -> 10 25 | CS -> 9 26 | DC -> 8 27 | RST -> 12 28 | BUSY -> 13 29 | 30 | 31 | 3. Basic use: 32 | 1): Press and hold the button on the Pico board, connect Pico to the USB port of the 33 | computer through the Micro USB cable, and then release the button. 34 | After connecting, the computer will automatically recognize a removable disk (RPI-RP2) 35 | 36 | 2): Copy the Pico.uf2 / Pico 2.uf2 file in the python directory to the recognized 37 | removable disk (RPI-RP2) 38 | 39 | 3): Update Thonny IDE 40 | sudo apt upgrade thonny 41 | 42 | 4): Open Thonny IDE (Click raspberry logo -> Programming -> Thonny Python IDE ) 43 | select Tools -> Options... -> Interpreter 44 | select MicroPython(Raspberry Pi Pico and ttyACM0 port 45 | 46 | 5): Open the python/Pico_ePaper-xxx.py file in Thonny IDE 47 | Then run the current script (green triangle) 48 | -------------------------------------------------------------------------------- /python/Resetting Flash memory/flash_nuke.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/python/Resetting Flash memory/flash_nuke.uf2 -------------------------------------------------------------------------------- /python/rp2-pico-20220117-v1.18.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/python/rp2-pico-20220117-v1.18.uf2 -------------------------------------------------------------------------------- /pythonNanoGui/ReadMe_CN.txt: -------------------------------------------------------------------------------- 1 | 快速使用 2 | Rev0.1 3 | 4 | 5 | 6 | 1. 将 demos/ drivers/ gui/ 和 color_setup.py 上传到 RPi Pico 中 7 | 8 | 9 | 2. 打开 color_setup.py, 将对应型号的模块导入注释取消 10 | 1) 例如你使用的是 Pico-ePaper-2.13 11 | 将 12 | # from drivers.ePaper2in13V3 import EPD as SSD 13 | 改为 14 | from drivers.ePaper2in13V3 import EPD as SSD 15 | 16 | 2) 例如你使用的是 Pico-ePaper-7.5-B 17 | 将 18 | # from drivers.ePaper7in5b import EPD as SSD 19 | # from drivers.ePaper7in5b import EPDred as SSDred 20 | # ssdred = SSDred(spi, pcs, pdc, prst, pbusy, landscape=False) # Cread a red display instance (just for B model) 21 | 改为 22 | from drivers.ePaper7in5b import EPD as SSD 23 | from drivers.ePaper7in5b import EPDred as SSDred 24 | ssdred = SSDred(spi, pcs, pdc, prst, pbusy, landscape=False) # Cread a red display instance (just for B model) 25 | 26 | 27 | 3. 打开程序 28 | 黑白: 29 | demos/ePaper_test.py 30 | 三色: 31 | demos/ePaper_test_B.py 32 | 33 | 34 | 4. 运行程序 -------------------------------------------------------------------------------- /pythonNanoGui/ReadMe_EN.txt: -------------------------------------------------------------------------------- 1 | Quick use 2 | Rev0.1 3 | 4 | 5 | 6 | 1. Upload demos/ drivers/ gui/ and color_setup.py to RPi Pico 7 | 8 | 9 | 2. Open color_setup.py and uncomment the module import of the corresponding model 10 | 1) Let's say you're using Pico-ePaper-2.13 11 | will 12 | # from drivers.ePaper2in13V3 import EPD as SSD 13 | Change to 14 | from drivers.ePaper2in13V3 import EPD as SSD 15 | 16 | 2) Let's say you're using Pico-ePaper-7.5-B 17 | will 18 | # from drivers.ePaper7in5b import EPD as SSD 19 | # from drivers.ePaper7in5b import EPDred as SSDred 20 | # ssdred = SSDred(spi, pcs, pdc, prst, pbusy, landscape=False) # Cread a red display instance (just for B model) 21 | Change to 22 | from drivers.ePaper7in5b import EPD as SSD 23 | from drivers.ePaper7in5b import EPDred as SSDred 24 | ssdred = SSDred(spi, pcs, pdc, prst, pbusy, landscape=False) # Cread a red display instance (just for B model) 25 | 26 | 27 | 3. Open the program 28 | Black and white: 29 | demos/ePaper_test.py 30 | Three colors: 31 | demos/ePaper_test_B.py 32 | 33 | 34 | 4. Run the program -------------------------------------------------------------------------------- /pythonNanoGui/Resetting Flash memory/flash_nuke.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/pythonNanoGui/Resetting Flash memory/flash_nuke.uf2 -------------------------------------------------------------------------------- /pythonNanoGui/color_setup.py: -------------------------------------------------------------------------------- 1 | # Released under the MIT license see LICENSE 2 | # Thanks to @Peter for a great micropython-nano-gui: https://github.com/peterhinch/micropython-nano-gui 3 | 4 | # Demo of initialisation procedure designed to minimise risk of memory fail 5 | # when instantiating the frame buffer. The aim is to do this as early as 6 | # possible before importing other modules. 7 | 8 | # ----------------------------------------------------------------------------- 9 | # * | File : color_setup.py 10 | # * | Function : configuration file 11 | # * | This version: V1.2 12 | # * | Date : 2022-10-11 13 | # ----------------------------------------------------------------------------- 14 | 15 | import machine 16 | import gc 17 | 18 | ## For Pico-ePaper-2.13 19 | # from drivers.ePaper2in13V3 import EPD as SSD 20 | 21 | ## For Pico-ePaper-2.13_V4 22 | # from drivers.ePaper2in13V4 import EPD as SSD 23 | 24 | # For Pico-ePaper-2.13-B 25 | from drivers.ePaper2in13bV4 import EPD as SSD 26 | from drivers.ePaper2in13bV4 import EPDred as SSDred 27 | 28 | ## For Pico-ePaper-2.7 29 | # from drivers.ePaper2in7 import EPD as SSD 30 | 31 | ## For Pico-ePaper-2.7_V2 32 | # from drivers.ePaper2in7V2 import EPD as SSD 33 | 34 | ## For Pico-ePaper-2.9 35 | # from drivers.ePaper2in9 import EPD as SSD 36 | 37 | ## For Pico-ePaper-3.7 38 | # from drivers.ePaper3in7 import EPD as SSD 39 | 40 | ## For Pico-ePaper-4.2 41 | # from drivers.ePaper4in2 import EPD as SSD 42 | 43 | # For Pico-ePaper-4.2_V2 44 | # from drivers.ePaper4in2V2 import EPD as SSD 45 | 46 | ## For Pico-ePaper-7.5-B 47 | # from drivers.ePaper7in5b import EPD as SSD 48 | # from drivers.ePaper7in5b import EPDred as SSDred 49 | 50 | RST_PIN = 12 51 | DC_PIN = 8 52 | CS_PIN = 9 53 | BUSY_PIN = 13 54 | 55 | prst = machine.Pin(RST_PIN, machine.Pin.OUT) 56 | pbusy = machine.Pin(BUSY_PIN, machine.Pin.IN, machine.Pin.PULL_DOWN) 57 | pcs = machine.Pin(CS_PIN, machine.Pin.OUT) 58 | spi = machine.SPI(1, baudrate=4_000_000) 59 | pdc = machine.Pin(DC_PIN, machine.Pin.OUT) 60 | gc.collect() # Precaution before instantiating framebuf 61 | ssd = SSD(spi, pcs, pdc, prst, pbusy, landscape=False, asyn=False) # Create a display instance 62 | ssdred = SSDred(spi, pcs, pdc, prst, pbusy, landscape=False) # Cread a red display instance (just for B model) 63 | ssd.demo_mode = True 64 | -------------------------------------------------------------------------------- /pythonNanoGui/demos/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/pythonNanoGui/demos/__init__.py -------------------------------------------------------------------------------- /pythonNanoGui/demos/ePaper2in9_test_async.py: -------------------------------------------------------------------------------- 1 | # ePaper2in9_test_async.py Demo program for nano_gui on 2.9" EPD display 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2020 Peter Hinch 5 | 6 | # color_setup must set landcsape True, asyn True and must not set demo_mode 7 | from cmath import exp, pi 8 | import uasyncio as asyncio 9 | from color_setup import ssd 10 | # On a monochrome display Writer is more efficient than CWriter. 11 | from gui.core.writer import Writer 12 | from gui.core.nanogui import refresh 13 | from gui.widgets.meter import Meter 14 | from gui.widgets.label import Label 15 | from gui.widgets.dial import Dial, Pointer 16 | 17 | # Fonts 18 | import gui.fonts.arial10 as arial10 19 | import gui.fonts.font6 as small 20 | 21 | ssd._asyn = True # HACK to make it config agnostic 22 | # Some ports don't support uos.urandom. 23 | # See https://github.com/peterhinch/micropython-samples/tree/master/random 24 | def xorshift64star(modulo, seed = 0xf9ac6ba4): 25 | x = seed 26 | def func(): 27 | nonlocal x 28 | x ^= x >> 12 29 | x ^= ((x << 25) & 0xffffffffffffffff) # modulo 2**64 30 | x ^= x >> 27 31 | return (x * 0x2545F4914F6CDD1D) % modulo 32 | return func 33 | 34 | async def compass(evt): 35 | wri = Writer(ssd, arial10, verbose=False) 36 | wri.set_clip(False, False, False) 37 | v1 = 0 + 0.9j 38 | v2 = exp(0 - (pi / 6) * 1j) 39 | dial = Dial(wri, 5, 5, height = 75, ticks = 12, bdcolor=None, 40 | label='Direction', style = Dial.COMPASS) 41 | ptr = Pointer(dial) 42 | while True: 43 | ptr.value(v1) 44 | v1 *= v2 45 | await evt.wait() 46 | 47 | 48 | async def multi_fields(evt): 49 | wri = Writer(ssd, small, verbose=False) 50 | wri.set_clip(False, False, False) 51 | 52 | nfields = [] 53 | dy = small.height() + 10 54 | row = 2 55 | col = 100 56 | width = wri.stringlen('99.990') 57 | for txt in ('X:', 'Y:', 'Z:'): 58 | Label(wri, row, col, txt) 59 | nfields.append(Label(wri, row, col, width, bdcolor=None)) # Draw border 60 | row += dy 61 | 62 | random = xorshift64star(2**24 - 1) 63 | while True: 64 | for _ in range(10): 65 | for field in nfields: 66 | value = random() / 167772 67 | field.value('{:5.2f}'.format(value)) 68 | await evt.wait() 69 | 70 | async def meter(evt): 71 | wri = Writer(ssd, arial10, verbose=False) 72 | wri.set_clip(False, False, False) 73 | row = 10 74 | col = 170 75 | args = {'height' : 80, 76 | 'width' : 15, 77 | 'divisions' : 4, 78 | 'style' : Meter.BAR} 79 | m0 = Meter(wri, row, col, legends=('0.0', '0.5', '1.0'), **args) 80 | m1 = Meter(wri, row, col + 40, legends=('-1', '0', '+1'), **args) 81 | m2 = Meter(wri, row, col + 80, legends=('-1', '0', '+1'), **args) 82 | random = xorshift64star(2**24 - 1) 83 | while True: 84 | steps = 10 85 | for n in range(steps + 1): 86 | m0.value(random() / 16777216) 87 | m1.value(n/steps) 88 | m2.value(1 - n/steps) 89 | await evt.wait() 90 | 91 | async def main(): 92 | refresh(ssd, True) # Clear display 93 | await ssd.wait() 94 | print('Ready') 95 | evt = asyncio.Event() 96 | asyncio.create_task(meter(evt)) 97 | asyncio.create_task(multi_fields(evt)) 98 | asyncio.create_task(compass(evt)) 99 | while True: 100 | # Normal procedure before refresh, but 10s sleep should mean it always returns immediately 101 | await ssd.wait() 102 | refresh(ssd) # Launches ._as_show() 103 | await ssd.updated() 104 | # Content has now been shifted out so coros can update 105 | # framebuffer in background 106 | evt.set() 107 | evt.clear() 108 | await asyncio.sleep(10) # Allow for slow refresh 109 | 110 | 111 | tstr = '''Test of asynchronous code updating the EPD. This should 112 | not be run for long periods as the EPD should not be updated more 113 | frequently than every 180s. 114 | ''' 115 | 116 | print(tstr) 117 | 118 | try: 119 | asyncio.run(main()) 120 | except KeyboardInterrupt: 121 | # Defensive code: avoid leaving EPD hardware in an undefined state. 122 | print('Waiting for display to become idle') 123 | ssd.sleep() # Synchronous code. May block for 5s if display is updating. 124 | finally: 125 | _ = asyncio.new_event_loop() 126 | -------------------------------------------------------------------------------- /pythonNanoGui/demos/ePaper2in9_test_sync.py: -------------------------------------------------------------------------------- 1 | # ePaper2in9_test_sync.py Demo of synchronous code on 2.9" EPD display 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2020 Peter Hinch 5 | 6 | # color_setup must set landcsape True, asyn False and must not set demo_mode 7 | 8 | from math import pi, sin 9 | from color_setup import ssd 10 | from gui.core.writer import Writer 11 | from gui.core.nanogui import refresh 12 | from gui.core.fplot import CartesianGraph, Curve 13 | from gui.widgets.meter import Meter 14 | from gui.widgets.label import Label 15 | from gui.widgets.dial import Dial, Pointer 16 | 17 | # Fonts 18 | import gui.fonts.arial10 as arial10 19 | import gui.fonts.freesans20 as large 20 | 21 | wri = Writer(ssd, arial10, verbose=False) 22 | wri.set_clip(False, False, False) 23 | 24 | wri_large = Writer(ssd, large, verbose=False) 25 | wri_large.set_clip(False, False, False) 26 | 27 | # 296*128 28 | def graph(): 29 | row, col, ht, wd = 5, 140, 75, 150 30 | def populate(): 31 | x = -0.998 32 | while x < 1.01: 33 | z = 6 * pi * x 34 | y = sin(z) / z 35 | yield x, y 36 | x += 0.05 37 | 38 | g = CartesianGraph(wri, row, col, height = ht, width = wd, bdcolor=False) 39 | curve2 = Curve(g, None, populate()) 40 | Label(wri, row + ht + 5, col - 10, '-2.0 t: secs') 41 | Label(wri, row + ht + 5, col - 8 + int(wd//2), '0.0') 42 | Label(wri, row + ht + 5, col - 10 + wd, '2.0') 43 | 44 | def compass(): 45 | dial = Dial(wri, 5, 5, height = 75, ticks = 12, bdcolor=None, 46 | label='Direction', style = Dial.COMPASS) 47 | ptr = Pointer(dial) 48 | ptr.value(1 + 1j) 49 | 50 | def meter(): 51 | m = Meter(wri, 5, 100, height = 75, divisions = 4, 52 | label='Peak', style=Meter.BAR, legends=('0', '50', '100')) 53 | m.value(0.72) 54 | 55 | def labels(): 56 | row = 100 57 | col = 0 58 | Label(wri_large, row, col, 'Seismograph') 59 | col = 140 60 | Label(wri, row, col + 0, 'Event time') 61 | Label(wri, row, col + 60, '01:35', bdcolor=None) 62 | Label(wri, row, col + 95, 'UTC') 63 | row = 115 64 | Label(wri, row, col + 0, 'Event date') 65 | Label(wri, row, col + 60, '6th Jan 2021', bdcolor=None) 66 | 67 | def main(): 68 | refresh(ssd, True) 69 | graph() 70 | compass() 71 | meter() 72 | labels() 73 | ssd.wait_until_ready() 74 | refresh(ssd) 75 | print('Waiting for display update') 76 | ssd.wait_until_ready() 77 | 78 | main() 79 | 80 | -------------------------------------------------------------------------------- /pythonNanoGui/demos/ePaper_test.py: -------------------------------------------------------------------------------- 1 | # ePaper_test.py Demo program for nano_gui on an Waveshare ePaper screen 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2020 Peter Hinch 5 | 6 | # color_setup must set landcsape False, asyn True and must not set demo_mode 7 | import uasyncio as asyncio 8 | from color_setup import ssd 9 | from gui.core.writer import Writer 10 | from gui.core.nanogui import refresh 11 | from gui.widgets.meter import Meter 12 | from gui.widgets.label import Label 13 | 14 | # Fonts 15 | import gui.fonts.arial10 as arial10 16 | import gui.fonts.courier20 as fixed 17 | import gui.fonts.font6 as small 18 | 19 | # Some ports don't support uos.urandom. 20 | # See https://github.com/peterhinch/micropython-samples/tree/master/random 21 | def xorshift64star(modulo, seed = 0xf9ac6ba4): 22 | x = seed 23 | def func(): 24 | nonlocal x 25 | x ^= x >> 12 26 | x ^= ((x << 25) & 0xffffffffffffffff) # modulo 2**64 27 | x ^= x >> 27 28 | return (x * 0x2545F4914F6CDD1D) % modulo 29 | return func 30 | 31 | async def fields(evt): 32 | wri = Writer(ssd, fixed, verbose=False) 33 | wri.set_clip(False, False, False) 34 | textfield = Label(wri, 0, 2, wri.stringlen('longer')) 35 | numfield = Label(wri, 25, 2, wri.stringlen('99.990'), bdcolor=None) 36 | countfield = Label(wri, 0, 90, wri.stringlen('1')) 37 | n = 1 38 | random = xorshift64star(65535) 39 | while True: 40 | for s in ('short', 'longer', '1', ''): 41 | textfield.value(s) 42 | numfield.value('{:5.2f}'.format(random() /1000)) 43 | countfield.value('{:1d}'.format(n)) 44 | n += 1 45 | await evt.wait() 46 | 47 | async def multi_fields(evt): 48 | wri = Writer(ssd, small, verbose=False) 49 | wri.set_clip(False, False, False) 50 | 51 | nfields = [] 52 | dy = small.height() + 10 53 | y = 80 54 | col = 20 55 | width = wri.stringlen('99.990') 56 | for txt in ('X:', 'Y:', 'Z:'): 57 | Label(wri, y, 0, txt) 58 | nfields.append(Label(wri, y, col, width, bdcolor=None)) # Draw border 59 | y += dy 60 | 61 | random = xorshift64star(2**24 - 1) 62 | while True: 63 | for _ in range(10): 64 | for field in nfields: 65 | value = random() / 167772 66 | field.value('{:5.2f}'.format(value)) 67 | await evt.wait() 68 | 69 | async def meter(evt): 70 | wri = Writer(ssd, arial10, verbose=False) 71 | args = {'height' : 80, 72 | 'width' : 15, 73 | 'divisions' : 4, 74 | 'style' : Meter.BAR} 75 | m0 = Meter(wri, 165, 2, legends=('0.0', '0.5', '1.0'), **args) 76 | m1 = Meter(wri, 165, 62, legends=('-1', '0', '+1'), **args) 77 | m2 = Meter(wri, 165, 122, legends=('-1', '0', '+1'), **args) 78 | random = xorshift64star(2**24 - 1) 79 | while True: 80 | steps = 10 81 | for n in range(steps + 1): 82 | m0.value(random() / 16777216) 83 | m1.value(n/steps) 84 | m2.value(1 - n/steps) 85 | await evt.wait() 86 | 87 | async def main(): 88 | ssd.fill(1) 89 | ssd.show() 90 | await ssd.wait() 91 | refresh(ssd, True) # Clear display 92 | await ssd.wait() 93 | print('Ready') 94 | evt = asyncio.Event() 95 | asyncio.create_task(meter(evt)) 96 | asyncio.create_task(multi_fields(evt)) 97 | asyncio.create_task(fields(evt)) 98 | while True: 99 | # Normal procedure before refresh, but 10s sleep should mean it always returns immediately 100 | await ssd.wait() 101 | refresh(ssd) # Launches ._as_show() 102 | await ssd.updated() 103 | # Content has now been shifted out so coros can update 104 | # framebuffer in background 105 | evt.set() 106 | evt.clear() 107 | await asyncio.sleep(9) # Allow for slow refresh 108 | 109 | 110 | tstr = '''Runs the following tests, updates every 10s 111 | fields() Label test with dynamic data. 112 | multi_fields() More Labels. 113 | meter() Demo of Meter object. 114 | ''' 115 | 116 | print(tstr) 117 | 118 | try: 119 | asyncio.run(main()) 120 | except KeyboardInterrupt: 121 | print('Waiting for display to become idle') 122 | ssd.wait_until_ready() # Synchronous code 123 | finally: 124 | _ = asyncio.new_event_loop() 125 | -------------------------------------------------------------------------------- /pythonNanoGui/demos/ePaper_test_B.py: -------------------------------------------------------------------------------- 1 | # ePaper_test_B.py Demo program for nano_gui on an Waveshare ePaper B screen 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2020 Peter Hinch 5 | 6 | # color_setup must set landcsape False, asyn True and must not set demo_mode 7 | import uasyncio as asyncio 8 | from color_setup import ssd 9 | from color_setup import ssdred 10 | from gui.core.writer import Writer 11 | from gui.core.nanogui import refresh 12 | from gui.widgets.meter import Meter 13 | from gui.widgets.label import Label 14 | 15 | # Fonts 16 | import gui.fonts.arial10 as arial10 17 | import gui.fonts.courier20 as fixed 18 | import gui.fonts.font6 as small 19 | 20 | # Some ports don't support uos.urandom. 21 | # See https://github.com/peterhinch/micropython-samples/tree/master/random 22 | def xorshift64star(modulo, seed = 0xf9ac6ba4): 23 | x = seed 24 | def func(): 25 | nonlocal x 26 | x ^= x >> 12 27 | x ^= ((x << 25) & 0xffffffffffffffff) # modulo 2**64 28 | x ^= x >> 27 29 | return (x * 0x2545F4914F6CDD1D) % modulo 30 | return func 31 | 32 | async def fields(evt): 33 | wri = Writer(ssd, fixed, verbose=False) 34 | wri.set_clip(False, False, False) 35 | textfield = Label(wri, 0, 2, wri.stringlen('longer')) 36 | numfield = Label(wri, 25, 2, wri.stringlen('99.990'), bdcolor=None) 37 | countfield = Label(wri, 0, 90, wri.stringlen('1')) 38 | n = 1 39 | random = xorshift64star(65535) 40 | while True: 41 | for s in ('short', 'longer', '1', ''): 42 | textfield.value(s) 43 | numfield.value('{:5.2f}'.format(random() /1000)) 44 | countfield.value('{:1d}'.format(n)) 45 | n += 1 46 | await evt.wait() 47 | 48 | async def multi_fields(evt): 49 | wri = Writer(ssd, small, verbose=False) 50 | wri.set_clip(False, False, False) 51 | 52 | nfields = [] 53 | dy = small.height() + 10 54 | y = 80 55 | col = 20 56 | width = wri.stringlen('99.990') 57 | for txt in ('X:', 'Y:', 'Z:'): 58 | Label(wri, y, 0, txt) 59 | nfields.append(Label(wri, y, col, width, bdcolor=None)) # Draw border 60 | y += dy 61 | 62 | random = xorshift64star(2**24 - 1) 63 | while True: 64 | for _ in range(10): 65 | for field in nfields: 66 | value = random() / 167772 67 | field.value('{:5.2f}'.format(value)) 68 | await evt.wait() 69 | 70 | async def meter(evt): 71 | wri = Writer(ssdred, arial10, verbose=False) 72 | args = {'height' : 80, 73 | 'width' : 15, 74 | 'divisions' : 4, 75 | 'style' : Meter.BAR} 76 | m0 = Meter(wri, 165, 2, legends=('0.0', '0.5', '1.0'), **args) 77 | m1 = Meter(wri, 165, 62, legends=('-1', '0', '+1'), **args) 78 | m2 = Meter(wri, 165, 122, legends=('-1', '0', '+1'), **args) 79 | random = xorshift64star(2**24 - 1) 80 | while True: 81 | steps = 10 82 | for n in range(steps + 1): 83 | m0.value(random() / 16777216) 84 | m1.value(n/steps) 85 | m2.value(1 - n/steps) 86 | await evt.wait() 87 | 88 | async def main(): 89 | ssdred.fill(1) 90 | ssd.fill(1) 91 | ssdred.show() 92 | ssd.show() 93 | await ssd.wait() 94 | 95 | refresh(ssdred, True) 96 | refresh(ssd, True) # Clear display 97 | await ssd.wait() 98 | 99 | print('Ready') 100 | evt = asyncio.Event() 101 | asyncio.create_task(meter(evt)) 102 | asyncio.create_task(multi_fields(evt)) 103 | asyncio.create_task(fields(evt)) 104 | while True: 105 | # Normal procedure before refresh, but 10s sleep should mean it always returns immediately 106 | await ssd.wait() 107 | refresh(ssdred) 108 | refresh(ssd) # Launches ._as_show() 109 | await ssd.updated() 110 | # Content has now been shifted out so coros can update 111 | # framebuffer in background 112 | evt.set() 113 | evt.clear() 114 | await asyncio.sleep(9) # Allow for slow refresh 115 | 116 | 117 | tstr = '''Runs the following tests, updates every 10s 118 | fields() Label test with dynamic data. 119 | multi_fields() More Labels. 120 | meter() Demo of Meter object. 121 | ''' 122 | 123 | print(tstr) 124 | 125 | try: 126 | asyncio.run(main()) 127 | except KeyboardInterrupt: 128 | print('Waiting for display to become idle') 129 | ssd.wait_until_ready() # Synchronous code 130 | finally: 131 | _ = asyncio.new_event_loop() 132 | 133 | -------------------------------------------------------------------------------- /pythonNanoGui/drivers/boolpalette.py: -------------------------------------------------------------------------------- 1 | # boolpalette.py Implement BoolPalette class 2 | # This is a 2-value color palette for rendering monochrome glyphs to color 3 | # FrameBuffer instances. Supports destinations with up to 16 bit color. 4 | 5 | # Copyright (c) Peter Hinch 2021 6 | # Released under the MIT license see LICENSE 7 | 8 | import framebuf 9 | 10 | class BoolPalette(framebuf.FrameBuffer): 11 | 12 | def __init__(self, mode): 13 | buf = bytearray(4) # OK for <= 16 bit color 14 | super().__init__(buf, 2, 1, mode) 15 | 16 | def fg(self, color): # Set foreground color 17 | self.pixel(1, 0, color) 18 | 19 | def bg(self, color): 20 | self.pixel(0, 0, color) 21 | -------------------------------------------------------------------------------- /pythonNanoGui/gui/core/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/pythonNanoGui/gui/core/__init__.py -------------------------------------------------------------------------------- /pythonNanoGui/gui/core/colors.py: -------------------------------------------------------------------------------- 1 | # colors.py Standard color constants for nano-gui 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2020 Peter Hinch 5 | 6 | from color_setup import SSD 7 | 8 | # Code can be portable between 4-bit and other drivers by calling create_color 9 | def create_color(idx, r, g, b): 10 | c = SSD.rgb(r, g, b) 11 | if not hasattr(SSD, 'lut'): 12 | return c 13 | if not 0 <= idx <= 15: 14 | raise ValueError('Color nos must be 0..15') 15 | x = idx << 1 16 | SSD.lut[x] = c & 0xff 17 | SSD.lut[x + 1] = c >> 8 18 | return idx 19 | 20 | if hasattr(SSD, 'lut'): # Colors defined by LUT 21 | BLACK = create_color(0, 0, 0, 0) 22 | GREEN = create_color(1, 0, 255, 0) 23 | RED = create_color(2, 255, 0, 0) 24 | LIGHTRED = create_color(3, 140, 0, 0) 25 | BLUE = create_color(4, 0, 0, 255) 26 | YELLOW = create_color(5, 255, 255, 0) 27 | GREY = create_color(6, 100, 100, 100) 28 | MAGENTA = create_color(7, 255, 0, 255) 29 | CYAN = create_color(8, 0, 255, 255) 30 | LIGHTGREEN = create_color(9, 0, 100, 0) 31 | DARKGREEN = create_color(10, 0, 80, 0) 32 | DARKBLUE = create_color(11, 0, 0, 90) 33 | # 12, 13, 14 free for user definition 34 | WHITE = create_color(15, 255, 255, 255) 35 | else: 36 | BLACK = SSD.rgb(0, 0, 0) 37 | GREEN = SSD.rgb(0, 255, 0) 38 | RED = SSD.rgb(255, 0, 0) 39 | LIGHTRED = SSD.rgb(140, 0, 0) 40 | BLUE = SSD.rgb(0, 0, 255) 41 | YELLOW = SSD.rgb(255, 255, 0) 42 | GREY = SSD.rgb(100, 100, 100) 43 | MAGENTA = SSD.rgb(255, 0, 255) 44 | CYAN = SSD.rgb(0, 255, 255) 45 | LIGHTGREEN = SSD.rgb(0, 100, 0) 46 | DARKGREEN = SSD.rgb(0, 80, 0) 47 | DARKBLUE = SSD.rgb(0, 0, 90) 48 | WHITE = SSD.rgb(255, 255, 255) 49 | -------------------------------------------------------------------------------- /pythonNanoGui/gui/core/nanogui.py: -------------------------------------------------------------------------------- 1 | # nanogui.py Displayable objects based on the Writer and CWriter classes 2 | # V0.41 Peter Hinch 16th Nov 2020 3 | # Move cmath dependency to widgets/dial 4 | 5 | # Released under the MIT License (MIT). See LICENSE. 6 | # Copyright (c) 2018-2021 Peter Hinch 7 | 8 | # Base class for a displayable object. Subclasses must implement .show() and .value() 9 | # Has position, colors and border definition. 10 | # border: False no border None use bgcolor, int: treat as color 11 | 12 | from gui.core.colors import * # Populate color LUT before use. 13 | from gui.core.writer import Writer 14 | import framebuf 15 | import gc 16 | 17 | def _circle(dev, x0, y0, r, color): # Single pixel circle 18 | x = -r 19 | y = 0 20 | err = 2 -2*r 21 | while x <= 0: 22 | dev.pixel(x0 -x, y0 +y, color) 23 | dev.pixel(x0 +x, y0 +y, color) 24 | dev.pixel(x0 +x, y0 -y, color) 25 | dev.pixel(x0 -x, y0 -y, color) 26 | e2 = err 27 | if (e2 <= y): 28 | y += 1 29 | err += y*2 +1 30 | if (-x == y and e2 <= x): 31 | e2 = 0 32 | if (e2 > x): 33 | x += 1 34 | err += x*2 +1 35 | 36 | def circle(dev, x0, y0, r, color, width =1): # Draw circle 37 | x0, y0, r = int(x0), int(y0), int(r) 38 | for r in range(r, r -width, -1): 39 | _circle(dev, x0, y0, r, color) 40 | 41 | def fillcircle(dev, x0, y0, r, color): # Draw filled circle 42 | x0, y0, r = int(x0), int(y0), int(r) 43 | x = -r 44 | y = 0 45 | err = 2 -2*r 46 | while x <= 0: 47 | dev.line(x0 -x, y0 -y, x0 -x, y0 +y, color) 48 | dev.line(x0 +x, y0 -y, x0 +x, y0 +y, color) 49 | e2 = err 50 | if (e2 <= y): 51 | y +=1 52 | err += y*2 +1 53 | if (-x == y and e2 <= x): 54 | e2 = 0 55 | if (e2 > x): 56 | x += 1 57 | err += x*2 +1 58 | 59 | # If a (framebuf based) device is passed to refresh, the screen is cleared. 60 | # None causes pending widgets to be drawn and the result to be copied to hardware. 61 | # The pend mechanism enables a displayable object to postpone its renedering 62 | # until it is complete: efficient for e.g. Dial which may have multiple Pointers 63 | def refresh(device, clear=False): 64 | if not isinstance(device, framebuf.FrameBuffer): 65 | raise ValueError('Device must be derived from FrameBuffer.') 66 | if device not in DObject.devices: 67 | DObject.devices[device] = set() 68 | device.fill(0) 69 | else: 70 | if clear: 71 | DObject.devices[device].clear() # Clear the pending set 72 | device.fill(0) 73 | else: 74 | for obj in DObject.devices[device]: 75 | obj.show() 76 | DObject.devices[device].clear() 77 | device.show() 78 | 79 | # Displayable object: effectively an ABC for all GUI objects. 80 | class DObject(): 81 | devices = {} # Index device instance, value is a set of pending objects 82 | 83 | @classmethod 84 | def _set_pend(cls, obj): 85 | cls.devices[obj.device].add(obj) 86 | 87 | def __init__(self, writer, row, col, height, width, fgcolor, bgcolor, bdcolor): 88 | writer.set_clip(True, True, False) # Disable scrolling text 89 | self.writer = writer 90 | device = writer.device 91 | self.device = device 92 | # The following assumes that the widget is mal-positioned, not oversize. 93 | if row < 0: 94 | row = 0 95 | self.warning() 96 | elif row + height >= device.height: 97 | row = device.height - height - 1 98 | self.warning() 99 | if col < 0: 100 | col = 0 101 | self.warning() 102 | elif col + width >= device.width: 103 | col = device.width - width - 1 104 | self.warning() 105 | self.row = row 106 | self.col = col 107 | self.width = width 108 | self.height = height 109 | self._value = None # Type depends on context but None means don't display. 110 | # Current colors 111 | if fgcolor is None: 112 | fgcolor = writer.fgcolor 113 | if bgcolor is None: 114 | bgcolor = writer.bgcolor 115 | if bdcolor is None: 116 | bdcolor = fgcolor 117 | self.fgcolor = fgcolor 118 | self.bgcolor = bgcolor 119 | # bdcolor is False if no border is to be drawn 120 | self.bdcolor = bdcolor 121 | # Default colors allow restoration after dynamic change 122 | self.def_fgcolor = fgcolor 123 | self.def_bgcolor = bgcolor 124 | self.def_bdcolor = bdcolor 125 | # has_border is True if a border was drawn 126 | self.has_border = False 127 | 128 | def warning(self): 129 | print('Warning: attempt to create {} outside screen dimensions.'.format(self.__class__.__name__)) 130 | 131 | # Blank working area 132 | # Draw a border if .bdcolor specifies a color. If False, erase an existing border 133 | def show(self): 134 | wri = self.writer 135 | dev = self.device 136 | dev.fill_rect(self.col, self.row, self.width, self.height, self.bgcolor) 137 | if isinstance(self.bdcolor, bool): # No border 138 | if self.has_border: # Border exists: erase it 139 | dev.rect(self.col - 2, self.row - 2, self.width + 4, self.height + 4, self.bgcolor) 140 | self.has_border = False 141 | elif self.bdcolor: # Border is required 142 | dev.rect(self.col - 2, self.row - 2, self.width + 4, self.height + 4, self.bdcolor) 143 | self.has_border = True 144 | 145 | def value(self, v=None): 146 | if v is not None: 147 | self._value = v 148 | return self._value 149 | 150 | def text(self, text=None, invert=False, fgcolor=None, bgcolor=None, bdcolor=None): 151 | if hasattr(self, 'label'): 152 | self.label.value(text, invert, fgcolor, bgcolor, bdcolor) 153 | else: 154 | raise ValueError('Attempt to update nonexistent label.') 155 | -------------------------------------------------------------------------------- /pythonNanoGui/gui/widgets/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/pythonNanoGui/gui/widgets/__init__.py -------------------------------------------------------------------------------- /pythonNanoGui/gui/widgets/dial.py: -------------------------------------------------------------------------------- 1 | # dial.py Dial and Pointer classes for nano-gui 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2018-2020 Peter Hinch 5 | 6 | import cmath 7 | from gui.core.nanogui import DObject, circle, fillcircle 8 | from gui.widgets.label import Label 9 | 10 | # Line defined by polar coords; origin and line are complex 11 | def polar(dev, origin, line, color): 12 | xs, ys = origin.real, origin.imag 13 | theta = cmath.polar(line)[1] 14 | dev.line(round(xs), round(ys), round(xs + line.real), round(ys - line.imag), color) 15 | 16 | def conj(v): # complex conjugate 17 | return v.real - v.imag * 1j 18 | 19 | # Draw an arrow; origin and vec are complex, scalar lc defines length of chevron. 20 | # cw and ccw are unit vectors of +-3pi/4 radians for chevrons (precompiled) 21 | def arrow(dev, origin, vec, lc, color, ccw=cmath.exp(3j * cmath.pi/4), cw=cmath.exp(-3j * cmath.pi/4)): 22 | length, theta = cmath.polar(vec) 23 | uv = cmath.rect(1, theta) # Unit rotation vector 24 | start = -vec 25 | if length > 3 * lc: # If line is long 26 | ds = cmath.rect(lc, theta) 27 | start += ds # shorten to allow for length of tail chevrons 28 | chev = lc + 0j 29 | polar(dev, origin, vec, color) # Origin to tip 30 | polar(dev, origin, start, color) # Origin to tail 31 | polar(dev, origin + conj(vec), chev*ccw*uv, color) # Tip chevron 32 | polar(dev, origin + conj(vec), chev*cw*uv, color) 33 | if length > lc: # Confusing appearance of very short vectors with tail chevron 34 | polar(dev, origin + conj(start), chev*ccw*uv, color) # Tail chevron 35 | polar(dev, origin + conj(start), chev*cw*uv, color) 36 | 37 | 38 | class Pointer(): 39 | def __init__(self, dial): 40 | self.dial = dial 41 | self.val = 0 + 0j 42 | self.color = None 43 | 44 | def value(self, v=None, color=None): 45 | self.color = color 46 | if v is not None: 47 | if isinstance(v, complex): 48 | l = cmath.polar(v)[0] 49 | if l > 1: 50 | self.val = v/l 51 | else: 52 | self.val = v 53 | else: 54 | raise ValueError('Pointer value must be complex.') 55 | self.dial.vectors.add(self) 56 | self.dial._set_pend(self.dial) # avoid redrawing for each vector 57 | return self.val 58 | 59 | class Dial(DObject): 60 | CLOCK = 0 61 | COMPASS = 1 62 | def __init__(self, writer, row, col, *, height=50, 63 | fgcolor=None, bgcolor=None, bdcolor=False, ticks=4, 64 | label=None, style=0, pip=None): 65 | super().__init__(writer, row, col, height, height, fgcolor, bgcolor, bdcolor) 66 | self.style = style 67 | self.pip = self.fgcolor if pip is None else pip 68 | if label is not None: 69 | self.label = Label(writer, row + height + 3, col, label) 70 | radius = int(height / 2) 71 | self.radius = radius 72 | self.ticks = ticks 73 | self.xorigin = col + radius 74 | self.yorigin = row + radius 75 | self.vectors = set() 76 | 77 | def show(self): 78 | super().show() 79 | # cache bound variables 80 | dev = self.device 81 | ticks = self.ticks 82 | radius = self.radius 83 | xo = self.xorigin 84 | yo = self.yorigin 85 | # vectors (complex) 86 | vor = xo + 1j * yo 87 | vtstart = 0.9 * radius + 0j # start of tick 88 | vtick = 0.1 * radius + 0j # tick 89 | vrot = cmath.exp(2j * cmath.pi/ticks) # unit rotation 90 | for _ in range(ticks): 91 | polar(dev, vor + conj(vtstart), vtick, self.fgcolor) 92 | vtick *= vrot 93 | vtstart *= vrot 94 | circle(dev, xo, yo, radius, self.fgcolor) 95 | vshort = 1000 # Length of shortest vector 96 | for v in self.vectors: 97 | color = self.fgcolor if v.color is None else v.color 98 | val = v.value() * radius # val is complex 99 | vshort = min(vshort, cmath.polar(val)[0]) 100 | if self.style == Dial.CLOCK: 101 | polar(dev, vor, val, color) 102 | else: 103 | arrow(dev, vor, val, 5, color) 104 | if isinstance(self.pip, int) and vshort > 5: 105 | fillcircle(dev, xo, yo, 2, self.pip) 106 | 107 | -------------------------------------------------------------------------------- /pythonNanoGui/gui/widgets/label.py: -------------------------------------------------------------------------------- 1 | # label.py Label class for nano-gui 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2018-2020 Peter Hinch 5 | 6 | from gui.core.nanogui import DObject 7 | from gui.core.writer import Writer 8 | 9 | # text: str display string int save width 10 | class Label(DObject): 11 | def __init__(self, writer, row, col, text, invert=False, fgcolor=None, bgcolor=None, bdcolor=False): 12 | # Determine width of object 13 | if isinstance(text, int): 14 | width = text 15 | text = None 16 | else: 17 | width = writer.stringlen(text) 18 | height = writer.height 19 | super().__init__(writer, row, col, height, width, fgcolor, bgcolor, bdcolor) 20 | if text is not None: 21 | self.value(text, invert) 22 | 23 | def value(self, text=None, invert=False, fgcolor=None, bgcolor=None, bdcolor=None): 24 | txt = super().value(text) 25 | # Redraw even if no text supplied: colors may have changed. 26 | self.invert = invert 27 | self.fgcolor = self.def_fgcolor if fgcolor is None else fgcolor 28 | self.bgcolor = self.def_bgcolor if bgcolor is None else bgcolor 29 | if bdcolor is False: 30 | self.def_bdcolor = False 31 | self.bdcolor = self.def_bdcolor if bdcolor is None else bdcolor 32 | self.show() 33 | return txt 34 | 35 | def show(self): 36 | txt = super().value() 37 | if txt is None: # No content to draw. Future use. 38 | return 39 | super().show() # Draw or erase border 40 | wri = self.writer 41 | dev = self.device 42 | Writer.set_textpos(dev, self.row, self.col) 43 | wri.setcolor(self.fgcolor, self.bgcolor) 44 | wri.printstring(txt, self.invert) 45 | wri.setcolor() # Restore defaults 46 | -------------------------------------------------------------------------------- /pythonNanoGui/gui/widgets/led.py: -------------------------------------------------------------------------------- 1 | # led.py LED class for nano-gui 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2018-2020 Peter Hinch 5 | 6 | from gui.core.nanogui import DObject, fillcircle, circle 7 | from gui.widgets.label import Label 8 | 9 | class LED(DObject): 10 | def __init__(self, writer, row, col, *, height=12, 11 | fgcolor=None, bgcolor=None, bdcolor=None, label=None): 12 | super().__init__(writer, row, col, height, height, fgcolor, bgcolor, bdcolor) 13 | if label is not None: 14 | self.label = Label(writer, row + height + 3, col, label) 15 | self.radius = self.height // 2 16 | 17 | def color(self, c=None): 18 | self.fgcolor = self.bgcolor if c is None else c 19 | self.show() 20 | 21 | def show(self): 22 | super().show() 23 | wri = self.writer 24 | dev = self.device 25 | r = self.radius 26 | fillcircle(dev, self.col + r, self.row + r, r, self.fgcolor) 27 | if isinstance(self.bdcolor, int): 28 | circle(dev, self.col + r, self.row + r, r, self.bdcolor) 29 | -------------------------------------------------------------------------------- /pythonNanoGui/gui/widgets/meter.py: -------------------------------------------------------------------------------- 1 | # meter.py Meter class for nano-gui 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2018-2020 Peter Hinch 5 | 6 | from gui.core.nanogui import DObject 7 | from gui.widgets.label import Label 8 | 9 | 10 | class Meter(DObject): 11 | BAR = 1 12 | LINE = 0 13 | def __init__(self, writer, row, col, *, height=50, width=10, 14 | fgcolor=None, bgcolor=None, ptcolor=None, bdcolor=None, 15 | divisions=5, label=None, style=0, legends=None, value=None): 16 | super().__init__(writer, row, col, height, width, fgcolor, bgcolor, bdcolor) 17 | self.divisions = divisions 18 | if label is not None: 19 | Label(writer, row + height + 3, col, label) 20 | self.style = style 21 | if legends is not None: # Legends 22 | x = col + width + 4 23 | y = row + height 24 | dy = 0 if len(legends) <= 1 else height / (len(legends) -1) 25 | yl = y - writer.height / 2 # Start at bottom 26 | for legend in legends: 27 | Label(writer, int(yl), x, legend) 28 | yl -= dy 29 | self.ptcolor = ptcolor if ptcolor is not None else self.fgcolor 30 | self.value(value) 31 | 32 | def value(self, n=None, color=None): 33 | if n is None: 34 | return super().value() 35 | n = super().value(min(1, max(0, n))) 36 | if color is not None: 37 | self.ptcolor = color 38 | self.show() 39 | return n 40 | 41 | def show(self): 42 | super().show() # Draw or erase border 43 | val = super().value() 44 | wri = self.writer 45 | dev = self.device 46 | width = self.width 47 | height = self.height 48 | x0 = self.col 49 | x1 = self.col + width 50 | y0 = self.row 51 | y1 = self.row + height 52 | if self.divisions > 0: 53 | dy = height / (self.divisions) # Tick marks 54 | for tick in range(self.divisions + 1): 55 | ypos = int(y0 + dy * tick) 56 | dev.hline(x0 + 2, ypos, x1 - x0 - 4, self.fgcolor) 57 | 58 | y = int(y1 - val * height) # y position of slider 59 | if self.style == self.LINE: 60 | dev.hline(x0, y, width, self.ptcolor) # Draw pointer 61 | else: 62 | w = width / 2 63 | dev.fill_rect(int(x0 + w - 2), y, 4, y1 - y, self.ptcolor) 64 | -------------------------------------------------------------------------------- /pythonNanoGui/gui/widgets/scale.py: -------------------------------------------------------------------------------- 1 | # scale.py Extension to nano-gui providing the Scale class 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2020 Peter Hinch 5 | 6 | # Usage: 7 | # from gui.widgets.scale import Scale 8 | 9 | from gui.core.nanogui import DObject 10 | from gui.core.writer import Writer 11 | from gui.core.colors import BLACK 12 | 13 | class Scale(DObject): 14 | def __init__(self, writer, row, col, *, 15 | ticks=200, legendcb=None, tickcb=None, 16 | height=0, width=100, bdcolor=None, fgcolor=None, bgcolor=None, 17 | pointercolor=None, fontcolor=None): 18 | if ticks % 2: 19 | raise ValueError('ticks arg must be divisible by 2') 20 | self.ticks = ticks 21 | self.tickcb = tickcb 22 | def lcb(f): 23 | return '{:3.1f}'.format(f) 24 | self.legendcb = legendcb if legendcb is not None else lcb 25 | bgcolor = BLACK if bgcolor is None else bgcolor 26 | text_ht = writer.font.height() 27 | ctrl_ht = 12 # Minimum height for ticks 28 | # Add 2 pixel internal border to give a little more space 29 | min_ht = text_ht + 6 # Ht of text, borders and gap between text and ticks 30 | if height < min_ht + ctrl_ht: 31 | height = min_ht + ctrl_ht # min workable height 32 | else: 33 | ctrl_ht = height - min_ht # adjust ticks for greater height 34 | width &= 0xfffe # Make divisible by 2: avoid 1 pixel pointer offset 35 | super().__init__(writer, row, col, height, width, fgcolor, bgcolor, bdcolor) 36 | self.fontcolor = fontcolor if fontcolor is not None else self.fgcolor 37 | self.x0 = col + 2 38 | self.x1 = col + self.width - 2 39 | self.y0 = row + 2 40 | self.y1 = row + self.height - 2 41 | self.ptrcolor = pointercolor if pointercolor is not None else self.fgcolor 42 | # Define tick dimensions 43 | ytop = self.y0 + text_ht + 2 # Top of scale graphic (2 pixel gap) 44 | ycl = ytop + (self.y1 - ytop) // 2 # Centre line 45 | self.sdl = round(ctrl_ht * 1 / 3) # Length of small tick. 46 | self.sdy0 = ycl - self.sdl // 2 47 | self.mdl = round(ctrl_ht * 2 / 3) # Medium tick 48 | self.mdy0 = ycl - self.mdl // 2 49 | self.ldl = ctrl_ht # Large tick 50 | self.ldy0 = ycl - self.ldl // 2 51 | 52 | def show(self): 53 | wri = self.writer 54 | dev = self.device 55 | x0: int = self.x0 # Internal rectangle occupied by scale and text 56 | x1: int = self.x1 57 | y0: int = self.y0 58 | y1: int = self.y1 59 | dev.fill_rect(x0, y0, x1 - x0, y1 - y0, self.bgcolor) 60 | super().show() 61 | # Scale is drawn using ints. Each division is 10 units. 62 | val: int = self._value # 0..ticks*10 63 | # iv increments for each tick. Its value modulo N determines tick length 64 | iv: int # val / 10 at a tick position 65 | d: int # val % 10: offset relative to a tick position 66 | fx: int # X offset of current tick in value units 67 | if val >= 100: # Whole LHS of scale will be drawn 68 | iv, d = divmod(val - 100, 10) # Initial value 69 | fx = 10 - d 70 | iv += 1 71 | else: # Scale will scroll right 72 | iv = 0 73 | fx = 100 - val 74 | 75 | # Window shows 20 divisions, each of which corresponds to 10 units of value. 76 | # So pixels per unit value == win_width/200 77 | win_width: int = x1 - x0 78 | ticks: int = self.ticks # Total # of ticks visible and hidden 79 | while True: 80 | x: int = x0 + (fx * win_width) // 200 # Current X position 81 | ys: int # Start Y position for tick 82 | yl: int # tick length 83 | if x > x1 or iv > ticks: # Out of space or data (scroll left) 84 | break 85 | if not iv % 10: 86 | txt = self.legendcb(self._fvalue(iv * 10)) 87 | tlen = wri.stringlen(txt) 88 | Writer.set_textpos(dev, y0, min(x, x1 - tlen)) 89 | wri.setcolor(self.fontcolor, self.bgcolor) 90 | wri.printstring(txt) 91 | wri.setcolor() 92 | ys = self.ldy0 # Large tick 93 | yl = self.ldl 94 | elif not iv % 5: 95 | ys = self.mdy0 96 | yl = self.mdl 97 | else: 98 | ys = self.sdy0 99 | yl = self.sdl 100 | if self.tickcb is None: 101 | color = self.fgcolor 102 | else: 103 | color = self.tickcb(self._fvalue(iv * 10), self.fgcolor) 104 | dev.vline(x, ys, yl, color) # Draw tick 105 | fx += 10 106 | iv += 1 107 | 108 | dev.vline(x0 + (x1 - x0) // 2, y0, y1 - y0, self.ptrcolor) # Draw pointer 109 | 110 | def _to_int(self, v): 111 | return round((v + 1.0) * self.ticks * 5) # 0..self.ticks*10 112 | 113 | def _fvalue(self, v=None): 114 | return v / (5 * self.ticks) - 1.0 115 | 116 | def value(self, val=None): # User method to get or set value 117 | if val is not None: 118 | val = min(max(val, - 1.0), 1.0) 119 | v = self._to_int(val) 120 | if v != self._value: 121 | self._value = v 122 | self.show() 123 | return self._fvalue(self._value) 124 | -------------------------------------------------------------------------------- /pythonNanoGui/gui/widgets/textbox.py: -------------------------------------------------------------------------------- 1 | # textbox.py Extension to nanogui providing the Textbox class 2 | 3 | # Released under the MIT License (MIT). See LICENSE. 4 | # Copyright (c) 2020 Peter Hinch 5 | 6 | # Usage: 7 | # from gui.widgets.textbox import Textbox 8 | 9 | from gui.core.nanogui import DObject 10 | from gui.core.writer import Writer 11 | 12 | # Reason for no tab support in private/reason_for_no_tabs 13 | 14 | class Textbox(DObject): 15 | def __init__(self, writer, row, col, width, nlines, *, bdcolor=None, fgcolor=None, 16 | bgcolor=None, clip=True): 17 | height = nlines * writer.height 18 | devht = writer.device.height 19 | devwd = writer.device.width 20 | if ((row + height + 2) > devht) or ((col + width + 2) > devwd): 21 | raise ValueError('Textbox extends beyond physical screen.') 22 | super().__init__(writer, row, col, height, width, fgcolor, bgcolor, bdcolor) 23 | self.nlines = nlines 24 | self.clip = clip 25 | self.lines = [] 26 | self.start = 0 # Start line for display 27 | 28 | def _add_lines(self, s): 29 | width = self.width 30 | font = self.writer.font 31 | n = -1 # Index into string 32 | newline = True 33 | while True: 34 | n += 1 35 | if newline: 36 | newline = False 37 | ls = n # Start of line being processed 38 | col = 0 # Column relative to text area 39 | if n >= len(s): # End of string 40 | if n > ls: 41 | self.lines.append(s[ls :]) 42 | return 43 | c = s[n] # Current char 44 | if c == '\n': 45 | self.lines.append(s[ls : n]) 46 | newline = True 47 | continue # Line fits window 48 | col += font.get_ch(c)[2] # width of current char 49 | if col > width: 50 | if self.clip: 51 | p = s[ls :].find('\n') # end of 1st line 52 | if p == -1: 53 | self.lines.append(s[ls : n]) # clip, discard all to right 54 | return 55 | self.lines.append(s[ls : n]) # clip, discard to 1st newline 56 | n = p # n will move to 1st char after newline 57 | elif c == ' ': # Easy word wrap 58 | self.lines.append(s[ls : n]) 59 | else: # Edge splits a word 60 | p = s.rfind(' ', ls, n + 1) 61 | if p >= 0: # spacechar in line: wrap at space 62 | assert (p > 0), 'space char in position 0' 63 | self.lines.append(s[ls : p]) 64 | n = p 65 | else: # No spacechar: wrap at end 66 | self.lines.append(s[ls : n]) 67 | n -= 1 # Don't skip current char 68 | newline = True 69 | 70 | def _print_lines(self): 71 | if len(self.lines) == 0: 72 | return 73 | 74 | dev = self.device 75 | wri = self.writer 76 | col = self.col 77 | row = self.row 78 | left = col 79 | ht = wri.height 80 | wri.setcolor(self.fgcolor, self.bgcolor) 81 | # Print the first (or last?) lines that fit widget's height 82 | #for line in self.lines[-self.nlines : ]: 83 | for line in self.lines[self.start : self.start + self.nlines]: 84 | Writer.set_textpos(dev, row, col) 85 | wri.printstring(line) 86 | row += ht 87 | col = left 88 | wri.setcolor() # Restore defaults 89 | 90 | def show(self): 91 | dev = self.device 92 | super().show() 93 | self._print_lines() 94 | 95 | def append(self, s, ntrim=None, line=None): 96 | self._add_lines(s) 97 | if ntrim is None: # Default to no. of lines that can fit 98 | ntrim = self.nlines 99 | if len(self.lines) > ntrim: 100 | self.lines = self.lines[-ntrim:] 101 | self.goto(line) 102 | 103 | def scroll(self, n): # Relative scrolling 104 | value = len(self.lines) 105 | if n == 0 or value <= self.nlines: # Nothing to do 106 | return False 107 | s = self.start 108 | self.start = max(0, min(self.start + n, value - self.nlines)) 109 | if s != self.start: 110 | self.show() 111 | return True 112 | return False 113 | 114 | def value(self): 115 | return len(self.lines) 116 | 117 | def clear(self): 118 | self.lines = [] 119 | self.show() 120 | 121 | def goto(self, line=None): # Absolute scrolling 122 | if line is None: 123 | self.start = max(0, len(self.lines) - self.nlines) 124 | else: 125 | self.start = max(0, min(line, len(self.lines) - self.nlines)) 126 | self.show() 127 | -------------------------------------------------------------------------------- /pythonNanoGui/rp2-pico-20220117-v1.18.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/pythonNanoGui/rp2-pico-20220117-v1.18.uf2 -------------------------------------------------------------------------------- /waveshare_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/waveshareteam/Pico_ePaper_Code/c9bcd84db5adf5f085353649a8a5c31492bc5fb8/waveshare_logo.png --------------------------------------------------------------------------------