Esempio n. 1
0
 def ReadBusy(self):
     self.send_command(0x71)
     busy = epdconfig.digital_read(self.busy_pin)
     while (busy == 0):
         self.send_command(0x71)
         busy = epdconfig.digital_read(self.busy_pin)
     epdconfig.delay_ms(200)
Esempio n. 2
0
    def display(self, imageblack, imagered):
        self.send_command(DATA_START_TRANSMISSION_1)
        for i in range(0, self.width // 8 * self.height):
            temp1 = imageblack[i]
            temp2 = imagered[i]
            j = 0
            while (j < 8):
                if ((temp2 & 0x80) == 0x00):
                    temp3 = 0x04  #red
                elif ((temp1 & 0x80) == 0x00):
                    temp3 = 0x00  #black
                else:
                    temp3 = 0x03  #white

                temp3 = (temp3 << 4) & 0xFF
                temp1 = (temp1 << 1) & 0xFF
                temp2 = (temp2 << 1) & 0xFF
                j += 1
                if ((temp2 & 0x80) == 0x00):
                    temp3 |= 0x04  #red
                elif ((temp1 & 0x80) == 0x00):
                    temp3 |= 0x00  #black
                else:
                    temp3 |= 0x03  #white
                temp1 = (temp1 << 1) & 0xFF
                temp2 = (temp2 << 1) & 0xFF
                self.send_data(temp3)
                j += 1
        # self.send_command(POWER_ON)
        # self.wait_until_idle()
        self.send_command(DISPLAY_REFRESH)
        epdconfig.delay_ms(100)
        self.wait_until_idle()
Esempio n. 3
0
 def reset(self):
     # epdconfig.digital_write(self.reset_pin, GPIO.HIGH)
     # epdconfig.delay_ms(200)
     epdconfig.digital_write(self.reset_pin, GPIO.LOW)  # module reset
     epdconfig.delay_ms(200)
     epdconfig.digital_write(self.reset_pin, GPIO.HIGH)
     epdconfig.delay_ms(200)
Esempio n. 4
0
    def Clear(self):
        self.send_command(0x10)
        for i in range(0, int(self.width * self.height / 8)):
            self.send_data(0xff)

        self.send_command(0x13)
        for i in range(0, int(self.width * self.height / 8)):
            self.send_data(0x00)

        self.send_command(0x12)
        epdconfig.delay_ms(100)
        self.ReadBusy()
Esempio n. 5
0
    def display(self, imageblack, imagered):
        self.send_command(0x10)
        for i in range(0, int(self.width * self.height / 8)):
            self.send_data(imageblack[i])

        self.send_command(0x13)
        for i in range(0, int(self.width * self.height / 8)):
            self.send_data(~imagered[i])

        self.send_command(0x12)
        epdconfig.delay_ms(100)
        self.ReadBusy()
Esempio n. 6
0
 def Clear(self, color):
     self.send_command(DATA_START_TRANSMISSION_1)
     for i in range(0, self.width // 8 * self.height):
         self.send_data(0x33)
         self.send_data(0x33)
         self.send_data(0x33)
         self.send_data(0x33)
     # self.send_command(POWER_ON)
     # self.wait_until_idle()
     self.send_command(DISPLAY_REFRESH)
     epdconfig.delay_ms(100)
     self.wait_until_idle()
Esempio n. 7
0
    def init(self):
        if (epdconfig.module_init() != 0):
            return -1

        self.reset()

        self.send_command(0x01)
        #POWER SETTING
        self.send_data(0x07)
        self.send_data(0x07)
        #VGH=20V,VGL=-20V
        self.send_data(0x3f)
        #VDH=15V
        self.send_data(0x3f)
        #VDL=-15V

        self.send_command(0x04)
        #POWER ON
        epdconfig.delay_ms(100)
        self.ReadBusy()

        self.send_command(0X00)
        #PANNEL SETTING
        self.send_data(0x0F)
        #KW-3f   KWR-2F	BWROTP 0f	BWOTP 1f

        self.send_command(0x61)
        #tres
        self.send_data(0x03)
        #source 800
        self.send_data(0x20)
        self.send_data(0x01)
        #gate 480
        self.send_data(0xE0)

        self.send_command(0X15)
        self.send_data(0x00)

        self.send_command(0X50)
        #VCOM AND DATA INTERVAL SETTING
        self.send_data(0x11)
        self.send_data(0x07)

        self.send_command(0X60)
        #TCON SETTING
        self.send_data(0x22)

        return 0
Esempio n. 8
0
 def reset(self):
     epdconfig.digital_write(self.reset_pin, 1)
     epdconfig.delay_ms(200)
     epdconfig.digital_write(self.reset_pin, 0)
     epdconfig.delay_ms(4)
     epdconfig.digital_write(self.reset_pin, 1)
     epdconfig.delay_ms(200)
Esempio n. 9
0
 def wait_until_idle(self):
     while (epdconfig.digital_read(self.busy_pin) == 0):  # 0: busy, 1: idle
         epdconfig.delay_ms(100)