Beispiel #1
0
    def display_frame(self, full_refresh: bool = False) -> None:
        """Display frame stored in sram"""
        # TODO check the display frame commands in the new library
        LOG.debug('Display frame stored in sram')
        self.send_command(VCM_DC_SETTING)
        self.send_data(0x28)
        self.send_command(VCOM_AND_DATA_INTERVAL_SETTING)
        self.send_command(
            0x97
        )  # VBDF 17|D7 VBDW 97  VBDB 57  VBDF F7  VBDW 77  VBDB 37  VBDR B7

        if self._frame_counter == config.FULL_REFRESH or full_refresh:
            self.set_lut()
            self.send_command(DISPLAY_REFRESH)
            self.wait_until_idle()
            self.set_lut(quick=True)
            self._frame_counter = 0
        else:
            self._frame_counter += 1
            self.send_command(DISPLAY_REFRESH)
            gpio.delay_ms(200)
            self.wait_until_idle()

        LOG.debug('frame counter: %s/%s before long screen refresh',
                  self._frame_counter, config.FULL_REFRESH)
Beispiel #2
0
 def display_partial_frame(self) -> None:
     # self.set_partial_lut()
     self.send_command(DISPLAY_REFRESH)
     gpio.delay_ms(
         200
     )  # THe current library from waveshere's example code tells this delay is important
     self.wait_until_idle()
     self.set_lut(quick=True)
Beispiel #3
0
 def wait_until_idle(self) -> None:
     timeout = 0
     while gpio.digital_read(self.busy_pin) == 0:  # 0: busy, 1: idle
         gpio.delay_ms(100)
         timeout += 1
         if timeout >= 100:
             LOG.debug(
                 "EPAPER: busy signal did not deactivate/epaper not responding in 10 sec"
             )
             timeout = 0
Beispiel #4
0
    def set_frame(self, frame_buffer: Tuple[bytes]) -> None:
        """
        Send frame to sram on the epaper module
        :param frame_buffer: tuple with frame buffer
        """
        self.send_command(DATA_START_TRANSMISSION_1)
        self.send_data(frame_buffer)
        self.send_command(DATA_STOP)
        gpio.delay_ms(2)

        self.send_command(DATA_START_TRANSMISSION_2)
        self.send_data(frame_buffer)
        self.send_command(DATA_STOP)
        gpio.delay_ms(2)
Beispiel #5
0
 def reset(self) -> None:
     """Module reset"""
     gpio.digital_write(self.reset_pin, 1)
     gpio.delay_ms(200)
     gpio.digital_write(self.reset_pin, 0)
     gpio.delay_ms(10)
     gpio.digital_write(self.reset_pin, 1)
     gpio.delay_ms(200)