fix for 12.48" epd
This commit is contained in:
		| @@ -151,7 +151,6 @@ class EPD(object): | ||||
|         return buf | ||||
|          | ||||
|     def display(self, buf): | ||||
|         start = time.clock()        | ||||
|  | ||||
|         #M1 part 648*492     | ||||
|         self.M1_SendCommand(0x13) | ||||
| @@ -177,13 +176,10 @@ class EPD(object): | ||||
|             for x in  range(0, 81): | ||||
|                 self.S2_SendData(buf[y*163 + x]) | ||||
|                  | ||||
|         end = time.clock() | ||||
|         print("use time:%f"%(end - start)) | ||||
|         self.TurnOnDisplay() | ||||
|  | ||||
|     def clear(self): | ||||
|         """Clear contents of image buffer""" | ||||
|         start = time.clock() | ||||
|         self.M1_SendCommand(0x13) | ||||
|         for y in  range(492, 984): | ||||
|             for x in  range(0, 81): | ||||
| @@ -203,8 +199,6 @@ class EPD(object): | ||||
|         for y in  range(0, 492): | ||||
|             for x in  range(0, 81): | ||||
|                 self.S2_SendData(0xff) | ||||
|         end = time.clock() | ||||
|         print("use time:%f"%(end - start)) | ||||
|         self.TurnOnDisplay() | ||||
|          | ||||
|     """   M1S1M2S2 Write register address and data     """ | ||||
|   | ||||
| @@ -172,7 +172,6 @@ class EPD(object): | ||||
|         return buf | ||||
|          | ||||
|     def display(self, blackbuf, redbuf): | ||||
|         start = time.clock() | ||||
|                      | ||||
|         #S2 part 648*492 | ||||
|         self.S2_SendCommand(0x10) | ||||
| @@ -213,14 +212,10 @@ class EPD(object): | ||||
|         for y in  range(492, 984): | ||||
|             for x in  range(81, 163): | ||||
|                 self.S1_SendData(~redbuf[y*163 + x]) | ||||
|                  | ||||
|         end = time.clock() | ||||
|         print("use time: %f"%(end - start)) | ||||
|         self.TurnOnDisplay() | ||||
|  | ||||
|     def clear(self): | ||||
|         """Clear contents of image buffer""" | ||||
|         start = time.clock() | ||||
|          | ||||
|         self.S2_SendCommand(0x10) | ||||
|         for y in  range(0, 492): | ||||
| @@ -258,11 +253,6 @@ class EPD(object): | ||||
|             for x in  range(81, 163): | ||||
|                 self.S1_SendData(0x00) | ||||
|          | ||||
|         end = time.clock() | ||||
|         print (end) | ||||
|         print (start) | ||||
|         print("use time: %f" %(end - start)) | ||||
|          | ||||
|         self.TurnOnDisplay() | ||||
|          | ||||
|     def Reset(self): | ||||
|   | ||||
| @@ -53,20 +53,12 @@ EPD_S1_BUSY_PIN  =19 | ||||
| EPD_M2_BUSY_PIN  =27 | ||||
| EPD_S2_BUSY_PIN  =24 | ||||
|  | ||||
| find_dirs = [ | ||||
|     os.path.dirname(os.path.realpath(__file__)), | ||||
|     '/usr/local/lib', | ||||
|     '/usr/lib', | ||||
| ] | ||||
| spi = None | ||||
| for find_dir in find_dirs: | ||||
|     so_filename = os.path.join(find_dir, 'epd_12_in_48_lib.so') | ||||
|     if os.path.exists(so_filename): | ||||
|         spi = CDLL(so_filename) | ||||
|         break | ||||
| if spi is None: | ||||
|     RuntimeError('Cannot find epd_12_in_48_lib.so') | ||||
| additional_driver_path = f"{os.getcwd()}/epd_12_in_48_lib.so" | ||||
|  | ||||
| if not os.path.exists(additional_driver_path): | ||||
|     RuntimeError("Inkycal cannot find the additional driver files for 12in48 3-colour") | ||||
|  | ||||
| spi = CDLL(additional_driver_path) | ||||
|  | ||||
| def digital_write(pin, value): | ||||
|     GPIO.output(pin, value) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user