def __init__(self, *args, **kwargs): self._epd_path = '/dev/epd' self._width = 200 self._height = 96 self._panel = 'EPD 2.0' self._cog = 0 self._film = 0 self._auto = False self._lm75b = LM75B() if len(args) > 0: self._epd_path = args[0] elif 'epd' in kwargs: self._epd_path = kwargs['epd'] if ('auto' in kwargs) and kwargs['auto']: self._auto = True with open(os.path.join(self._epd_path, 'version')) as f: self._version = f.readline().rstrip('\n') with open(os.path.join(self._epd_path, 'panel')) as f: line = f.readline().rstrip('\n') m = self.PANEL_RE.match(line) if None == m: raise EPDError('invalid panel string') self._panel = m.group(1) + ' ' + m.group(2) self._width = int(m.group(3)) self._height = int(m.group(4)) self._cog = int(m.group(5)) self._film = int(m.group(6)) if self._width < 1 or self._height < 1: raise EPDError('invalid panel geometry')
def __init__(self, epd_path='/dev/epd', rotation=0, auto_update=False): self._epd_path = epd_path self._panel = 'EPD 2.0' self._cog = 0 self._film = 0 self.use_temp_sensor = True self._lm75b = LM75B() with open(os.path.join(self._epd_path, 'version')) as f: self._version = f.readline().rstrip('\n') width, height = 0, 0 with open(os.path.join(self._epd_path, 'panel')) as f: m = self.PANEL_RE.match(f.readline().rstrip('\n')) if not m: raise EPDError('invalid panel string') self._panel = m.group(1) + ' ' + m.group(2) width = int(m.group(3)) height = int(m.group(4)) self._cog = int(m.group(5)) self._film = int(m.group(6)) super(EPD, self).__init__(width=width, height=height, rotation=rotation, auto_update=auto_update)