Best practices & code cleanup

This commit is contained in:
Ace
2023-12-18 12:46:33 +01:00
parent ad0610635e
commit e710964e10
29 changed files with 1241 additions and 1228 deletions

View File

@@ -1,4 +1,3 @@
#!python3
"""
10.3" driver class
Copyright by aceinnolab

View File

@@ -1,12 +1,10 @@
#!python3
"""
7.8" parallel driver class
Copyright by aceinnolab
"""
from subprocess import run
from inkycal.custom import image_folder, top_level
from os.path import exists
from PIL import Image
# Display resolution
EPD_WIDTH = 1872

View File

@@ -1,12 +1,10 @@
#!python3
"""
9.7" driver class
Copyright by aceinnolab
"""
from subprocess import run
from inkycal.custom import image_folder, top_level
from os.path import exists
from PIL import Image
# Display resolution
EPD_WIDTH = 1200

View File

@@ -1,42 +1,43 @@
# *****************************************************************************
# * | File : epd5in83b_V2.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V1.1
# * | Date : 2022-08-10
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd5in83b_V2.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V1.1
* | Date : 2022-08-10
# | Info : python demo
-----------------------------------------------------------------------------
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
furished 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 OR 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.
"""
import logging
from . import epdconfig
# Display resolution
EPD_WIDTH = 648
EPD_HEIGHT = 480
EPD_WIDTH = 648
EPD_HEIGHT = 480
logger = logging.getLogger(__name__)
class EPD:
def __init__(self):
self.reset_pin = epdconfig.RST_PIN
@@ -49,11 +50,11 @@ class EPD:
# Hardware reset
def reset(self):
epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(200)
epdconfig.delay_ms(200)
epdconfig.digital_write(self.reset_pin, 0)
epdconfig.delay_ms(1)
epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(200)
epdconfig.delay_ms(200)
def send_command(self, command):
epdconfig.digital_write(self.dc_pin, 0)
@@ -73,74 +74,74 @@ class EPD:
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")
self.send_command(0X71)
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
while (epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
self.send_command(0X71)
epdconfig.delay_ms(200)
logger.debug("e-Paper busy release")
def init(self):
if (epdconfig.module_init() != 0):
return -1
self.reset()
self.send_command(0x01) #POWER SETTING
self.send_data (0x07)
self.send_data (0x07) #VGH=20V,VGL=-20V
self.send_data (0x3f) #VDH=15V
self.send_data (0x3f) #VDL=-15V
self.send_command(0x01) # POWER SETTING
self.send_data(0x07)
self.send_data(0x07) # VGH=20V,VGL=-20V
self.send_data(0x3f) # VDH=15V
self.send_data(0x3f) # VDL=-15V
self.send_command(0x04) #POWER ON
epdconfig.delay_ms(100)
self.ReadBusy() #waiting for the electronic paper IC to release the idle signal
self.send_command(0x04) # POWER ON
epdconfig.delay_ms(100)
self.ReadBusy() # waiting for the electronic paper IC to release the idle signal
self.send_command(0X00) #PANNEL SETTING
self.send_data(0x0F) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
self.send_command(0X00) # PANNEL SETTING
self.send_data(0x0F) # KW-3f KWR-2F BWROTP 0f BWOTP 1f
self.send_command(0x61) #tres
self.send_data (0x02) #source 648
self.send_data (0x88)
self.send_data (0x01) #gate 480
self.send_data (0xe0)
self.send_command(0x61) # tres
self.send_data(0x02) # source 648
self.send_data(0x88)
self.send_data(0x01) # gate 480
self.send_data(0xe0)
self.send_command(0X15)
self.send_data(0x00)
self.send_command(0X50) #VCOM AND DATA INTERVAL SETTING
self.send_command(0X50) # VCOM AND DATA INTERVAL SETTING
self.send_data(0x11)
self.send_data(0x07)
self.send_command(0X60) #TCON SETTING
self.send_command(0X60) # TCON SETTING
self.send_data(0x22)
return 0
def getbuffer(self, image):
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
buf = [0xFF] * (int(self.width/8) * self.height)
buf = [0xFF] * (int(self.width / 8) * self.height)
image_monocolor = image.convert('1')
imwidth, imheight = image_monocolor.size
pixels = image_monocolor.load()
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
if(imwidth == self.width and imheight == self.height):
if (imwidth == self.width and imheight == self.height):
logger.debug("Vertical")
for y in range(imheight):
for x in range(imwidth):
# Set the bits for the column of pixels at the current position.
if pixels[x, y] == 0:
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
elif(imwidth == self.height and imheight == self.width):
elif (imwidth == self.height and imheight == self.width):
logger.debug("Horizontal")
for y in range(imheight):
for x in range(imwidth):
newx = y
newy = self.height - x - 1
if pixels[x, y] == 0:
buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8))
buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8))
return buf
def display(self, imageblack, imagered):
@@ -150,13 +151,13 @@ class EPD:
if (imageblack != None):
self.send_command(0X10)
self.send_data2(imageblack)
self.send_data2(imageblack)
if (imagered != None):
self.send_command(0X13)
self.send_data2(buf)
self.send_command(0x12)
epdconfig.delay_ms(200)
epdconfig.delay_ms(200)
self.ReadBusy()
def Clear(self):
@@ -166,15 +167,15 @@ class EPD:
self.send_data2([0x00] * int(self.width * self.height / 8))
self.send_command(0x12)
epdconfig.delay_ms(200)
epdconfig.delay_ms(200)
self.ReadBusy()
def sleep(self):
self.send_command(0X02) # power off
self.send_command(0X02) # power off
self.ReadBusy()
self.send_command(0X07) # deep sleep
self.send_command(0X07) # deep sleep
self.send_data(0xA5)
epdconfig.delay_ms(2000)
epdconfig.module_exit()
### END OF FILE ###

View File

