def Clear(self, color): self.send_command(0x10) for i in range(0, int(self.width * self.height / 8)): self.send_data(0x00) epdconfig.delay_ms(10) self.send_command(0x13) for i in range(0, int(self.width * self.height / 8)): self.send_data(0xFF) epdconfig.delay_ms(10) self.SetFullReg() self.TurnOnDisplay()
def display(self, image): self.send_command(0x10) for i in range(0, int(self.width * self.height / 8)): self.send_data(0x00) epdconfig.delay_ms(10) self.send_command(0x13) for i in range(0, int(self.width * self.height / 8)): self.send_data(image[i]) epdconfig.delay_ms(10) self.SetFullReg() self.TurnOnDisplay()
def reset(self): epdconfig.digital_write(self.reset_pin, 1) epdconfig.delay_ms(200) epdconfig.digital_write(self.reset_pin, 0) epdconfig.delay_ms(10) epdconfig.digital_write(self.reset_pin, 1) epdconfig.delay_ms(200)
def DisplayPartial(self, image): self.SetPartReg() self.send_command(0x91) self.send_command(0x90) self.send_data(0) self.send_data(self.width - 1) self.send_data(0) self.send_data(0) self.send_data(int(self.height / 256)) self.send_data(self.height % 256 - 1) self.send_data(0x28) self.send_command(0x10) for i in range(0, int(self.width * self.height / 8)): self.send_data(image[i]) epdconfig.delay_ms(10) self.send_command(0x13) for i in range(0, int(self.width * self.height / 8)): self.send_data(~image[i]) epdconfig.delay_ms(10) self.TurnOnDisplay()
def ReadBusy(self): while (epdconfig.digital_read( self.busy_pin) == 1): # 0: idle, 1: busy epdconfig.delay_ms(200)
def TurnOnDisplay(self): self.send_command(0x12) epdconfig.delay_ms(10) self.ReadBusy()
def ReadBusy(self): 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) logging.debug("e-Paper busy release")