MicroPython v1.9 updates

Replace deprecated Pin.high()/low() methods with .__call__(1/0)
master
Mike Causer 2018-06-07 19:46:00 +10:00
rodzic 0bc7f0e2e9
commit ca6f940ffd
14 zmienionych plików z 112 dodań i 112 usunięć

Wyświetl plik

@ -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):

Wyświetl plik

@ -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):

Wyświetl plik

@ -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):

Wyświetl plik

@ -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):

Wyświetl plik

@ -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):

Wyświetl plik

@ -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):

Wyświetl plik

@ -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):

Wyświetl plik

@ -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):

Wyświetl plik

@ -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):

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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