1## LCD tjpgd example 2 3(See the README.md file in the upper level 'examples' directory for more information about examples.) 4 5## Overview 6 7This example shows how to decode a jpeg image and display it on an SPI-interfaced LCD, and rotates the image periodically. 8 9If you want to adapt this example to another type of display or pinout, check [lcd_tjpgd_example_main.c](main/lcd_tjpgd_example_main.c) for comments with some implementation details. 10 11## How to Use Example 12 13### Hardware Required 14 15* An ESP development board 16* An SPI-interfaced LCD 17* An USB cable for power supply and programming 18 19### Hardware Connection 20 21The connection between ESP Board and the LCD is as follows: 22 23``` 24 ESP Board LCD Screen 25 +---------+ +---------------------------------+ 26 | | | | 27 | 3V3 +--------------+ VCC +----------------------+ | 28 | | | | | | 29 | GND +--------------+ GND | | | 30 | | | | | | 31 | DATA0 +--------------+ MOSI | | | 32 | | | | | | 33 | PCLK +--------------+ SCK | | | 34 | | | | | | 35 | CS +--------------+ CS | | | 36 | | | | | | 37 | D/C +--------------+ D/C | | | 38 | | | | | | 39 | RST +--------------+ RST | | | 40 | | | | | | 41 |BK_LIGHT +--------------+ BCKL +----------------------+ | 42 | | | | 43 +---------+ +---------------------------------+ 44``` 45 46The GPIO number used by this example can be changed in [lcd_tjpgd_example_main.c](main/lcd_tjpgd_example_main.c), where: 47 48| GPIO number | LCD pin | 49| ------------------------ | ------- | 50| EXAMPLE_PIN_NUM_PCLK | SCK | 51| EXAMPLE_PIN_NUM_CS | CS | 52| EXAMPLE_PIN_NUM_DC | DC | 53| EXAMPLE_PIN_NUM_RST | RST | 54| EXAMPLE_PIN_NUM_DATA0 | MOSI | 55| EXAMPLE_PIN_NUM_BK_LIGHT | BCKL | 56 57Especially, please pay attention to the level used to turn on the LCD backlight, some LCD module needs a low level to turn it on, while others take a high level. You can change the backlight level macro `EXAMPLE_LCD_BK_LIGHT_ON_LEVEL` in [lcd_tjpgd_example_main.c](main/lcd_tjpgd_example_main.c). 58 59 60#### Extra connections for 8-line LCD (Octal SPI) 61 62Firstly, please run `idf.py menuconfig` and set the `Drive a LCD with 8 data lines` option at `Example Configuration`. 63 64Change the extra GPOIs used by octal SPI in [lcd_tjpgd_example_main.c](main/lcd_tjpgd_example_main.c), where: 65 66| GPIO number | LCD pin | 67| ------------- | ------- | 68| PIN_NUM_DATA1 | D1 | 69| PIN_NUM_DATA2 | D2 | 70| PIN_NUM_DATA3 | D3 | 71| PIN_NUM_DATA4 | D4 | 72| PIN_NUM_DATA5 | D5 | 73| PIN_NUM_DATA6 | D6 | 74| PIN_NUM_DATA7 | D7 | 75 76### Build and Flash 77 78Run `idf.py -p PORT flash monitor` to build, flash and monitor the project. A flowing picture will be shown on the LCD screen. 79 80(To exit the serial monitor, type ``Ctrl-]``.) 81 82See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects. 83 84## Troubleshooting 85 86For any technical queries, please open an [issue] (https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon. 87