Add Sunrise x3 Pi Python program, modify some programs to speed up data transfer.
This commit is contained in:
parent
979184d047
commit
88bbf456c6
28 changed files with 707 additions and 451 deletions
|
|
@ -7,8 +7,8 @@
|
|||
# * | Function : Electronic paper driver
|
||||
# * | Info :
|
||||
# *----------------
|
||||
# * | This version: V2.0
|
||||
# * | Date : 2019-06-20
|
||||
# * | This version: V2.1
|
||||
# * | Date : 2022-08-10
|
||||
# # | Info : python demo
|
||||
# -----------------------------------------------------------------------------
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
from distutils.command.build_scripts import build_scripts
|
||||
import logging
|
||||
from . import epdconfig
|
||||
from PIL import Image
|
||||
|
|
@ -129,6 +130,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)
|
||||
|
||||
def ReadBusy(self):
|
||||
logger.debug("e-Paper busy")
|
||||
|
|
@ -199,20 +207,15 @@ class EPD:
|
|||
self.send_data(0x97)
|
||||
|
||||
self.send_command(0x20) # vcom
|
||||
for count in range(0, 44):
|
||||
self.send_data(self.lut_vcom1[count])
|
||||
self.send_data2(self.lut_vcom1)
|
||||
self.send_command(0x21) # ww --
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_ww1[count])
|
||||
self.send_data2(self.lut_ww1)
|
||||
self.send_command(0x22) # bw r
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_bw1[count])
|
||||
self.send_data2(self.lut_bw1)
|
||||
self.send_command(0x23) # wb w
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_wb1[count])
|
||||
self.send_data2(self.lut_wb1)
|
||||
self.send_command(0x24) # bb b
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_bb1[count])
|
||||
self.send_data2(self.lut_bb1)
|
||||
|
||||
def getbuffer(self, image):
|
||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
||||
|
|
@ -240,13 +243,11 @@ class EPD:
|
|||
|
||||
def display(self, image):
|
||||
self.send_command(0x10)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(0x00)
|
||||
self.send_data2([0x00] * int(self.width * self.height / 8))
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(image[i])
|
||||
self.send_data2(image)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.TurnOnDisplay()
|
||||
|
|
@ -263,28 +264,28 @@ class EPD:
|
|||
self.send_data(int(self.height / 256))
|
||||
self.send_data(self.height % 256 - 1)
|
||||
self.send_data(0x28)
|
||||
|
||||
self.send_command(0x10)
|
||||
|
||||
|
||||
buf = [0x00] * int(self.width * self.height / 8)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(image[i])
|
||||
buf[i] = ~image[i]
|
||||
self.send_command(0x10)
|
||||
self.send_data2(image)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(~image[i])
|
||||
self.send_data2(buf)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def Clear(self, color):
|
||||
def Clear(self):
|
||||
self.send_command(0x10)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(0x00)
|
||||
self.send_data2([0x00] * int(self.width * self.height / 8))
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.send_command(0x13)
|
||||
for i in range(0, int(self.width * self.height / 8)):
|
||||
self.send_data(0xFF)
|
||||
self.send_data2([0xFF] * int(self.width * self.height / 8))
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.TurnOnDisplay()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue