From ca6f940ffd7e5b34d7c4aa806f40325ac21edafb Mon Sep 17 00:00:00 2001 From: Mike Causer Date: Thu, 7 Jun 2018 19:46:00 +1000 Subject: [PATCH] MicroPython v1.9 updates Replace deprecated Pin.high()/low() methods with .__call__(1/0) --- epaper1in54.py | 16 ++++++++-------- epaper1in54b.py | 16 ++++++++-------- epaper2in13.py | 16 ++++++++-------- epaper2in13b.py | 16 ++++++++-------- epaper2in7.py | 16 ++++++++-------- epaper2in7b.py | 16 ++++++++-------- epaper2in9.py | 16 ++++++++-------- epaper2in9b.py | 16 ++++++++-------- epaper4in2.py | 16 ++++++++-------- epaper4in2b.py | 16 ++++++++-------- epaper5in83.py | 16 ++++++++-------- epaper5in83b.py | 16 ++++++++-------- epaper7in5.py | 16 ++++++++-------- epaper7in5b.py | 16 ++++++++-------- 14 files changed, 112 insertions(+), 112 deletions(-) diff --git a/epaper1in54.py b/epaper1in54.py index 0d51323..88a0e8e 100644 --- a/epaper1in54.py +++ b/epaper1in54.py @@ -76,18 +76,18 @@ class EPD: LUT_PARTIAL_UPDATE = bytearray(b'\x10\x18\x18\x08\x18\x18\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x14\x44\x12\x00\x00\x00\x00\x00\x00') def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -107,9 +107,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) def set_lut(self, lut): diff --git a/epaper1in54b.py b/epaper1in54b.py index e88c46d..5498e1b 100644 --- a/epaper1in54b.py +++ b/epaper1in54b.py @@ -108,18 +108,18 @@ class EPD: LUT_RED1 = LUT_VCOM1 def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -140,9 +140,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) def set_lut_bw(self): diff --git a/epaper2in13.py b/epaper2in13.py index abff2b8..44c54ad 100644 --- a/epaper2in13.py +++ b/epaper2in13.py @@ -81,18 +81,18 @@ class EPD: LUT_PARTIAL_UPDATE = bytearray(b'\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0F\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -112,9 +112,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) def set_lut(self, lut): diff --git a/epaper2in13b.py b/epaper2in13b.py index 213d320..db9f943 100644 --- a/epaper2in13b.py +++ b/epaper2in13b.py @@ -98,18 +98,18 @@ class EPD: self.rotate = ROTATE_0 def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -125,9 +125,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) def display_frame(self, frame_buffer_black, frame_buffer_red): diff --git a/epaper2in7.py b/epaper2in7.py index 979b54b..bbd46cf 100644 --- a/epaper2in7.py +++ b/epaper2in7.py @@ -95,18 +95,18 @@ class EPD: LUT_WB = LUT_BB # R23H w def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -133,9 +133,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) def set_lut(self): diff --git a/epaper2in7b.py b/epaper2in7b.py index 8c1eb23..91c6e3f 100644 --- a/epaper2in7b.py +++ b/epaper2in7b.py @@ -105,18 +105,18 @@ class EPD: LUT_WB = bytearray(b'\x90\x1A\x1A\x00\x00\x01\x20\x0A\x0A\x00\x00\x08\x84\x0E\x01\x0E\x01\x10\x10\x0A\x0A\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0E\x00\x00\x0A\x00\x23\x00\x00\x00\x01') # R24H b def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -141,9 +141,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) def set_lut(self): diff --git a/epaper2in9.py b/epaper2in9.py index 9dc7570..23cf418 100644 --- a/epaper2in9.py +++ b/epaper2in9.py @@ -82,18 +82,18 @@ class EPD: #LUT_PARTIAL_UPDATE = bytearray(b'\x10\x18\x18\x08\x18\x18\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x14\x44\x12\x00\x00\x00\x00\x00\x00') def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -110,9 +110,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) def set_lut(self, lut): diff --git a/epaper2in9b.py b/epaper2in9b.py index 9e4dc08..ac7ed70 100644 --- a/epaper2in9b.py +++ b/epaper2in9b.py @@ -93,18 +93,18 @@ class EPD: self.rotate = ROTATE_0 def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -121,9 +121,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) def display_frame(self, frame_buffer_black, frame_buffer_red): diff --git a/epaper4in2.py b/epaper4in2.py index 843602e..1ac915e 100644 --- a/epaper4in2.py +++ b/epaper4in2.py @@ -98,18 +98,18 @@ class EPD: LUT_WB = LUT_BB def _command(self, command, data=None): - self.dc.value(0) - self.cs.value(0) + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.value(1) + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.value(1) - self.cs.value(0) + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.value(1) + self.cs(1) def init(self): self.reset() @@ -125,9 +125,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.value(0) + self.rst(0) sleep_ms(200) - self.rst.value(1) + self.rst(1) sleep_ms(200) def set_lut(self): diff --git a/epaper4in2b.py b/epaper4in2b.py index 2b28a4f..e4afd15 100644 --- a/epaper4in2b.py +++ b/epaper4in2b.py @@ -91,18 +91,18 @@ class EPD: self.height = EPD_HEIGHT def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -116,9 +116,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) # draw the current frame memory diff --git a/epaper5in83.py b/epaper5in83.py index b6fed18..7f63c10 100644 --- a/epaper5in83.py +++ b/epaper5in83.py @@ -90,18 +90,18 @@ class EPD: self.height = EPD_HEIGHT def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -123,9 +123,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) # draw the current frame memory diff --git a/epaper5in83b.py b/epaper5in83b.py index d2a0b3a..390f7af 100644 --- a/epaper5in83b.py +++ b/epaper5in83b.py @@ -90,18 +90,18 @@ class EPD: self.height = EPD_HEIGHT def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -123,9 +123,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) # draw the current frame memory diff --git a/epaper7in5.py b/epaper7in5.py index 438a40e..31cbe52 100644 --- a/epaper7in5.py +++ b/epaper7in5.py @@ -90,18 +90,18 @@ class EPD: self.height = EPD_HEIGHT def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -123,9 +123,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) # draw the current frame memory diff --git a/epaper7in5b.py b/epaper7in5b.py index a9bf2ec..f4a409b 100644 --- a/epaper7in5b.py +++ b/epaper7in5b.py @@ -92,18 +92,18 @@ class EPD: self.height = EPD_HEIGHT def _command(self, command, data=None): - self.dc.low() - self.cs.low() + self.dc(0) + self.cs(0) self.spi.write(bytearray([command])) - self.cs.high() + self.cs(1) if data is not None: self._data(data) def _data(self, data): - self.dc.high() - self.cs.low() + self.dc(1) + self.cs(0) self.spi.write(data) - self.cs.high() + self.cs(1) def init(self): self.reset() @@ -125,9 +125,9 @@ class EPD: sleep_ms(100) def reset(self): - self.rst.low() + self.rst(0) sleep_ms(200) - self.rst.high() + self.rst(1) sleep_ms(200) # draw the current frame memory