Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/funnygeeker/micropython-easydisplay
A display library: implemented purely in Micropython. 纯 Micropython 实现的显示库
https://github.com/funnygeeker/micropython-easydisplay
bmp chinese english esp01s esp32 esp32-c3 esp32-s3 framebuffer japanese micropython micropython-esp32 pbm ssd1306 st7735 st7735s st7789
Last synced: about 1 month ago
JSON representation
A display library: implemented purely in Micropython. 纯 Micropython 实现的显示库
- Host: GitHub
- URL: https://github.com/funnygeeker/micropython-easydisplay
- Owner: funnygeeker
- License: mit
- Created: 2023-01-31T20:09:20.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-27T04:22:40.000Z (8 months ago)
- Last Synced: 2024-04-27T05:23:40.348Z (8 months ago)
- Topics: bmp, chinese, english, esp01s, esp32, esp32-c3, esp32-s3, framebuffer, japanese, micropython, micropython-esp32, pbm, ssd1306, st7735, st7735s, st7789
- Language: Python
- Homepage:
- Size: 61 MB
- Stars: 33
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.ZH-CN.md
- License: LICENSE
Awesome Lists containing this project
README
[English (英语)](./README.md)
# micropython-easydisplay
- 适用于 `Micropython` 的:高通用性,多功能,纯 `Micropython` 实现的显示库
- 自用,顺便开源,希望能够推动 `Micropython` 生态的发展### 显示效果
以下为 `2.0` 版本的显示效果
![IMG_20231107_235742](https://github.com/funnygeeker/micropython-easydisplay/assets/96659329/f76a7713-7397-4a99-8ccd-37af7ebe0cbe)
![IMG_20231107_004226](https://github.com/funnygeeker/micropython-easydisplay/assets/96659329/e765b55a-45bb-486a-b15e-5161b4d876fa)
![IMG_20231107_004229](https://github.com/funnygeeker/micropython-easydisplay/assets/96659329/f82910c4-b515-4ffd-a00c-9eafffcbb0bf)### 项目特点
- 可以通过导入 `bmf` 字体文件,显示非 `ASCII` 字符,比如:中文 和 特殊符号
- 支持 `P4`/`P6` 格式的 `PBM` 图片显示,以及 `24-bit` 的 `BMP` 图片显示
- 初始化时可以设置默认参数,调用函数时更简洁,同时调用指定函数时,本次调用可覆盖默认参数
- 兼容大多数 `MicroPython` 官方和非官方版本,纯 `MicroPython` 原生实现,不需要进行固件编译,同时尽可能保持了高效率
- 支持多种屏幕的多种工作模式 `SSD1306`,`ST7735`,`ST7789`,支持低内存开发板驱动高分辨率屏幕(如 `ESP32C3` 驱动 `240*240` `ST7789`)### 使用方法
- 详见源码注释### 注意事项
`dat` 格式的图片在非 Framebuffer 驱动模式下,不得超出屏幕显示范围,否则图像可能无法正常显示### 示例代码
```python
# 这是一个使用示例 This is an example of usage
import time
from machine import SPI, Pin
from driver import st7735_buf
from lib.easydisplay import EasyDisplay# ESP32S3 & ST7735
spi = SPI(1, baudrate=20000000, polarity=0, phase=0, sck=Pin(18), mosi=Pin(17))
dp = st7735_buf.ST7735(width=128, height=128, spi=spi, cs=14, dc=15, res=16, rotate=1, bl=13, invert=False, rgb=False)
ed = EasyDisplay(dp, "RGB565", font="/text_lite_16px_2312.v3.bmf", show=True, color=0xFFFF, clear=True)ed.bmp("/img/test.bmp", 0, 0)
time.sleep(3)
ed.pbm("/img/test.pbm", 0, 0)
time.sleep(3)
ed.text("你好,世界!\nHello World!\nこんにちは、世界!", 0, 0)# 更多高级使用方式详见源码注释:/lib/easydisplay.py
# For more advanced usage, please refer to the source code comments: /lib/easydisplay.py
```### 特别致谢
参考项目:中文显示:[https://github.com/AntonVanke/MicroPython-Chinese-Font](https://github.com/AntonVanke/MicroPython-Chinese-Font)
BMP图片显示:[https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py](https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py)
### 参考资料
PBM图像显示:[https://www.bilibili.com/video/av798158808/](https://www.bilibili.com/video/av798158808/)PBM文件格式:[https://www.cnblogs.com/SeekHit/p/7055748.html](https://www.cnblogs.com/SeekHit/p/7055748.html)
PBM文件转换:[https://blog.csdn.net/jd3096/article/details/121319042](https://blog.csdn.net/jd3096/article/details/121319042)
灰度化、二值化:[https://blog.csdn.net/li_wen01/article/details/72867057](https://blog.csdn.net/li_wen01/article/details/72867057)
### 其他
感谢各位大佬对开源做出的贡献!交流QQ群:[748103265](https://jq.qq.com/?_wv=1027&k=I74bKifU)