Adding support for 9.7"" ePaper display
This commit is contained in:
		| @@ -23,6 +23,7 @@ class Layout: | |||||||
|  |  | ||||||
|     if (model != None) and (width == None) and (height == None): |     if (model != None) and (width == None) and (height == None): | ||||||
|       display_dimensions = { |       display_dimensions = { | ||||||
|  |         '9_in_7': (1200, 825), | ||||||
|         'epd_7_in_5_v2_colour': (800, 480), |         'epd_7_in_5_v2_colour': (800, 480), | ||||||
|         'epd_7_in_5_v2': (800, 480), |         'epd_7_in_5_v2': (800, 480), | ||||||
|         'epd_7_in_5_colour': (640, 384), |         'epd_7_in_5_colour': (640, 384), | ||||||
| @@ -30,7 +31,7 @@ class Layout: | |||||||
|         'epd_5_in_83_colour': (600, 448), |         'epd_5_in_83_colour': (600, 448), | ||||||
|         'epd_5_in_83': (600, 448), |         'epd_5_in_83': (600, 448), | ||||||
|         'epd_4_in_2_colour': (400, 300), |         'epd_4_in_2_colour': (400, 300), | ||||||
|       'epd_4_in_2': (400, 300), |         'epd_4_in_2': (400, 300) | ||||||
|         } |         } | ||||||
|  |  | ||||||
|       self.display_height, self.display_width = display_dimensions[model] |       self.display_height, self.display_width = display_dimensions[model] | ||||||
|   | |||||||
| @@ -26,7 +26,8 @@ class Settings: | |||||||
|   'epd_7_in_5_v2_colour', 'epd_7_in_5_v2', |   'epd_7_in_5_v2_colour', 'epd_7_in_5_v2', | ||||||
|   'epd_7_in_5_colour', 'epd_7_in_5', |   'epd_7_in_5_colour', 'epd_7_in_5', | ||||||
|   'epd_5_in_83_colour','epd_5_in_83', |   'epd_5_in_83_colour','epd_5_in_83', | ||||||
|   'epd_4_in_2_colour', 'epd_4_in_2' |   'epd_4_in_2_colour', 'epd_4_in_2', | ||||||
|  |   '9_in_7' | ||||||
|   ] |   ] | ||||||
|  |  | ||||||
|   def __init__(self, settings_file_path): |   def __init__(self, settings_file_path): | ||||||
|   | |||||||
							
								
								
									
										57
									
								
								inkycal/display/drivers/9_in_7.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								inkycal/display/drivers/9_in_7.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | |||||||
|  | #!/usr/bin/python3 | ||||||
|  | # -*- coding: utf-8 -*- | ||||||
|  | """ | ||||||
|  | 9.7" driver class | ||||||
|  | Copyright by aceisace | ||||||
|  | """ | ||||||
|  | from inkycal.custom import images, top_level | ||||||
|  | from subprocess import call, run | ||||||
|  | from os import chdir | ||||||
|  | from PIL import Image | ||||||
|  |  | ||||||
|  | # Display resolution | ||||||
|  | EPD_WIDTH       = 1200 | ||||||
|  | EPD_HEIGHT      = 825 | ||||||
|  |  | ||||||
|  | driver_dir = top_level+'/inkycal/display/drivers/9_in_7_drivers/' | ||||||
|  |  | ||||||
|  | class EPD: | ||||||
|  |  | ||||||
|  |   def __init__(self): | ||||||
|  |     """9.7" epaper class""" | ||||||
|  |     with open(driver_dir+'setup_state.txt', 'r') as file: | ||||||
|  |       setup_state = int(file.readline().rstrip()) | ||||||
|  |  | ||||||
|  |     if setup_state == 0: | ||||||
|  |       print('installing additional drivers...') | ||||||
|  |       self.setup() | ||||||
|  |  | ||||||
|  |   def init(self): | ||||||
|  |     pass | ||||||
|  |  | ||||||
|  |   def display(self, command): | ||||||
|  |     """displays an image""" | ||||||
|  |     try: | ||||||
|  |       run_command = command.split() | ||||||
|  |       run(run_command) | ||||||
|  |     except: | ||||||
|  |       print("oops, something didn't work right :/") | ||||||
|  |  | ||||||
|  |   def getbuffer(self, image): | ||||||
|  |     """ad-hoc""" | ||||||
|  |     image.convert('RGB').save(images+'canvas.bmp', 'BMP') | ||||||
|  |     command = 'sudo {}IT8951/IT8951 0 0 {}'.format(driver_dir, images+'canvas.bmp') | ||||||
|  |     print(command) | ||||||
|  |     return command | ||||||
|  |  | ||||||
|  |   def setup(self): | ||||||
|  |     """Runs the required setup for 9.7" epaper displays""" | ||||||
|  |     run(["chmod", "+x", driver_dir+"install.sh"]) | ||||||
|  |     call(driver_dir+"install.sh") | ||||||
|  |  | ||||||
|  |     with open(driver_dir+'setup_state.txt', 'w') as file: | ||||||
|  |       file.write('1') | ||||||
|  |  | ||||||
|  |   def sleep(self): | ||||||
|  |     pass | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								inkycal/display/drivers/9_in_7_drivers/install.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								inkycal/display/drivers/9_in_7_drivers/install.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | #!/bin/bash | ||||||
|  |  | ||||||
|  | # Installs drivers for 9.7" ePaper display | ||||||
|  | cd bcm2835-1.58 | ||||||
|  | chmod +x configure | ||||||
|  | ./configure | ||||||
|  | make | ||||||
|  | sudo make check | ||||||
|  | sudo make install | ||||||
|  |  | ||||||
|  | cd .. | ||||||
|  | cd IT8951 | ||||||
|  | make clean | ||||||
|  | make | ||||||
		Reference in New Issue
	
	Block a user