@@ -1,221 +1,224 @@
# /*****************************************************************************
# * | File : epd12in48.py
# * | Author : Waveshare electrices
# * | Function : Hardware underlying interface
# * | Info :
# *----------------
# * | This version: V1.0
# * | Date : 2019-11-01
# * | Info :
# ******************************************************************************/
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd12in48.py
* | Author : Waveshare electrices
* | Function : Hardware underlying interface
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-11-01
* | Info :
******************************************************************************/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import time
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
EPD_WIDTH = 1304
EPD_HEIGHT = 984
EPD_WIDTH = 1304
EPD_HEIGHT = 984
class EPD(object):
def __init__(self):
self.width = EPD_WIDTH
self.height = EPD_HEIGHT
self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN
self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN
self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN
self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN
self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN
self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN
self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN
self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN
self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN
self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN
self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN
self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN
self.EPD_M1S1_RST_PIN = epdconfig.EPD_M1S1_RST_PIN
self.EPD_M2S2_RST_PIN = epdconfig.EPD_M2S2_RST_PIN
self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN
self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN
self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN
self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN
self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN
self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN
self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN
self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN
def init(self):
print("EPD init...")
epdconfig.module_init()
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
self.Reset()
#panel setting
self.M1_SendCommand(0x00)
self.M1_SendData(0x1f) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
self.S1_SendCommand(0x00)
self.S1_SendData(0x1f)
self.M2_SendCommand(0x00)
self.M2_SendData(0x13)
self.S2_SendCommand(0x00)
self.S2_SendData(0x13)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
self.Reset()
# panel setting
self.M1_SendCommand(0x00)
self.M1_SendData(0x1f) # KW-3f KWR-2F BWROTP 0f BWOTP 1f
self.S1_SendCommand(0x00)
self.S1_SendData(0x1f)
self.M2_SendCommand(0x00)
self.M2_SendData(0x13)
self.S2_SendCommand(0x00)
self.S2_SendData(0x13)
# booster soft start
self.M1_SendCommand(0x06)
self.M1_SendData(0x17) #A
self.M1_SendData(0x17) #B
self.M1_SendData(0x39) #C
self.M1_SendData(0x17)
self.M2_SendCommand(0x06)
self.M2_SendData(0x17)
self.M2_SendData(0x17)
self.M2_SendData(0x39)
self.M2_SendData(0x17)
self.M1_SendCommand(0x06)
self.M1_SendData(0x17) # A
self.M1_SendData(0x17) # B
self.M1_SendData(0x39) # C
self.M1_SendData(0x17)
self.M2_SendCommand(0x06)
self.M2_SendData(0x17)
self.M2_SendData(0x17)
self.M2_SendData(0x39)
self.M2_SendData(0x17)
#resolution setting
self.M1_SendCommand(0x61)
self.M1_SendData(0x02)
self.M1_SendData(0x88) #source 648
self.M1_SendData(0x01) #gate 492
self.M1_SendData(0xEC)
self.S1_SendCommand(0x61)
self.S1_SendData(0x02)
self.S1_SendData(0x90) #source 656
self.S1_SendData(0x01) #gate 492
self.S1_SendData(0xEC)
self.M2_SendCommand(0x61)
self.M2_SendData(0x02)
self.M2_SendData(0x90) #source 656
self.M2_SendData(0x01) #gate 492
self.M2_SendData(0xEC)
self.S2_SendCommand(0x61)
self.S2_SendData(0x02)
self.S2_SendData(0x88) #source 648
self.S2_SendData(0x01) #gate 492
self.S2_SendData(0xEC)
# resolution setting
self.M1_SendCommand(0x61)
self.M1_SendData(0x02)
self.M1_SendData(0x88) # source 648
self.M1_SendData(0x01) # gate 492
self.M1_SendData(0xEC)
self.S1_SendCommand(0x61)
self.S1_SendData(0x02)
self.S1_SendData(0x90) # source 656
self.S1_SendData(0x01) # gate 492
self.S1_SendData(0xEC)
self.M2_SendCommand(0x61)
self.M2_SendData(0x02)
self.M2_SendData(0x90) # source 656
self.M2_SendData(0x01) # gate 492
self.M2_SendData(0xEC)
self.S2_SendCommand(0x61)
self.S2_SendData(0x02)
self.S2_SendData(0x88) # source 648
self.S2_SendData(0x01) # gate 492
self.S2_SendData(0xEC)
self.M1S1M2S2_SendCommand(0x15) #DUSPI
self.M1S1M2S2_SendData(0x20)
self.M1S1M2S2_SendCommand(0x15) # DUSPI
self.M1S1M2S2_SendData(0x20)
self.M1S1M2S2_SendCommand(0x50) #Vcom and data interval setting
self.M1S1M2S2_SendData(0x21) #Border KW
self.M1S1M2S2_SendData(0x07)
self.M1S1M2S2_SendCommand(0x50) # Vcom and data interval setting
self.M1S1M2S2_SendData(0x21) # Border KW
self.M1S1M2S2_SendData(0x07)
self.M1S1M2S2_SendCommand(0x60) #TCON
self.M1S1M2S2_SendData(0x22)
self.M1S1M2S2_SendCommand(0x60) # TCON
self.M1S1M2S2_SendData(0x22)
self.M1S1M2S2_SendCommand(0xE3)
self.M1S1M2S2_SendData(0x00)
self.M1S1M2S2_SendCommand(0xE3)
self.M1S1M2S2_SendData(0x00)
#temperature
temp = self.M1_ReadTemperature()
# temperature
temp = self.M1_ReadTemperature()
self.M1S1M2S2_SendCommand(0xe0) #Cascade setting
self.M1S1M2S2_SendData(0x03)
self.M1S1M2S2_SendCommand(0xe5) #Force temperature
self.M1S1M2S2_SendCommand(0xe0) # Cascade setting
self.M1S1M2S2_SendData(0x03)
self.M1S1M2S2_SendCommand(0xe5) # Force temperature
self.M1S1M2S2_SendData(temp)
def getbuffer(self, image):
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
buf = [0xFF] * (int(self.width/8) * self.height)
buf = [0xFF] * (int(self.width / 8) * self.height)
image_monocolor = image.convert('1')
imwidth, imheight = image_monocolor.size
pixels = image_monocolor.load()
if(imwidth == self.width and imheight == self.height):
if (imwidth == self.width and imheight == self.height):
for y in range(imheight):
for x in range(imwidth):
# Set the bits for the column of pixels at the current position.
if pixels[x, y] == 0:
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
elif(imwidth == self.height and imheight == self.width):
elif (imwidth == self.height and imheight == self.width):
for y in range(imheight):
for x in range(imwidth):
newx = y
newy = self.height - x - 1
if pixels[x, y] == 0:
buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8))
buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8))
return buf
def display(self, buf):
#M1 part 648*492
# M1 part 648*492
self.M1_SendCommand(0x13)
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(buf[y*163 + x])
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(buf[y * 163 + x])
#S1 part 656*492
# S1 part 656*492
self.S1_SendCommand(0x13)
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(buf[y*163 + x])
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(buf[y * 163 + x])
#M2 part 656*492
# M2 part 656*492
self.M2_SendCommand(0x13)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(buf[y*163 + x])
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(buf[y * 163 + x])
#S2 part 648*492
# S2 part 648*492
self.S2_SendCommand(0x13)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(buf[y*163 + x])
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(buf[y * 163 + x])
self.TurnOnDisplay()
def clear(self):
"""Clear contents of image buffer"""
self.M1_SendCommand(0x13)
for y in range(492, 984):
for x in range(0, 81):
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(0xff)
self.S1_SendCommand(0x13)
for y in range(492, 984):
for x in range(81, 163):
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(0xff)
self.M2_SendCommand(0x13)
for y in range(0, 492):
for x in range(81, 163):
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(0xff)
self.S2_SendCommand(0x13)
for y in range(0, 492):
for x in range(0, 81):
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(0xff)
self.TurnOnDisplay()
""" M1S1M2S2 Write register address and data """
def M1S1M2S2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
def M1S1M2S2_SendData(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
@@ -224,59 +227,62 @@ class EPD(object):
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
""" M1M2 Write register address and data """
def M1M2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
def M1S1M2S2_Senddata(self, val):
def M1S1M2S2_Senddata(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
""" S2 Write register address and data """
def S2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
def S2_SendData(self, val):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
""" M2 Write register address and data """
def M2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
def M2_SendData(self, val):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
""" S1 Write register address and data """
def S1_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
@@ -288,8 +294,9 @@ class EPD(object):
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
""" M1 Write register address and data """
def M1_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
@@ -303,97 +310,96 @@ class EPD(object):
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
def Reset(self):
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0)
time.sleep(0.01)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
def sleep(self):
self.M1S1M2S2_SendCommand(0X02)
time.sleep(0.3)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0)
time.sleep(0.01)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
self.M1S1M2S2_SendCommand(0X07)
self.M1S1M2S2_SendData(0xA5)
time.sleep(0.3)
def sleep(self):
self.M1S1M2S2_SendCommand(0X02)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0X07)
self.M1S1M2S2_SendData(0xA5)
time.sleep(0.3)
print("module_exit")
epdconfig.module_exit()
def TurnOnDisplay(self):
self.M1M2_SendCommand(0x04)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0x12)
self.M1M2_SendCommand(0x04)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0x12)
self.M1_ReadBusy()
self.S1_ReadBusy()
self.M2_ReadBusy()
self.S2_ReadBusy()
#Busy
# Busy
def M1_ReadBusy(self):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not(busy & 0x01)
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not (busy & 0x01)
print("M1_ReadBusy")
while(busy):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not(busy & 0x01)
while (busy):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def M2_ReadBusy(self):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not(busy & 0x01)
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not (busy & 0x01)
print("M2_ReadBusy")
while(busy):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy =not(busy & 0x01)
time.sleep(0.2)
while (busy):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def S1_ReadBusy(self):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not(busy & 0x01)
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not (busy & 0x01)
print("s1_ReadBusy")
while(busy):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not(busy & 0x01)
time.sleep(0.2)
while (busy):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def S2_ReadBusy(self):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not(busy & 0x01)
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not (busy & 0x01)
print("S2_ReadBusy")
while(busy):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not(busy & 0x01)
time.sleep(0.2)
while (busy):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def M1_ReadTemperature(self):
self.M1_SendCommand(0x40)
self.M1_ReadBusy()
self.M1_SendCommand(0x40)
self.M1_ReadBusy()
time.sleep(0.3)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
time.sleep(0.01)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
time.sleep(0.01)
# temp = epdconfig.spi_readbyte(0x00)
temp = 25
print("Read Temperature Reg:%d"%temp)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
print("Read Temperature Reg:%d" % temp)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
# temp =0x29
return temp
return temp

