update 2.9d&4.2, fix 5.65f&2.66b
|
|
@ -76,5 +76,5 @@ except IOError as e:
|
|||
|
||||
except KeyboardInterrupt:
|
||||
logging.info("ctrl + c:")
|
||||
epd1in54b.epdconfig.module_exit()
|
||||
epd1in54b_V2.epdconfig.module_exit()
|
||||
exit()
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ try:
|
|||
|
||||
# Drawing on the Horizontal image
|
||||
logging.info("1.Drawing on the Horizontal image...")
|
||||
HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
HRYimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image
|
||||
HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 296*152
|
||||
HRYimage = Image.new('1', (epd.height, epd.width), 255) # 296*152 ryimage: red or yellow image
|
||||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
drawry = ImageDraw.Draw(HRYimage)
|
||||
drawblack.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
|
|
@ -62,8 +62,8 @@ try:
|
|||
|
||||
# Drawing on the Vertical image
|
||||
logging.info("4.Drawing on the Vertical image...")
|
||||
LBlackimage = Image.new('1', (epd.width, epd.height), 255) # 126*298
|
||||
LRYimage = Image.new('1', (epd.width, epd.height), 255) # 126*298
|
||||
LBlackimage = Image.new('1', (epd.width, epd.height), 255) # 152*296
|
||||
LRYimage = Image.new('1', (epd.width, epd.height), 255) # 152*296
|
||||
drawblack = ImageDraw.Draw(LBlackimage)
|
||||
drawry = ImageDraw.Draw(LRYimage)
|
||||
time.sleep(3)
|
||||
|
|
|
|||
|
|
@ -91,10 +91,11 @@ try:
|
|||
num = num + 1
|
||||
if(num == 10):
|
||||
break
|
||||
|
||||
|
||||
epd.init()
|
||||
logging.info("Clear...")
|
||||
epd.Clear(0xFF)
|
||||
|
||||
time.sleep(2)
|
||||
logging.info("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ try:
|
|||
|
||||
epd.Clear()
|
||||
logging.info("3.read bmp file")
|
||||
Himage = Image.open(os.path.join(picdir, '4.01inch-e-Paper.bmp'))
|
||||
Himage = Image.open(os.path.join(picdir, '4in01-1.bmp'))
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(3)
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ try:
|
|||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(3)
|
||||
|
||||
logging.info("2.Drawing on the Vertical image...")
|
||||
# logging.info("2.Drawing on the Vertical image...")
|
||||
Himage = Image.new('RGB', (epd.height, epd.width), 0xffffff) # 255: clear the frame
|
||||
draw = ImageDraw.Draw(Himage)
|
||||
draw.text((10, 0), 'hello world', font = font24, fill = 0)
|
||||
|
|
@ -72,24 +72,14 @@ try:
|
|||
time.sleep(3)
|
||||
|
||||
logging.info("3.read bmp file")
|
||||
Himage = Image.open(os.path.join(picdir, '5in65f0.bmp'))
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(3)
|
||||
|
||||
Himage = Image.open(os.path.join(picdir, '5in65f.bmp'))
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(3)
|
||||
|
||||
Himage = Image.open(os.path.join(picdir, '5in65f2.bmp'))
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(3)
|
||||
|
||||
|
||||
Himage = Image.open(os.path.join(picdir, '5in65f3.bmp'))
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(3)
|
||||
|
||||
|
||||
Himage = Image.open(os.path.join(picdir, '5in65f4.bmp'))
|
||||
epd.display(epd.getbuffer(Himage))
|
||||
time.sleep(3)
|
||||
|
||||
epd.Clear()
|
||||
logging.info("Goto Sleep...")
|
||||
epd.sleep()
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ try:
|
|||
logging.info("4.read bmp file on window")
|
||||
Himage2 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
Himage2_Other = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
|
||||
bmp = Image.open(os.path.join(picdir, '100x100.bmp'))
|
||||
bmp = Image.open(os.path.join(picdir, '2in9.bmp'))
|
||||
Himage2.paste(bmp, (50,10))
|
||||
Himage2_Other.paste(bmp, (50,300))
|
||||
epd.display(epd.getbuffer(Himage2), epd.getbuffer(Himage2_Other))
|
||||
|
|
|
|||
|
|
@ -99,23 +99,23 @@ class EPD:
|
|||
return 0
|
||||
|
||||
def setWindows(self, Xstart, Ystart, Xend, Yend):
|
||||
self.send_command(0x44); # SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
self.send_data((Xstart>>3) & 0x1F);
|
||||
self.send_data((Xend>>3) & 0x1F);
|
||||
self.send_command(0x44) # SET_RAM_X_ADDRESS_START_END_POSITION
|
||||
self.send_data((Xstart>>3) & 0x1F)
|
||||
self.send_data((Xend>>3) & 0x1F)
|
||||
|
||||
self.send_command(0x45); # SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
self.send_data(Ystart & 0xFF);
|
||||
self.send_data((Ystart >> 8) & 0x01);
|
||||
self.send_data(Yend & 0xFF);
|
||||
self.send_data((Yend >> 8) & 0x01);
|
||||
self.send_command(0x45) # SET_RAM_Y_ADDRESS_START_END_POSITION
|
||||
self.send_data(Ystart & 0xFF)
|
||||
self.send_data((Ystart >> 8) & 0x01)
|
||||
self.send_data(Yend & 0xFF)
|
||||
self.send_data((Yend >> 8) & 0x01)
|
||||
|
||||
def setCursor(self, Xstart, Ystart):
|
||||
self.send_command(0x4E); # SET_RAM_X_ADDRESS_COUNTER
|
||||
self.send_data(Xstart & 0x1F);
|
||||
self.send_command(0x4E) # SET_RAM_X_ADDRESS_COUNTER
|
||||
self.send_data(Xstart & 0x1F)
|
||||
|
||||
self.send_command(0x4F); # SET_RAM_Y_ADDRESS_COUNTER
|
||||
self.send_data(Ystart & 0xFF);
|
||||
self.send_data((Ystart >> 8) & 0x01);
|
||||
self.send_command(0x4F) # SET_RAM_Y_ADDRESS_COUNTER
|
||||
self.send_data(Ystart & 0xFF)
|
||||
self.send_data((Ystart >> 8) & 0x01)
|
||||
|
||||
def turnon_display(self):
|
||||
self.send_command(0x20)
|
||||
|
|
@ -148,13 +148,6 @@ class EPD:
|
|||
def display(self, Blackimage, Redimage):
|
||||
if (Blackimage == None or Redimage == None):
|
||||
return
|
||||
|
||||
self.send_command(0x4E)
|
||||
self.send_data(0x01)
|
||||
self.send_command(0x4F)
|
||||
self.send_data(0x27)
|
||||
self.send_data(0x01)
|
||||
|
||||
self.send_command(0x24)
|
||||
for j in range(0, self.height):
|
||||
for i in range(0, int(self.width / 8)):
|
||||
|
|
@ -169,7 +162,6 @@ class EPD:
|
|||
|
||||
|
||||
def Clear(self):
|
||||
|
||||
self.send_command(0x24)
|
||||
for j in range(0, self.height):
|
||||
for i in range(0, int(self.width / 8)):
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ class EPD:
|
|||
|
||||
self.send_command(0x22);
|
||||
self.send_data(0xC0);
|
||||
self.send_command(0x20);
|
||||
self.send_command(0x20);
|
||||
self.ReadBusy();
|
||||
|
||||
self.SetWindow(0, 0, self.width - 1, self.height - 1)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
# *****************************************************************************
|
||||
# * | File : epd2in9d.py
|
||||
# * | File : epd2in9d.py
|
||||
# * | Author : Waveshare team
|
||||
# * | Function : Electronic paper driver
|
||||
# * | Info :
|
||||
|
|
@ -27,7 +30,6 @@
|
|||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
from . import epdconfig
|
||||
from PIL import Image
|
||||
|
|
@ -45,57 +47,6 @@ class EPD:
|
|||
self.cs_pin = epdconfig.CS_PIN
|
||||
self.width = EPD_WIDTH
|
||||
self.height = EPD_HEIGHT
|
||||
|
||||
lut_vcomDC = [
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x60, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_ww = [
|
||||
0x40, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x40, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_bw = [
|
||||
0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x0F, 0x0F, 0x00, 0x00, 0x03,
|
||||
0x40, 0x0A, 0x01, 0x00, 0x00, 0x01,
|
||||
0xA0, 0x0E, 0x0E, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_wb = [
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_bb = [
|
||||
0x80, 0x08, 0x00, 0x00, 0x00, 0x02,
|
||||
0x90, 0x28, 0x28, 0x00, 0x00, 0x01,
|
||||
0x80, 0x14, 0x00, 0x00, 0x00, 0x01,
|
||||
0x50, 0x12, 0x12, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
||||
|
||||
lut_vcom1 = [
|
||||
0x00, 0x19, 0x01, 0x00, 0x00, 0x01,
|
||||
|
|
@ -151,11 +102,19 @@ class EPD:
|
|||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.delay_ms(20)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(5)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.delay_ms(20)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(5)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(20)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(5)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(20)
|
||||
|
||||
def send_command(self, command):
|
||||
epdconfig.digital_write(self.dc_pin, 0)
|
||||
|
|
@ -173,8 +132,9 @@ class EPD:
|
|||
logging.debug("e-Paper busy")
|
||||
while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy
|
||||
self.send_command(0x71)
|
||||
epdconfig.delay_ms(100)
|
||||
epdconfig.delay_ms(10)
|
||||
logging.debug("e-Paper busy release")
|
||||
|
||||
def TurnOnDisplay(self):
|
||||
self.send_command(0x12)
|
||||
epdconfig.delay_ms(10)
|
||||
|
|
@ -186,65 +146,56 @@ class EPD:
|
|||
# EPD hardware init start
|
||||
self.reset()
|
||||
|
||||
self.send_command(0x01) # POWER SETTING
|
||||
self.send_command(0x04)
|
||||
self.ReadBusy() #waiting for the electronic paper IC to release the idle signal
|
||||
|
||||
self.send_command(0x00) #panel setting
|
||||
self.send_data(0x1f) # LUT from OTP,KW-BF KWR-AF BWROTP 0f BWOTP 1f
|
||||
|
||||
self.send_command(0x61) #resolution setting
|
||||
self.send_data (0x80)
|
||||
self.send_data (0x01)
|
||||
self.send_data (0x28)
|
||||
|
||||
self.send_command(0X50) #VCOM AND DATA INTERVAL SETTING
|
||||
self.send_data(0x97) #WBmode:VBDF 17|D7 VBDW 97 VBDB 57 WBRmode:VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||
|
||||
return 0
|
||||
|
||||
def SetPartReg(self):
|
||||
|
||||
self.send_command(0x01) #POWER SETTING
|
||||
self.send_data(0x03)
|
||||
self.send_data(0x00)
|
||||
self.send_data(0x2b)
|
||||
self.send_data(0x2b)
|
||||
self.send_data(0x03)
|
||||
|
||||
self.send_command(0x06) # boost soft start
|
||||
self.send_data(0x17) # A
|
||||
self.send_data(0x17) # B
|
||||
self.send_data(0x17) # C
|
||||
self.send_command(0x06) #boost soft start
|
||||
self.send_data(0x17) #A
|
||||
self.send_data(0x17) #B
|
||||
self.send_data(0x17) #C
|
||||
|
||||
self.send_command(0x04)
|
||||
self.ReadBusy()
|
||||
|
||||
self.send_command(0x00) # panel setting
|
||||
self.send_data(0xbf) # LUT from OTP,128x296
|
||||
self.send_data(0x0d) # VCOM to 0V fast
|
||||
self.send_command(0x00) #panel setting
|
||||
self.send_data(0xbf) #LUT from OTP,128x296
|
||||
|
||||
self.send_command(0x30) #PLL setting
|
||||
self.send_data(0x3a) # 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
self.send_command(0x30) #PLL setting
|
||||
self.send_data(0x3a) # 3a 100HZ 29 150Hz 39 200HZ 31 171HZ
|
||||
|
||||
self.send_command(0x61) # resolution setting
|
||||
self.send_command(0x61) #resolution setting
|
||||
self.send_data(self.width)
|
||||
self.send_data((self.height >> 8) & 0xff)
|
||||
self.send_data(self.height& 0xff)
|
||||
self.send_data(self.height & 0xff)
|
||||
|
||||
self.send_command(0x82) #vcom_DC setting
|
||||
self.send_data(0x12)
|
||||
|
||||
self.send_command(0x82) # vcom_DC setting
|
||||
self.send_data(0x28)
|
||||
return 0
|
||||
|
||||
def SetFullReg(self):
|
||||
self.send_command(0x82)
|
||||
self.send_data(0x00)
|
||||
self.send_command(0X50)
|
||||
self.send_data(0x97)
|
||||
|
||||
self.send_command(0x20) # vcom
|
||||
for count in range(0, 44):
|
||||
self.send_data(self.lut_vcomDC[count])
|
||||
self.send_command(0x21) # ww --
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_ww[count])
|
||||
self.send_command(0x22) # bw r
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_bw[count])
|
||||
self.send_command(0x23) # wb w
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_wb[count])
|
||||
self.send_command(0x24) # bb b
|
||||
for count in range(0, 42):
|
||||
self.send_data(self.lut_bb[count])
|
||||
|
||||
def SetPartReg(self):
|
||||
self.send_command(0x82)
|
||||
self.send_data(0x03)
|
||||
self.send_command(0X50)
|
||||
self.send_data(0x47)
|
||||
|
||||
self.send_command(0x20) # vcom
|
||||
for count in range(0, 44):
|
||||
self.send_data(self.lut_vcom1[count])
|
||||
|
|
@ -296,7 +247,6 @@ class EPD:
|
|||
self.send_data(image[i])
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.SetFullReg()
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def DisplayPartial(self, image):
|
||||
|
|
@ -335,7 +285,6 @@ class EPD:
|
|||
self.send_data(0xFF)
|
||||
epdconfig.delay_ms(10)
|
||||
|
||||
self.SetFullReg()
|
||||
self.TurnOnDisplay()
|
||||
|
||||
def sleep(self):
|
||||
|
|
|
|||
|
|
@ -202,11 +202,19 @@ class EPD:
|
|||
# Hardware reset
|
||||
def reset(self):
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.delay_ms(20)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(5)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(200)
|
||||
epdconfig.delay_ms(20)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(5)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(20)
|
||||
epdconfig.digital_write(self.reset_pin, 0)
|
||||
epdconfig.delay_ms(5)
|
||||
epdconfig.digital_write(self.reset_pin, 1)
|
||||
epdconfig.delay_ms(20)
|
||||
|
||||
def send_command(self, command):
|
||||
epdconfig.digital_write(self.dc_pin, 0)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class EPD:
|
|||
self.send_data(0x1D)
|
||||
self.send_command(0x30)
|
||||
self.send_data(0x3c)
|
||||
self.send_command(0x40)
|
||||
self.send_command(0x41)
|
||||
self.send_data(0x00)
|
||||
self.send_command(0x50)
|
||||
self.send_data(0x37)
|
||||
|
|
|
|||
BIN
RaspberryPi_JetsonNano/python/pic/2.66__b.bmp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/2.66__r.bmp
Normal file
|
After Width: | Height: | Size: 6 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/2in13_1.bmp
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/2in13_2.bmp
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/2in13_b1.bmp
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/2in13_y1.bmp
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/2in9_1.bmp
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/2in9_2.bmp
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4.2 m.bmp
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4in01f.bmp
Normal file
|
After Width: | Height: | Size: 750 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4in01f1.bmp
Normal file
|
After Width: | Height: | Size: 750 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4in2_Scale.bmp
Normal file
|
After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/4in2_Scale_2.bmp
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/5in65_n0.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/5in65_n1.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/5in65_n2.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/5in65_n3.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/5in65_n4.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/5in65_n5.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |
|
Before Width: | Height: | Size: 788 KiB After Width: | Height: | Size: 788 KiB |
BIN
RaspberryPi_JetsonNano/python/pic/5in65f0.bmp
Normal file
|
After Width: | Height: | Size: 788 KiB |