Document new displays. Add 2.4" CYD setup example.

pull/80/head
Peter Hinch 2025-01-05 15:21:49 +00:00
rodzic 07095f475f
commit 02f943f9f0
4 zmienionych plików z 117 dodań i 25 usunięć

Wyświetl plik

@ -13,7 +13,7 @@ which is quick enough to [work with micro-gui][1z].
## Displays using drivers in this repo
Size is diagonal in inches. C/M/GS color/1-bit monochrome/greyscale.
Displays with a touch overlay are denoted by T, K or R depending on the touch
Displays with a touch overlay are denoted by T, K, R or S depending on the touch
hardware. See [Touch Displays below](./DISPLAYS.md#touch-displays).
Width and height are pixels.
@ -37,6 +37,10 @@ Width and height are pixels.
| 2.8C T | 320 | 240 | TFT | [ST7789][5d] | [Waveshare pico 2.8][10m] | Display for Pi Pico. (Touch support). |
| 1.14C | 240 | 135 | TFT | [ST7789][5d] | [Waveshare pico 1.14][11m] | For Pi Pico. Buttons good for micro-gui. |
| 1.14C | 240 | 135 | TFT | [ST7789][5d] | [Pimoroni pico 1.14][23m] | For Pi Pico. Buttons good for micro-gui. |
| 1.47C | 320 | 172 | TFT | [ST7789][5d] | [DFR0995][31m] | |
| 1.3C | 240 | 240 | TFT | [ST7789][5d] | [Waveshare Pico 1.3][32m] | |
| 1.9C | 320 | 170 | TFT | [ST7789][5d] | [Adafruit 5395][33m] | |
| 3.2C S | 320 | 240 | TFT | [ILI9341][6d] | [ESP32-2432S024C][34m] | Cheap yellow display 3.2" capacitive touch |
| 3.2C R | 320 | 240 | TFT | [ILI9341][6d] | [Adafruit 1743][12m] | Big touch unit. eBay equivalents work here. |
| 3.5C T | 480 | 320 | TFT | [ILI9486][12d] | [Waveshare Rpi 3.5 LCD][22m] | Pi HAT. Many pixels. Needs plenty of RAM. |
| 3.5C R | 480 | 320 | TFT | [ILI9486][12d] | [Adafruit 3.5 LCD][24m] | 3.5" HX8357D touch, notes as above. |
@ -105,14 +109,13 @@ simple. See [this doc](./DRIVERS.md#7-writing-device-drivers) for details.
# Touch displays
| Label | Controller | Comments |
|:-----:|:--------------|:------------------------------------------------|
| R | [TSC2007][1t] | Resistive touch needs [external controller][1q] |
| T | [XPT2046][2t] | Resistive touch, XPT2046 controller. |
| K | [FT6206][3t] | Capacitive touch controller. |
| Q | [CST816S][4t] | Capacitive touch controller. |
| S | [CST820][5t] | Capacitive touch controller. |
# Links
@ -174,11 +177,16 @@ simple. See [this doc](./DRIVERS.md#7-writing-device-drivers) for details.
[28m]: https://www.adafruit.com/product/1947
[29m]: https://www.waveshare.com/wiki/1.28inch_Touch_LCD
[30m]: https://www.waveshare.com/wiki/RP2040-Touch-LCD-1.28
[31m]: https://wiki.dfrobot.com/SKU_DFR0995_1.47inches_IPS_LCD_Display_Module
[32m]: https://www.waveshare.com/pico-lcd-1.3.htm
[33m]: https://www.adafruit.com/product/5394
[34m]: https://www.amazon.co.uk/DIYmalls-ESP32-2432S024C-Capacitive-ESP-WROOM-32-Development/dp/B0CLGD2DG6
[1t]: https://github.com/peterhinch/micropython-touch/blob/master/TOUCHPAD.md#tsc2007
[2t]: https://github.com/peterhinch/micropython-touch/blob/master/TOUCHPAD.md#xpt2046
[3t]: https://github.com/peterhinch/micropython-touch/blob/master/TOUCHPAD.md#ft6206-capacitive-controller
[4t]: https://github.com/peterhinch/micropython-touch/blob/master/TOUCHPAD.md#cst816s-capacitive-controller
[5t]: https://github.com/peterhinch/micropython-touch/blob/master/TOUCHPAD.md#cst820-capacitive-controller
[1q]: https://www.adafruit.com/product/5423

Wyświetl plik

@ -491,16 +491,15 @@ constructor arg set `True`. Patch and testing provided by
## 3.3 Drivers for ST7789
These displays tend to be physically small with a high pixel density. The chip
supports up to 240x320 displays. The Adafruit units tested are 240x240. To keep
the buffer size down, the driver uses 4-bit color with dynamic conversion to 16
bit RGB565 at runtime. This uses a lookup table (LUT) enabling user defined
colors. The resultant buffer size for the Adafruit displays is 28800 bytes. See
The chip supports sizes up to 240x320 pixels. To keep the buffer size down, the
normal driver uses 4-bit color with dynamic conversion to 16 bit RGB565 at
runtime. This uses a lookup table (LUT) enabling user defined colors. The
resultant buffer size for a 240x240 display is 28800 bytes. See
[Color handling](./DRIVERS.md#11-color-handling) for the implications of 4-bit
color.
An 8-bit driver is also provided. This may be used for rendering color images;
for use with the GUIs, demos are visually identical with the 4-bit driver.
when used with the GUIs, demos are visually identical to the 4-bit driver.
[Tested display: Adafruit 1.3 inch](https://www.adafruit.com/product/4313). The
Adafruit [1.54 inch](https://www.adafruit.com/product/3787) has identical
@ -533,16 +532,10 @@ below. An example file for the Pi Pico is in `setup_examples/st7789_pico.py`.
aspect ratio.
* `width=240`
* `disp_mode=LANDSCAPE` This arg enables portrait mode and other
configurations. See below.
configurations. See below for options exported by the driver.
* `init_spi=False` For shared SPI bus applications. See note below.
* `display=GENERIC` Defines the hardware variant.
The `display` arg is an opaque type defining the display hardware. Current
options (exported by the driver) are `GENERIC` for Adafruit displays,
`TDISPLAY` for the TTGO board, `PI_PICO_LCD_2`, `DFR0995`, `WAVESHARE_13` and
`ADAFRUIT_1_9`. These were contributed by users. See the driver code comments
for the names of the target hardware and acknowledgements of the contributors.
* `display=GENERIC` Defines the hardware variant. See below for options
exported by the driver.
#### Method (4-bit driver only)
@ -572,12 +565,18 @@ Orientation (values for `disp_mode`):
`USD` Upside down rendering.
`REFLECT` Mirror image rendering.
Display types (values for `display`):
`GENERIC` For Adafruit displays.
`TDISPLAY` For the TTGO T-Display and Waveshare Pico LCD.
`PI_PICO_LCD_2` Waveshare Pico LCD 2 determined by Mike Wilson.
`DFR0995` DFR0995 Contributed by @EdgarKluge
`WAVESHARE_13` Waveshare 1.3" 240x240 LCD contributed by Aaron Mittelmeier
Display types. These are values for `display` constructor arg:
* `GENERIC` Adafruit displays, Waveshare Pico Res Touch 2.8., 3.2" Cheap Yellow
Display and others.
* `TDISPLAY` TTGO t-display, Waveshare Pico LCD 1.14 inch.
* `PI_PICO_LCD_2` Waveshare Pico LCD 2.
* `DFR0995` DFRobot DFR0995 1.47".
* `WAVESHARE_13` Waveshare Pico LCD 1.3" 240x240
* `ADAFRUIT_1_9` Adafruit 5394 1.9" LCD 320x170
These were contributed by users. See the
[driver code](https://github.com/peterhinch/micropython-nano-gui/blob/master/drivers/st7789/st7789_4bit.py)
comments for more details and acknowledgements of contributors.
### init_spi

Wyświetl plik

@ -125,7 +125,7 @@ my GUI's employ the American spelling of `color`.
## 1.1 Change log
22 May 2024 Support circular displays with gc9a01 controller.
22 May 2024 Support circular displays with gc9a01 controller.
15 Mar 2023 Driver update to 4.2 inch Waveshare ePpaper display.
12 Feb 2023 Add support for sh1106 driver. Fix color compatibility of SSD1306.
5 Sep 2022 Add support for additional Pico displays.

Wyświetl plik

@ -0,0 +1,85 @@
# hardware_setup.py for CYD_ESP32-2432S024C --- ili9341_CST820_ESP32
# 2.4" Cheap Yellow Display
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2021-2024 Peter Hinch
# 17-dec-2024 ZolAnd
# Schematic
# https://github.com/jtobinart/Micropython_CYDc_ESP32-2432S024C/blob/main/resources/5-Schematic/2432S024-2-V1.0.png
# also in schematics
# This 2.4" Cheap Yellow Display comes in resistive and capacitive versions.
# Both use a vanilla ESP32 with an ili9341 240x320 display.
# Resistive version uses XPT2046 on same SPI bus as display, cs/ on GPIO33
# This setup is for the capacitive version with CST820 controller on I2C.
"""
Pin Reference (display and touch)
D 0 Digital Boot Button
D 2 Digital Display - Display: TFT_RS / TFT_DC
12 Digital Display - Display: TFT_SDO / TFT_MISO [HSPI]
D 13 Digital Display - Display: TFT_SDI / TFT_MOSI [HSPI]
D 14 Digital Display - Display: TFT_SCK [HSPI]
D 15 Digital Display - Display: TFT_CS [HSPI]
T 21 Digital Touch, Connector P3 & CN1 - Touch CST820: CTP_INT / I2C SDA
T 25 Digital Touch CST920 - Touch CST820: CTP_RST
D 27 Digital Display - Display: TFT_BL (BackLight)
T 32 Digital Touch CST820 - Touch CST820: CTP_SCL
T 33 Digital Touch CST820 - Touch CST820: CTP_SDA
Full pin reference.
Source https://github.com/jtobinart/Micropython_CYDc_ESP32-2432S024C/blob/main/cydc.py
IO Pins
0 Digital Boot Button
1 Digital Connector P1 & USB Chip - TX
2 Digital Display - TFT_RS / TFT_DC
3 Digital Connector P1 & USB Chip - RX
4 Digital RGB LED - Red
5 Digital SD Card - TF_CS [VSPI]
6 Digital Not Connected
7 Digital Not Connected
8 Digital Not Connected
9 Digital Not Connected
10 Digital Not Connected
11 Digital Not Connected
12 Digital Display - TFT_SDO / TFT_MISO [HSPI]
13 Digital Display - TFT_SDI / TFT_MOSI [HSPI]
14 Digital Display - TFT_SCK [HSPI]
15 Digital Display - TFT_CS [HSPI]
16 Digital RGB LED - Green
17 Digital RGB LED - Blue
18 Digital SD Card - SCK [VSPI]
19 Digital SD Card - MISO [VSPI]
21 Digital Touch, Connector P3 & CN1 - CTP_INT / I2C SDA
22 Digital Connector P3 & CN1 - I2C SCL
23 Digital SD Card - MOSI [VSPI]
25 Digital Touch CST920 - CTP_RST
26 Analog Speaker - !!!Speaker ONLY! Connected to Amp!!!
27 Digital Display - TFT_BL (BackLight)
32 Digital Touch CST820 - CTP_SCL
33 Digital Touch CST820 - CTP_SDA
34 Analog LDR Light Sensor - !!!Input ONLY!!!
35 Digital P3 Connector - !!!Input ONLY w/ NO pull-ups!!!
36 Digital Not Connected
39 Digital Not Connected
"""
from machine import Pin, SPI
import gc
from drivers.ili93xx.ili9341 import ILI9341 as SSD
# Display setup
prst = Pin(0, Pin.OUT, value=1)
pdc = Pin(2, Pin.OUT, value=0)
pcs = Pin(15, Pin.OUT, value=1)
# Use hardSPI (bus 1)
spi = SPI(1, sck=Pin(14), mosi=Pin(13), baudrate=40_000_000)
# Precaution before instantiating framebuf
gc.collect()
ssd = SSD(spi, height=240, width=320, dc=pdc, cs=pcs, rst=prst, usd=True) # 240x320 default
# Backlight
tft_bl = Pin(27, Pin.OUT, value=1) # Turn on backlight