Suppression fichier inutile
This commit is contained in:
parent
61c4296af6
commit
669a31ce69
@ -1,644 +0,0 @@
|
|||||||
|
|
||||||
import RPi.GPIO as GPIO
|
|
||||||
import time
|
|
||||||
|
|
||||||
""" Register initial variable """
|
|
||||||
xDot = 122
|
|
||||||
yDot = 250
|
|
||||||
DELAYTIME = 2
|
|
||||||
LUTDefault_full = [0x32,0x22,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x01,0x00,0x00,0x00,0x00]
|
|
||||||
LUTDefault_part = [0x32,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
|
|
||||||
|
|
||||||
GDOControl = [0x01,int((yDot-1)%256),int((yDot-1)/256),0x00] #for 2.9inch
|
|
||||||
softstart = [0x0c,0xd7,0xd6,0x9d]
|
|
||||||
VCOMVol = [0x2c,0xa8] # VCOM 7c
|
|
||||||
DummyLine = [0x3a,0x1a] # 4 dummy line per gate
|
|
||||||
Gatetime = [0x3b,0x08] # 2us per line
|
|
||||||
RamDataEntryMode = [0x11,0x01] # Ram data entry mode
|
|
||||||
w_buffer = [0 for i in range(5000)]
|
|
||||||
|
|
||||||
""" BCM GPIO """
|
|
||||||
RST = 17
|
|
||||||
DC = 25
|
|
||||||
BUSY = 24
|
|
||||||
CS = 8
|
|
||||||
|
|
||||||
""" Display lib """
|
|
||||||
Font1206 = [
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#" ",0*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x3F,0x40,0x00,0x00,0x00,0x00,0x00,0x00],#"!",1*/
|
|
||||||
[0x00,0x00,0x30,0x00,0x40,0x00,0x30,0x00,0x40,0x00,0x00,0x00],#""",2*/
|
|
||||||
[0x09,0x00,0x0B,0xC0,0x3D,0x00,0x0B,0xC0,0x3D,0x00,0x09,0x00],#"#",3*/
|
|
||||||
[0x18,0xC0,0x24,0x40,0x7F,0xE0,0x22,0x40,0x31,0x80,0x00,0x00],#"$",4*/
|
|
||||||
[0x18,0x00,0x24,0xC0,0x1B,0x00,0x0D,0x80,0x32,0x40,0x01,0x80],#"%",5*/
|
|
||||||
[0x03,0x80,0x1C,0x40,0x27,0x40,0x1C,0x80,0x07,0x40,0x00,0x40],#"&",6*/
|
|
||||||
[0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#"'",7*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x80,0x20,0x40,0x40,0x20],#"(",8*/
|
|
||||||
[0x00,0x00,0x40,0x20,0x20,0x40,0x1F,0x80,0x00,0x00,0x00,0x00],#")",9*/
|
|
||||||
[0x09,0x00,0x06,0x00,0x1F,0x80,0x06,0x00,0x09,0x00,0x00,0x00],#"*",10*/
|
|
||||||
[0x04,0x00,0x04,0x00,0x3F,0x80,0x04,0x00,0x04,0x00,0x00,0x00],#"+",11*/
|
|
||||||
[0x00,0x10,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#",",12*/
|
|
||||||
[0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00],#"-",13*/
|
|
||||||
[0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#".",14*/
|
|
||||||
[0x00,0x20,0x01,0xC0,0x06,0x00,0x38,0x00,0x40,0x00,0x00,0x00],#"/",15*/
|
|
||||||
[0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00],#"0",16*/
|
|
||||||
[0x00,0x00,0x10,0x40,0x3F,0xC0,0x00,0x40,0x00,0x00,0x00,0x00],#"1",17*/
|
|
||||||
[0x18,0xC0,0x21,0x40,0x22,0x40,0x24,0x40,0x18,0x40,0x00,0x00],#"2",18*/
|
|
||||||
[0x10,0x80,0x20,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00],#"3",19*/
|
|
||||||
[0x02,0x00,0x0D,0x00,0x11,0x00,0x3F,0xC0,0x01,0x40,0x00,0x00],#"4",20*/
|
|
||||||
[0x3C,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x23,0x80,0x00,0x00],#"5",21*/
|
|
||||||
[0x1F,0x80,0x24,0x40,0x24,0x40,0x34,0x40,0x03,0x80,0x00,0x00],#"6",22*/
|
|
||||||
[0x30,0x00,0x20,0x00,0x27,0xC0,0x38,0x00,0x20,0x00,0x00,0x00],#"7",23*/
|
|
||||||
[0x1B,0x80,0x24,0x40,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00],#"8",24*/
|
|
||||||
[0x1C,0x00,0x22,0xC0,0x22,0x40,0x22,0x40,0x1F,0x80,0x00,0x00],#"9",25*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00],#":",26*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x04,0x60,0x00,0x00,0x00,0x00,0x00,0x00],#";",27*/
|
|
||||||
[0x00,0x00,0x04,0x00,0x0A,0x00,0x11,0x00,0x20,0x80,0x40,0x40],#"<",28*/
|
|
||||||
[0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x09,0x00,0x00,0x00],#"=",29*/
|
|
||||||
[0x00,0x00,0x40,0x40,0x20,0x80,0x11,0x00,0x0A,0x00,0x04,0x00],#">",30*/
|
|
||||||
[0x18,0x00,0x20,0x00,0x23,0x40,0x24,0x00,0x18,0x00,0x00,0x00],#"?",31*/
|
|
||||||
[0x1F,0x80,0x20,0x40,0x27,0x40,0x29,0x40,0x1F,0x40,0x00,0x00],#"@",32*/
|
|
||||||
[0x00,0x40,0x07,0xC0,0x39,0x00,0x0F,0x00,0x01,0xC0,0x00,0x40],#"A",33*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x40,0x1B,0x80,0x00,0x00],#"B",34*/
|
|
||||||
[0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x30,0x80,0x00,0x00],#"C",35*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00],#"D",36*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x40,0x30,0xC0,0x00,0x00],#"E",37*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x24,0x40,0x2E,0x00,0x30,0x00,0x00,0x00],#"F",38*/
|
|
||||||
[0x0F,0x00,0x10,0x80,0x20,0x40,0x22,0x40,0x33,0x80,0x02,0x00],#"G",39*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x04,0x00,0x04,0x00,0x3F,0xC0,0x20,0x40],#"H",40*/
|
|
||||||
[0x20,0x40,0x20,0x40,0x3F,0xC0,0x20,0x40,0x20,0x40,0x00,0x00],#"I",41*/
|
|
||||||
[0x00,0x60,0x20,0x20,0x20,0x20,0x3F,0xC0,0x20,0x00,0x20,0x00],#"J",42*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x24,0x40,0x0B,0x00,0x30,0xC0,0x20,0x40],#"K",43*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x20,0x40,0x00,0x40,0x00,0x40,0x00,0xC0],#"L",44*/
|
|
||||||
[0x3F,0xC0,0x3C,0x00,0x03,0xC0,0x3C,0x00,0x3F,0xC0,0x00,0x00],#"M",45*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x0C,0x40,0x23,0x00,0x3F,0xC0,0x20,0x00],#"N",46*/
|
|
||||||
[0x1F,0x80,0x20,0x40,0x20,0x40,0x20,0x40,0x1F,0x80,0x00,0x00],#"O",47*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x24,0x40,0x24,0x00,0x18,0x00,0x00,0x00],#"P",48*/
|
|
||||||
[0x1F,0x80,0x21,0x40,0x21,0x40,0x20,0xE0,0x1F,0xA0,0x00,0x00],#"Q",49*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x24,0x40,0x26,0x00,0x19,0xC0,0x00,0x40],#"R",50*/
|
|
||||||
[0x18,0xC0,0x24,0x40,0x24,0x40,0x22,0x40,0x31,0x80,0x00,0x00],#"S",51*/
|
|
||||||
[0x30,0x00,0x20,0x40,0x3F,0xC0,0x20,0x40,0x30,0x00,0x00,0x00],#"T",52*/
|
|
||||||
[0x20,0x00,0x3F,0x80,0x00,0x40,0x00,0x40,0x3F,0x80,0x20,0x00],#"U",53*/
|
|
||||||
[0x20,0x00,0x3E,0x00,0x01,0xC0,0x07,0x00,0x38,0x00,0x20,0x00],#"V",54*/
|
|
||||||
[0x38,0x00,0x07,0xC0,0x3C,0x00,0x07,0xC0,0x38,0x00,0x00,0x00],#"W",55*/
|
|
||||||
[0x20,0x40,0x39,0xC0,0x06,0x00,0x39,0xC0,0x20,0x40,0x00,0x00],#"X",56*/
|
|
||||||
[0x20,0x00,0x38,0x40,0x07,0xC0,0x38,0x40,0x20,0x00,0x00,0x00],#"Y",57*/
|
|
||||||
[0x30,0x40,0x21,0xC0,0x26,0x40,0x38,0x40,0x20,0xC0,0x00,0x00],#"Z",58*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x7F,0xE0,0x40,0x20,0x40,0x20,0x00,0x00],#"[",59*/
|
|
||||||
[0x00,0x00,0x70,0x00,0x0C,0x00,0x03,0x80,0x00,0x40,0x00,0x00],#"\",60*/
|
|
||||||
[0x00,0x00,0x40,0x20,0x40,0x20,0x7F,0xE0,0x00,0x00,0x00,0x00],#"]",61*/
|
|
||||||
[0x00,0x00,0x20,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00],#"^",62*/
|
|
||||||
[0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10],#"_",63*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#"`",64*/
|
|
||||||
[0x00,0x00,0x02,0x80,0x05,0x40,0x05,0x40,0x03,0xC0,0x00,0x40],#"a",65*/
|
|
||||||
[0x20,0x00,0x3F,0xC0,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00],#"b",66*/
|
|
||||||
[0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x06,0x40,0x00,0x00],#"c",67*/
|
|
||||||
[0x00,0x00,0x03,0x80,0x04,0x40,0x24,0x40,0x3F,0xC0,0x00,0x40],#"d",68*/
|
|
||||||
[0x00,0x00,0x03,0x80,0x05,0x40,0x05,0x40,0x03,0x40,0x00,0x00],#"e",69*/
|
|
||||||
[0x00,0x00,0x04,0x40,0x1F,0xC0,0x24,0x40,0x24,0x40,0x20,0x00],#"f",70*/
|
|
||||||
[0x00,0x00,0x02,0xE0,0x05,0x50,0x05,0x50,0x06,0x50,0x04,0x20],#"g",71*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40],#"h",72*/
|
|
||||||
[0x00,0x00,0x04,0x40,0x27,0xC0,0x00,0x40,0x00,0x00,0x00,0x00],#"i",73*/
|
|
||||||
[0x00,0x10,0x00,0x10,0x04,0x10,0x27,0xE0,0x00,0x00,0x00,0x00],#"j",74*/
|
|
||||||
[0x20,0x40,0x3F,0xC0,0x01,0x40,0x07,0x00,0x04,0xC0,0x04,0x40],#"k",75*/
|
|
||||||
[0x20,0x40,0x20,0x40,0x3F,0xC0,0x00,0x40,0x00,0x40,0x00,0x00],#"l",76*/
|
|
||||||
[0x07,0xC0,0x04,0x00,0x07,0xC0,0x04,0x00,0x03,0xC0,0x00,0x00],#"m",77*/
|
|
||||||
[0x04,0x40,0x07,0xC0,0x04,0x40,0x04,0x00,0x03,0xC0,0x00,0x40],#"n",78*/
|
|
||||||
[0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x40,0x03,0x80,0x00,0x00],#"o",79*/
|
|
||||||
[0x04,0x10,0x07,0xF0,0x04,0x50,0x04,0x40,0x03,0x80,0x00,0x00],#"p",80*/
|
|
||||||
[0x00,0x00,0x03,0x80,0x04,0x40,0x04,0x50,0x07,0xF0,0x00,0x10],#"q",81*/
|
|
||||||
[0x04,0x40,0x07,0xC0,0x02,0x40,0x04,0x00,0x04,0x00,0x00,0x00],#"r",82*/
|
|
||||||
[0x00,0x00,0x06,0x40,0x05,0x40,0x05,0x40,0x04,0xC0,0x00,0x00],#"s",83*/
|
|
||||||
[0x00,0x00,0x04,0x00,0x1F,0x80,0x04,0x40,0x00,0x40,0x00,0x00],#"t",84*/
|
|
||||||
[0x04,0x00,0x07,0x80,0x00,0x40,0x04,0x40,0x07,0xC0,0x00,0x40],#"u",85*/
|
|
||||||
[0x04,0x00,0x07,0x00,0x04,0xC0,0x01,0x80,0x06,0x00,0x04,0x00],#"v",86*/
|
|
||||||
[0x06,0x00,0x01,0xC0,0x07,0x00,0x01,0xC0,0x06,0x00,0x00,0x00],#"w",87*/
|
|
||||||
[0x04,0x40,0x06,0xC0,0x01,0x00,0x06,0xC0,0x04,0x40,0x00,0x00],#"x",88*/
|
|
||||||
[0x04,0x10,0x07,0x10,0x04,0xE0,0x01,0x80,0x06,0x00,0x04,0x00],#"y",89*/
|
|
||||||
[0x00,0x00,0x04,0x40,0x05,0xC0,0x06,0x40,0x04,0x40,0x00,0x00],#"z",90*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x04,0x00,0x7B,0xE0,0x40,0x20,0x00,0x00],#"{",91*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00],#"|",92*/
|
|
||||||
[0x00,0x00,0x40,0x20,0x7B,0xE0,0x04,0x00,0x00,0x00,0x00,0x00],#"]",93*/
|
|
||||||
[0x40,0x00,0x80,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x40,0x00],#"~",94*/
|
|
||||||
]
|
|
||||||
|
|
||||||
Font1608 = [
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#" ",0*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCC,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00],#"!",1*/
|
|
||||||
[0x00,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x08,0x00,0x30,0x00,0x60,0x00,0x00,0x00],#""",2*/
|
|
||||||
[0x02,0x20,0x03,0xFC,0x1E,0x20,0x02,0x20,0x03,0xFC,0x1E,0x20,0x02,0x20,0x00,0x00],#"#",3*/
|
|
||||||
[0x00,0x00,0x0E,0x18,0x11,0x04,0x3F,0xFF,0x10,0x84,0x0C,0x78,0x00,0x00,0x00,0x00],#"$",4*/
|
|
||||||
[0x0F,0x00,0x10,0x84,0x0F,0x38,0x00,0xC0,0x07,0x78,0x18,0x84,0x00,0x78,0x00,0x00],#"%",5*/
|
|
||||||
[0x00,0x78,0x0F,0x84,0x10,0xC4,0x11,0x24,0x0E,0x98,0x00,0xE4,0x00,0x84,0x00,0x08],#"&",6*/
|
|
||||||
[0x08,0x00,0x68,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#"'",7*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x18,0x18,0x20,0x04,0x40,0x02,0x00,0x00],#"(",8*/
|
|
||||||
[0x00,0x00,0x40,0x02,0x20,0x04,0x18,0x18,0x07,0xE0,0x00,0x00,0x00,0x00,0x00,0x00],#")",9*/
|
|
||||||
[0x02,0x40,0x02,0x40,0x01,0x80,0x0F,0xF0,0x01,0x80,0x02,0x40,0x02,0x40,0x00,0x00],#"*",10*/
|
|
||||||
[0x00,0x80,0x00,0x80,0x00,0x80,0x0F,0xF8,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00],#"+",11*/
|
|
||||||
[0x00,0x01,0x00,0x0D,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#",",12*/
|
|
||||||
[0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80],#"-",13*/
|
|
||||||
[0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#".",14*/
|
|
||||||
[0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x60,0x01,0x80,0x06,0x00,0x18,0x00,0x20,0x00],#"/",15*/
|
|
||||||
[0x00,0x00,0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00],#"0",16*/
|
|
||||||
[0x00,0x00,0x08,0x04,0x08,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00],#"1",17*/
|
|
||||||
[0x00,0x00,0x0E,0x0C,0x10,0x14,0x10,0x24,0x10,0x44,0x11,0x84,0x0E,0x0C,0x00,0x00],#"2",18*/
|
|
||||||
[0x00,0x00,0x0C,0x18,0x10,0x04,0x11,0x04,0x11,0x04,0x12,0x88,0x0C,0x70,0x00,0x00],#"3",19*/
|
|
||||||
[0x00,0x00,0x00,0xE0,0x03,0x20,0x04,0x24,0x08,0x24,0x1F,0xFC,0x00,0x24,0x00,0x00],#"4",20*/
|
|
||||||
[0x00,0x00,0x1F,0x98,0x10,0x84,0x11,0x04,0x11,0x04,0x10,0x88,0x10,0x70,0x00,0x00],#"5",21*/
|
|
||||||
[0x00,0x00,0x07,0xF0,0x08,0x88,0x11,0x04,0x11,0x04,0x18,0x88,0x00,0x70,0x00,0x00],#"6",22*/
|
|
||||||
[0x00,0x00,0x1C,0x00,0x10,0x00,0x10,0xFC,0x13,0x00,0x1C,0x00,0x10,0x00,0x00,0x00],#"7",23*/
|
|
||||||
[0x00,0x00,0x0E,0x38,0x11,0x44,0x10,0x84,0x10,0x84,0x11,0x44,0x0E,0x38,0x00,0x00],#"8",24*/
|
|
||||||
[0x00,0x00,0x07,0x00,0x08,0x8C,0x10,0x44,0x10,0x44,0x08,0x88,0x07,0xF0,0x00,0x00],#"9",25*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x03,0x0C,0x00,0x00,0x00,0x00,0x00,0x00],#":",26*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#";",27*/
|
|
||||||
[0x00,0x00,0x00,0x80,0x01,0x40,0x02,0x20,0x04,0x10,0x08,0x08,0x10,0x04,0x00,0x00],#"<",28*/
|
|
||||||
[0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x00,0x00],#"=",29*/
|
|
||||||
[0x00,0x00,0x10,0x04,0x08,0x08,0x04,0x10,0x02,0x20,0x01,0x40,0x00,0x80,0x00,0x00],#">",30*/
|
|
||||||
[0x00,0x00,0x0E,0x00,0x12,0x00,0x10,0x0C,0x10,0x6C,0x10,0x80,0x0F,0x00,0x00,0x00],#"?",31*/
|
|
||||||
[0x03,0xE0,0x0C,0x18,0x13,0xE4,0x14,0x24,0x17,0xC4,0x08,0x28,0x07,0xD0,0x00,0x00],#"@",32*/
|
|
||||||
[0x00,0x04,0x00,0x3C,0x03,0xC4,0x1C,0x40,0x07,0x40,0x00,0xE4,0x00,0x1C,0x00,0x04],#"A",33*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x04,0x11,0x04,0x0E,0x88,0x00,0x70,0x00,0x00],#"B",34*/
|
|
||||||
[0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x08,0x1C,0x10,0x00,0x00],#"C",35*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00],#"D",36*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x04,0x17,0xC4,0x10,0x04,0x08,0x18,0x00,0x00],#"E",37*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x00,0x17,0xC0,0x10,0x00,0x08,0x00,0x00,0x00],#"F",38*/
|
|
||||||
[0x03,0xE0,0x0C,0x18,0x10,0x04,0x10,0x04,0x10,0x44,0x1C,0x78,0x00,0x40,0x00,0x00],#"G",39*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x10,0x84,0x00,0x80,0x00,0x80,0x10,0x84,0x1F,0xFC,0x10,0x04],#"H",40*/
|
|
||||||
[0x00,0x00,0x10,0x04,0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x04,0x00,0x00,0x00,0x00],#"I",41*/
|
|
||||||
[0x00,0x03,0x00,0x01,0x10,0x01,0x10,0x01,0x1F,0xFE,0x10,0x00,0x10,0x00,0x00,0x00],#"J",42*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x11,0x04,0x03,0x80,0x14,0x64,0x18,0x1C,0x10,0x04,0x00,0x00],#"K",43*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x10,0x04,0x00,0x04,0x00,0x04,0x00,0x04,0x00,0x0C,0x00,0x00],#"L",44*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x1F,0x00,0x00,0xFC,0x1F,0x00,0x1F,0xFC,0x10,0x04,0x00,0x00],#"M",45*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x0C,0x04,0x03,0x00,0x00,0xE0,0x10,0x18,0x1F,0xFC,0x10,0x00],#"N",46*/
|
|
||||||
[0x07,0xF0,0x08,0x08,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x08,0x07,0xF0,0x00,0x00],#"O",47*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x10,0x84,0x10,0x80,0x10,0x80,0x10,0x80,0x0F,0x00,0x00,0x00],#"P",48*/
|
|
||||||
[0x07,0xF0,0x08,0x18,0x10,0x24,0x10,0x24,0x10,0x1C,0x08,0x0A,0x07,0xF2,0x00,0x00],#"Q",49*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x11,0x04,0x11,0x00,0x11,0xC0,0x11,0x30,0x0E,0x0C,0x00,0x04],#"R",50*/
|
|
||||||
[0x00,0x00,0x0E,0x1C,0x11,0x04,0x10,0x84,0x10,0x84,0x10,0x44,0x1C,0x38,0x00,0x00],#"S",51*/
|
|
||||||
[0x18,0x00,0x10,0x00,0x10,0x04,0x1F,0xFC,0x10,0x04,0x10,0x00,0x18,0x00,0x00,0x00],#"T",52*/
|
|
||||||
[0x10,0x00,0x1F,0xF8,0x10,0x04,0x00,0x04,0x00,0x04,0x10,0x04,0x1F,0xF8,0x10,0x00],#"U",53*/
|
|
||||||
[0x10,0x00,0x1E,0x00,0x11,0xE0,0x00,0x1C,0x00,0x70,0x13,0x80,0x1C,0x00,0x10,0x00],#"V",54*/
|
|
||||||
[0x1F,0xC0,0x10,0x3C,0x00,0xE0,0x1F,0x00,0x00,0xE0,0x10,0x3C,0x1F,0xC0,0x00,0x00],#"W",55*/
|
|
||||||
[0x10,0x04,0x18,0x0C,0x16,0x34,0x01,0xC0,0x01,0xC0,0x16,0x34,0x18,0x0C,0x10,0x04],#"X",56*/
|
|
||||||
[0x10,0x00,0x1C,0x00,0x13,0x04,0x00,0xFC,0x13,0x04,0x1C,0x00,0x10,0x00,0x00,0x00],#"Y",57*/
|
|
||||||
[0x08,0x04,0x10,0x1C,0x10,0x64,0x10,0x84,0x13,0x04,0x1C,0x04,0x10,0x18,0x00,0x00],#"Z",58*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFE,0x40,0x02,0x40,0x02,0x40,0x02,0x00,0x00],#"[",59*/
|
|
||||||
[0x00,0x00,0x30,0x00,0x0C,0x00,0x03,0x80,0x00,0x60,0x00,0x1C,0x00,0x03,0x00,0x00],#"\",60*/
|
|
||||||
[0x00,0x00,0x40,0x02,0x40,0x02,0x40,0x02,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00],#"]",61*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x00,0x00],#"^",62*/
|
|
||||||
[0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01],#"_",63*/
|
|
||||||
[0x00,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#"`",64*/
|
|
||||||
[0x00,0x00,0x00,0x98,0x01,0x24,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xFC,0x00,0x04],#"a",65*/
|
|
||||||
[0x10,0x00,0x1F,0xFC,0x00,0x88,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00],#"b",66*/
|
|
||||||
[0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x00],#"c",67*/
|
|
||||||
[0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x11,0x08,0x1F,0xFC,0x00,0x04],#"d",68*/
|
|
||||||
[0x00,0x00,0x00,0xF8,0x01,0x44,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xC8,0x00,0x00],#"e",69*/
|
|
||||||
[0x00,0x00,0x01,0x04,0x01,0x04,0x0F,0xFC,0x11,0x04,0x11,0x04,0x11,0x00,0x18,0x00],#"f",70*/
|
|
||||||
[0x00,0x00,0x00,0xD6,0x01,0x29,0x01,0x29,0x01,0x29,0x01,0xC9,0x01,0x06,0x00,0x00],#"g",71*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04],#"h",72*/
|
|
||||||
[0x00,0x00,0x01,0x04,0x19,0x04,0x19,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00],#"i",73*/
|
|
||||||
[0x00,0x00,0x00,0x03,0x00,0x01,0x01,0x01,0x19,0x01,0x19,0xFE,0x00,0x00,0x00,0x00],#"j",74*/
|
|
||||||
[0x10,0x04,0x1F,0xFC,0x00,0x24,0x00,0x40,0x01,0xB4,0x01,0x0C,0x01,0x04,0x00,0x00],#"k",75*/
|
|
||||||
[0x00,0x00,0x10,0x04,0x10,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00],#"l",76*/
|
|
||||||
[0x01,0x04,0x01,0xFC,0x01,0x04,0x01,0x00,0x01,0xFC,0x01,0x04,0x01,0x00,0x00,0xFC],#"m",77*/
|
|
||||||
[0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04],#"n",78*/
|
|
||||||
[0x00,0x00,0x00,0xF8,0x01,0x04,0x01,0x04,0x01,0x04,0x01,0x04,0x00,0xF8,0x00,0x00],#"o",79*/
|
|
||||||
[0x01,0x01,0x01,0xFF,0x00,0x85,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00],#"p",80*/
|
|
||||||
[0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x01,0x05,0x01,0xFF,0x00,0x01],#"q",81*/
|
|
||||||
[0x01,0x04,0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x04,0x01,0x00,0x01,0x80,0x00,0x00],#"r",82*/
|
|
||||||
[0x00,0x00,0x00,0xCC,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x24,0x01,0x98,0x00,0x00],#"s",83*/
|
|
||||||
[0x00,0x00,0x01,0x00,0x01,0x00,0x07,0xF8,0x01,0x04,0x01,0x04,0x00,0x00,0x00,0x00],#"t",84*/
|
|
||||||
[0x01,0x00,0x01,0xF8,0x00,0x04,0x00,0x04,0x00,0x04,0x01,0x08,0x01,0xFC,0x00,0x04],#"u",85*/
|
|
||||||
[0x01,0x00,0x01,0x80,0x01,0x70,0x00,0x0C,0x00,0x10,0x01,0x60,0x01,0x80,0x01,0x00],#"v",86*/
|
|
||||||
[0x01,0xF0,0x01,0x0C,0x00,0x30,0x01,0xC0,0x00,0x30,0x01,0x0C,0x01,0xF0,0x01,0x00],#"w",87*/
|
|
||||||
[0x00,0x00,0x01,0x04,0x01,0x8C,0x00,0x74,0x01,0x70,0x01,0x8C,0x01,0x04,0x00,0x00],#"x",88*/
|
|
||||||
[0x01,0x01,0x01,0x81,0x01,0x71,0x00,0x0E,0x00,0x18,0x01,0x60,0x01,0x80,0x01,0x00],#"y",89*/
|
|
||||||
[0x00,0x00,0x01,0x84,0x01,0x0C,0x01,0x34,0x01,0x44,0x01,0x84,0x01,0x0C,0x00,0x00],#"z",90*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x3E,0xFC,0x40,0x02,0x40,0x02],#"{",91*/
|
|
||||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00],#"|",92*/
|
|
||||||
[0x00,0x00,0x40,0x02,0x40,0x02,0x3E,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00],#"]",93*/
|
|
||||||
[0x00,0x00,0x60,0x00,0x80,0x00,0x80,0x00,0x40,0x00,0x40,0x00,0x20,0x00,0x20,0x00],#"~",94*/
|
|
||||||
]
|
|
||||||
|
|
||||||
progress_head = [
|
|
||||||
0x00,0x00,0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,
|
|
||||||
0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,
|
|
||||||
]
|
|
||||||
progress_zero = [
|
|
||||||
0x00,0x00,0x00,0x00,0x3F,0xFC,0x3F,0xFC,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,
|
|
||||||
0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,
|
|
||||||
]
|
|
||||||
progress_start = [
|
|
||||||
0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,
|
|
||||||
0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,
|
|
||||||
]
|
|
||||||
progress_Spare = [
|
|
||||||
0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,
|
|
||||||
0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC
|
|
||||||
]
|
|
||||||
progress_full = [
|
|
||||||
0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,
|
|
||||||
0x30,0x0C,0x30,0x0C,0x30,0x0C,0x30,0x0C,0x3F,0xFC,0x3F,0xFC,0x00,0x00,0x00,0x00,
|
|
||||||
]
|
|
||||||
progress_end = [
|
|
||||||
0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,
|
|
||||||
0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x3F,0xFC,0x00,0x00,0x00,0x00,
|
|
||||||
]
|
|
||||||
|
|
||||||
class EPD_driver(object):
|
|
||||||
def __init__(self,spi):
|
|
||||||
#Initialize DC RST pin
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
|
||||||
GPIO.setwarnings(False)
|
|
||||||
GPIO.setup(RST,GPIO.OUT)
|
|
||||||
GPIO.setup(DC,GPIO.OUT)
|
|
||||||
GPIO.setup(CS,GPIO.OUT)
|
|
||||||
GPIO.setup(BUSY,GPIO.IN)
|
|
||||||
#Initialize SPI
|
|
||||||
self._spi = spi
|
|
||||||
self._spi.max_speed_hz = 2000000
|
|
||||||
self._spi.mode = 0b00
|
|
||||||
|
|
||||||
def ReadBusy(self):
|
|
||||||
for i in range(0,400):
|
|
||||||
if GPIO.input(BUSY)==0:
|
|
||||||
#print('Busy is Low')
|
|
||||||
return 1
|
|
||||||
time.sleep(0.01)
|
|
||||||
|
|
||||||
def EPD_WriteCMD(self,command):
|
|
||||||
GPIO.output(DC,GPIO.LOW)
|
|
||||||
#print 'send command : ' ,hex(command)
|
|
||||||
self._spi.writebytes([command])
|
|
||||||
|
|
||||||
def EPD_WriteCMD_p1(self,command,para):
|
|
||||||
self.ReadBusy()
|
|
||||||
GPIO.output(DC,GPIO.LOW)
|
|
||||||
#print 'send command : ' ,hex(command)
|
|
||||||
self._spi.writebytes([command])
|
|
||||||
GPIO.output(DC,GPIO.HIGH)
|
|
||||||
#print 'Sent to data : ' ,hex(para),
|
|
||||||
self._spi.writebytes([para])
|
|
||||||
|
|
||||||
def EPD_POWERON(self):
|
|
||||||
self.EPD_WriteCMD_p1(0x22,0xc0)
|
|
||||||
self.EPD_WriteCMD(0x20)
|
|
||||||
|
|
||||||
def EPD_Write(self,value):
|
|
||||||
"""Send command byte to display"""
|
|
||||||
GPIO.output(DC,GPIO.LOW)
|
|
||||||
time.sleep(0.01)
|
|
||||||
#print(value)
|
|
||||||
#print('send command : ' ,hex(value[0]))
|
|
||||||
self._spi.writebytes([value[0]]) #The first byte is written with the command value
|
|
||||||
GPIO.output(DC,GPIO.HIGH)
|
|
||||||
for i in range(0,len(value)-1):
|
|
||||||
data = value[i+1]
|
|
||||||
self._spi.writebytes([data])
|
|
||||||
|
|
||||||
def EPD_WriteDispRam(self,XSize,YSize,Dispbuff):
|
|
||||||
if XSize%8!=0 :
|
|
||||||
XSize = XSize+(8-XSize%8)
|
|
||||||
XSize = XSize/8
|
|
||||||
NUM = 0
|
|
||||||
self.ReadBusy()
|
|
||||||
GPIO.output(DC,GPIO.LOW)
|
|
||||||
self._spi.writebytes([0x24])
|
|
||||||
GPIO.output(DC,GPIO.HIGH)
|
|
||||||
for i in range(0,int(YSize)):
|
|
||||||
for j in range(0,int(XSize)):
|
|
||||||
self._spi.writebytes([Dispbuff[NUM]])
|
|
||||||
NUM = NUM +1
|
|
||||||
|
|
||||||
def EPD_WriteDispRamMono(self,XSize,YSize,dispdata):
|
|
||||||
if XSize%8!=0 :
|
|
||||||
XSize = XSize+(8-XSize%8)
|
|
||||||
XSize = XSize/8
|
|
||||||
NUM = 0
|
|
||||||
self.ReadBusy()
|
|
||||||
#print 'send command : ' ,hex(0x24)
|
|
||||||
GPIO.output(DC,GPIO.LOW)
|
|
||||||
self._spi.writebytes([0x24])
|
|
||||||
GPIO.output(DC,GPIO.HIGH)
|
|
||||||
#print 'Sent to data : ',hex(dispdata),
|
|
||||||
if isinstance(dispdata,list):
|
|
||||||
for i in range(0,YSize):
|
|
||||||
for j in range(0,XSize):
|
|
||||||
self._spi.writebytes([dispdata[NUM]])
|
|
||||||
NUM = NUM +1
|
|
||||||
#print hex(dispdata[i+j]),
|
|
||||||
else:
|
|
||||||
#print 'send data : ' ,dispdata
|
|
||||||
for i in range(0,YSize):
|
|
||||||
for j in range(0,int(XSize)):
|
|
||||||
self._spi.writebytes([dispdata])
|
|
||||||
|
|
||||||
def EPD_SetRamArea(self,Xstart,Xend,Ystart,Ystart1,Yend,Yend1):
|
|
||||||
RamAreaX = []
|
|
||||||
RamAreaY = []
|
|
||||||
RamAreaX.extend([0x44,Xstart,Xend])
|
|
||||||
RamAreaY.extend([0x45,Ystart,Ystart1,Yend,Yend1])
|
|
||||||
self.EPD_Write(RamAreaX)
|
|
||||||
self.EPD_Write(RamAreaY)
|
|
||||||
|
|
||||||
def EPD_SetRamPointer(self,addrX,addrY,addrY1):
|
|
||||||
RamPointerX = []
|
|
||||||
RamPointerY = []
|
|
||||||
RamPointerX.extend([0x4e,addrX])
|
|
||||||
RamPointerY.extend([0x4f,addrY,addrY1])
|
|
||||||
self.EPD_Write(RamPointerX)
|
|
||||||
self.EPD_Write(RamPointerY)
|
|
||||||
|
|
||||||
def part_display(self,RAM_XST,RAM_XEND,RAM_YST,RAM_YST1,RAM_YEND,RAM_YEND1):
|
|
||||||
self.EPD_SetRamArea(RAM_XST,RAM_XEND,RAM_YST,RAM_YST1,RAM_YEND,RAM_YEND1)
|
|
||||||
self.EPD_SetRamPointer(RAM_XST,RAM_YST,RAM_YST1)
|
|
||||||
|
|
||||||
def EPD_Init(self):
|
|
||||||
"""Initialize dispaly"""
|
|
||||||
"""2.reset driver"""
|
|
||||||
GPIO.output(CS,GPIO.LOW)
|
|
||||||
GPIO.output(RST,GPIO.HIGH)
|
|
||||||
time.sleep(0.1)
|
|
||||||
GPIO.output(RST,GPIO.LOW)
|
|
||||||
if GPIO.input(RST) == 0:
|
|
||||||
print('Reset is complete')
|
|
||||||
else:
|
|
||||||
print('Reset is false')
|
|
||||||
time.sleep(0.01)
|
|
||||||
GPIO.output(RST,GPIO.HIGH)
|
|
||||||
"""3.set register"""
|
|
||||||
print('***********set register Start**********')
|
|
||||||
self.EPD_Write(GDOControl) # Pannel configuration, Gate selection
|
|
||||||
self.EPD_Write(softstart) # X decrease, Y decrease
|
|
||||||
self.EPD_Write(VCOMVol) # VCOM setting
|
|
||||||
self.EPD_Write(DummyLine) # dummy line per gate
|
|
||||||
self.EPD_Write(Gatetime) # Gage time setting
|
|
||||||
self.EPD_Write(RamDataEntryMode) # X increase, Y decrease
|
|
||||||
self.EPD_SetRamArea(0x00,int((xDot-1)/8),int((yDot-1)%256),int((yDot-1)/256),0x00,0x00) # X-source area,Y-gage area
|
|
||||||
self.EPD_SetRamPointer(0x00,(yDot-1)%256,int((yDot-1)/256)) # set ram
|
|
||||||
print('***********set register end**********')
|
|
||||||
|
|
||||||
def EPD_Update(self):
|
|
||||||
self.EPD_WriteCMD_p1(0x22,0xc7)
|
|
||||||
self.EPD_WriteCMD(0x20)
|
|
||||||
self.EPD_WriteCMD(0xff)
|
|
||||||
|
|
||||||
def EPD_Update_Part(self):
|
|
||||||
self.EPD_WriteCMD_p1(0x22,0x04)
|
|
||||||
self.EPD_WriteCMD(0x20)
|
|
||||||
self.EPD_WriteCMD(0xff)
|
|
||||||
|
|
||||||
def EPD_init_Full(self):
|
|
||||||
self.EPD_Init()
|
|
||||||
self.EPD_Write(LUTDefault_full)
|
|
||||||
self.EPD_POWERON()
|
|
||||||
|
|
||||||
def EPD_init_Part(self):
|
|
||||||
#GPIO.output(CS,GPIO.LOW)
|
|
||||||
self.EPD_Init()
|
|
||||||
self.EPD_Write(LUTDefault_part)
|
|
||||||
self.EPD_POWERON()
|
|
||||||
|
|
||||||
def EPD_Dis_Full(self,DisBuffer,Label):
|
|
||||||
self.EPD_SetRamPointer(0x00,(yDot-1)%256,int((yDot-1)/256))
|
|
||||||
if Label == 0 :
|
|
||||||
self.EPD_WriteDispRamMono(xDot, yDot, 0xff)
|
|
||||||
else:
|
|
||||||
if isinstance(DisBuffer,list):
|
|
||||||
print('is list')
|
|
||||||
else:
|
|
||||||
print('not list')
|
|
||||||
self.EPD_WriteDispRam(xDot, yDot, DisBuffer)
|
|
||||||
self.EPD_Update()
|
|
||||||
|
|
||||||
def EPD_Dis_Part(self,xStart,xEnd,yStart,yEnd,DisBuffer,Label) :
|
|
||||||
if Label == 0 :
|
|
||||||
self.part_display(int(xStart/8),int(xEnd/8),int(yEnd%256),int(yEnd/256),int(yStart%256),int(yStart/256))
|
|
||||||
self.EPD_WriteDispRamMono(xEnd-xStart, yEnd-yStart+1, DisBuffer)
|
|
||||||
self.EPD_Update_Part()
|
|
||||||
time.sleep(0.5)
|
|
||||||
self.part_display(int(xStart/8),int(xEnd/8),int(yEnd%256),int(yEnd/256),int(yStart%256),int(yStart/256))
|
|
||||||
self.EPD_WriteDispRamMono(xEnd-xStart, yEnd-yStart+1, DisBuffer)
|
|
||||||
else:
|
|
||||||
self.part_display(int(xStart/8),int(xEnd/8),int(yEnd%256),int(yEnd/256),int(yStart%256),int(yStart/256))
|
|
||||||
self.EPD_WriteDispRam(xEnd-xStart, yEnd-yStart+1, DisBuffer)
|
|
||||||
self.EPD_Update_Part()
|
|
||||||
time.sleep(0.5)
|
|
||||||
self.part_display(int(xStart/8),int(xEnd/8),int(yEnd%256),int(yEnd/256),int(yStart%256),int(yStart/256))
|
|
||||||
self.EPD_WriteDispRam(xEnd-xStart, yEnd-yStart+1, DisBuffer)
|
|
||||||
|
|
||||||
"""***********************************************************************************************************************
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
|\\\ ///|
|
|
||||||
|\\\ App layer ///|
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
***********************************************************************************************************************"""
|
|
||||||
"""********************************************************************************
|
|
||||||
clear full screen
|
|
||||||
********************************************************************************"""
|
|
||||||
def Dis_Clear_full(self):
|
|
||||||
print('1.init full screen')
|
|
||||||
self.EPD_init_Full()
|
|
||||||
time.sleep(DELAYTIME)
|
|
||||||
|
|
||||||
#Clear screen
|
|
||||||
print('2.Clear screen')
|
|
||||||
m=0xff
|
|
||||||
self.EPD_Dis_Full(m,0)
|
|
||||||
time.sleep(DELAYTIME)
|
|
||||||
|
|
||||||
def Dis_Clear_part(self):
|
|
||||||
print('1.init part screen')
|
|
||||||
self.EPD_init_Part()
|
|
||||||
time.sleep(DELAYTIME)
|
|
||||||
|
|
||||||
#Clear screen
|
|
||||||
print('Clear screen')
|
|
||||||
m=0xff
|
|
||||||
self.EPD_Dis_Part(0,xDot-1,0,yDot-1,m,0)
|
|
||||||
time.sleep(DELAYTIME)
|
|
||||||
|
|
||||||
def Dis_full_pic(self,DisBuffer):
|
|
||||||
self.EPD_Dis_Full(DisBuffer,1)
|
|
||||||
|
|
||||||
def Dis_part_pic(self,xStart,xEnd,yStart,yEnd,DisBuffer):
|
|
||||||
self.EPD_Dis_Part(xStart,xEnd,yStart,yEnd,DisBuffer,1)
|
|
||||||
|
|
||||||
"""********************************************************************************
|
|
||||||
funtion : Select the character size
|
|
||||||
parameter :
|
|
||||||
acsii : char data
|
|
||||||
size : char len
|
|
||||||
mode : char mode
|
|
||||||
n : char len
|
|
||||||
Remarks:
|
|
||||||
********************************************************************************"""
|
|
||||||
def Dis_Char(self,acsii,size,mode,n):
|
|
||||||
ch = ord(acsii) - 32
|
|
||||||
#print "ch =",ch
|
|
||||||
if size == 12:
|
|
||||||
temp = [0 for i in range(11)]
|
|
||||||
temp = Font1206[ch]
|
|
||||||
else :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[ch]
|
|
||||||
for i in range(0,size):
|
|
||||||
del w_buffer[size*n+i]
|
|
||||||
w_buffer.insert(size*n+i,~temp[i]&0xff)
|
|
||||||
|
|
||||||
|
|
||||||
"""********************************************************************************
|
|
||||||
funtion : write string
|
|
||||||
parameter :
|
|
||||||
x : x start address
|
|
||||||
y : y start address
|
|
||||||
pString : Display data
|
|
||||||
Size : char len
|
|
||||||
Remarks:
|
|
||||||
********************************************************************************"""
|
|
||||||
def Dis_String(self,x,y,pString,Size):
|
|
||||||
len_s = 0
|
|
||||||
x_addr = x
|
|
||||||
y_addr = y
|
|
||||||
#1.Remove the character and determine the character size
|
|
||||||
while len_s < len(pString):
|
|
||||||
if (x > (xDot- Size / 2)):
|
|
||||||
x = 0
|
|
||||||
y = y + Size
|
|
||||||
if (y > (yDot- Size)):
|
|
||||||
y = x = 0
|
|
||||||
new_string = pString[len_s:len_s+1]
|
|
||||||
self.Dis_Char(new_string, Size, 0,len_s)
|
|
||||||
x = x + Size / 2
|
|
||||||
len_s = len_s + 1 #Calculate the current number for the first few characters
|
|
||||||
#2.show
|
|
||||||
if Size == 12:
|
|
||||||
self.EPD_Dis_Part(y_addr+1,y_addr+Size/2,yDot-(Size*len_s)-x_addr+1,yDot-x_addr,w_buffer,1)
|
|
||||||
else:
|
|
||||||
self.EPD_Dis_Part(y_addr+1,y_addr+Size/2,yDot-(Size*len_s)-x_addr+1,yDot-x_addr,w_buffer,1)
|
|
||||||
|
|
||||||
"""********************************************************************************
|
|
||||||
funtion : Drawing pic
|
|
||||||
parameter :
|
|
||||||
xStart : x start address
|
|
||||||
yStart : y start address
|
|
||||||
DisBuffer : Display data
|
|
||||||
xSize : Displays the x length of the image
|
|
||||||
ySize : Displays the y length of the image
|
|
||||||
Remarks:
|
|
||||||
The sample image is 32 * 32
|
|
||||||
********************************************************************************"""
|
|
||||||
def Dis_Drawing(self,xStart,yStart,DisBuffer,xSize,ySize):
|
|
||||||
x_addr = xStart*8
|
|
||||||
y_addr = yStart*8
|
|
||||||
self.EPD_Dis_Part(y_addr,y_addr+xSize-1,yDot-ySize-x_addr,yDot-x_addr-1,DisBuffer,1)
|
|
||||||
|
|
||||||
|
|
||||||
"""********************************************************************************
|
|
||||||
funtion : show Progress
|
|
||||||
parameter :
|
|
||||||
progress_len : Progress bar length
|
|
||||||
********************************************************************************"""
|
|
||||||
def Dis_Progress(self,progress_len):
|
|
||||||
y = 0
|
|
||||||
pheight_pix = 2
|
|
||||||
pWidth_pix = 16
|
|
||||||
w_buffer = [0xff for i in range(0,5000)]
|
|
||||||
#1.Initialize the progress bar length and place it in the center of the lower end of the display
|
|
||||||
for z in range(0,progress_len):
|
|
||||||
for x in range(0,pWidth_pix*pheight_pix):
|
|
||||||
if(z == 0):
|
|
||||||
temp = [0 for i in range(pheight_pix*pWidth_pix-1)]
|
|
||||||
temp = progress_head
|
|
||||||
del w_buffer[y]
|
|
||||||
w_buffer.insert(y,temp[x])
|
|
||||||
y = y + 1
|
|
||||||
elif(z == progress_len -1):
|
|
||||||
temp = [0 for i in range(pheight_pix*pWidth_pix-1)]
|
|
||||||
temp = progress_end
|
|
||||||
del w_buffer[y]
|
|
||||||
w_buffer.insert(y,temp[x])
|
|
||||||
y = y + 1
|
|
||||||
else:
|
|
||||||
temp = [0 for i in range(pheight_pix*pWidth_pix-1)]
|
|
||||||
temp = progress_Spare
|
|
||||||
del w_buffer[y]
|
|
||||||
w_buffer.insert(y,temp[x])
|
|
||||||
y = y + 1
|
|
||||||
self.EPD_Dis_Part(xDot-xDot/16-5,xDot-xDot/16+4,(yDot-16*progress_len)/2-1,(yDot-16*progress_len)/2-1+16*progress_len,w_buffer,1)
|
|
||||||
#2.Load progress bar
|
|
||||||
y =0
|
|
||||||
for z in range(0,progress_len):
|
|
||||||
for x in range(0,pWidth_pix*pheight_pix):
|
|
||||||
if(z == 0):
|
|
||||||
temp = [0 for i in range(pheight_pix*pWidth_pix-1)]
|
|
||||||
temp = progress_zero
|
|
||||||
del w_buffer[y]
|
|
||||||
w_buffer.insert(y,temp[x])
|
|
||||||
y = y + 1
|
|
||||||
elif(z == progress_len-1):
|
|
||||||
temp = [0 for i in range(pheight_pix*pWidth_pix-1)]
|
|
||||||
temp = progress_full
|
|
||||||
del w_buffer[y]
|
|
||||||
w_buffer.insert(y,temp[x])
|
|
||||||
y = y + 1
|
|
||||||
else:
|
|
||||||
temp = [0 for i in range(pheight_pix*pWidth_pix-1)]
|
|
||||||
temp = progress_start
|
|
||||||
del w_buffer[y]
|
|
||||||
w_buffer.insert(y,temp[x])
|
|
||||||
y = y + 1
|
|
||||||
self.EPD_Dis_Part(xDot-xDot/16-5,xDot-xDot/16+4,(yDot-16*progress_len)/2-1,(yDot-16*progress_len)/2-1+16*progress_len,w_buffer,1)
|
|
||||||
|
|
||||||
def Dis_showtime(self,hour,minute,sec):
|
|
||||||
len_s = 16
|
|
||||||
w_buffer = [0xff for i in range(5000)]
|
|
||||||
for z in range(0,8):
|
|
||||||
for x in range(0,len_s):
|
|
||||||
if z == 0 :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[int(16+hour/10)]
|
|
||||||
del w_buffer[x + z *16]
|
|
||||||
w_buffer.insert(x + z *16,~temp[x]&0xff)
|
|
||||||
elif z == 1 :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[int(16+hour%10)]
|
|
||||||
del w_buffer[x + z *16]
|
|
||||||
w_buffer.insert(x + z *16,~temp[x]&0xff)
|
|
||||||
elif z == 2 :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[26]
|
|
||||||
del w_buffer[x + z *16]#delete
|
|
||||||
w_buffer.insert(x + z *16,~temp[x]&0xff)
|
|
||||||
elif z == 3 :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[int(16+minute/10)]
|
|
||||||
del w_buffer[x + z *16]
|
|
||||||
w_buffer.insert(x + z *16,~temp[x]&0xff)
|
|
||||||
elif z == 4 :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[int(16+minute%10)]
|
|
||||||
del w_buffer[x + z *16]
|
|
||||||
w_buffer.insert(x + z *16,~temp[x]&0xff)
|
|
||||||
elif z == 5 :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[26]
|
|
||||||
del w_buffer[x + z *16]
|
|
||||||
w_buffer.insert(x + z *16,~temp[x]&0xff)
|
|
||||||
elif z == 6 :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[int(16+sec/10)]
|
|
||||||
del w_buffer[x + z *16]
|
|
||||||
w_buffer.insert(x + z *16,~temp[x]&0xff)
|
|
||||||
elif z == 7 :
|
|
||||||
temp = [0 for i in range(15)]
|
|
||||||
temp = Font1608[int(16+sec%10)]
|
|
||||||
del w_buffer[x + z *16]
|
|
||||||
w_buffer.insert(x + z *16,~temp[x]&0xff)
|
|
||||||
else :
|
|
||||||
return 1
|
|
||||||
self.EPD_Dis_Part(int(xDot/10-1),int(xDot/10+8),int((yDot-16*4)/2),int((yDot-16*4)/2-1+16*4),w_buffer,1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user