From a7f383aac9d7430d48ebb873041c61f99b34e49e Mon Sep 17 00:00:00 2001 From: peterhinch Date: Sun, 29 Jan 2023 10:39:02 +0000 Subject: [PATCH] Various doc improvements. --- DISPLAYS.md | 24 +++++++++++++----------- DRIVERS.md | 26 +++++++++++++++----------- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 71 insertions(+), 32 deletions(-) diff --git a/DISPLAYS.md b/DISPLAYS.md index 03d3c25..b395e60 100644 --- a/DISPLAYS.md +++ b/DISPLAYS.md @@ -10,34 +10,35 @@ owing to their long update time. ## Displays using drivers in this repo -Size is diagonal in inches. C/M/GS color/monochrome/greyscale. +Size is diagonal in inches. C/M/GS color/1-bit monochrome/greyscale. Width and height are pixels. | Size | Width | Height | Tech | Driver | Description | Notes | |:------:|:-----:|:------:|:------|:--------------|:----------------------------|:------| | 0.96C | 94 | 64 | OLED | [SSD1331][1d] | [Adafruit 684][1m] | | -| 1.12GS | 96 | 96 | OLED | [SSD1327][11d]| [Seeed 104030011][21m] | Obsolescent | +| 1.12GS | 96 | 96 | OLED | [SSD1327][11d]| [Seeed 104030011][21m] | Obsolescent. | | 1.27C | 128 | 96 | OLED | [SSD1351][2d] | [Adafruit 1673][2m] | | | 1.5C | 128 | 128 | OLED | [SSD1351][2d] | [Adafruit 1431][3m] | | | 1.44C | 128 | 128 | TFT | [ST7735R][4d] | [Adafruit 2088][5m] | | | 1.5C | 160 | 128 | TFT | [ST7735R][4d] | [Adafruit 358][6m] | | | 1.3C | 240 | 240 | TFT | [ST7789][5d] | [Adafruit 4313][7m] | | | 1.5GS | 128 | 128 | OLED | [SSD1327][11d]| [Waveshare 13992][20m] | | -| 2.0C | 320 | 240 | TFT | [ST7789][5d] | [Waveshare Pico LCD 2][18m] | For Pi Pico | +| 2.0C | 320 | 240 | TFT | [ST7789][5d] | [Waveshare Pico LCD 2][18m] | For Pi Pico. | | 1.54C | 240 | 240 | TFT | [ST7789][5d] | [Adafruit 3787][8m] | | -| 1.14C | 240 | 135 | TFT | [ST7789][5d] | [T-Display][9m] | ESP32 with attached display | -| 2.8C | 320 | 240 | TFT | [ST7789][5d] | [Waveshare pico 2.8][10m] | Display for Pi Pico | -| 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.14C | 240 | 135 | TFT | [ST7789][5d] | [T-Display][9m] | ESP32 with attached display. | +| 2.8C | 320 | 240 | TFT | [ST7789][5d] | [Waveshare pico 2.8][10m] | Display for Pi Pico. | +| 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. | | 3.2C | 320 | 240 | TFT | [ILI9341][6d] | [Adafruit 1743][12m] | Big display. eBay equivalents work here. | | 3.5C | 480 | 320 | TFT | [ILI9486][12d]| [Waveshare Rpi 3.5 LCD][22m]| Pi HAT. Many pixels. Needs plenty of RAM. | | 3.5C | 480 | 320 | TFT | [ILI9486][12d]| [Adafruit 3.5 LCD][24m] | 3.5" HX8357D display, notes as above. | -| 2.9M | 296 | 128 | eInk | [UC8151D][7d] | [Adafruit 4262][13m] | Flexible ePaper display | -| 2.9M | 296 | 128 | eInk | [UC8151D][7d] | [Adafruit 4777][15m] | FeatherWing ePaper display | -| 4.2M | 400 | 300 | eInk | [WS][10d] | [Waveshare pico 4.2][19m] | Pico, Pico W plug in. Other hosts via cable | +| 3.5C | 480 | 320 | TFT | [ILI9486][12d]| [Waveshere RPI 3.5 LCD][25m]| 3.5" ILI9488 display, notes as above. | +| 2.9M | 296 | 128 | eInk | [UC8151D][7d] | [Adafruit 4262][13m] | Flexible ePaper display. | +| 2.9M | 296 | 128 | eInk | [UC8151D][7d] | [Adafruit 4777][15m] | FeatherWing ePaper display. | +| 4.2M | 400 | 300 | eInk | [WS][10d] | [Waveshare pico 4.2][19m] | Pico, Pico W plug in. Other hosts via cable. | | 2.7M | 274 | 176 | eInk | [HAT][8d] | [Waveshare HAT][14m] | HAT designed for Raspberry Pi, repurposed. | | 2.7M | 400 | 240 | Sharp | [Sharp][9d] | [Adafruit 4694][16m] | Micropower monochrome display. | -| 1.3M | 168 | 144 | Sharp | [Sharp][9d] | [Adafruit 3502][17m] | Ditto | +| 1.3M | 168 | 144 | Sharp | [Sharp][9d] | [Adafruit 3502][17m] | Ditto. | ## Displays using compatible drivers @@ -118,4 +119,5 @@ simple. See [this doc](./DRIVERS.md#7-writing-device-drivers) for details. [22m]: https://www.waveshare.com/product/3.5inch-rpi-lcd-a.htm [23m]: https://shop.pimoroni.com/products/pico-display-pack?variant=32368664215635 [24m]: https://www.adafruit.com/product/2050 +[25m]: https://www.waveshare.com/wiki/Pico-ResTouch-LCD-3.5 diff --git a/DRIVERS.md b/DRIVERS.md index 31032bd..e1b8d2a 100644 --- a/DRIVERS.md +++ b/DRIVERS.md @@ -641,6 +641,7 @@ If your display shows garbage, check the following (I have seen both): ## 3.4 Driver for ILI94xx This was developed for the ILI9486 but its application is more wide ranging. +These have been tested: ILI9341, ILI9488 and HX8357D. The ILI9486 supports displays of up to 480x320 pixels which is large by microcontroller standards. Even with 4-bit color the frame buffer requires @@ -648,17 +649,6 @@ microcontroller standards. Even with 4-bit color the frame buffer requires compile unless frozen bytecode is used, in which case it runs with about 75K of free RAM. -##### Design note - -The driver aims to work with any ILI9486, however -[this display](https://www.waveshare.com/product/3.5inch-RPi-LCD-A.htm), a -480x320 color LCD designed for the Raspberry Pi, has special hardware. Rather -than driving the ILI9486 via SPI, it uses SPI to fill a shift register, copying -the data to the chip using a parallel interface. The driver is designed to work -with both types of hardware; to achieve this it uses driver default values -where possible. These defaults are common to a range of controllers. For example -ILI9341 and HX8357D have been tested. It may work with ILI9488. - ##### Generic display wiring Testing was done with a Pico and an @@ -750,6 +740,20 @@ If this is run the display will be refreshed, but will periodically yield to the scheduler enabling other tasks to run. This is documented [here](./ASYNC.md). +##### Design note + +The driver aims to work with any ILI9486, however +[this display](https://www.waveshare.com/product/3.5inch-RPi-LCD-A.htm), a +480x320 color LCD designed for the Raspberry Pi, has special hardware. Rather +than driving the ILI9486 via SPI, it uses SPI to fill a shift register, copying +the data to the chip using a parallel interface. The driver is designed to work +with both types of hardware; to achieve this it uses driver default values +where possible. These defaults are common to a range of controllers. + +The driver is quite minimal. Drivers released by display manufacturers set up +the controller to achieve precise color rendering. With a 4-bit palette these +consume bytes with zero visual benefit. + ###### [Contents](./DRIVERS.md#contents) # 4. Drivers for sharp displays diff --git a/README.md b/README.md index 54bb260..ec449dd 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ display. 3.7 [Class Textbox](./README.md#37-class-textbox) Scrolling text display. 4. [ESP8266](./README.md#4-esp8266) This can work. Contains information on minimising the RAM and flash footprints of the GUI. - 5. [Old firmware](./README.md#5-old-firmware) For users of color displays who can't run current firmware. +[Appendix 1 Freezing bytecode](./README.md#appendix-1-freezing-bytecode) Optional way to save RAM. #### [Supported displays](./DISPLAYS.md) @@ -94,7 +94,8 @@ GUI supports multiple displays attached to a single target, but bear in mind the RAM requirements for multiple frame buffers. The GUI has been tested on Pyboard 1.1, Pyboard D, Raspberry Pi Pico and on the ESP32 reference board without SPIRAM. Running on ESP8266 is possible but frozen bytecode must be used -owing to its restricted RAM. +owing to its restricted RAM - see +[Appendix 1 Freezing bytecode](./README.md#appendix-1-freezing-bytecode). It uses synchronous code but is compatible with `uasyncio`. Some demo programs illustrate this. Code is standard MicroPython, but some device drivers use the @@ -900,14 +901,46 @@ bytes, `tbox.py` reported 10512 bytes, sometimes more, as the demo progressed. With the 4 bit driver `scale.py` reported 18112 bytes. In conclusion I think that applications of moderate complexity should be feasible. -# 5. Old firmware +###### [Contents](./README.md#contents) -Current firmware is highly recommended. For users of color displays who cannot -meet the requirements of -[Files and Dependencies](./README.md#2-files-and-dependencies) it is possible -to run under V1.15+. This involves copying -[this file](https://github.com/peterhinch/micropython-font-to-py/blob/master/writer/old_versions/writer_fw_compatible.py) -to `gui/core/writer.py`. This uses Python code to render text if the firmware -or driver are unable to support fast rendering. +## Appendix 1 Freezing bytecode + +This achieves a major saving of RAM. The correct way to do this is via a +[manifest file](http://docs.micropython.org/en/latest/reference/manifest.html). +The first step is to clone MicroPython and prove that you can build and deploy +firmware to the chosen platform. Build instructions vary between ports and can +be found in the MicroPython source tree in `ports//README.md`. + +The following is an example of how the entire GUI with fonts, demos and all +widgets can be frozen on RP2. + +Build script: +```bash +cd /mnt/qnap2/data/Projects/MicroPython/micropython/ports/rp2 +MANIFEST='/mnt/qnap2/Scripts/manifests/rp2_manifest.py' + +make submodules +make clean +if make -j 8 BOARD=PICO FROZEN_MANIFEST=$MANIFEST +then + echo Firmware is in build-PICO/firmware.uf2 +else + echo Build failure +fi +cd - +``` +Manifest file contents (first line ensures that the default files are frozen): +```python +include("$(MPY_DIR)/ports/rp2/boards/manifest.py") +freeze('/mnt/qnap2/Scripts/modules/rp2_modules') +``` +The directory `/mnt/qnap2/Scripts/modules/rp2_modules` contains only a symlink +to the `gui` directory of the `micropython-micro-gui` source tree. The freezing +process follows symlinks and respects directory structures. + +It is usually best to keep `hardware_setup.py` unfrozen for ease of making +changes. I also keep the display driver and `boolpalette.py` in the filesystem +as I have experienced problems freezing display drivers - but feel free to +experiment. ###### [Contents](./README.md#contents)