Best practices & code cleanup
This commit is contained in:
parent
ad0610635e
commit
e710964e10
@ -1,4 +1,3 @@
|
|||||||
#!python3
|
|
||||||
"""
|
"""
|
||||||
Inkycal custom Exceptions
|
Inkycal custom Exceptions
|
||||||
"""
|
"""
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#!python3
|
|
||||||
"""
|
"""
|
||||||
10.3" driver class
|
10.3" driver class
|
||||||
Copyright by aceinnolab
|
Copyright by aceinnolab
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
#!python3
|
|
||||||
"""
|
"""
|
||||||
7.8" parallel driver class
|
7.8" parallel driver class
|
||||||
Copyright by aceinnolab
|
Copyright by aceinnolab
|
||||||
"""
|
"""
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
|
|
||||||
from inkycal.custom import image_folder, top_level
|
from inkycal.custom import image_folder, top_level
|
||||||
from os.path import exists
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
EPD_WIDTH = 1872
|
EPD_WIDTH = 1872
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
#!python3
|
|
||||||
"""
|
"""
|
||||||
9.7" driver class
|
9.7" driver class
|
||||||
Copyright by aceinnolab
|
Copyright by aceinnolab
|
||||||
"""
|
"""
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
|
|
||||||
from inkycal.custom import image_folder, top_level
|
from inkycal.custom import image_folder, top_level
|
||||||
from os.path import exists
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
EPD_WIDTH = 1200
|
EPD_WIDTH = 1200
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd5in83b_V2.py
|
* | File : epd5in83b_V2.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V1.1
|
* | This version: V1.1
|
||||||
# * | Date : 2022-08-10
|
* | Date : 2022-08-10
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
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 logging
|
||||||
|
|
||||||
from . import epdconfig
|
from . import epdconfig
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
@ -37,6 +37,7 @@ EPD_HEIGHT = 480
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@ -77,7 +78,7 @@ class EPD:
|
|||||||
def ReadBusy(self):
|
def ReadBusy(self):
|
||||||
logger.debug("e-Paper busy")
|
logger.debug("e-Paper busy")
|
||||||
self.send_command(0X71)
|
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)
|
self.send_command(0X71)
|
||||||
epdconfig.delay_ms(200)
|
epdconfig.delay_ms(200)
|
||||||
logger.debug("e-Paper busy release")
|
logger.debug("e-Paper busy release")
|
||||||
@ -88,59 +89,59 @@ class EPD:
|
|||||||
|
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
self.send_command(0x01) #POWER SETTING
|
self.send_command(0x01) # POWER SETTING
|
||||||
self.send_data (0x07)
|
self.send_data(0x07)
|
||||||
self.send_data (0x07) #VGH=20V,VGL=-20V
|
self.send_data(0x07) # VGH=20V,VGL=-20V
|
||||||
self.send_data (0x3f) #VDH=15V
|
self.send_data(0x3f) # VDH=15V
|
||||||
self.send_data (0x3f) #VDL=-15V
|
self.send_data(0x3f) # VDL=-15V
|
||||||
|
|
||||||
self.send_command(0x04) #POWER ON
|
self.send_command(0x04) # POWER ON
|
||||||
epdconfig.delay_ms(100)
|
epdconfig.delay_ms(100)
|
||||||
self.ReadBusy() #waiting for the electronic paper IC to release the idle signal
|
self.ReadBusy() # waiting for the electronic paper IC to release the idle signal
|
||||||
|
|
||||||
self.send_command(0X00) #PANNEL SETTING
|
self.send_command(0X00) # PANNEL SETTING
|
||||||
self.send_data(0x0F) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
self.send_data(0x0F) # KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||||
|
|
||||||
self.send_command(0x61) #tres
|
self.send_command(0x61) # tres
|
||||||
self.send_data (0x02) #source 648
|
self.send_data(0x02) # source 648
|
||||||
self.send_data (0x88)
|
self.send_data(0x88)
|
||||||
self.send_data (0x01) #gate 480
|
self.send_data(0x01) # gate 480
|
||||||
self.send_data (0xe0)
|
self.send_data(0xe0)
|
||||||
|
|
||||||
self.send_command(0X15)
|
self.send_command(0X15)
|
||||||
self.send_data(0x00)
|
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(0x11)
|
||||||
self.send_data(0x07)
|
self.send_data(0x07)
|
||||||
|
|
||||||
self.send_command(0X60) #TCON SETTING
|
self.send_command(0X60) # TCON SETTING
|
||||||
self.send_data(0x22)
|
self.send_data(0x22)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def getbuffer(self, image):
|
def getbuffer(self, image):
|
||||||
# logger.debug("bufsiz = ",int(self.width/8) * self.height)
|
# 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')
|
image_monocolor = image.convert('1')
|
||||||
imwidth, imheight = image_monocolor.size
|
imwidth, imheight = image_monocolor.size
|
||||||
pixels = image_monocolor.load()
|
pixels = image_monocolor.load()
|
||||||
# logger.debug("imwidth = %d, imheight = %d",imwidth,imheight)
|
# 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")
|
logger.debug("Vertical")
|
||||||
for y in range(imheight):
|
for y in range(imheight):
|
||||||
for x in range(imwidth):
|
for x in range(imwidth):
|
||||||
# Set the bits for the column of pixels at the current position.
|
# Set the bits for the column of pixels at the current position.
|
||||||
if pixels[x, y] == 0:
|
if pixels[x, y] == 0:
|
||||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
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")
|
logger.debug("Horizontal")
|
||||||
for y in range(imheight):
|
for y in range(imheight):
|
||||||
for x in range(imwidth):
|
for x in range(imwidth):
|
||||||
newx = y
|
newx = y
|
||||||
newy = self.height - x - 1
|
newy = self.height - x - 1
|
||||||
if pixels[x, y] == 0:
|
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
|
return buf
|
||||||
|
|
||||||
def display(self, imageblack, imagered):
|
def display(self, imageblack, imagered):
|
||||||
|
@ -1,37 +1,39 @@
|
|||||||
# /*****************************************************************************
|
"""
|
||||||
# * | File : epd12in48.py
|
* | File : epd12in48.py
|
||||||
# * | Author : Waveshare electrices
|
* | Author : Waveshare electrices
|
||||||
# * | Function : Hardware underlying interface
|
* | Function : Hardware underlying interface
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V1.0
|
* | This version: V1.0
|
||||||
# * | Date : 2019-11-01
|
* | Date : 2019-11-01
|
||||||
# * | Info :
|
* | Info :
|
||||||
# ******************************************************************************/
|
******************************************************************************/
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
furished to do so, subject to the following conditions:
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
# all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
#
|
"""
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
|
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
|
||||||
|
|
||||||
EPD_WIDTH = 1304
|
EPD_WIDTH = 1304
|
||||||
EPD_HEIGHT = 984
|
EPD_HEIGHT = 984
|
||||||
|
|
||||||
|
|
||||||
class EPD(object):
|
class EPD(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.width = EPD_WIDTH
|
self.width = EPD_WIDTH
|
||||||
@ -63,9 +65,9 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
self.Reset()
|
self.Reset()
|
||||||
|
|
||||||
#panel setting
|
# panel setting
|
||||||
self.M1_SendCommand(0x00)
|
self.M1_SendCommand(0x00)
|
||||||
self.M1_SendData(0x1f) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
self.M1_SendData(0x1f) # KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||||
self.S1_SendCommand(0x00)
|
self.S1_SendCommand(0x00)
|
||||||
self.S1_SendData(0x1f)
|
self.S1_SendData(0x1f)
|
||||||
self.M2_SendCommand(0x00)
|
self.M2_SendCommand(0x00)
|
||||||
@ -75,9 +77,9 @@ class EPD(object):
|
|||||||
|
|
||||||
# booster soft start
|
# booster soft start
|
||||||
self.M1_SendCommand(0x06)
|
self.M1_SendCommand(0x06)
|
||||||
self.M1_SendData(0x17) #A
|
self.M1_SendData(0x17) # A
|
||||||
self.M1_SendData(0x17) #B
|
self.M1_SendData(0x17) # B
|
||||||
self.M1_SendData(0x39) #C
|
self.M1_SendData(0x39) # C
|
||||||
self.M1_SendData(0x17)
|
self.M1_SendData(0x17)
|
||||||
self.M2_SendCommand(0x06)
|
self.M2_SendCommand(0x06)
|
||||||
self.M2_SendData(0x17)
|
self.M2_SendData(0x17)
|
||||||
@ -85,96 +87,96 @@ class EPD(object):
|
|||||||
self.M2_SendData(0x39)
|
self.M2_SendData(0x39)
|
||||||
self.M2_SendData(0x17)
|
self.M2_SendData(0x17)
|
||||||
|
|
||||||
#resolution setting
|
# resolution setting
|
||||||
self.M1_SendCommand(0x61)
|
self.M1_SendCommand(0x61)
|
||||||
self.M1_SendData(0x02)
|
self.M1_SendData(0x02)
|
||||||
self.M1_SendData(0x88) #source 648
|
self.M1_SendData(0x88) # source 648
|
||||||
self.M1_SendData(0x01) #gate 492
|
self.M1_SendData(0x01) # gate 492
|
||||||
self.M1_SendData(0xEC)
|
self.M1_SendData(0xEC)
|
||||||
self.S1_SendCommand(0x61)
|
self.S1_SendCommand(0x61)
|
||||||
self.S1_SendData(0x02)
|
self.S1_SendData(0x02)
|
||||||
self.S1_SendData(0x90) #source 656
|
self.S1_SendData(0x90) # source 656
|
||||||
self.S1_SendData(0x01) #gate 492
|
self.S1_SendData(0x01) # gate 492
|
||||||
self.S1_SendData(0xEC)
|
self.S1_SendData(0xEC)
|
||||||
self.M2_SendCommand(0x61)
|
self.M2_SendCommand(0x61)
|
||||||
self.M2_SendData(0x02)
|
self.M2_SendData(0x02)
|
||||||
self.M2_SendData(0x90) #source 656
|
self.M2_SendData(0x90) # source 656
|
||||||
self.M2_SendData(0x01) #gate 492
|
self.M2_SendData(0x01) # gate 492
|
||||||
self.M2_SendData(0xEC)
|
self.M2_SendData(0xEC)
|
||||||
self.S2_SendCommand(0x61)
|
self.S2_SendCommand(0x61)
|
||||||
self.S2_SendData(0x02)
|
self.S2_SendData(0x02)
|
||||||
self.S2_SendData(0x88) #source 648
|
self.S2_SendData(0x88) # source 648
|
||||||
self.S2_SendData(0x01) #gate 492
|
self.S2_SendData(0x01) # gate 492
|
||||||
self.S2_SendData(0xEC)
|
self.S2_SendData(0xEC)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x15) #DUSPI
|
self.M1S1M2S2_SendCommand(0x15) # DUSPI
|
||||||
self.M1S1M2S2_SendData(0x20)
|
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(0x21) #Border KW
|
self.M1S1M2S2_SendData(0x21) # Border KW
|
||||||
self.M1S1M2S2_SendData(0x07)
|
self.M1S1M2S2_SendData(0x07)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x60) #TCON
|
self.M1S1M2S2_SendCommand(0x60) # TCON
|
||||||
self.M1S1M2S2_SendData(0x22)
|
self.M1S1M2S2_SendData(0x22)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0xE3)
|
self.M1S1M2S2_SendCommand(0xE3)
|
||||||
self.M1S1M2S2_SendData(0x00)
|
self.M1S1M2S2_SendData(0x00)
|
||||||
|
|
||||||
#temperature
|
# temperature
|
||||||
temp = self.M1_ReadTemperature()
|
temp = self.M1_ReadTemperature()
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0xe0) #Cascade setting
|
self.M1S1M2S2_SendCommand(0xe0) # Cascade setting
|
||||||
self.M1S1M2S2_SendData(0x03)
|
self.M1S1M2S2_SendData(0x03)
|
||||||
self.M1S1M2S2_SendCommand(0xe5) #Force temperature
|
self.M1S1M2S2_SendCommand(0xe5) # Force temperature
|
||||||
self.M1S1M2S2_SendData(temp)
|
self.M1S1M2S2_SendData(temp)
|
||||||
|
|
||||||
def getbuffer(self, image):
|
def getbuffer(self, image):
|
||||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
# 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')
|
image_monocolor = image.convert('1')
|
||||||
imwidth, imheight = image_monocolor.size
|
imwidth, imheight = image_monocolor.size
|
||||||
pixels = image_monocolor.load()
|
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 y in range(imheight):
|
||||||
for x in range(imwidth):
|
for x in range(imwidth):
|
||||||
# Set the bits for the column of pixels at the current position.
|
# Set the bits for the column of pixels at the current position.
|
||||||
if pixels[x, y] == 0:
|
if pixels[x, y] == 0:
|
||||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
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 y in range(imheight):
|
||||||
for x in range(imwidth):
|
for x in range(imwidth):
|
||||||
newx = y
|
newx = y
|
||||||
newy = self.height - x - 1
|
newy = self.height - x - 1
|
||||||
if pixels[x, y] == 0:
|
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
|
return buf
|
||||||
|
|
||||||
def display(self, buf):
|
def display(self, buf):
|
||||||
|
|
||||||
#M1 part 648*492
|
# M1 part 648*492
|
||||||
self.M1_SendCommand(0x13)
|
self.M1_SendCommand(0x13)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.M1_SendData(buf[y*163 + x])
|
self.M1_SendData(buf[y * 163 + x])
|
||||||
|
|
||||||
#S1 part 656*492
|
# S1 part 656*492
|
||||||
self.S1_SendCommand(0x13)
|
self.S1_SendCommand(0x13)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.S1_SendData(buf[y*163 + x])
|
self.S1_SendData(buf[y * 163 + x])
|
||||||
|
|
||||||
#M2 part 656*492
|
# M2 part 656*492
|
||||||
self.M2_SendCommand(0x13)
|
self.M2_SendCommand(0x13)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.M2_SendData(buf[y*163 + x])
|
self.M2_SendData(buf[y * 163 + x])
|
||||||
|
|
||||||
#S2 part 648*492
|
# S2 part 648*492
|
||||||
self.S2_SendCommand(0x13)
|
self.S2_SendCommand(0x13)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.S2_SendData(buf[y*163 + x])
|
self.S2_SendData(buf[y * 163 + x])
|
||||||
|
|
||||||
self.TurnOnDisplay()
|
self.TurnOnDisplay()
|
||||||
|
|
||||||
@ -202,6 +204,7 @@ class EPD(object):
|
|||||||
self.TurnOnDisplay()
|
self.TurnOnDisplay()
|
||||||
|
|
||||||
""" M1S1M2S2 Write register address and data """
|
""" M1S1M2S2 Write register address and data """
|
||||||
|
|
||||||
def M1S1M2S2_SendCommand(self, cmd):
|
def M1S1M2S2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
@ -231,6 +234,7 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
""" M1M2 Write register address and data """
|
""" M1M2 Write register address and data """
|
||||||
|
|
||||||
def M1M2_SendCommand(self, cmd):
|
def M1M2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
@ -250,13 +254,13 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
||||||
|
|
||||||
""" S2 Write register address and data """
|
""" S2 Write register address and data """
|
||||||
|
|
||||||
def S2_SendCommand(self, cmd):
|
def S2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_S2_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_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
|
|
||||||
def S2_SendData(self, val):
|
def S2_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
|
||||||
@ -264,6 +268,7 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
""" M2 Write register address and data """
|
""" M2 Write register address and data """
|
||||||
|
|
||||||
def M2_SendCommand(self, cmd):
|
def M2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
|
||||||
@ -277,6 +282,7 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
||||||
|
|
||||||
""" S1 Write register address and data """
|
""" S1 Write register address and data """
|
||||||
|
|
||||||
def S1_SendCommand(self, cmd):
|
def S1_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
||||||
@ -290,6 +296,7 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
||||||
|
|
||||||
""" M1 Write register address and data """
|
""" M1 Write register address and data """
|
||||||
|
|
||||||
def M1_SendCommand(self, cmd):
|
def M1_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
|
||||||
@ -323,7 +330,6 @@ class EPD(object):
|
|||||||
print("module_exit")
|
print("module_exit")
|
||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
|
|
||||||
|
|
||||||
def TurnOnDisplay(self):
|
def TurnOnDisplay(self):
|
||||||
self.M1M2_SendCommand(0x04)
|
self.M1M2_SendCommand(0x04)
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
@ -333,49 +339,49 @@ class EPD(object):
|
|||||||
self.M2_ReadBusy()
|
self.M2_ReadBusy()
|
||||||
self.S2_ReadBusy()
|
self.S2_ReadBusy()
|
||||||
|
|
||||||
#Busy
|
# Busy
|
||||||
def M1_ReadBusy(self):
|
def M1_ReadBusy(self):
|
||||||
self.M1_SendCommand(0x71)
|
self.M1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
print("M1_ReadBusy")
|
print("M1_ReadBusy")
|
||||||
while(busy):
|
while (busy):
|
||||||
self.M1_SendCommand(0x71)
|
self.M1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def M2_ReadBusy(self):
|
def M2_ReadBusy(self):
|
||||||
self.M2_SendCommand(0x71)
|
self.M2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
print("M2_ReadBusy")
|
print("M2_ReadBusy")
|
||||||
while(busy):
|
while (busy):
|
||||||
self.M2_SendCommand(0x71)
|
self.M2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
||||||
busy =not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def S1_ReadBusy(self):
|
def S1_ReadBusy(self):
|
||||||
self.S1_SendCommand(0x71)
|
self.S1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
print("s1_ReadBusy")
|
print("s1_ReadBusy")
|
||||||
while(busy):
|
while (busy):
|
||||||
self.S1_SendCommand(0x71)
|
self.S1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def S2_ReadBusy(self):
|
def S2_ReadBusy(self):
|
||||||
self.S2_SendCommand(0x71)
|
self.S2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
print("S2_ReadBusy")
|
print("S2_ReadBusy")
|
||||||
while(busy):
|
while (busy):
|
||||||
self.S2_SendCommand(0x71)
|
self.S2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def M1_ReadTemperature(self):
|
def M1_ReadTemperature(self):
|
||||||
@ -393,7 +399,7 @@ class EPD(object):
|
|||||||
|
|
||||||
# temp = epdconfig.spi_readbyte(0x00)
|
# temp = epdconfig.spi_readbyte(0x00)
|
||||||
temp = 25
|
temp = 25
|
||||||
print("Read Temperature Reg:%d"%temp)
|
print("Read Temperature Reg:%d" % temp)
|
||||||
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M1_CS_PIN, 1)
|
||||||
# temp =0x29
|
# temp =0x29
|
||||||
return temp
|
return temp
|
||||||
|
@ -1,37 +1,39 @@
|
|||||||
# /*****************************************************************************
|
"""
|
||||||
# * | File : epd12in48.py
|
* | File : epd12in48.py
|
||||||
# * | Author : Waveshare electrices
|
* | Author : Waveshare electrices
|
||||||
# * | Function : Hardware underlying interface
|
* | Function : Hardware underlying interface
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V1.0
|
* | This version: V1.0
|
||||||
# * | Date : 2019-11-01
|
* | Date : 2019-11-01
|
||||||
# * | Info :
|
* | Info :
|
||||||
# ******************************************************************************/
|
******************************************************************************/
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
furished to do so, subject to the following conditions:
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
# all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
#
|
"""
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
|
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
|
||||||
|
|
||||||
EPD_WIDTH = 1304
|
EPD_WIDTH = 1304
|
||||||
EPD_HEIGHT = 984
|
EPD_HEIGHT = 984
|
||||||
|
|
||||||
|
|
||||||
class EPD(object):
|
class EPD(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.width = EPD_WIDTH
|
self.width = EPD_WIDTH
|
||||||
@ -63,9 +65,9 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
self.Reset()
|
self.Reset()
|
||||||
|
|
||||||
#panel setting
|
# panel setting
|
||||||
self.M1_SendCommand(0x00)
|
self.M1_SendCommand(0x00)
|
||||||
self.M1_SendData(0x2f) #KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
self.M1_SendData(0x2f) # KW-3f KWR-2F BWROTP 0f BWOTP 1f
|
||||||
self.S1_SendCommand(0x00)
|
self.S1_SendCommand(0x00)
|
||||||
self.S1_SendData(0x2f)
|
self.S1_SendData(0x2f)
|
||||||
self.M2_SendCommand(0x00)
|
self.M2_SendCommand(0x00)
|
||||||
@ -89,9 +91,9 @@ class EPD(object):
|
|||||||
|
|
||||||
# booster soft start
|
# booster soft start
|
||||||
self.M1_SendCommand(0x06)
|
self.M1_SendCommand(0x06)
|
||||||
self.M1_SendData(0x17) #A
|
self.M1_SendData(0x17) # A
|
||||||
self.M1_SendData(0x17) #B
|
self.M1_SendData(0x17) # B
|
||||||
self.M1_SendData(0x39) #C
|
self.M1_SendData(0x39) # C
|
||||||
self.M1_SendData(0x17)
|
self.M1_SendData(0x17)
|
||||||
self.M2_SendCommand(0x06)
|
self.M2_SendCommand(0x06)
|
||||||
self.M2_SendData(0x17)
|
self.M2_SendData(0x17)
|
||||||
@ -99,44 +101,44 @@ class EPD(object):
|
|||||||
self.M2_SendData(0x39)
|
self.M2_SendData(0x39)
|
||||||
self.M2_SendData(0x17)
|
self.M2_SendData(0x17)
|
||||||
|
|
||||||
#resolution setting
|
# resolution setting
|
||||||
self.M1_SendCommand(0x61)
|
self.M1_SendCommand(0x61)
|
||||||
self.M1_SendData(0x02)
|
self.M1_SendData(0x02)
|
||||||
self.M1_SendData(0x88) #source 648
|
self.M1_SendData(0x88) # source 648
|
||||||
self.M1_SendData(0x01) #gate 492
|
self.M1_SendData(0x01) # gate 492
|
||||||
self.M1_SendData(0xEC)
|
self.M1_SendData(0xEC)
|
||||||
self.S1_SendCommand(0x61)
|
self.S1_SendCommand(0x61)
|
||||||
self.S1_SendData(0x02)
|
self.S1_SendData(0x02)
|
||||||
self.S1_SendData(0x90) #source 656
|
self.S1_SendData(0x90) # source 656
|
||||||
self.S1_SendData(0x01) #gate 492
|
self.S1_SendData(0x01) # gate 492
|
||||||
self.S1_SendData(0xEC)
|
self.S1_SendData(0xEC)
|
||||||
self.M2_SendCommand(0x61)
|
self.M2_SendCommand(0x61)
|
||||||
self.M2_SendData(0x02)
|
self.M2_SendData(0x02)
|
||||||
self.M2_SendData(0x90) #source 656
|
self.M2_SendData(0x90) # source 656
|
||||||
self.M2_SendData(0x01) #gate 492
|
self.M2_SendData(0x01) # gate 492
|
||||||
self.M2_SendData(0xEC)
|
self.M2_SendData(0xEC)
|
||||||
self.S2_SendCommand(0x61)
|
self.S2_SendCommand(0x61)
|
||||||
self.S2_SendData(0x02)
|
self.S2_SendData(0x02)
|
||||||
self.S2_SendData(0x88) #source 648
|
self.S2_SendData(0x88) # source 648
|
||||||
self.S2_SendData(0x01) #gate 492
|
self.S2_SendData(0x01) # gate 492
|
||||||
self.S2_SendData(0xEC)
|
self.S2_SendData(0xEC)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x15) #DUSPI
|
self.M1S1M2S2_SendCommand(0x15) # DUSPI
|
||||||
self.M1S1M2S2_SendData(0x20)
|
self.M1S1M2S2_SendData(0x20)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x30) # PLL
|
self.M1S1M2S2_SendCommand(0x30) # PLL
|
||||||
self.M1S1M2S2_SendData(0x08)
|
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(0x31)
|
||||||
self.M1S1M2S2_SendData(0x07)
|
self.M1S1M2S2_SendData(0x07)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x60)#TCON
|
self.M1S1M2S2_SendCommand(0x60) # TCON
|
||||||
self.M1S1M2S2_SendData(0x22)
|
self.M1S1M2S2_SendData(0x22)
|
||||||
|
|
||||||
self.M1_SendCommand(0xE0) #POWER SETTING
|
self.M1_SendCommand(0xE0) # POWER SETTING
|
||||||
self.M1_SendData(0x01)
|
self.M1_SendData(0x01)
|
||||||
self.M2_SendCommand(0xE0) #POWER SETTING
|
self.M2_SendCommand(0xE0) # POWER SETTING
|
||||||
self.M2_SendData(0x01)
|
self.M2_SendData(0x01)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0xE3)
|
self.M1S1M2S2_SendCommand(0xE3)
|
||||||
@ -151,67 +153,67 @@ class EPD(object):
|
|||||||
|
|
||||||
def getbuffer(self, image):
|
def getbuffer(self, image):
|
||||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
# 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')
|
image_monocolor = image.convert('1')
|
||||||
imwidth, imheight = image_monocolor.size
|
imwidth, imheight = image_monocolor.size
|
||||||
pixels = image_monocolor.load()
|
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 y in range(imheight):
|
||||||
for x in range(imwidth):
|
for x in range(imwidth):
|
||||||
# Set the bits for the column of pixels at the current position.
|
# Set the bits for the column of pixels at the current position.
|
||||||
if pixels[x, y] == 0:
|
if pixels[x, y] == 0:
|
||||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
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 y in range(imheight):
|
||||||
for x in range(imwidth):
|
for x in range(imwidth):
|
||||||
newx = y
|
newx = y
|
||||||
newy = self.height - x - 1
|
newy = self.height - x - 1
|
||||||
if pixels[x, y] == 0:
|
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
|
return buf
|
||||||
|
|
||||||
def display(self, blackbuf, redbuf):
|
def display(self, blackbuf, redbuf):
|
||||||
|
|
||||||
#S2 part 648*492
|
# S2 part 648*492
|
||||||
self.S2_SendCommand(0x10)
|
self.S2_SendCommand(0x10)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.S2_SendData(blackbuf[y*163 + x])
|
self.S2_SendData(blackbuf[y * 163 + x])
|
||||||
self.S2_SendCommand(0x13)
|
self.S2_SendCommand(0x13)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.S2_SendData(~redbuf[y*163 + x])
|
self.S2_SendData(~redbuf[y * 163 + x])
|
||||||
|
|
||||||
#M2 part 656*492
|
# M2 part 656*492
|
||||||
self.M2_SendCommand(0x10)
|
self.M2_SendCommand(0x10)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.M2_SendData(blackbuf[y*163 + x])
|
self.M2_SendData(blackbuf[y * 163 + x])
|
||||||
self.M2_SendCommand(0x13)
|
self.M2_SendCommand(0x13)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.M2_SendData(~redbuf[y*163 + x])
|
self.M2_SendData(~redbuf[y * 163 + x])
|
||||||
|
|
||||||
#M1 part 648*492
|
# M1 part 648*492
|
||||||
self.M1_SendCommand(0x10)
|
self.M1_SendCommand(0x10)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.M1_SendData(blackbuf[y*163 + x])
|
self.M1_SendData(blackbuf[y * 163 + x])
|
||||||
self.M1_SendCommand(0x13)
|
self.M1_SendCommand(0x13)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.M1_SendData(~redbuf[y*163 + x])
|
self.M1_SendData(~redbuf[y * 163 + x])
|
||||||
|
|
||||||
#S1 part 656*492
|
# S1 part 656*492
|
||||||
self.S1_SendCommand(0x10)
|
self.S1_SendCommand(0x10)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.S1_SendData(blackbuf[y*163 + x])
|
self.S1_SendData(blackbuf[y * 163 + x])
|
||||||
self.S1_SendCommand(0x13)
|
self.S1_SendCommand(0x13)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.S1_SendData(~redbuf[y*163 + x])
|
self.S1_SendData(~redbuf[y * 163 + x])
|
||||||
self.TurnOnDisplay()
|
self.TurnOnDisplay()
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
@ -286,6 +288,7 @@ class EPD(object):
|
|||||||
self.S2_ReadBusy()
|
self.S2_ReadBusy()
|
||||||
|
|
||||||
""" M1S1M2S2 Write register address and data """
|
""" M1S1M2S2 Write register address and data """
|
||||||
|
|
||||||
def M1S1M2S2_SendCommand(self, cmd):
|
def M1S1M2S2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
@ -315,6 +318,7 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
""" M1M2 Write register address and data """
|
""" M1M2 Write register address and data """
|
||||||
|
|
||||||
def M1M2_SendCommand(self, cmd):
|
def M1M2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
@ -334,11 +338,13 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
||||||
|
|
||||||
""" S2 Write register address and data """
|
""" S2 Write register address and data """
|
||||||
|
|
||||||
def S2_SendCommand(self, cmd):
|
def S2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_S2_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_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
def S2_SendData(self, val):
|
def S2_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
|
||||||
@ -346,11 +352,13 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
""" M2 Write register address and data """
|
""" M2 Write register address and data """
|
||||||
|
|
||||||
def M2_SendCommand(self, cmd):
|
def M2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2_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_M2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
||||||
|
|
||||||
def M2_SendData(self, val):
|
def M2_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
|
||||||
@ -358,11 +366,13 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
||||||
|
|
||||||
""" S1 Write register address and data """
|
""" S1 Write register address and data """
|
||||||
|
|
||||||
def S1_SendCommand(self, cmd):
|
def S1_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
||||||
epdconfig.spi_writebyte(cmd)
|
epdconfig.spi_writebyte(cmd)
|
||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
||||||
|
|
||||||
def S1_SendData(self, val):
|
def S1_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
||||||
@ -370,54 +380,59 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
||||||
|
|
||||||
""" M1 Write register address and data """
|
""" M1 Write register address and data """
|
||||||
|
|
||||||
def M1_SendCommand(self, cmd):
|
def M1_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1_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_M1_CS_PIN, 1)
|
||||||
|
|
||||||
def M1_SendData(self, val):
|
def M1_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1_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_M1_CS_PIN, 1)
|
||||||
|
|
||||||
#Busy
|
# Busy
|
||||||
def M1_ReadBusy(self):
|
def M1_ReadBusy(self):
|
||||||
self.M1_SendCommand(0x71)
|
self.M1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
while(busy):
|
while (busy):
|
||||||
self.M1_SendCommand(0x71)
|
self.M1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def M2_ReadBusy(self):
|
def M2_ReadBusy(self):
|
||||||
self.M2_SendCommand(0x71)
|
self.M2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
self.M2_SendCommand(0x71)
|
self.M2_SendCommand(0x71)
|
||||||
while(busy):
|
while (busy):
|
||||||
self.M2_SendCommand(0x71)
|
self.M2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
||||||
busy =not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def S1_ReadBusy(self):
|
def S1_ReadBusy(self):
|
||||||
self.S1_SendCommand(0x71)
|
self.S1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
while(busy):
|
while (busy):
|
||||||
self.S1_SendCommand(0x71)
|
self.S1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def S2_ReadBusy(self):
|
def S2_ReadBusy(self):
|
||||||
self.S2_SendCommand(0x71)
|
self.S2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
while(busy):
|
while (busy):
|
||||||
self.S2_SendCommand(0x71)
|
self.S2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
lut_vcom1 = [
|
lut_vcom1 = [
|
||||||
@ -482,26 +497,26 @@ class EPD(object):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def SetLut(self):
|
def SetLut(self):
|
||||||
self.M1S1M2S2_SendCommand(0x20) #vcom
|
self.M1S1M2S2_SendCommand(0x20) # vcom
|
||||||
for count in range(0, 60):
|
for count in range(0, 60):
|
||||||
self.M1S1M2S2_SendData(self.lut_vcom1[count])
|
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):
|
for count in range(0, 60):
|
||||||
self.M1S1M2S2_SendData(self.lut_ww1[count])
|
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):
|
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):
|
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):
|
for count in range(0, 60):
|
||||||
self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b
|
self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x25) #bb b
|
self.M1S1M2S2_SendCommand(0x25) # bb b
|
||||||
for count in range(0, 60):
|
for count in range(0, 60):
|
||||||
self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b
|
self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b
|
||||||
|
@ -1,37 +1,40 @@
|
|||||||
# /*****************************************************************************
|
"""
|
||||||
# * | File : epd_12_in_48_colour.py
|
* | File : epd_12_in_48_colour.py
|
||||||
# * | Author : Waveshare electrices, modified by Sebastien Harnist
|
* | Author : Waveshare electrices, modified by Sebastien Harnist
|
||||||
# * | Function : Hardware underlying interface
|
* | Function : Hardware underlying interface
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V1.1
|
* | This version: V1.1
|
||||||
# * | Date : 2022-11-23
|
* | Date : 2022-11-23
|
||||||
# * | Info :
|
* | Info :
|
||||||
# ******************************************************************************/
|
******************************************************************************/
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
furished to do so, subject to the following conditions:
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
# all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
#
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
|
from inkycal.display.drivers import epdconfig_12_in_48 as epdconfig
|
||||||
|
|
||||||
EPD_WIDTH = 1304
|
EPD_WIDTH = 1304
|
||||||
EPD_HEIGHT = 984
|
EPD_HEIGHT = 984
|
||||||
|
|
||||||
|
|
||||||
class EPD(object):
|
class EPD(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.width = EPD_WIDTH
|
self.width = EPD_WIDTH
|
||||||
@ -65,7 +68,7 @@ class EPD(object):
|
|||||||
|
|
||||||
# panel setting for Display
|
# panel setting for Display
|
||||||
self.M1_SendCommand(0x00)
|
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_SendCommand(0x00)
|
||||||
self.S1_SendData(0x0f)
|
self.S1_SendData(0x0f)
|
||||||
self.M2_SendCommand(0x00)
|
self.M2_SendCommand(0x00)
|
||||||
@ -75,9 +78,9 @@ class EPD(object):
|
|||||||
|
|
||||||
# booster soft start
|
# booster soft start
|
||||||
self.M1_SendCommand(0x06)
|
self.M1_SendCommand(0x06)
|
||||||
self.M1_SendData(0x17) #A
|
self.M1_SendData(0x17) # A
|
||||||
self.M1_SendData(0x17) #B
|
self.M1_SendData(0x17) # B
|
||||||
self.M1_SendData(0x39) #C
|
self.M1_SendData(0x39) # C
|
||||||
self.M1_SendData(0x17)
|
self.M1_SendData(0x17)
|
||||||
self.M2_SendCommand(0x06)
|
self.M2_SendCommand(0x06)
|
||||||
self.M2_SendData(0x17)
|
self.M2_SendData(0x17)
|
||||||
@ -85,36 +88,36 @@ class EPD(object):
|
|||||||
self.M2_SendData(0x39)
|
self.M2_SendData(0x39)
|
||||||
self.M2_SendData(0x17)
|
self.M2_SendData(0x17)
|
||||||
|
|
||||||
#resolution setting
|
# resolution setting
|
||||||
self.M1_SendCommand(0x61)
|
self.M1_SendCommand(0x61)
|
||||||
self.M1_SendData(0x02)
|
self.M1_SendData(0x02)
|
||||||
self.M1_SendData(0x88) #source 648
|
self.M1_SendData(0x88) # source 648
|
||||||
self.M1_SendData(0x01) #gate 492
|
self.M1_SendData(0x01) # gate 492
|
||||||
self.M1_SendData(0xEC)
|
self.M1_SendData(0xEC)
|
||||||
self.S1_SendCommand(0x61)
|
self.S1_SendCommand(0x61)
|
||||||
self.S1_SendData(0x02)
|
self.S1_SendData(0x02)
|
||||||
self.S1_SendData(0x90) #source 656
|
self.S1_SendData(0x90) # source 656
|
||||||
self.S1_SendData(0x01) #gate 492
|
self.S1_SendData(0x01) # gate 492
|
||||||
self.S1_SendData(0xEC)
|
self.S1_SendData(0xEC)
|
||||||
self.M2_SendCommand(0x61)
|
self.M2_SendCommand(0x61)
|
||||||
self.M2_SendData(0x02)
|
self.M2_SendData(0x02)
|
||||||
self.M2_SendData(0x90) #source 656
|
self.M2_SendData(0x90) # source 656
|
||||||
self.M2_SendData(0x01) #gate 492
|
self.M2_SendData(0x01) # gate 492
|
||||||
self.M2_SendData(0xEC)
|
self.M2_SendData(0xEC)
|
||||||
self.S2_SendCommand(0x61)
|
self.S2_SendCommand(0x61)
|
||||||
self.S2_SendData(0x02)
|
self.S2_SendData(0x02)
|
||||||
self.S2_SendData(0x88) #source 648
|
self.S2_SendData(0x88) # source 648
|
||||||
self.S2_SendData(0x01) #gate 492
|
self.S2_SendData(0x01) # gate 492
|
||||||
self.S2_SendData(0xEC)
|
self.S2_SendData(0xEC)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x15) #DUSPI
|
self.M1S1M2S2_SendCommand(0x15) # DUSPI
|
||||||
self.M1S1M2S2_SendData(0x20)
|
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(0x11)
|
||||||
self.M1S1M2S2_SendData(0x07)
|
self.M1S1M2S2_SendData(0x07)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x60)#TCON
|
self.M1S1M2S2_SendCommand(0x60) # TCON
|
||||||
self.M1S1M2S2_SendData(0x22)
|
self.M1S1M2S2_SendData(0x22)
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0xE3)
|
self.M1S1M2S2_SendCommand(0xE3)
|
||||||
@ -126,67 +129,67 @@ class EPD(object):
|
|||||||
|
|
||||||
def getbuffer(self, image):
|
def getbuffer(self, image):
|
||||||
# logging.debug("bufsiz = ",int(self.width/8) * self.height)
|
# 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')
|
image_monocolor = image.convert('1')
|
||||||
imwidth, imheight = image_monocolor.size
|
imwidth, imheight = image_monocolor.size
|
||||||
pixels = image_monocolor.load()
|
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 y in range(imheight):
|
||||||
for x in range(imwidth):
|
for x in range(imwidth):
|
||||||
# Set the bits for the column of pixels at the current position.
|
# Set the bits for the column of pixels at the current position.
|
||||||
if pixels[x, y] == 0:
|
if pixels[x, y] == 0:
|
||||||
buf[int((x + y * self.width) / 8)] &= ~(0x80 >> (x % 8))
|
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 y in range(imheight):
|
||||||
for x in range(imwidth):
|
for x in range(imwidth):
|
||||||
newx = y
|
newx = y
|
||||||
newy = self.height - x - 1
|
newy = self.height - x - 1
|
||||||
if pixels[x, y] == 0:
|
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
|
return buf
|
||||||
|
|
||||||
def display(self, blackbuf, redbuf):
|
def display(self, blackbuf, redbuf):
|
||||||
|
|
||||||
#S2 part 648*492
|
# S2 part 648*492
|
||||||
self.S2_SendCommand(0x10)
|
self.S2_SendCommand(0x10)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.S2_SendData(blackbuf[y*163 + x])
|
self.S2_SendData(blackbuf[y * 163 + x])
|
||||||
self.S2_SendCommand(0x13)
|
self.S2_SendCommand(0x13)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.S2_SendData(~redbuf[y*163 + x])
|
self.S2_SendData(~redbuf[y * 163 + x])
|
||||||
|
|
||||||
#M2 part 656*492
|
# M2 part 656*492
|
||||||
self.M2_SendCommand(0x10)
|
self.M2_SendCommand(0x10)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.M2_SendData(blackbuf[y*163 + x])
|
self.M2_SendData(blackbuf[y * 163 + x])
|
||||||
self.M2_SendCommand(0x13)
|
self.M2_SendCommand(0x13)
|
||||||
for y in range(0, 492):
|
for y in range(0, 492):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.M2_SendData(~redbuf[y*163 + x])
|
self.M2_SendData(~redbuf[y * 163 + x])
|
||||||
|
|
||||||
#M1 part 648*492
|
# M1 part 648*492
|
||||||
self.M1_SendCommand(0x10)
|
self.M1_SendCommand(0x10)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.M1_SendData(blackbuf[y*163 + x])
|
self.M1_SendData(blackbuf[y * 163 + x])
|
||||||
self.M1_SendCommand(0x13)
|
self.M1_SendCommand(0x13)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(0, 81):
|
for x in range(0, 81):
|
||||||
self.M1_SendData(~redbuf[y*163 + x])
|
self.M1_SendData(~redbuf[y * 163 + x])
|
||||||
|
|
||||||
#S1 part 656*492
|
# S1 part 656*492
|
||||||
self.S1_SendCommand(0x10)
|
self.S1_SendCommand(0x10)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.S1_SendData(blackbuf[y*163 + x])
|
self.S1_SendData(blackbuf[y * 163 + x])
|
||||||
self.S1_SendCommand(0x13)
|
self.S1_SendCommand(0x13)
|
||||||
for y in range(492, 984):
|
for y in range(492, 984):
|
||||||
for x in range(81, 163):
|
for x in range(81, 163):
|
||||||
self.S1_SendData(~redbuf[y*163 + x])
|
self.S1_SendData(~redbuf[y * 163 + x])
|
||||||
self.TurnOnDisplay()
|
self.TurnOnDisplay()
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
@ -261,6 +264,7 @@ class EPD(object):
|
|||||||
self.S2_ReadBusy()
|
self.S2_ReadBusy()
|
||||||
|
|
||||||
""" M1S1M2S2 Write register address and data """
|
""" M1S1M2S2 Write register address and data """
|
||||||
|
|
||||||
def M1S1M2S2_SendCommand(self, cmd):
|
def M1S1M2S2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
@ -290,6 +294,7 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
""" M1M2 Write register address and data """
|
""" M1M2 Write register address and data """
|
||||||
|
|
||||||
def M1M2_SendCommand(self, cmd):
|
def M1M2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
@ -309,11 +314,13 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
||||||
|
|
||||||
""" S2 Write register address and data """
|
""" S2 Write register address and data """
|
||||||
|
|
||||||
def S2_SendCommand(self, cmd):
|
def S2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_S2_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_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
def S2_SendData(self, val):
|
def S2_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 0)
|
||||||
@ -321,11 +328,13 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S2_CS_PIN, 1)
|
||||||
|
|
||||||
""" M2 Write register address and data """
|
""" M2 Write register address and data """
|
||||||
|
|
||||||
def M2_SendCommand(self, cmd):
|
def M2_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M2_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_M2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
||||||
|
|
||||||
def M2_SendData(self, val):
|
def M2_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2S2_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 0)
|
||||||
@ -333,11 +342,13 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_M2_CS_PIN, 1)
|
||||||
|
|
||||||
""" S1 Write register address and data """
|
""" S1 Write register address and data """
|
||||||
|
|
||||||
def S1_SendCommand(self, cmd):
|
def S1_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
||||||
epdconfig.spi_writebyte(cmd)
|
epdconfig.spi_writebyte(cmd)
|
||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
||||||
|
|
||||||
def S1_SendData(self, val):
|
def S1_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 0)
|
||||||
@ -345,54 +356,59 @@ class EPD(object):
|
|||||||
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
epdconfig.digital_write(self.EPD_S1_CS_PIN, 1)
|
||||||
|
|
||||||
""" M1 Write register address and data """
|
""" M1 Write register address and data """
|
||||||
|
|
||||||
def M1_SendCommand(self, cmd):
|
def M1_SendCommand(self, cmd):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 0)
|
||||||
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1_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_M1_CS_PIN, 1)
|
||||||
|
|
||||||
def M1_SendData(self, val):
|
def M1_SendData(self, val):
|
||||||
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
|
epdconfig.digital_write(self.EPD_M1S1_DC_PIN, 1)
|
||||||
epdconfig.digital_write(self.EPD_M1_CS_PIN, 0)
|
epdconfig.digital_write(self.EPD_M1_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_M1_CS_PIN, 1)
|
||||||
|
|
||||||
#Busy
|
# Busy
|
||||||
def M1_ReadBusy(self):
|
def M1_ReadBusy(self):
|
||||||
self.M1_SendCommand(0x71)
|
self.M1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
while(busy):
|
while (busy):
|
||||||
self.M1_SendCommand(0x71)
|
self.M1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def M2_ReadBusy(self):
|
def M2_ReadBusy(self):
|
||||||
self.M2_SendCommand(0x71)
|
self.M2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
self.M2_SendCommand(0x71)
|
self.M2_SendCommand(0x71)
|
||||||
while(busy):
|
while (busy):
|
||||||
self.M2_SendCommand(0x71)
|
self.M2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_M2_BUSY_PIN)
|
||||||
busy =not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def S1_ReadBusy(self):
|
def S1_ReadBusy(self):
|
||||||
self.S1_SendCommand(0x71)
|
self.S1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
while(busy):
|
while (busy):
|
||||||
self.S1_SendCommand(0x71)
|
self.S1_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S1_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
def S2_ReadBusy(self):
|
def S2_ReadBusy(self):
|
||||||
self.S2_SendCommand(0x71)
|
self.S2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
while(busy):
|
while (busy):
|
||||||
self.S2_SendCommand(0x71)
|
self.S2_SendCommand(0x71)
|
||||||
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
busy = epdconfig.digital_read(self.EPD_S2_BUSY_PIN)
|
||||||
busy = not(busy & 0x01)
|
busy = not (busy & 0x01)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
lut_vcom1 = [
|
lut_vcom1 = [
|
||||||
@ -457,27 +473,27 @@ class EPD(object):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def SetLut(self):
|
def SetLut(self):
|
||||||
self.M1S1M2S2_SendCommand(0x20) #vcom
|
self.M1S1M2S2_SendCommand(0x20) # vcom
|
||||||
for count in range(0, 60):
|
for count in range(0, 60):
|
||||||
self.M1S1M2S2_SendData(self.lut_vcom1[count])
|
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):
|
for count in range(0, 60):
|
||||||
self.M1S1M2S2_SendData(self.lut_ww1[count])
|
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):
|
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):
|
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):
|
for count in range(0, 60):
|
||||||
self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b
|
self.M1S1M2S2_SendData(self.lut_bb1[count]) # bb=b
|
||||||
|
|
||||||
self.M1S1M2S2_SendCommand(0x25) #bb b
|
self.M1S1M2S2_SendCommand(0x25) # bb b
|
||||||
for count in range(0, 60):
|
for count in range(0, 60):
|
||||||
self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b
|
self.M1S1M2S2_SendData(self.lut_ww1[count]) # bb=b
|
||||||
|
|
||||||
|
@ -1,37 +1,35 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd4in2.py
|
* | File : epd4in2.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
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 logging
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig
|
from inkycal.display.drivers import epdconfig
|
||||||
from PIL import Image
|
|
||||||
import RPi.GPIO as GPIO
|
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
EPD_WIDTH = 400
|
EPD_WIDTH = 400
|
||||||
|
@ -1,33 +1,34 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd4in2bc.py
|
* | File : epd4in2bc.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
furished to do so, subject to the following conditions:
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
# all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
#
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig
|
from inkycal.display.drivers import epdconfig
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd5in83.py
|
* | File : epd5in83.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
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 logging
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig
|
from inkycal.display.drivers import epdconfig
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd5in83b.py
|
* | File : epd5in83b.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
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 logging
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig
|
from inkycal.display.drivers import epdconfig
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd7in5.py
|
* | File : epd7in5.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
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 logging
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig
|
from inkycal.display.drivers import epdconfig
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd7in5bc.py
|
* | File : epd7in5bc.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
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 logging
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig
|
from inkycal.display.drivers import epdconfig
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd7in5.py
|
* | File : epd7in5.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
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 logging
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig
|
from inkycal.display.drivers import epdconfig
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd7in5bc.py
|
* | File : epd7in5bc.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
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 logging
|
||||||
|
|
||||||
from inkycal.display.drivers import epdconfig
|
from inkycal.display.drivers import epdconfig
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd7in5.py
|
* | File : epd7in5.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
furished to do so, subject to the following conditions:
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
# all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
#
|
"""
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
# *****************************************************************************
|
"""
|
||||||
# * | File : epd7in5bc.py
|
* | File : epd7in5bc.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Electronic paper driver
|
* | Function : Electronic paper driver
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V4.0
|
* | This version: V4.0
|
||||||
# * | Date : 2019-06-20
|
* | Date : 2019-06-20
|
||||||
# # | Info : python demo
|
# | Info : python demo
|
||||||
# -----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
furished to do so, subject to the following conditions:
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
# all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
#
|
"""
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
# /*****************************************************************************
|
"""
|
||||||
# * | File : epdconfig.py
|
* | File : epdconfig.py
|
||||||
# * | Author : Waveshare team
|
* | Author : Waveshare team
|
||||||
# * | Function : Hardware underlying interface
|
* | Function : Hardware underlying interface
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V1.0
|
* | This version: V1.0
|
||||||
# * | Date : 2019-06-21
|
* | Date : 2019-06-21
|
||||||
# * | Info :
|
* | Info :
|
||||||
# ******************************************************************************
|
******************************************************************************
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
furished to do so, subject to the following conditions:
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
# all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
#
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -1,39 +1,38 @@
|
|||||||
# /*****************************************************************************
|
"""
|
||||||
# * | File : epdconfig.py
|
* | File : epdconfig.py
|
||||||
# * | Author : Waveshare electrices
|
* | Author : Waveshare electrices
|
||||||
# * | Function : Hardware underlying interface
|
* | Function : Hardware underlying interface
|
||||||
# * | Info :
|
* | Info :
|
||||||
# *----------------
|
*----------------
|
||||||
# * | This version: V1.0
|
* | This version: V1.0
|
||||||
# * | Date : 2019-11-01
|
* | Date : 2019-11-01
|
||||||
# * | Info :
|
* | Info :
|
||||||
# ******************************************************************************/
|
******************************************************************************/
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documnetation files (the "Software"), to deal
|
of this software and associated documnetation files (the "Software"), to deal
|
||||||
# in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
# furished to do so, subject to the following conditions:
|
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
|
|
||||||
|
|
||||||
|
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 *
|
from ctypes import *
|
||||||
|
|
||||||
|
import RPi.GPIO as GPIO
|
||||||
|
|
||||||
EPD_SCK_PIN = 11
|
EPD_SCK_PIN = 11
|
||||||
EPD_MOSI_PIN = 10
|
EPD_MOSI_PIN = 10
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
"""Image file driver for testing"""
|
||||||
|
|
||||||
# Display resolution
|
# Display resolution
|
||||||
EPD_WIDTH = 800
|
EPD_WIDTH = 800
|
||||||
EPD_HEIGHT = 480
|
EPD_HEIGHT = 480
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def init(self):
|
def init(self):
|
||||||
pass
|
pass
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#!python3
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Third party module template (inkycal-compatible module)
|
Third party module template (inkycal-compatible module)
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#!python3
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Custom image class for Inkycal Project
|
Custom image class for Inkycal Project
|
||||||
Takes care of handling images. Made to be used by other modules to handle
|
Takes care of handling images. Made to be used by other modules to handle
|
||||||
@ -14,7 +11,6 @@ import os
|
|||||||
import PIL
|
import PIL
|
||||||
import numpy
|
import numpy
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -116,7 +112,7 @@ class Inkyimage:
|
|||||||
self.image = image
|
self.image = image
|
||||||
logger.info(f'flipped image by {angle} degrees')
|
logger.info(f'flipped image by {angle} degrees')
|
||||||
|
|
||||||
def autoflip(self, layout:str) -> None:
|
def autoflip(self, layout: str) -> None:
|
||||||
"""flips the image automatically to the given layout.
|
"""flips the image automatically to the given layout.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -335,4 +331,3 @@ class Inkyimage:
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {__name__} in standalone/debug mode')
|
print(f'running {__name__} in standalone/debug mode')
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
#!python3
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Inkycal Image Module
|
Inkycal Image Module
|
||||||
Copyright by aceinnolab
|
Copyright by aceinnolab
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from inkycal.modules.template import inkycal_module
|
|
||||||
from inkycal.custom import *
|
from inkycal.custom import *
|
||||||
|
|
||||||
from inkycal.modules.inky_image import Inkyimage as Images
|
from inkycal.modules.inky_image import Inkyimage as Images
|
||||||
|
from inkycal.modules.template import inkycal_module
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -1,17 +1,12 @@
|
|||||||
#!python3
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Inkycal-server module for Inkycal Project
|
Inkycal-server module for Inkycal Project
|
||||||
by Aterju (https://inkycal.robertsirre.nl/)
|
by Aterju (https://inkycal.robertsirre.nl/)
|
||||||
Copyright by aceinnolab
|
Copyright by aceinnolab
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
from inkycal.modules.template import inkycal_module
|
|
||||||
from inkycal.custom import *
|
from inkycal.custom import *
|
||||||
|
|
||||||
from inkycal.modules.inky_image import Inkyimage as Images
|
from inkycal.modules.inky_image import Inkyimage as Images
|
||||||
|
from inkycal.modules.template import inkycal_module
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
#!python3
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Inkycal Slideshow Module
|
Inkycal Slideshow Module
|
||||||
Copyright by aceinnolab
|
Copyright by aceinnolab
|
||||||
"""
|
"""
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
from inkycal.modules.template import inkycal_module
|
|
||||||
from inkycal.custom import *
|
from inkycal.custom import *
|
||||||
|
|
||||||
# PIL has a class named Image, use alias for Inkyimage -> Images
|
# PIL has a class named Image, use alias for Inkyimage -> Images
|
||||||
from inkycal.modules.inky_image import Inkyimage as Images
|
from inkycal.modules.inky_image import Inkyimage as Images
|
||||||
|
from inkycal.modules.template import inkycal_module
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
#!python3
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Inkycal weather module
|
Inkycal weather module
|
||||||
Copyright by aceinnolab
|
Copyright by aceinnolab
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from inkycal.modules.template import inkycal_module
|
|
||||||
from inkycal.custom import *
|
|
||||||
|
|
||||||
import math
|
|
||||||
import decimal
|
import decimal
|
||||||
|
import math
|
||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
|
|
||||||
|
from inkycal.custom import *
|
||||||
from inkycal.custom import OpenWeatherMap
|
from inkycal.custom import OpenWeatherMap
|
||||||
|
from inkycal.modules.template import inkycal_module
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -104,9 +102,8 @@ class Weather(inkycal_module):
|
|||||||
# give an OK message
|
# give an OK message
|
||||||
print(f"{__name__} loaded")
|
print(f"{__name__} loaded")
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def mps_to_beaufort(meters_per_second:float) -> int:
|
def mps_to_beaufort(meters_per_second: float) -> int:
|
||||||
"""Map meters per second to the beaufort scale.
|
"""Map meters per second to the beaufort scale.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -120,7 +117,7 @@ class Weather(inkycal_module):
|
|||||||
return next((i for i, threshold in enumerate(thresholds) if meters_per_second < threshold), 11)
|
return next((i for i, threshold in enumerate(thresholds) if meters_per_second < threshold), 11)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def mps_to_mph(meters_per_second:float) -> float:
|
def mps_to_mph(meters_per_second: float) -> float:
|
||||||
"""Map meters per second to miles per hour, rounded to one decimal place.
|
"""Map meters per second to miles per hour, rounded to one decimal place.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -135,7 +132,7 @@ class Weather(inkycal_module):
|
|||||||
return round(miles_per_hour, 1)
|
return round(miles_per_hour, 1)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def celsius_to_fahrenheit(celsius:int or float):
|
def celsius_to_fahrenheit(celsius: int or float):
|
||||||
"""Converts the given temperate from degrees Celsius to Fahrenheit."""
|
"""Converts the given temperate from degrees Celsius to Fahrenheit."""
|
||||||
fahrenheit = (celsius * 9 / 5) + 32
|
fahrenheit = (celsius * 9 / 5) + 32
|
||||||
return fahrenheit
|
return fahrenheit
|
||||||
@ -180,7 +177,8 @@ class Weather(inkycal_module):
|
|||||||
4: '\uf0a3',
|
4: '\uf0a3',
|
||||||
5: '\uf0a7',
|
5: '\uf0a7',
|
||||||
6: '\uf0aa',
|
6: '\uf0aa',
|
||||||
7: '\uf0ae'}[int(index) & 7]
|
7: '\uf0ae'
|
||||||
|
}[int(index) & 7]
|
||||||
|
|
||||||
def is_negative(temp):
|
def is_negative(temp):
|
||||||
"""Check if temp is below freezing point of water (0°C/30°F)
|
"""Check if temp is below freezing point of water (0°C/30°F)
|
||||||
@ -458,7 +456,8 @@ class Weather(inkycal_module):
|
|||||||
# Create a list containing time-objects for every 3rd hour of the day
|
# Create a list containing time-objects for every 3rd hour of the day
|
||||||
time_range = list(
|
time_range = list(
|
||||||
arrow.Arrow.range('hour',
|
arrow.Arrow.range('hour',
|
||||||
now.shift(days=days_from_today).floor('day'),now.shift(days=days_from_today).ceil('day')
|
now.shift(days=days_from_today).floor('day'),
|
||||||
|
now.shift(days=days_from_today).ceil('day')
|
||||||
))[::3]
|
))[::3]
|
||||||
|
|
||||||
# Get forecasts for each time-object
|
# Get forecasts for each time-object
|
||||||
@ -493,7 +492,7 @@ class Weather(inkycal_module):
|
|||||||
if dec_temp != 0:
|
if dec_temp != 0:
|
||||||
temperature = f"{round(weather['main']['temp'])}°"
|
temperature = f"{round(weather['main']['temp'])}°"
|
||||||
else:
|
else:
|
||||||
temperature = f"{round(weather['main']['temp'],ndigits=dec_temp)}°"
|
temperature = f"{round(weather['main']['temp'], ndigits=dec_temp)}°"
|
||||||
|
|
||||||
weather_icon = weather["weather"][0]["icon"]
|
weather_icon = weather["weather"][0]["icon"]
|
||||||
humidity = str(weather["main"]["humidity"])
|
humidity = str(weather["main"]["humidity"])
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!python3
|
"""Inkycal module template"""
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from inkycal.custom import *
|
from inkycal.custom import *
|
||||||
|
|
||||||
|
|
||||||
|
3
setup.py
3
setup.py
@ -1,7 +1,6 @@
|
|||||||
#!python3
|
from os import path
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
from os import path
|
|
||||||
|
|
||||||
this_directory = path.abspath(path.dirname(__file__))
|
this_directory = path.abspath(path.dirname(__file__))
|
||||||
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user