Skip to content

Commit e6e6353

Browse files
author
funnygeeker
committed
update
1 parent 6911723 commit e6e6353

File tree

3 files changed

+101
-43
lines changed

3 files changed

+101
-43
lines changed

README.ZH-CN.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[English (英语)](https://github.com/funnygeeker/micropython-easydisplay/blob/main/README.md)
2+
3+
# micropython-easydisplay
4+
- 适用于 `Micropython` 的:高通用性,多功能,纯 `Micropython` 实现的显示库
5+
- 自用,顺便开源,希望能够推动 `Micropython` 生态的发展
6+
7+
8+
### 显示效果
9+
以下为 `2.0` 版本的显示效果
10+
[image]
11+
12+
### 项目特点
13+
- 可以通过导入 `bmf` 字体文件,显示非 `ASCII` 字符,比如:中文 和 特殊符号
14+
- 支持 `P4`/`P6` 格式的 `PBM` 图片显示,以及 `24-bit``BMP` 图片显示
15+
- 初始化时可以设置默认参数,调用函数时更简洁,同时调用指定函数时,本次调用可覆盖默认参数
16+
- 兼容大多数 `MicroPython` 官方和非官方版本,纯 `MicroPython` 原生实现,不需要进行固件编译,同时尽可能保持了高效率
17+
- 支持多种屏幕的多种工作模式 `SSD1306``ST7735``ST7789`,支持低内存开发板驱动高分辨率屏幕(如 `ESP32C3` 驱动 `240*240` `ST7789`
18+
19+
### 使用方法
20+
- 详见源码注释
21+
22+
### 示例代码
23+
```python
24+
# 这是一个使用示例 This is an example of usage
25+
import time
26+
import framebuf
27+
from machine import SPI, Pin
28+
from drivers import st7735_buf
29+
from libs.easydisplay import EasyDisplay
30+
31+
# ESP32C3 & ST7735
32+
spi = SPI(1, baudrate=20000000, polarity=0, phase=0, sck=Pin(19), mosi=Pin(18))
33+
dp = st7735_buf.ST7735(width=160, height=128, spi=spi, cs=0, dc=1, rst=11, rotation=1)
34+
ed = EasyDisplay(display=dp, font="/text_lite_16px_2311.v3.bmf", show=True, color=0xFFFF, clear=True,
35+
color_type=framebuf.RGB565, text_half_char=True, text_auto_wrap=True)
36+
37+
ed.bmp("/img/test.bmp", 0, 0)
38+
time.sleep(3)
39+
ed.pbm("/img/test.pbm", 0, 0, color_type=framebuf.MONO_HLSB)
40+
time.sleep(3)
41+
ed.text("你好,世界!\nHello World!\nこんにちは、世界!", 0, 0)
42+
43+
44+
# 更多高级使用方式详见源码注释:/libs/easydisplay.py
45+
```
46+
47+
### 特别致谢
48+
参考项目:
49+
50+
中文显示:[https://github.com/AntonVanke/MicroPython-Chinese-Font](https://github.com/AntonVanke/MicroPython-Chinese-Font)
51+
52+
BMP图片显示:[https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py](https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py)
53+
54+
55+
### 参考资料
56+
PBM图像显示:[https://www.bilibili.com/video/av798158808/](https://www.bilibili.com/video/av798158808/)
57+
58+
PBM文件格式:[https://www.cnblogs.com/SeekHit/p/7055748.html](https://www.cnblogs.com/SeekHit/p/7055748.html)
59+
60+
PBM文件转换:[https://blog.csdn.net/jd3096/article/details/121319042](https://blog.csdn.net/jd3096/article/details/121319042)
61+
62+
灰度化、二值化:[https://blog.csdn.net/li_wen01/article/details/72867057](https://blog.csdn.net/li_wen01/article/details/72867057)
63+
64+
65+
### 其他
66+
感谢各位大佬对开源做出的贡献!
67+
68+
交流QQ群:[748103265](https://jq.qq.com/?_wv=1027&k=I74bKifU)

README.md

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
# micropython-easydisplay
2-
- 适用于 `Micropython` 的:高通用性,多功能,纯 `Micropython` 实现的显示库
3-
- 自用,顺便开源,希望能够推动 `Micropython` 生态的发展
4-
1+
[简体中文 (Chinese)](https://github.com/funnygeeker/micropython-easydisplay/blob/main/README.ZH-CN.md)
52

6-
### 显示效果
7-
以下为 `1.1` 版本的显示效果,`2.0` 版本存在字体文件缺陷,正在修复,请留意最新的字体文件版本...
8-
![font_display](https://user-images.githubusercontent.com/96659329/217912388-32b67ae0-c586-426a-8409-15d66626af67.jpg)
9-
![bmp_color_display](https://user-images.githubusercontent.com/96659329/217912256-576ae657-9355-4384-a8b3-1430f295f700.jpg)
10-
![pbm_display](https://user-images.githubusercontent.com/96659329/217912280-92b902f8-b177-4b37-bc25-84ffdb13978b.jpg)
3+
# micropython-easydisplay
4+
- A display library for `Micropython`: high versatility, multifunctionality, implemented purely in `Micropython`.
5+
- This `README` may contain translations that are not entirely accurate.
116

7+
### Display Effects
8+
The following are the display effects of version `2.0`.
9+
[image]
1210

13-
### 项目特点
14-
- 可以通过导入 `bmf` 字体文件,显示非 `ASCII` 字符,比如:中文 和 特殊符号
15-
- 支持 `P4`/`P6` 格式的 `PBM` 图片显示,以及 `24-bit``BMP` 图片显示
16-
- 初始化时可以设置默认参数,调用函数时更简洁,同时调用指定函数时,本次调用可覆盖默认参数
17-
- 兼容大多数 `MicroPython` 官方和非官方版本,纯 `MicroPython` 原生实现,不需要进行固件编译,同时尽可能保持了高效率
18-
- 支持多种屏幕的多种工作模式 `SSD1306``ST7735``ST7789`,支持低内存开发板驱动高分辨率屏幕(如 `ESP32C3` 驱动 `240*240` `ST7789`
11+
### Project Features
12+
- Ability to display non-ASCII characters, such as Chinese and special symbols, by importing `bmf` font files.
13+
- Supports displaying `PBM` images in `P4`/`P6` format and `BMP` images in `24-bit`.
14+
- Default parameters can be set during initialization, making function calls more concise. Additionally, the current function call can override the default parameters.
15+
- Compatible with most official and unofficial versions of `MicroPython`. It is implemented purely with native `MicroPython` and does not require firmware compilation. Additionally, it maintains high efficiency as much as possible.
16+
- Supports multiple screen models such as `SSD1306`, `ST7735`, and `ST7789`. It also supports driving high-resolution screens on low-memory development boards (e.g., `ESP32C3` driving `240*240 ST7789` screens).
1917

20-
### 使用方法
21-
- 详见源码注释
18+
### Usage
19+
- Please refer to the source code comments.(The comments section is written in Chinese and may need translation in order to read.)
2220

23-
### 示例代码
21+
### Example Code
2422
```python
25-
# 这是一个使用示例 This is an example of usage
23+
# This is an example of usage
2624
import time
2725
import framebuf
2826
from machine import SPI, Pin
@@ -32,41 +30,33 @@ from libs.easydisplay import EasyDisplay
3230
# ESP32C3 & ST7735
3331
spi = SPI(1, baudrate=20000000, polarity=0, phase=0, sck=Pin(19), mosi=Pin(18))
3432
dp = st7735_buf.ST7735(width=160, height=128, spi=spi, cs=0, dc=1, rst=11, rotation=1)
35-
ed = EasyDisplay(display=dp, font="/text_lite_16px_2311-1.v3.bmf", show=True, color=0xFFFF, clear=True,
36-
color_type=framebuf.RGB565, text_half_char=False)
33+
ed = EasyDisplay(display=dp, font="/text_lite_16px_2311.v3.bmf", show=True, color=0xFFFF, clear=True,
34+
color_type=framebuf.RGB565, text_half_char=True, text_auto_wrap=True)
3735

3836
ed.bmp("/img/test.bmp", 0, 0)
3937
time.sleep(3)
4038
ed.pbm("/img/test.pbm", 0, 0, color_type=framebuf.MONO_HLSB)
4139
time.sleep(3)
4240
ed.text("你好,世界!\nHello World!\nこんにちは、世界!", 0, 0)
4341

44-
# 更多高级使用方式详见源码注释:/libs/easydisplay.py
42+
# For more advanced usage, please refer to the source code comments: /libs/easydisplay.py
4543
```
4644

47-
### 特别致谢
48-
参考项目:
49-
50-
中文显示:[https://github.com/AntonVanke/MicroPython-Chinese-Font](https://github.com/AntonVanke/MicroPython-Chinese-Font)
51-
52-
BMP图片显示:[https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py](https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py)
53-
54-
55-
### 参考资料
56-
PBM图像显示:[https://www.bilibili.com/video/av798158808/](https://www.bilibili.com/video/av798158808/)
45+
### Special Thanks
46+
Reference projects:
5747

58-
PBM文件格式:[https://www.cnblogs.com/SeekHit/p/7055748.html](https://www.cnblogs.com/SeekHit/p/7055748.html)
48+
Chinese display: [https://github.com/AntonVanke/MicroPython-Chinese-Font](https://github.com/AntonVanke/MicroPython-Chinese-Font)
5949

60-
PBM文件转换:[https://blog.csdn.net/jd3096/article/details/121319042](https://blog.csdn.net/jd3096/article/details/121319042)
50+
BMP image display: [https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py](https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py)
6151

62-
灰度化、二值化:[https://blog.csdn.net/li_wen01/article/details/72867057](https://blog.csdn.net/li_wen01/article/details/72867057)
52+
### References
53+
PBM image display: [https://www.bilibili.com/video/av798158808/](https://www.bilibili.com/video/av798158808/)
6354

55+
PBM file format: [https://www.cnblogs.com/SeekHit/p/7055748.html](https://www.cnblogs.com/SeekHit/p/7055748.html)
6456

65-
### 其他
66-
感谢各位大佬对开源做出的贡献!
57+
PBM file conversion: [https://blog.csdn.net/jd3096/article/details/121319042](https://blog.csdn.net/jd3096/article/details/121319042)
6758

68-
交流QQ群:[748103265](https://jq.qq.com/?_wv=1027&k=I74bKifU)
59+
Grayscale, binarization: [https://blog.csdn.net/li_wen01/article/details/72867057](https://blog.csdn.net/li_wen01/article/details/72867057)
6960

70-
# TODO 2311
71-
- 修复 `Lite` 字符集缺少空格的问题
72-
- 更换更合适的字体,以优化英文显示
61+
### Others
62+
Thanks to all contributors for their contributions to open source!

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# ESP32C3 & ST7735
99
spi = SPI(1, baudrate=20000000, polarity=0, phase=0, sck=Pin(19), mosi=Pin(18))
1010
dp = st7735_buf.ST7735(width=160, height=128, spi=spi, cs=0, dc=1, rst=11, rotation=1)
11-
ed = EasyDisplay(display=dp, font="/text_lite_16px_2311-1.v3.bmf", show=True, color=0xFFFF, clear=True,
12-
color_type=framebuf.RGB565, text_half_char=False)
11+
ed = EasyDisplay(display=dp, font="/text_lite_16px_2311.v3.bmf", show=True, color=0xFFFF, clear=True,
12+
color_type=framebuf.RGB565, text_half_char=True, text_auto_wrap=True)
1313

1414
ed.bmp("/img/test.bmp", 0, 0)
1515
time.sleep(3)

0 commit comments

Comments
 (0)