st7789 drivers: provide default rst arg.

pull/101/head
Peter Hinch 2025-04-15 17:04:56 +01:00
rodzic 332fd6d709
commit cd5210a132
3 zmienionych plików z 20 dodań i 17 usunięć

Wyświetl plik

@ -427,7 +427,8 @@ below. An example file for the Pi Pico is in `setup_examples/st7789_pico.py`.
electrical issues such as lead lengths, PCB layout and grounding. electrical issues such as lead lengths, PCB layout and grounding.
* `cs` An initialised output pin. Initial value should be 1. * `cs` An initialised output pin. Initial value should be 1.
* `dc` An initialised output pin. Initial value should be 0. * `dc` An initialised output pin. Initial value should be 0.
* `rst` An initialised output pin. Initial value should be 1. * `rst=None` An initialised output pin with initial value 1. The default is for
vendors who do not provide an `rst` connection.
* `height=240` Display dimensions in pixels. For portrait mode exchange * `height=240` Display dimensions in pixels. For portrait mode exchange
`height` and `width` values: this ensures that `nano-gui` gets the correct `height` and `width` values: this ensures that `nano-gui` gets the correct
aspect ratio. aspect ratio.

Wyświetl plik

@ -81,7 +81,7 @@ class ST7789(framebuf.FrameBuffer):
spi, spi,
cs, cs,
dc, dc,
rst, rst=None,
height=240, height=240,
width=240, width=240,
disp_mode=LANDSCAPE, disp_mode=LANDSCAPE,
@ -114,13 +114,14 @@ class ST7789(framebuf.FrameBuffer):
# Hardware reset # Hardware reset
def _hwreset(self): def _hwreset(self):
self._dc(0) if self._rst is not None:
self._rst(1) self._dc(0)
sleep_ms(1) self._rst(1)
self._rst(0) sleep_ms(1)
sleep_ms(1) self._rst(0)
self._rst(1) sleep_ms(1)
sleep_ms(1) self._rst(1)
sleep_ms(1)
# Write a command, a bytes instance (in practice 1 byte). # Write a command, a bytes instance (in practice 1 byte).
def _wcmd(self, buf): def _wcmd(self, buf):

Wyświetl plik

@ -70,7 +70,7 @@ class ST7789(framebuf.FrameBuffer):
spi, spi,
cs, cs,
dc, dc,
rst, rst=None,
height=240, height=240,
width=240, width=240,
disp_mode=LANDSCAPE, disp_mode=LANDSCAPE,
@ -103,13 +103,14 @@ class ST7789(framebuf.FrameBuffer):
# Hardware reset # Hardware reset
def _hwreset(self): def _hwreset(self):
self._dc(0) if self._rst is not None:
self._rst(1) self._dc(0)
sleep_ms(1) self._rst(1)
self._rst(0) sleep_ms(1)
sleep_ms(1) self._rst(0)
self._rst(1) sleep_ms(1)
sleep_ms(1) self._rst(1)
sleep_ms(1)
# Write a command, a bytes instance (in practice 1 byte). # Write a command, a bytes instance (in practice 1 byte).
def _wcmd(self, buf): def _wcmd(self, buf):