Skip to content

A display library: implemented purely in Micropython. 纯 Micropython 实现的显示库

License

Notifications You must be signed in to change notification settings

funnygeeker/micropython-easydisplay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

简体中文 (Chinese)

micropython-easydisplay

  • A display library for Micropython: high versatility, multifunctionality, implemented purely in Micropython.
  • This README may contain translations that are not entirely accurate.

Display Effects

The following are the display effects of version 2.0. IMG_20231107_235742 IMG_20231107_004226 IMG_20231107_004229

Project Features

  • Ability to display non-ASCII characters, such as Chinese and special symbols, by importing bmf font files.
  • Supports displaying PBM images in P4/P6 format and BMP images in 24-bit.
  • Default parameters can be set during initialization, making function calls more concise. Additionally, the current function call can override the default parameters.
  • 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.
  • 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).

Usage

  • Please refer to the source code comments.(The comments section is written in Chinese and may need translation in order to read.)

Note

For images in the dat format, make sure that they do not exceed the screen display area when using non-framebuffer driver modes. Otherwise, the image may not be displayed correctly.

Example Code

# 这是一个使用示例 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

Special Thanks

Reference projects:

Chinese display: https://github.com/AntonVanke/MicroPython-Chinese-Font

BMP image display: https://github.com/boochow/MicroPython-ST7735/blob/master/tftbmp.py

References

PBM image display: https://www.bilibili.com/video/av798158808/

PBM file format: https://www.cnblogs.com/SeekHit/p/7055748.html

PBM file conversion: https://blog.csdn.net/jd3096/article/details/121319042

Grayscale, binarization: https://blog.csdn.net/li_wen01/article/details/72867057

Others

Thanks to all contributors for their contributions to open source!