一、目的
这一节我们学习如何使用我们的ESP32开发板来控制2.90寸电子墨水屏模块(黑白套件)。
二、环境
ESP32 + 2.90寸 电子墨水屏模块 + Thonny IDE + 几根杜邦线
接线方法:
三、墨水屏驱动
此处注意注意:不同的型号、不同厂家的墨水屏驱动方式有些不同,一定要联系卖家。这里分享一下墨水屏驱动。
1、老版本墨水屏驱动:
"""
MicroPython Waveshare 4.2" Black/White GDEW042T2 e-paper display driver
https://github.com/mcauser/micropython-waveshare-epaper
MIT License
Copyright (c) 2017 Waveshare
Copyright (c) 2018 Mike Causer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from micropython import const
from time import sleep_ms
import ustruct
# Display resolution
EPD_WIDTH = const(296)
EPD_HEIGHT = const(128)
# Display commands
PANEL_SETTING = const(0x00)
POWER_SETTING = const(0x01)
POWER_OFF = const(0x02)
#POWER_OFF_SEQUENCE_SETTING = const(0x03)
POWER_ON = const(0x04)
#POWER_ON_MEASURE = const(0x05)
BOOSTER_SOFT_START = const(0x06)
DEEP_SLEEP = const(0x07)
DATA_START_TRANSMISSION_1 = const(0x10)
#DATA_STOP = const(0x11)
DISPLAY_REFRESH = const(0x12)
DATA_START_TRANSMISSION_2 = const(0x13)
LUT_FOR_VCOM = const(0x20)
LUT_WHITE_TO_WHITE = const(0x21)
LUT_BLACK_TO_WHITE = const(0x22)
LUT_WHITE_TO_BLACK = const(0x23)
LUT_BLACK_TO_BLACK = const(0x24)
PLL_CONTROL = const(0x30)
#TEMPERATURE_SENSOR_COMMAND = const(0x40)
#TEMPERATURE_SENSOR_SELECTION = const(0x41)
#TEMPERATURE_SENSOR_WRITE = const(0x42)
#TEMPERATURE_SENSOR_READ = const(0x43)
VCOM_AND_DATA_INTERVAL_SETTING = const(0x50)
#LOW_POWER_DETECTION = const(0x51)
#TCON_SETTING = const(0x60)
TCON_RESOLUTION = const(0x61)
RESOLUTION_SETTING = const(0x61)
#GSST_SETTING = const(0x65)
#GET_STATUS = const(0x71)
#AUTO_MEASUREMENT_VCOM = const(0x80)
#READ_VCOM_VALUE = const(0x81)
VCM_DC_SETTING = const(0x82)
#PARTIAL_WINDOW = const(0x90)
#PARTIAL_IN = const(0x91)
#PARTIAL_OUT = const(0x92)
#PROGRAM_MODE = const(0xA0)
#ACTIVE_PROGRAMMING = const(0xA1)
#READ_OTP = const(0xA2)
#POWER_SAVING = const(0xE3)
BUSY = const(0) # 0=busy, 1=idle
class EPD:
# 44/42 bytes (look up tables)
LUT_VCOM0 = bytearray(b'\x00\x17\x00\x00\x00\x02\x00\x17\x17\x00\x00\x02\x00\x0A\x01\x00\x00\x01\x00\x0E\x0E\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
LUT_WW = bytearray(b'\x40\x17\x00\x00\x00\x02\x90\x17\x17\x00\x00\x02\x40\x0A\x01\x00\x00\x01\xA0\x0E\x0E\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
LUT_BW = LUT_WW
LUT_BB = bytearray(b'\x80\x17\x00\x00\x00\x02\x90\x17\x17\x00\x00\x02\x80\x0A\x01\x00\x00\x01\x50\x0E\x0E\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
LUT_WB = LUT_BB
def __init__(self, spi, cs, dc, rst, busy):
self.spi = spi
self.cs = cs
self.dc = dc
self.rst = rst
self.busy = busy
self.cs.init(self.cs.OUT, value=1)
self.dc.init(self.dc.OUT, value=0)
self.rst.init(self.rst.OUT, value=0)
self.busy.init(self.busy.IN)
self.width = EPD_WIDTH
self.height = EPD_HEIGHT
def _command(self, command, data=None):
self.dc(0)
self.cs(0)
self.spi.write(bytearray([command]))
self.cs(1)
if data is not None:
self._data(data)
def _data(self, data):
self.dc(1)
self.cs(0)
self.spi.write(data)
self.cs(1)
def init(self):
self.reset()
self._command(POWER_SETTING, b'\x03\x00\x2B\x2B\xFF') # VDS_EN VDG_EN, VCOM_HV VGHL_LV[1] VGHL_LV[0], VDH, VDL, VDHR
# self._command(POWER_SETTING, b'\x03\x00\x2B\x2B\x29')
self._command(BOOSTER_SOFT_START, b'\x17\x17\x17') # 07 0f 17 1f 27 2F 37 2f
self._command(POWER_ON)
self.wait_until_idle()
self._command(PANEL_SETTING, b'\xBF\x0B') # KW-BF KWR-AF BWROTP 0f
# self._command(PANEL_SETTING, b'\xCF')
self._command(VCOM_AND_DATA_INTERVAL_SETTING, b'\x17')
self._command(PLL_CONTROL, b'\x3C') # 3A 100HZ 29 150Hz 39 200HZ 31 171HZ
# self._command(PLL_CONTROL, b'\x39')
# self._command(TCON_RESOLUTION, bytearray([self.width, self.height>>8, self.height]))
# self._command(VCM_DC_SETTING, b'\x0E')
def wait_until_idle(self):
while self.busy.value() == BUSY:
sleep_ms(10)
def reset(self):
self.rst(0)
sleep_ms(20)
self.rst(1)
sleep_ms(20)
def set_lut(self):
self._command(LUT_FOR_VCOM, self.LUT_VCOM0) # vcom
self._command(LUT_WHITE_TO_WHITE, self.LUT_WW) # ww --
self._command(LUT_BLACK_TO_WHITE, self.LUT_BW) # bw r
self._command(LUT_WHITE_TO_BLACK, self.LUT_BB) # wb w
self._command(LUT_BLACK_TO_BLACK, self.LUT_WB) # bb b
# draw the current frame memory
def display_frame(self, frame_buffer):
self._command(RESOLUTION_SETTING, ustruct.pack(">HH", EPD_WIDTH, EPD_HEIGHT))
self._command(VCM_DC_SETTING, b'\x12')
self._command(VCOM_AND_DATA_INTERVAL_SETTING)
self._command(0x97) # VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
# TODO should ^ this be _data(0x97), not sure what it does
if frame_buffer:
"""
self._command(DATA_START_TRANSMISSION_1)
for i in range(0, self.width * self.height // 8):
self._data(bytearray([0xFF])) # bit set: white, bit reset: black
sleep_ms(2)
"""
self._command(DATA_START_TRANSMISSION_2)
sleep_ms(2)
print("self.width * self.height // 8 =====", self.width * self.height // 8)
for i in range(0, self.width * self.height // 8):
# print(">>>>>i=", i, "<<<<<<111 ")
self._data(bytearray([frame_buffer[i]]))
# print(">>>>>i=", i, "<<<<<<111222222222")
sleep_ms(2)
self.set_lut()
self._command(DISPLAY_REFRESH)
sleep_ms(10)
self.wait_until_idle()
2、新版本墨水屏驱动:
"""
日期:2022年9月27日
说明:
1. 此版本对应于2.9寸墨水屏,且是从2022年8月份更新后的版本,之前的老版本墨水屏不通用
2. 【2022年10月1日】更新:修复文字显示相反的bug
"""
from time import sleep_ms
# Display resolution
EPD_WIDTH = 296
EPD_HEIGHT = 128
class EPD:
def __init__(self, spi, cs, dc, rst, busy):
self.spi = spi
self.cs = cs
self.dc = dc
self.rst = rst
self.busy = busy
self.cs.init(self.cs.OUT, value=1)
self.dc.init(self.dc.OUT, value=0)
self.rst.init(self.rst.OUT, value=0)
self.busy.init(self.busy.IN)
self.width = EPD_WIDTH
self.height = EPD_HEIGHT
def _command(self, command, data=None):
sleep_ms(1)
self.dc(0)
self.cs(0)
print("command=", command)
try:
self.spi.write(bytearray([command]))
except:
self.spi.write(command)
self.cs(1)
if data is not None:
self._data(data)
def _data(self, data):
sleep_ms(1)
self.cs(0)
self.dc(1)
self.spi.write(data)
self.cs(1)
def init(self):
self.reset()
self.wait_until_idle()
self._command(b'\x12')
self.wait_until_idle()
self._command(b'\x01') # Driver output control
self._data(b'\x27')
self._data(b'\x01')
self._data(b'\x00')
self._command(b'\x11') # data entry mode
self._data(b'\x03') # 这里影响内容镜像
self._command(b'\x44') # set Ram-X address start/end position
self._data(b'\x00') # X起始点为0(1个字节)
self._data(b'\x0F') # X终止点为(1个字节)0x0F-->(15+1)*8=128
self._command(b'\x45') # set Ram-Y address start/end position
self._data(b'\x00') # Y设置起始点为 0(2个字节)
self._data(b'\x00')
self._data(b'\x27') # 终止点为(2个字节):0x0127-->(295+1)=296
self._data(b'\x01')
self._command(b'\x3C') # BorderWavefrom
self._data(b'\x05')
self._command(b'\x21') # Display update control
self._data(b'\x00')
self._data(b'\x80')
self._command(b'\x18') # Read built-in temperature sensor
self._data(b'\x80')
self._command(b'\x4E') # set RAM x address count to 0
self._data(b'\x00')
self._command(b'\x4F') # set RAM y address count to 0X199
self._data(b'\x27')
self._data(b'\x01')
self.wait_until_idle()
def wait_until_idle(self):
while True:
if self.busy.value() == 0: # 1 busy
break
sleep_ms(10)
def reset(self):
self.rst(0)
sleep_ms(10)
self.rst(1)
sleep_ms(10)
def display_frame(self, frame_buffer):
self._command(b'\x24')
if frame_buffer:
print("self.width * self.height // 8 =====", self.width * self.height // 8)
for i in range(0, self.width * self.height // 8):
# print(">>>>>i=", i, "<<<<<<111 ")
self._data(bytearray([frame_buffer[i]]))
# print(">>>>>i=", i, "<<<<<<111222222222")
sleep_ms(1)
self.epd_udpate()
def epd_udpate(self):
self._command(b'\x22') # Display Update Control
self._data(b'\xF7')
self._command(b'\x20') # Activate Display Update Sequence
self.wait_until_idle()
五、墨水屏显示图片
1、准备图片。制作1个296x128像素的图片,图片的格式必须是jpg格式。
2,使用工具image2lcd转变图片为程序格式。工具从百度自行下载,或者从文末下载。
程序会保存为一个.C的文件,我们打开文件,复制里面的十六进制数据:
3,打开Thonny IDE,新建一个Python文件,命名为image_array.py,把上一步的十六进制数据粘贴在代码里面:
# 128 x 296
image_array = bytearray([0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF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X07,0XFF,0XFF,
0XFF,0XFF,0XFF,0X80,0X3C,0X1E,0X00,0X00,0X00,0X00,0X00,0X18,0XFF,0X07,0XFF,0XFF,
0XFF,0XFF,0XFF,0X80,0X38,0X0E,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0X0F,0XFF,0XFF,
0XFF,0XFF,0XFF,0X80,0X30,0X0C,0X00,0X00,0X00,0X00,0X00,0X01,0XFE,0X0F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFE,0X0F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X0F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X0F,0XFF,0XFF,
0XFF,0XFF,0XDF,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFC,0X0F,0XFF,0XFF,
0XFF,0XFF,0X9F,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFC,0X0F,0XFF,0XFF,
0XFF,0XFF,0X9F,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XF8,0X0F,0XFF,0XFF,
0XFF,0XFF,0X9F,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X38,0X0F,0XFF,0XFF,
0XFF,0XFF,0XDF,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,
0XFF,0XFF,0XCF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,0X11,0X00,0X0F,0XFF,0XFF,
0XFF,0XFF,0XCF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,0X09,0XC0,0X0F,0XFF,0XFF,
0XFF,0XFF,0XCF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X3C,0X49,0XE0,0X0F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
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF])
4、测试程序。在新建一个文件,命名为test.py,代码如下:
from machine import Pin, SPI
import framebuf
import epaper
# 1. 创建对应的引脚
miso = Pin(19)
mosi = Pin(23)
sck = Pin(18)
cs = Pin(33)
dc = Pin(32)
rst = Pin(19)
busy = Pin(35)
spi = SPI(2, baudrate=10000000, polarity=0, phase=0, sck=sck, miso=miso, mosi=mosi)
# 2. 创建墨水屏驱动对象
e = epaper.EPD(spi, cs, dc, rst, busy)
e.init()
# 3. 定义要显示的内容宽度高度
w = 296
h = 128
# 4. 创建需要的对象
buf = bytearray(w * h // 8) # 296 * 128 // 8 = 4736
fb = framebuf.FrameBuffer(buf, h, w, framebuf.MONO_HLSB)
def show_black_white():
black = 0
white = 1
fb.fill(white)
# fb.fill(black)
e.display_frame(buf)
def show_image():
from image_array import image_array
# 注意:实际的图片多大这里就写多大,例如实际的图片是118x296,那么就将下面的128改为118
fbImage = framebuf.FrameBuffer(image_array, 128, 296, framebuf.MONO_HLSB)
fb.blit(fbImage, 0, 0)
e.display_frame(buf)
if __name__ == "__main__":
# show_black_white()
show_image()
代码运行效果如下:
六、墨水屏显示文字
上面我们显示图片时的test.py中使用了framebuf库,原来的这个库不能调整显示文字的方向。我们更新下这个库,使用它可以4个方向任意调整和可以放大字体。字体库在文末下载。
newframebuf.py
# SPDX-FileCopyrightText: <text> 2018 Kattni Rembor, Melissa LeBlanc-Williams
# and Tony DiCola, for Adafruit Industries.
# Original file created by Damien P. George </text>
#
# SPDX-License-Identifier: MIT
"""
`adafruit_framebuf`
====================================================
CircuitPython pure-python framebuf module, based on the micropython framebuf module.
Implementation Notes
--------------------
**Hardware:**
* `Adafruit SSD1306 OLED displays <https://www.adafruit.com/?q=ssd1306>`_
**Software and Dependencies:**
* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
"""
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_framebuf.git"
import os
import struct
# Framebuf format constants:
MVLSB = 0 # Single bit displays (like SSD1306 OLED)
RGB565 = 1 # 16-bit color displays
GS4_HMSB = 2 # Unimplemented!
MHMSB = 3 # Single bit displays like the Sharp Memory
RGB888 = 4 # Neopixels and Dotstars
class MHMSBFormat:
"""MHMSBFormat"""
@staticmethod
def set_pixel(framebuf, x, y, color):
"""Set a given pixel to a color."""
index = (y * framebuf.stride + x) // 8
offset = 7 - x & 0x07
framebuf.buf[index] = (framebuf.buf[index] & ~(0x01 << offset)) | (
(color != 0) << offset
)
@staticmethod
def get_pixel(framebuf, x, y):
"""Get the color of a given pixel"""
index = (y * framebuf.stride + x) // 8
offset = 7 - x & 0x07
return (framebuf.buf[index] >> offset) & 0x01
@staticmethod
def fill(framebuf, color):
"""completely fill/clear the buffer with a color"""
if color:
fill = 0xFF
else:
fill = 0x00
for i in range(len(framebuf.buf)): # pylint: disable=consider-using-enumerate
framebuf.buf[i] = fill
@staticmethod
def fill_rect(framebuf, x, y, width, height, color):
"""Draw a rectangle at the given location, size and color. The ``fill_rect`` method draws
both the outline and interior."""
# pylint: disable=too-many-arguments
for _x in range(x, x + width):
offset = 7 - _x & 0x07
for _y in range(y, y + height):
index = (_y * framebuf.stride + _x) // 8
framebuf.buf[index] = (framebuf.buf[index] & ~(0x01 << offset)) | (
(color != 0) << offset
)
class MVLSBFormat:
"""MVLSBFormat"""
@staticmethod
def set_pixel(framebuf, x, y, color):
"""Set a given pixel to a color."""
index = (y >> 3) * framebuf.stride + x
offset = y & 0x07
framebuf.buf[index] = (framebuf.buf[index] & ~(0x01 << offset)) | (
(color != 0) << offset
)
@staticmethod
def get_pixel(framebuf, x, y):
"""Get the color of a given pixel"""
index = (y >> 3) * framebuf.stride + x
offset = y & 0x07
return (framebuf.buf[index] >> offset) & 0x01
@staticmethod
def fill(framebuf, color):
"""completely fill/clear the buffer with a color"""
if color:
fill = 0xFF
else:
fill = 0x00
for i in range(len(framebuf.buf)): # pylint: disable=consider-using-enumerate
framebuf.buf[i] = fill
@staticmethod
def fill_rect(framebuf, x, y, width, height, color):
"""Draw a rectangle at the given location, size and color. The ``fill_rect`` method draws
both the outline and interior."""
# pylint: disable=too-many-arguments
while height > 0:
index = (y >> 3) * framebuf.stride + x
offset = y & 0x07
for w_w in range(width):
framebuf.buf[index + w_w] = (
framebuf.buf[index + w_w] & ~(0x01 << offset)
) | ((color != 0) << offset)
y += 1
height -= 1
class RGB888Format:
"""RGB888Format"""
@staticmethod
def set_pixel(framebuf, x, y, color):
"""Set a given pixel to a color."""
index = (y * framebuf.stride + x) * 3
if isinstance(color, tuple):
framebuf.buf[index : index + 3] = bytes(color)
else:
framebuf.buf[index : index + 3] = bytes(
((color >> 16) & 255, (color >> 8) & 255, color & 255)
)
@staticmethod
def get_pixel(framebuf, x, y):
"""Get the color of a given pixel"""
index = (y * framebuf.stride + x) * 3
return (
(framebuf.buf[index] << 16)
| (framebuf.buf[index + 1] << 8)
| framebuf.buf[index + 2]
)
@staticmethod
def fill(framebuf, color):
"""completely fill/clear the buffer with a color"""
fill = (color >> 16) & 255, (color >> 8) & 255, color & 255
for i in range(0, len(framebuf.buf), 3):
framebuf.buf[i : i + 3] = bytes(fill)
@staticmethod
def fill_rect(framebuf, x, y, width, height, color):
"""Draw a rectangle at the given location, size and color. The ``fill_rect`` method draws
both the outline and interior."""
# pylint: disable=too-many-arguments
fill = (color >> 16) & 255, (color >> 8) & 255, color & 255
for _x in range(x, x + width):
for _y in range(y, y + height):
index = (_y * framebuf.stride + _x) * 3
framebuf.buf[index : index + 3] = bytes(fill)
class FrameBuffer:
"""FrameBuffer object.
:param buf: An object with a buffer protocol which must be large enough to contain every
pixel defined by the width, height and format of the FrameBuffer.
:param width: The width of the FrameBuffer in pixel
:param height: The height of the FrameBuffer in pixel
:param buf_format: Specifies the type of pixel used in the FrameBuffer; permissible values
are listed under Constants below. These set the number of bits used to
encode a color value and the layout of these bits in ``buf``. Where a
color value c is passed to a method, c is a small integer with an encoding
that is dependent on the format of the FrameBuffer.
:param stride: The number of pixels between each horizontal line of pixels in the
FrameBuffer. This defaults to ``width`` but may need adjustments when
implementing a FrameBuffer within another larger FrameBuffer or screen. The
``buf`` size must accommodate an increased step size.
"""
def __init__(self, buf, width, height, buf_format=MVLSB, stride=None):
# pylint: disable=too-many-arguments
self.buf = buf
self.width = width
self.height = height
self.stride = stride
self._font = None
if self.stride is None:
self.stride = width
if buf_format == MVLSB:
self.format = MVLSBFormat()
elif buf_format == MHMSB:
self.format = MHMSBFormat()
elif buf_format == RGB888:
self.format = RGB888Format()
else:
raise ValueError("invalid format")
self._rotation = 0
@property
def rotation(self):
"""The rotation setting of the display, can be one of (0, 1, 2, 3)"""
return self._rotation
@rotation.setter
def rotation(self, val):
if not val in (0, 1, 2, 3):
raise RuntimeError("Bad rotation setting")
self._rotation = val
def fill(self, color):
"""Fill the entire FrameBuffer with the specified color."""
self.format.fill(self, color)
def fill_rect(self, x, y, width, height, color):
"""Draw a rectangle at the given location, size and color. The ``fill_rect`` method draws
both the outline and interior."""
# pylint: disable=too-many-arguments, too-many-boolean-expressions
self.rect(x, y, width, height, color, fill=True)
def pixel(self, x, y, color=None):
"""If ``color`` is not given, get the color value of the specified pixel. If ``color`` is
given, set the specified pixel to the given color."""
if self.rotation == 1:
x, y = y, x
x = self.width - x - 1
if self.rotation == 2:
x = self.width - x - 1
y = self.height - y - 1
if self.rotation == 3:
x, y = y, x
y = self.height - y - 1
if x < 0 or x >= self.width or y < 0 or y >= self.height:
return None
if color is None:
return self.format.get_pixel(self, x, y)
self.format.set_pixel(self, x, y, color)
return None
def hline(self, x, y, width, color):
"""Draw a horizontal line up to a given length."""
self.rect(x, y, width, 1, color, fill=True)
def vline(self, x, y, height, color):
"""Draw a vertical line up to a given length."""
self.rect(x, y, 1, height, color, fill=True)
def circle(self, center_x, center_y, radius, color):
"""Draw a circle at the given midpoint location, radius and color.
The ```circle``` method draws only a 1 pixel outline."""
x = radius - 1
y = 0
d_x = 1
d_y = 1
err = d_x - (radius << 1)
while x >= y:
self.pixel(center_x + x, center_y + y, color)
self.pixel(center_x + y, center_y + x, color)
self.pixel(center_x - y, center_y + x, color)
self.pixel(center_x - x, center_y + y, color)
self.pixel(center_x - x, center_y - y, color)
self.pixel(center_x - y, center_y - x, color)
self.pixel(center_x + y, center_y - x, color)
self.pixel(center_x + x, center_y - y, color)
if err <= 0:
y += 1
err += d_y
d_y += 2
if err > 0:
x -= 1
d_x += 2
err += d_x - (radius << 1)
def rect(self, x, y, width, height, color, *, fill=False):
"""Draw a rectangle at the given location, size and color. The ```rect``` method draws only
a 1 pixel outline."""
# pylint: disable=too-many-arguments
if self.rotation == 1:
x, y = y, x
width, height = height, width
x = self.width - x - width
if self.rotation == 2:
x = self.width - x - width
y = self.height - y - height
if self.rotation == 3:
x, y = y, x
width, height = height, width
y = self.height - y - height
# pylint: disable=too-many-boolean-expressions
if (
width < 1
or height < 1
or (x + width) <= 0
or (y + height) <= 0
or y >= self.height
or x >= self.width
):
return
x_end = min(self.width - 1, x + width - 1)
y_end = min(self.height - 1, y + height - 1)
x = max(x, 0)
y = max(y, 0)
if fill:
self.format.fill_rect(self, x, y, x_end - x + 1, y_end - y + 1, color)
else:
self.format.fill_rect(self, x, y, x_end - x + 1, 1, color)
self.format.fill_rect(self, x, y, 1, y_end - y + 1, color)
self.format.fill_rect(self, x, y_end, x_end - x + 1, 1, color)
self.format.fill_rect(self, x_end, y, 1, y_end - y + 1, color)
def line(self, x_0, y_0, x_1, y_1, color):
# pylint: disable=too-many-arguments
"""Bresenham's line algorithm"""
d_x = abs(x_1 - x_0)
d_y = abs(y_1 - y_0)
x, y = x_0, y_0
s_x = -1 if x_0 > x_1 else 1
s_y = -1 if y_0 > y_1 else 1
if d_x > d_y:
err = d_x / 2.0
while x != x_1:
self.pixel(x, y, color)
err -= d_y
if err < 0:
y += s_y
err += d_x
x += s_x
else:
err = d_y / 2.0
while y != y_1:
self.pixel(x, y, color)
err -= d_x
if err < 0:
x += s_x
err += d_y
y += s_y
self.pixel(x, y, color)
def blit(self):
"""blit is not yet implemented"""
raise NotImplementedError()
def scroll(self, delta_x, delta_y):
"""shifts framebuf in x and y direction"""
if delta_x < 0:
shift_x = 0
xend = self.width + delta_x
dt_x = 1
else:
shift_x = self.width - 1
xend = delta_x - 1
dt_x = -1
if delta_y < 0:
y = 0
yend = self.height + delta_y
dt_y = 1
else:
y = self.height - 1
yend = delta_y - 1
dt_y = -1
while y != yend:
x = shift_x
while x != xend:
self.format.set_pixel(
self, x, y, self.format.get_pixel(self, x - delta_x, y - delta_y)
)
x += dt_x
y += dt_y
# pylint: disable=too-many-arguments
def text(self, string, x, y, color, *, font_name="font5x8.bin", size=1):
"""Place text on the screen in variables sizes. Breaks on \n to next line.
Does not break on line going off screen.
"""
# determine our effective width/height, taking rotation into account
frame_width = self.width
frame_height = self.height
if self.rotation in (1, 3):
frame_width, frame_height = frame_height, frame_width
for chunk in string.split("\n"):
if not self._font or self._font.font_name != font_name:
# load the font!
self._font = BitmapFont(font_name)
width = self._font.font_width
height = self._font.font_height
for i, char in enumerate(chunk):
char_x = x + (i * (width + 1)) * size
if (
char_x + (width * size) > 0
and char_x < frame_width
and y + (height * size) > 0
and y < frame_height
):
self._font.draw_char(char, char_x, y, self, color, size=size)
y += height * size
# pylint: enable=too-many-arguments
def image(self, img):
"""Set buffer to value of Python Imaging Library image. The image should
be in 1 bit mode and a size equal to the display size."""
# determine our effective width/height, taking rotation into account
width = self.width
height = self.height
if self.rotation in (1, 3):
width, height = height, width
if isinstance(self.format, RGB888Format) and img.mode != "RGB":
raise ValueError("Image must be in mode RGB.")
if isinstance(self.format, (MHMSBFormat, MVLSBFormat)) and img.mode != "1":
raise ValueError("Image must be in mode 1.")
imwidth, imheight = img.size
if imwidth != width or imheight != height:
raise ValueError(
"Image must be same dimensions as display ({0}x{1}).".format(
width, height
)
)
# Grab all the pixels from the image, faster than getpixel.
pixels = img.load()
# Clear buffer
for i in range(len(self.buf)): # pylint: disable=consider-using-enumerate
self.buf[i] = 0
# Iterate through the pixels
for x in range(width): # yes this double loop is slow,
for y in range(height): # but these displays are small!
if img.mode == "RGB":
self.pixel(x, y, pixels[(x, y)])
elif pixels[(x, y)]:
self.pixel(x, y, 1) # only write if pixel is true
# MicroPython basic bitmap font renderer.
# Author: Tony DiCola
# License: MIT License (https://opensource.org/licenses/MIT)
class BitmapFont:
"""A helper class to read binary font tiles and 'seek' through them as a
file to display in a framebuffer. We use file access so we dont waste 1KB
of RAM on a font!"""
def __init__(self, font_name="font5x8.bin"):
# Specify the drawing area width and height, and the pixel function to
# call when drawing pixels (should take an x and y param at least).
# Optionally specify font_name to override the font file to use (default
# is font5x8.bin). The font format is a binary file with the following
# format:
# - 1 unsigned byte: font character width in pixels
# - 1 unsigned byte: font character height in pixels
# - x bytes: font data, in ASCII order covering all 255 characters.
# Each character should have a byte for each pixel column of
# data (i.e. a 5x8 font has 5 bytes per character).
self.font_name = font_name
# Open the font file and grab the character width and height values.
# Note that only fonts up to 8 pixels tall are currently supported.
try:
self._font = open( # pylint: disable=consider-using-with
self.font_name, "rb"
)
self.font_width, self.font_height = struct.unpack("BB", self._font.read(2))
# simple font file validation check based on expected file size
if 2 + 256 * self.font_width != os.stat(font_name)[6]:
raise RuntimeError("Invalid font file: " + font_name)
except OSError:
print("Could not find font file", font_name)
raise
except OverflowError:
# os.stat can throw this on boards without long int support
# just hope the font file is valid and press on
pass
def deinit(self):
"""Close the font file as cleanup."""
self._font.close()
def __enter__(self):
"""Initialize/open the font file"""
self.__init__()
return self
def __exit__(self, exception_type, exception_value, traceback):
"""cleanup on exit"""
self.deinit()
def draw_char(
self, char, x, y, framebuffer, color, size=1
): # pylint: disable=too-many-arguments
"""Draw one character at position (x,y) to a framebuffer in a given color"""
size = max(size, 1)
# Don't draw the character if it will be clipped off the visible area.
# if x < -self.font_width or x >= framebuffer.width or \
# y < -self.font_height or y >= framebuffer.height:
# return
# Go through each column of the character.
for char_x in range(self.font_width):
# Grab the byte for the current column of font data.
self._font.seek(2 + (ord(char) * self.font_width) + char_x)
try:
line = struct.unpack("B", self._font.read(1))[0]
except RuntimeError:
continue # maybe character isnt there? go to next
# Go through each row in the column byte.
for char_y in range(self.font_height):
# Draw a pixel for each bit that's flipped on.
if (line >> char_y) & 0x1:
framebuffer.fill_rect(
x + char_x * size, y + char_y * size, size, size, color
)
def width(self, text):
"""Return the pixel width of the specified text message."""
return len(text) * (self.font_width + 1)
class FrameBuffer1(FrameBuffer): # pylint: disable=abstract-method
"""FrameBuffer1 object. Inherits from FrameBuffer."""
pass
我们来测试下,新建一个文件test1.py
from machine import Pin, SPI
import newframebuf
import time
import epaper
def show_text():
black = 0
white = 1
fb.fill(white)
fb.text('Welcome to China!', 20, 10, black, size=2)
"""
e.display_frame(buf)
time.sleep(0.5)
fb.pixel(30, 10, black)
e.display_frame(buf)
time.sleep(0.5)
fb.hline(30, 30, 10, black)
e.display_frame(buf)
time.sleep(0.5)
fb.vline(30, 50, 10, black)
fb.line(30, 70, 40, 80, black)
fb.rect(30, 90, 10, 10, black)
fb.fill_rect(30, 110, 10, 10, black)
for row in range(0,36):
fb.text(str(row), 0, row*8, black)
fb.text('Line 36', 0, 268, black)
"""
e.display_frame(buf)
if __name__ == "__main__":
# 1. 创建对应的引脚
miso = Pin(19)
mosi = Pin(23)
sck = Pin(18)
cs = Pin(33)
dc = Pin(32)
rst = Pin(19)
busy = Pin(35)
spi = SPI(2, baudrate=10000000, polarity=0, phase=0, sck=sck, miso=miso, mosi=mosi)
# 2. 创建墨水屏驱动对象
e = epaper.EPD(spi, cs, dc, rst, busy)
e.init()
# 3. 定义要显示的内容宽度高度
w = 296
h = 128
# 4. 创建需要的对象
buf = bytearray(w * h // 8) # 296 * 128 // 8 = 4736
fb = newframebuf.FrameBuffer(buf, h, w, newframebuf.MHMSB)
fb.rotation = 3 # 调整显示的方向,可以在0/1/2/3之间选择
# 5. 显示文字
show_text()
显示文字演示效果:
七、墨水屏连接WIFI显示日历加图片
我们上面讲解了图片和文字的显示,下面我们将他们结合起来做。
1,图片制作
百度搜索一个你想要的图片,使用截图软件Snipaste进行截图,保存为jpg格式。
然后转化为十六进制
创建一个新的image_array.py文件
# 128 x 296
image_array = bytearray([0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X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0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF])
创键新的test2.py文件
from machine import Pin, SPI, RTC
import newframebuf
import framebuf
import time
import epaper
import ntptime
import network
# 记录上次矩形的左上角
last_rect_x = 0
last_rect_y = 0
# 记录上次显示的所有数字左上角
last_number_x_y = []
def get_week_with_data(y,m,d):
'''根据年月日计算星期几'''
y = y - 1 if m == 1 or m == 2 else y
m = 13 if m == 1 else (14 if m == 2 else m)
w = (d + 2 * m + 3 * (m + 1) // 5 + y + y // 4 - y // 100 + y // 400) % 7 + 1
return w
def is_leap_year(y):
if y%400==0 or (y%4==0 and y%100!=0):
return True
return False
def get_days_in_month(y,m):
if m in [1, 3, 5, 7, 8, 10, 12]:
return 31
elif m in [4, 6, 9, 11]:
return 30
else:
return 29 if is_leap_year(y) else 28
def connect_wifi(wifi, password):
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
wlan.connect(wifi, password)
def ntp():
# 链接互联网
connect_wifi("名字", "密码") # WIFI名字密码
time.sleep(2)
ntptime.host="ntp1.aliyun.com"
ntptime.NTP_DELTA = 3155644800 # 东八区 UTC+8偏移时间(秒)
try:
ntptime.settime()
print("联网成功...")
except Exception as e:
pass
def show_text(year, month, day):
global last_rect_x, last_rect_y, last_number_x_y
# 清空上次显示的数字
for content, x, y in last_number_x_y:
fb.text(content, x, y, white)
# 清空列表
last_number_x_y = []
# 1.提示用户输入年月
year = year
mouth = month
# 2.计算这个月有多少天
days = get_days_in_month(year, mouth)
# 3.按照指定格式显示日期
print('一 二 三 四 五 六 日')
fb.text(' Mon Tus Wed Thu Fri Sat Sun', 0, 15, black)
content = '-' * 30
print(content)
# fb.text(content, 0, 30, black)
fb.hline(0, 30, 180, black)
content = ""
row = 3
today_row = 0
today_col = 0
for i in range(1, days + 1):
w = get_week_with_data(year, mouth, i)
if i == 1:
content = content + ' ' * (w-1)
# print(content, end="*")
else:
if w == 1:
print(content)
fb.text(content, 0, row * 15 - 5, black)
last_number_x_y.append([content, 0, row * 15 - 5])
row += 1
content = ""
content = content + f" {i:2d}"
if i == day:
today_row = row
today_col = w
if content:
print(content)
fb.text(content, 0, row * 15 - 5, black)
last_number_x_y.append([content, 0, row * 15 - 5])
rect_x = (today_col - 1) * 24 + 5
rect_y = today_row * 15 - 8
if last_rect_x != 0 and last_rect_y != 0:
print("last_rect_x=%d, last_rect_y=%d" % (last_rect_x, last_rect_y))
fb.rect(last_rect_x, last_rect_y, 22, 14, white)
last_rect_x, last_rect_y = rect_x, rect_y
fb.rect(rect_x, rect_y, 22, 14, black)
# fb.text('hello World', 0, 0, black, size=2)
e.display_frame(buf) # 刷新显示
if __name__ == "__main__":
# 1. 创建对应的引脚
miso = Pin(19)
mosi = Pin(23)
sck = Pin(18)
cs = Pin(33)
dc = Pin(32)
rst = Pin(19)
busy = Pin(35)
spi = SPI(2, baudrate=10000000, polarity=0, phase=0, sck=sck, miso=miso, mosi=mosi)
# 2. 创建墨水屏驱动对象
e = epaper.EPD(spi, cs, dc, rst, busy)
e.init()
# 3. 导入需要的背景图
from image_array import image_array
# 4. 定义要显示的内容宽度高度
w = 296
h = 128
# 注意:实际的图片多大这里就写多大
buf = image_array
# buf = bytearray(w * h // 8) # 296 * 128 // 8 = 4736 空白
black = 0
white = 1
# 5. 以背景图为基础创建缓存区
fb = newframebuf.FrameBuffer(buf, h, w, newframebuf.MHMSB)
# fb.fill(white) # 清空内容
fb.rotation = 3 # 调整显示的方向,可以在0/1/2/3之间选择
# 6. 联网 便于获取互联网时间
rtc = RTC()
ntp()
# 7. 显示文字
date = rtc.datetime()
show_text(date[0], date[1], date[2]) # 年月日
演示效果
八、资料下载
本文代码,图片,工具比较多,我一起打包放在了下面链接:
链接: https://pan.baidu.com/s/1hvjEXYPzAbvRjqcZ1epEKA 提取码: 2rvi 复制这段内容后打开百度网盘手机App,操作更方便哦
五、购买
某宝链接如下:
https://item.taobao.com/item.htm?spm=a1z09.2.0.0.5ca42e8doe2jPd&id=627397618004&_u=9p01rch2819
2.9寸墨水屏资料链接:https://pan.baidu.com/s/1IZYnwmiBnMc2tnWwtxhslQ
提取码:8888