View File

@@ -1,97 +1,99 @@
# /*****************************************************************************
# * | File : epd12in48.py
# * | Author : Waveshare electrices
# * | Function : Hardware underlying interface
# * | Info :
# *----------------
# * | This version: V1.0
# * | Date : 2019-11-01
# * | Info :
# ******************************************************************************/
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd12in48.py
* | Author : Waveshare electrices
* | Function : Hardware underlying interface
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-11-01
* | Info :
******************************************************************************/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import time
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
EPD_WIDTH = 1304
EPD_HEIGHT = 984
EPD_WIDTH = 1304
EPD_HEIGHT = 984
class EPD(object):
def __init__(self):
self.width = EPD_WIDTH
self.height = EPD_HEIGHT
self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN
self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN
self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN
self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN
self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN
self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN
self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN
self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN
self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN
self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN
self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN
self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN
self.EPD_M1S1_RST_PIN = epdconfig.EPD_M1S1_RST_PIN
self.EPD_M2S2_RST_PIN = epdconfig.EPD_M2S2_RST_PIN
self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN
self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN
self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN
self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN
self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN
self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN
self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN
self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN
def init(self):
print("EPD init...")
epdconfig.module_init()
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
self.Reset()
#panel setting
self.M1_SendCommand(0x00)
self.M1_SendData(0x2f) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
self.S1_SendCommand(0x00)
self.S1_SendData(0x2f)
self.M2_SendCommand(0x00)
self.M2_SendData(0x23)
self.S2_SendCommand(0x00)
self.S2_SendData(0x23)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
self.Reset()
# panel setting
self.M1_SendCommand(0x00)
self.M1_SendData(0x2f) # KW-3f KWR-2F BWROTP 0f BWOTP 1f
self.S1_SendCommand(0x00)
self.S1_SendData(0x2f)
self.M2_SendCommand(0x00)
self.M2_SendData(0x23)
self.S2_SendCommand(0x00)
self.S2_SendData(0x23)
# POWER SETTING
self.M1_SendCommand(0x01)
self.M1_SendData(0x07)
self.M1_SendData(0x17) # VGH=20V,VGL=-20V
self.M1_SendData(0x3F) # VDH=15V
self.M1_SendData(0x3F) # VDL=-15V
self.M1_SendData(0x17) # VGH=20V,VGL=-20V
self.M1_SendData(0x3F) # VDH=15V
self.M1_SendData(0x3F) # VDL=-15V
self.M1_SendData(0x0d)
self.M2_SendCommand(0x01)
self.M2_SendData(0x07)
self.M2_SendData(0x17) # VGH=20V,VGL=-20V
self.M2_SendData(0x3F) # VDH=15V
self.M2_SendData(0x17) # VGH=20V,VGL=-20V
self.M2_SendData(0x3F) # VDH=15V
self.M2_SendData(0x3F) # VDL=-15V
self.M2_SendData(0x0d)
# booster soft start
self.M1_SendCommand(0x06)
self.M1_SendData(0x17) #A
self.M1_SendData(0x17) #B
self.M1_SendData(0x39) #C
self.M1_SendData(0x17) # A
self.M1_SendData(0x17) # B
self.M1_SendData(0x39) # C
self.M1_SendData(0x17)
self.M2_SendCommand(0x06)
self.M2_SendData(0x17)
@@ -99,44 +101,44 @@ class EPD(object):
self.M2_SendData(0x39)
self.M2_SendData(0x17)
#resolution setting
# resolution setting
self.M1_SendCommand(0x61)
self.M1_SendData(0x02)
self.M1_SendData(0x88) #source 648
self.M1_SendData(0x01) #gate 492
self.M1_SendData(0x88) # source 648
self.M1_SendData(0x01) # gate 492
self.M1_SendData(0xEC)
self.S1_SendCommand(0x61)
self.S1_SendData(0x02)
self.S1_SendData(0x90) #source 656
self.S1_SendData(0x01) #gate 492
self.S1_SendData(0x90) # source 656
self.S1_SendData(0x01) # gate 492
self.S1_SendData(0xEC)
self.M2_SendCommand(0x61)
self.M2_SendData(0x02)
self.M2_SendData(0x90) #source 656
self.M2_SendData(0x01) #gate 492
self.M2_SendData(0x90) # source 656
self.M2_SendData(0x01) # gate 492
self.M2_SendData(0xEC)
self.S2_SendCommand(0x61)
self.S2_SendData(0x02)
self.S2_SendData(0x88) #source 648
self.S2_SendData(0x01) #gate 492
self.S2_SendData(0x88) # source 648
self.S2_SendData(0x01) # gate 492
self.S2_SendData(0xEC)
self.M1S1M2S2_SendCommand(0x15) #DUSPI
self.M1S1M2S2_SendCommand(0x15) # DUSPI
self.M1S1M2S2_SendData(0x20)
self.M1S1M2S2_SendCommand(0x30) # PLL
self.M1S1M2S2_SendCommand(0x30) # PLL
self.M1S1M2S2_SendData(0x08)
self.M1S1M2S2_SendCommand(0x50) #Vcom and data interval setting
self.M1S1M2S2_SendCommand(0x50) # Vcom and data interval setting
self.M1S1M2S2_SendData(0x31)
self.M1S1M2S2_SendData(0x07)
self.M1S1M2S2_SendCommand(0x60)#TCON
self.M1S1M2S2_SendCommand(0x60) # TCON
self.M1S1M2S2_SendData(0x22)
self.M1_SendCommand(0xE0) #POWER SETTING
self.M1_SendCommand(0xE0) # POWER SETTING
self.M1_SendData(0x01)
self.M2_SendCommand(0xE0) #POWER SETTING
self.M2_SendCommand(0xE0) # POWER SETTING
self.M2_SendData(0x01)
self.M1S1M2S2_SendCommand(0xE3)
@@ -148,158 +150,159 @@ class EPD(object):
self.M2_SendData(0x1c)
self.SetLut()
def getbuffer(self, image):
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
buf = [0xFF] * (int(self.width/8) * self.height)
buf = [0xFF] * (int(self.width / 8) * self.height)
image_monocolor = image.convert('1')
imwidth, imheight = image_monocolor.size
pixels = image_monocolor.load()
if(imwidth == self.width and imheight == self.height):
if (imwidth == self.width and imheight == self.height):
for y in range(imheight):
for x in range(imwidth):
# Set the bits for the column of pixels at the current position.
if pixels[x, y] == 0:
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
elif(imwidth == self.height and imheight == self.width):
elif (imwidth == self.height and imheight == self.width):
for y in range(imheight):
for x in range(imwidth):
newx = y
newy = self.height - x - 1
if pixels[x, y] == 0:
buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8))
buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8))
return buf
def display(self, blackbuf, redbuf):
#S2 part 648*492
self.S2_SendCommand(0x10)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(blackbuf[y*163 + x])
self.S2_SendCommand(0x13)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(~redbuf[y*163 + x])
#M2 part 656*492
self.M2_SendCommand(0x10)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(blackbuf[y*163 + x])
self.M2_SendCommand(0x13)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(~redbuf[y*163 + x])
#M1 part 648*492
def display(self, blackbuf, redbuf):
# S2 part 648*492
self.S2_SendCommand(0x10)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(blackbuf[y * 163 + x])
self.S2_SendCommand(0x13)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(~redbuf[y * 163 + x])
# M2 part 656*492
self.M2_SendCommand(0x10)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(blackbuf[y * 163 + x])
self.M2_SendCommand(0x13)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(~redbuf[y * 163 + x])
# M1 part 648*492
self.M1_SendCommand(0x10)
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(blackbuf[y*163 + x])
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(blackbuf[y * 163 + x])
self.M1_SendCommand(0x13)
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(~redbuf[y*163 + x])
#S1 part 656*492
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(~redbuf[y * 163 + x])
# S1 part 656*492
self.S1_SendCommand(0x10)
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(blackbuf[y*163 + x])
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(blackbuf[y * 163 + x])
self.S1_SendCommand(0x13)
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(~redbuf[y*163 + x])
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(~redbuf[y * 163 + x])
self.TurnOnDisplay()
def clear(self):
"""Clear contents of image buffer"""
self.S2_SendCommand(0x10)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(0xff)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(0xff)
self.S2_SendCommand(0x13)
for y in range(0, 492):
for x in range(0, 81):
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(0x00)
self.M2_SendCommand(0x10)
for y in range(0, 492):
for x in range(81, 163):
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(0xff)
self.M2_SendCommand(0x13)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(0x00)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(0x00)
self.M1_SendCommand(0x10)
for y in range(492, 984):
for x in range(0, 81):
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(0xff)
self.M1_SendCommand(0x13)
for y in range(492, 984):
for x in range(0, 81):
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(0x00)
self.S1_SendCommand(0x10)
for y in range(492, 984):
for x in range(81, 163):
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(0xff)
self.S1_SendCommand(0x13)
for y in range(492, 984):
for x in range(81, 163):
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(0x00)
self.TurnOnDisplay()
def Reset(self):
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0)
time.sleep(0.01)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
def sleep(self):
self.M1S1M2S2_SendCommand(0X02)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0X07)
self.M1S1M2S2_SendData(0xA5)
time.sleep(0.3)
self.TurnOnDisplay()
def Reset(self):
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0)
time.sleep(0.01)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
def sleep(self):
self.M1S1M2S2_SendCommand(0X02)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0X07)
self.M1S1M2S2_SendData(0xA5)
time.sleep(0.3)
print("module_exit")
epdconfig.module_exit()
def TurnOnDisplay(self):
self.M1M2_SendCommand(0x04)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0x12)
self.M1M2_SendCommand(0x04)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0x12)
self.M1_ReadBusy()
self.S1_ReadBusy()
self.M2_ReadBusy()
self.S2_ReadBusy()
self.S2_ReadBusy()
""" M1S1M2S2 Write register address and data """
def M1S1M2S2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
def M1S1M2S2_SendData(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
@@ -308,200 +311,212 @@ class EPD(object):
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
""" M1M2 Write register address and data """
def M1M2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
def M1M2_Sendata(self, val):
def M1M2_Sendata(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
""" S2 Write register address and data """
def S2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
def S2_SendData(self, val):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
""" M2 Write register address and data """
def M2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
def M2_SendData(self, val):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
""" S1 Write register address and data """
def S1_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
def S1_SendData(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
""" M1 Write register address and data """
def M1_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
def M1_SendData(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
#Busy
# Busy
def M1_ReadBusy(self):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not(busy & 0x01)
while(busy):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not(busy & 0x01)
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not (busy & 0x01)
while (busy):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def M2_ReadBusy(self):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not(busy & 0x01)
self.M2_SendCommand(0x71)
while(busy):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy =not(busy & 0x01)
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not (busy & 0x01)
self.M2_SendCommand(0x71)
while (busy):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def S1_ReadBusy(self):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not(busy & 0x01)
while(busy):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not(busy & 0x01)
time.sleep(0.2)
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not (busy & 0x01)
while (busy):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def S2_ReadBusy(self):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not(busy & 0x01)
while(busy):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not(busy & 0x01)
time.sleep(0.2)
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not (busy & 0x01)
while (busy):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
lut_vcom1 = [
0x00, 0x10, 0x10, 0x01, 0x08, 0x01,
0x00, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x08, 0x01, 0x08, 0x01, 0x06,
0x00, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x00, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x10, 0x01, 0x08, 0x01,
0x00, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x08, 0x01, 0x08, 0x01, 0x06,
0x00, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x00, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
lut_ww1 = [
0x91, 0x10, 0x10, 0x01, 0x08, 0x01,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x08, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x91, 0x10, 0x10, 0x01, 0x08, 0x01,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x08, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
lut_bw1 = [
0xA8, 0x10, 0x10, 0x01, 0x08, 0x01,
0x84, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x86, 0x06, 0x01, 0x06, 0x01, 0x05,
0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0xF0, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xA8, 0x10, 0x10, 0x01, 0x08, 0x01,
0x84, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x86, 0x06, 0x01, 0x06, 0x01, 0x05,
0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0xF0, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
lut_wb1 = [
0x91, 0x10, 0x10, 0x01, 0x08, 0x01,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x08, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x91, 0x10, 0x10, 0x01, 0x08, 0x01,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x08, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
lut_bb1 = [
0x92, 0x10, 0x10, 0x01, 0x08, 0x01,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x01, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x92, 0x10, 0x10, 0x01, 0x08, 0x01,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x01, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
def SetLut(self):
self.M1S1M2S2_SendCommand(0x20) #vcom
self.M1S1M2S2_SendCommand(0x20) # vcom
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_vcom1[count])
self.M1S1M2S2_SendCommand(0x21) #red not use
self.M1S1M2S2_SendCommand(0x21) # red not use
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_ww1[count])
self.M1S1M2S2_SendCommand(0x22) #bw r
self.M1S1M2S2_SendCommand(0x22) # bw r
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_bw1[count]) # bw=r
self.M1S1M2S2_SendData(self.lut_bw1[count]) # bw=r
self.M1S1M2S2_SendCommand(0x23) #wb w
self.M1S1M2S2_SendCommand(0x23) # wb w
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_wb1[count]) # wb=w
self.M1S1M2S2_SendData(self.lut_wb1[count]) # wb=w
self.M1S1M2S2_SendCommand(0x24) #bb b
self.M1S1M2S2_SendCommand(0x24) # bb b
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b
self.M1S1M2S2_SendCommand(0x25) #bb b
self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b
self.M1S1M2S2_SendCommand(0x25) # bb b
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b
self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b

View File

@@ -1,71 +1,74 @@
# /*****************************************************************************
# * | File : epd_12_in_48_colour.py
# * | Author : Waveshare electrices, modified by Sebastien Harnist
# * | Function : Hardware underlying interface
# * | Info :
# *----------------
# * | This version: V1.1
# * | Date : 2022-11-23
# * | Info :
# ******************************************************************************/
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd_12_in_48_colour.py
* | Author : Waveshare electrices, modified by Sebastien Harnist
* | Function : Hardware underlying interface
* | Info :
*----------------
* | This version: V1.1
* | Date : 2022-11-23
* | Info :
******************************************************************************/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import time
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
EPD_WIDTH = 1304
EPD_HEIGHT = 984
EPD_WIDTH = 1304
EPD_HEIGHT = 984
class EPD(object):
def __init__(self):
self.width = EPD_WIDTH
self.height = EPD_HEIGHT
self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN
self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN
self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN
self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN
self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN
self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN
self.EPD_M1_CS_PIN = epdconfig.EPD_M1_CS_PIN
self.EPD_S1_CS_PIN = epdconfig.EPD_S1_CS_PIN
self.EPD_M2_CS_PIN = epdconfig.EPD_M2_CS_PIN
self.EPD_S2_CS_PIN = epdconfig.EPD_S2_CS_PIN
self.EPD_M1S1_DC_PIN = epdconfig.EPD_M1S1_DC_PIN
self.EPD_M2S2_DC_PIN = epdconfig.EPD_M2S2_DC_PIN
self.EPD_M1S1_RST_PIN = epdconfig.EPD_M1S1_RST_PIN
self.EPD_M2S2_RST_PIN = epdconfig.EPD_M2S2_RST_PIN
self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN
self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN
self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN
self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN
self.EPD_M1_BUSY_PIN = epdconfig.EPD_M1_BUSY_PIN
self.EPD_S1_BUSY_PIN = epdconfig.EPD_S1_BUSY_PIN
self.EPD_M2_BUSY_PIN = epdconfig.EPD_M2_BUSY_PIN
self.EPD_S2_BUSY_PIN = epdconfig.EPD_S2_BUSY_PIN
def init(self):
print("EPD init...")
epdconfig.module_init()
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
self.Reset()
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
self.Reset()
# panel setting for Display
self.M1_SendCommand(0x00)
self.M1_SendData(0x0f) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
self.M1_SendData(0x0f) # KW-3f KWR-2F BWROTP 0f BWOTP 1f
self.S1_SendCommand(0x00)
self.S1_SendData(0x0f)
self.M2_SendCommand(0x00)
@@ -75,9 +78,9 @@ class EPD(object):
# booster soft start
self.M1_SendCommand(0x06)
self.M1_SendData(0x17) #A
self.M1_SendData(0x17) #B
self.M1_SendData(0x39) #C
self.M1_SendData(0x17) # A
self.M1_SendData(0x17) # B
self.M1_SendData(0x39) # C
self.M1_SendData(0x17)
self.M2_SendCommand(0x06)
self.M2_SendData(0x17)
@@ -85,196 +88,197 @@ class EPD(object):
self.M2_SendData(0x39)
self.M2_SendData(0x17)
#resolution setting
# resolution setting
self.M1_SendCommand(0x61)
self.M1_SendData(0x02)
self.M1_SendData(0x88) #source 648
self.M1_SendData(0x01) #gate 492
self.M1_SendData(0x88) # source 648
self.M1_SendData(0x01) # gate 492
self.M1_SendData(0xEC)
self.S1_SendCommand(0x61)
self.S1_SendData(0x02)
self.S1_SendData(0x90) #source 656
self.S1_SendData(0x01) #gate 492
self.S1_SendData(0x90) # source 656
self.S1_SendData(0x01) # gate 492
self.S1_SendData(0xEC)
self.M2_SendCommand(0x61)
self.M2_SendData(0x02)
self.M2_SendData(0x90) #source 656
self.M2_SendData(0x01) #gate 492
self.M2_SendData(0x90) # source 656
self.M2_SendData(0x01) # gate 492
self.M2_SendData(0xEC)
self.S2_SendCommand(0x61)
self.S2_SendData(0x02)
self.S2_SendData(0x88) #source 648
self.S2_SendData(0x01) #gate 492
self.S2_SendData(0x88) # source 648
self.S2_SendData(0x01) # gate 492
self.S2_SendData(0xEC)
self.M1S1M2S2_SendCommand(0x15) #DUSPI
self.M1S1M2S2_SendCommand(0x15) # DUSPI
self.M1S1M2S2_SendData(0x20)
self.M1S1M2S2_SendCommand(0x50) #Vcom and data interval setting
self.M1S1M2S2_SendCommand(0x50) # Vcom and data interval setting
self.M1S1M2S2_SendData(0x11)
self.M1S1M2S2_SendData(0x07)
self.M1S1M2S2_SendCommand(0x60)#TCON
self.M1S1M2S2_SendCommand(0x60) # TCON
self.M1S1M2S2_SendData(0x22)
self.M1S1M2S2_SendCommand(0xE3)
self.M1S1M2S2_SendData(0x00)
self.M1_ReadTemperature()
self.SetLut()
def getbuffer(self, image):
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
buf = [0xFF] * (int(self.width/8) * self.height)
buf = [0xFF] * (int(self.width / 8) * self.height)
image_monocolor = image.convert('1')
imwidth, imheight = image_monocolor.size
pixels = image_monocolor.load()
if(imwidth == self.width and imheight == self.height):
if (imwidth == self.width and imheight == self.height):
for y in range(imheight):
for x in range(imwidth):
# Set the bits for the column of pixels at the current position.
if pixels[x, y] == 0:
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
elif(imwidth == self.height and imheight == self.width):
elif (imwidth == self.height and imheight == self.width):
for y in range(imheight):
for x in range(imwidth):
newx = y
newy = self.height - x - 1
if pixels[x, y] == 0:
buf[int((newx + newy*self.width) / 8)] &= ~(0x80 >> (y % 8))
return buf
def display(self, blackbuf, redbuf):
#S2 part 648*492
self.S2_SendCommand(0x10)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(blackbuf[y*163 + x])
self.S2_SendCommand(0x13)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(~redbuf[y*163 + x])
#M2 part 656*492
self.M2_SendCommand(0x10)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(blackbuf[y*163 + x])
self.M2_SendCommand(0x13)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(~redbuf[y*163 + x])
buf[int((newx + newy * self.width) / 8)] &= ~(0x80 >> (y % 8))
return buf
#M1 part 648*492
def display(self, blackbuf, redbuf):
# S2 part 648*492
self.S2_SendCommand(0x10)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(blackbuf[y * 163 + x])
self.S2_SendCommand(0x13)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(~redbuf[y * 163 + x])
# M2 part 656*492
self.M2_SendCommand(0x10)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(blackbuf[y * 163 + x])
self.M2_SendCommand(0x13)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(~redbuf[y * 163 + x])
# M1 part 648*492
self.M1_SendCommand(0x10)
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(blackbuf[y*163 + x])
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(blackbuf[y * 163 + x])
self.M1_SendCommand(0x13)
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(~redbuf[y*163 + x])
#S1 part 656*492
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(~redbuf[y * 163 + x])
# S1 part 656*492
self.S1_SendCommand(0x10)
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(blackbuf[y*163 + x])
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(blackbuf[y * 163 + x])
self.S1_SendCommand(0x13)
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(~redbuf[y*163 + x])
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(~redbuf[y * 163 + x])
self.TurnOnDisplay()
def clear(self):
"""Clear contents of image buffer"""
self.S2_SendCommand(0x10)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(0xff)
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(0xff)
self.S2_SendCommand(0x13)
for y in range(0, 492):
for x in range(0, 81):
for y in range(0, 492):
for x in range(0, 81):
self.S2_SendData(0x00)
self.M2_SendCommand(0x10)
for y in range(0, 492):
for x in range(81, 163):
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(0xff)
self.M2_SendCommand(0x13)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(0x00)
for y in range(0, 492):
for x in range(81, 163):
self.M2_SendData(0x00)
self.M1_SendCommand(0x10)
for y in range(492, 984):
for x in range(0, 81):
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(0xff)
self.M1_SendCommand(0x13)
for y in range(492, 984):
for x in range(0, 81):
for y in range(492, 984):
for x in range(0, 81):
self.M1_SendData(0x00)
self.S1_SendCommand(0x10)
for y in range(492, 984):
for x in range(81, 163):
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(0xff)
self.S1_SendCommand(0x13)
for y in range(492, 984):
for x in range(81, 163):
for y in range(492, 984):
for x in range(81, 163):
self.S1_SendData(0x00)
self.TurnOnDisplay()
def Reset(self):
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0)
time.sleep(0.01)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
def sleep(self):
self.M1S1M2S2_SendCommand(0X02)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0X07)
self.M1S1M2S2_SendData(0xA5)
time.sleep(0.3)
self.TurnOnDisplay()
def Reset(self):
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 0)
time.sleep(0.01)
epdconfig.digital_write(self.EPD_M1S1_RST_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_RST_PIN, 1)
time.sleep(0.2)
def sleep(self):
self.M1S1M2S2_SendCommand(0X02)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0X07)
self.M1S1M2S2_SendData(0xA5)
time.sleep(0.3)
print("module_exit")
epdconfig.module_exit()
def TurnOnDisplay(self):
self.M1M2_SendCommand(0x04)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0x12)
self.M1M2_SendCommand(0x04)
time.sleep(0.3)
self.M1S1M2S2_SendCommand(0x12)
self.M1_ReadBusy()
self.S1_ReadBusy()
self.M2_ReadBusy()
self.S2_ReadBusy()
self.S2_ReadBusy()
""" M1S1M2S2 Write register address and data """
def M1S1M2S2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
def M1S1M2S2_SendData(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
@@ -283,220 +287,232 @@ class EPD(object):
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
""" M1M2 Write register address and data """
def M1M2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
def M1M2_Sendata(self, val):
def M1M2_Sendata(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
""" S2 Write register address and data """
def S2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
def S2_SendData(self, val):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
""" M2 Write register address and data """
def M2_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
def M2_SendData(self, val):
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
""" S1 Write register address and data """
def S1_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
def S1_SendData(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
""" M1 Write register address and data """
def M1_SendCommand(self, cmd):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.spi_writebyte(cmd)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
def M1_SendData(self, val):
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.spi_writebyte(val)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
#Busy
# Busy
def M1_ReadBusy(self):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not(busy & 0x01)
while(busy):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not(busy & 0x01)
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not (busy & 0x01)
while (busy):
self.M1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def M2_ReadBusy(self):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not(busy & 0x01)
self.M2_SendCommand(0x71)
while(busy):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy =not(busy & 0x01)
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not (busy & 0x01)
self.M2_SendCommand(0x71)
while (busy):
self.M2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def S1_ReadBusy(self):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not(busy & 0x01)
while(busy):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not(busy & 0x01)
time.sleep(0.2)
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not (busy & 0x01)
while (busy):
self.S1_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
def S2_ReadBusy(self):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not(busy & 0x01)
while(busy):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not(busy & 0x01)
time.sleep(0.2)
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not (busy & 0x01)
while (busy):
self.S2_SendCommand(0x71)
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
busy = not (busy & 0x01)
time.sleep(0.2)
lut_vcom1 = [
0x00, 0x10, 0x10, 0x01, 0x08, 0x01,
0x00, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x08, 0x01, 0x08, 0x01, 0x06,
0x00, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x00, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x10, 0x01, 0x08, 0x01,
0x00, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x08, 0x01, 0x08, 0x01, 0x06,
0x00, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x00, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
lut_ww1 = [
0x91, 0x10, 0x10, 0x01, 0x08, 0x01,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x08, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x91, 0x10, 0x10, 0x01, 0x08, 0x01,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x08, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
lut_bw1 = [
0xA8, 0x10, 0x10, 0x01, 0x08, 0x01,
0x84, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x86, 0x06, 0x01, 0x06, 0x01, 0x05,
0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0xF0, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xA8, 0x10, 0x10, 0x01, 0x08, 0x01,
0x84, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x86, 0x06, 0x01, 0x06, 0x01, 0x05,
0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x8C, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0xF0, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
lut_wb1 = [
0x91, 0x10, 0x10, 0x01, 0x08, 0x01,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x08, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x91, 0x10, 0x10, 0x01, 0x08, 0x01,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x08, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
lut_bb1 = [
0x92, 0x10, 0x10, 0x01, 0x08, 0x01,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x01, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x92, 0x10, 0x10, 0x01, 0x08, 0x01,
0x80, 0x06, 0x01, 0x06, 0x01, 0x05,
0x84, 0x08, 0x01, 0x08, 0x01, 0x06,
0x04, 0x06, 0x01, 0x06, 0x01, 0x05,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x06,
0x00, 0x05, 0x01, 0x1E, 0x0F, 0x01,
0x01, 0x04, 0x05, 0x08, 0x08, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]
def SetLut(self):
self.M1S1M2S2_SendCommand(0x20) #vcom
self.M1S1M2S2_SendCommand(0x20) # vcom
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_vcom1[count])
self.M1S1M2S2_SendCommand(0x21) #red not use
self.M1S1M2S2_SendCommand(0x21) # red not use
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_ww1[count])
self.M1S1M2S2_SendCommand(0x22) #bw r
self.M1S1M2S2_SendCommand(0x22) # bw r
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_bw1[count]) # bw=r
self.M1S1M2S2_SendData(self.lut_bw1[count]) # bw=r
self.M1S1M2S2_SendCommand(0x23) #wb w
self.M1S1M2S2_SendCommand(0x23) # wb w
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_wb1[count]) # wb=w
self.M1S1M2S2_SendData(self.lut_wb1[count]) # wb=w
self.M1S1M2S2_SendCommand(0x24) #bb b
self.M1S1M2S2_SendCommand(0x24) # bb b
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b
self.M1S1M2S2_SendCommand(0x25) #bb b
self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b
self.M1S1M2S2_SendCommand(0x25) # bb b
for count in range(0, 60):
self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b
self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b
def M1_ReadTemperature(self):
self.M1_SendCommand(0x40)
self.M1_ReadBusy()
time.sleep(0.3)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
time.sleep(0.05)
temp = epdconfig.spi_readbyte(0x00)
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
self.M1S1M2S2_SendCommand(0xE0)
self.M1S1M2S2_SendData(0x03)
self.M1S1M2S2_SendCommand(0xE5)

View File

@@ -1,37 +1,35 @@
# *****************************************************************************
# * | File : epd4in2.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd4in2.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
from inkycal.display.drivers import epdconfig
from PIL import Image
import RPi.GPIO as GPIO
# Display resolution
EPD_WIDTH = 400
@@ -354,8 +352,8 @@ class EPD:
i = i + 1
if (i % 4 == 0):
buf[int((x + (y * self.width)) / 4)] = (
(pixels[x - 3, y] & 0xc0) | (pixels[x - 2, y] & 0xc0) >> 2 | (
pixels[x - 1, y] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6)
(pixels[x - 3, y] & 0xc0) | (pixels[x - 2, y] & 0xc0) >> 2 | (
pixels[x - 1, y] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6)
elif (imwidth == self.height and imheight == self.width):
logging.debug("Horizontal")
@@ -370,8 +368,8 @@ class EPD:
i = i + 1
if (i % 4 == 0):
buf[int((newx + (newy * self.width)) / 4)] = (
(pixels[x, y - 3] & 0xc0) | (pixels[x, y - 2] & 0xc0) >> 2 | (
pixels[x, y - 1] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6)
(pixels[x, y - 3] & 0xc0) | (pixels[x, y - 2] & 0xc0) >> 2 | (
pixels[x, y - 1] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6)
return buf

View File

@@ -1,33 +1,34 @@
# *****************************************************************************
# * | File : epd4in2bc.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd4in2bc.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
from inkycal.display.drivers import epdconfig
# Display resolution

View File

@@ -1,34 +1,34 @@
# *****************************************************************************
# * | File : epd5in83.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd5in83.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
from inkycal.display.drivers import epdconfig
# Display resolution

View File

@@ -1,34 +1,34 @@
# *****************************************************************************
# * | File : epd5in83b.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd5in83b.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
from inkycal.display.drivers import epdconfig
# Display resolution

View File

@@ -1,34 +1,34 @@
# *****************************************************************************
# * | File : epd7in5.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd7in5.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
from inkycal.display.drivers import epdconfig
# Display resolution

View File

@@ -1,34 +1,34 @@
# *****************************************************************************
# * | File : epd7in5bc.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd7in5bc.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
from inkycal.display.drivers import epdconfig
# Display resolution

View File

@@ -1,34 +1,34 @@
# *****************************************************************************
# * | File : epd7in5.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd7in5.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
from inkycal.display.drivers import epdconfig
# Display resolution
@@ -175,4 +175,4 @@ class EPD:
epdconfig.delay_ms(2000)
epdconfig.module_exit()
### END OF FILE ###
### END OF FILE ###

View File

@@ -1,34 +1,34 @@
# *****************************************************************************
# * | File : epd7in5bc.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd7in5bc.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
from inkycal.display.drivers import epdconfig
# Display resolution

View File

@@ -1,31 +1,31 @@
# *****************************************************************************
# * | File : epd7in5.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd7in5.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging

View File

@@ -1,31 +1,31 @@
# *****************************************************************************
# * | File : epd7in5bc.py
# * | Author : Waveshare team
# * | Function : Electronic paper driver
# * | Info :
# *----------------
# * | This version: V4.0
# * | Date : 2019-06-20
# # | Info : python demo
# -----------------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epd7in5bc.py
* | Author : Waveshare team
* | Function : Electronic paper driver
* | Info :
*----------------
* | This version: V4.0
* | Date : 2019-06-20
# | Info : python demo
-----------------------------------------------------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging

View File

@@ -1,34 +1,34 @@
# /*****************************************************************************
# * | File : epdconfig.py
# * | Author : Waveshare team
# * | Function : Hardware underlying interface
# * | Info :
# *----------------
# * | This version: V1.0
# * | Date : 2019-06-21
# * | Info :
# ******************************************************************************
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
"""
* | File : epdconfig.py
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-06-21
* | Info :
******************************************************************************
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import os
import logging
import os
import sys
import time

View File

@@ -1,39 +1,38 @@
# /*****************************************************************************
# * | File : epdconfig.py
# * | Author : Waveshare electrices
# * | Function : Hardware underlying interface
# * | Info :
# *----------------
# * | This version: V1.0
# * | Date : 2019-11-01
# * | Info :
# ******************************************************************************/
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation 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
# furished 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 OR 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.
#
import RPi.GPIO as GPIO
import time
import os
import logging
import sys
"""
* | File : epdconfig.py
* | Author : Waveshare electrices
* | Function : Hardware underlying interface
* | Info :
*----------------
* | This version: V1.0
* | Date : 2019-11-01
* | Info :
******************************************************************************/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documnetation 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
furished 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 OR 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.
"""
import logging
import os
import time
from ctypes import *
import RPi.GPIO as GPIO
EPD_SCK_PIN = 11
EPD_MOSI_PIN = 10

View File

@@ -1,6 +1,9 @@
"""Image file driver for testing"""
# Display resolution
EPD_WIDTH = 800
EPD_HEIGHT = 480
EPD_WIDTH = 800
EPD_HEIGHT = 480
class EPD:
def init(self):