Add Sunrise x3 Pi Python program, modify some programs to speed up data transfer.

This commit is contained in:
SSYYL 2022-08-15 11:14:27 +08:00
parent 979184d047
commit 88bbf456c6
28 changed files with 709 additions and 453 deletions

View file

@ -4,8 +4,8 @@
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V1.1
# * | Date : 2021-10-30
# * | This version: V1.2
# * | Date : 2022-08-9
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
@ -123,6 +123,13 @@ class EPD:
epdconfig.digital_write(self.cs_pin, 0)
epdconfig.spi_writebyte([data])
epdconfig.digital_write(self.cs_pin, 1)
# send a lot of data
def send_data2(self, data):
epdconfig.digital_write(self.dc_pin, 1)
epdconfig.digital_write(self.cs_pin, 0)
epdconfig.spi_writebyte2(data)
epdconfig.digital_write(self.cs_pin, 1)
'''
function :Wait until the busy_pin goes LOW
@ -336,9 +343,10 @@ class EPD:
self.SetCursor(0, 0)
self.send_command(0x24) # WRITE_RAM
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(image[i + j * linewidth])
# for j in range(0, self.height):
# for i in range(0, linewidth):
# self.send_data(image[i + j * linewidth])
self.send_data2(image)
self.TurnOnDisplayPart()
'''
@ -353,14 +361,10 @@ class EPD:
linewidth = int(self.width/8) + 1
self.send_command(0x24)
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(image[i + j * linewidth])
self.send_data2(image)
self.send_command(0x26)
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(image[i + j * linewidth])
self.send_data2(image)
self.TurnOnDisplay()
'''
@ -375,10 +379,7 @@ class EPD:
# logger.debug(linewidth)
self.send_command(0x24)
for j in range(0, self.height):
for i in range(0, linewidth):
self.send_data(color)
self.send_data2([color] * int(self.height * linewidth))
self.TurnOnDisplay()
'''