kopia lustrzana https://github.com/peterhinch/micropython-nano-gui
Update DRIVERS.md, add support for Waveshare Pico LCD 1.14
rodzic
b5d62a64c5
commit
f0619a8e19
14
DRIVERS.md
14
DRIVERS.md
|
@ -392,6 +392,11 @@ The driver also supports the
|
||||||
[TTGO T-Display](http://www.lilygo.cn/claprod_view.aspx?TypeId=62&Id=1274).
|
[TTGO T-Display](http://www.lilygo.cn/claprod_view.aspx?TypeId=62&Id=1274).
|
||||||
This is an inexpensive ESP32 with a 135x240 color TFT display.
|
This is an inexpensive ESP32 with a 135x240 color TFT display.
|
||||||
|
|
||||||
|
Also, in landscape mode only, the
|
||||||
|
[Waveshare Pico LCD 1.14 inch](https://www.waveshare.com/pico-lcd-1.14.htm).
|
||||||
|
This has a hardware quirk, copy `setup_examples/st7789_pico_lcd_114.py` to
|
||||||
|
your setup file.
|
||||||
|
|
||||||
The `color_setup.py` file should initialise the SPI bus with a baudrate of
|
The `color_setup.py` file should initialise the SPI bus with a baudrate of
|
||||||
30_000_000. Args `polarity`, `phase`, `bits`, `firstbit` are defaults. Hard or
|
30_000_000. Args `polarity`, `phase`, `bits`, `firstbit` are defaults. Hard or
|
||||||
soft SPI may be used but hard may be faster. 30MHz is a conservative value: see
|
soft SPI may be used but hard may be faster. 30MHz is a conservative value: see
|
||||||
|
@ -1042,6 +1047,15 @@ method:
|
||||||
This ensures compatibility with code written for color displays by converting
|
This ensures compatibility with code written for color displays by converting
|
||||||
RGB values to a single bit.
|
RGB values to a single bit.
|
||||||
|
|
||||||
|
For color display drivers some boilerplate code is required for rendering
|
||||||
|
monochrome objects such as glyphs:
|
||||||
|
```python
|
||||||
|
from drivers.boolpalette import BoolPalette
|
||||||
|
# In the constructor:
|
||||||
|
mode = framebuf.GS8 # Whatever mode the driver uses
|
||||||
|
self.palette = BoolPalette(mode)
|
||||||
|
super().__init__(buf, self.width, self.height, mode)
|
||||||
|
```
|
||||||
Refresh must be handled by a `show` method taking no arguments; when called,
|
Refresh must be handled by a `show` method taking no arguments; when called,
|
||||||
the contents of the buffer underlying the `FrameBuffer` must be copied to the
|
the contents of the buffer underlying the `FrameBuffer` must be copied to the
|
||||||
hardware.
|
hardware.
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# hardware_setup.py Customise for your hardware config
|
||||||
|
|
||||||
|
# Released under the MIT License (MIT). See LICENSE.
|
||||||
|
# Copyright (c) 2021 Peter Hinch, Ihor Nehrutsa
|
||||||
|
|
||||||
|
# Supports:
|
||||||
|
# Waveshare Pico LCD 1.14" 135*240(Pixel) based on ST7789V
|
||||||
|
# https://www.waveshare.com/wiki/Pico-LCD-1.14
|
||||||
|
# https://www.waveshare.com/pico-lcd-1.14.htm
|
||||||
|
|
||||||
|
from machine import Pin, SPI
|
||||||
|
import gc
|
||||||
|
|
||||||
|
from drivers.st7789.st7789_4bit import *
|
||||||
|
SSD = ST7789
|
||||||
|
|
||||||
|
gc.collect() # Precaution before instantiating framebuf
|
||||||
|
# Conservative low baudrate. Can go to 62.5MHz.
|
||||||
|
spi = SPI(1, 30_000_000, sck=Pin(10), mosi=Pin(11), miso=None)
|
||||||
|
pcs = Pin(9, Pin.OUT, value=1)
|
||||||
|
prst = Pin(12, Pin.OUT, value=1)
|
||||||
|
pbl = Pin(13, Pin.OUT, value=1)
|
||||||
|
pdc = Pin(8, Pin.OUT, value=0)
|
||||||
|
|
||||||
|
ssd = SSD(spi, height=135, width=240, dc=pdc, cs=pcs, rst=prst, disp_mode=LANDSCAPE, display=TDISPLAY)
|
Ładowanie…
Reference in New Issue