lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.03k stars 189 forks source link

Connect the resistive touchscreen to CS, RS, D0, D1 #482

Closed 2serg2 closed 4 months ago

2serg2 commented 5 months ago

Hello! My display: http://www.lcdwiki.com/3.5inch_Arduino_Display-UNO This is the touchscreen connection diagram: https://iarduino.ru/img/upload/dbc406579b2f25fb1b6a56d99ea6a1f6.jpg The contacts CS, RS, D0, D1 are connected to the resistive layer of the touchscreen.

1) I switch the D0 contact for voltage measurement gpio_set_direction(GPIO_NUM_2, GPIO_MODE_INPUT); 2) I measure the analog signal pin 2 3) Set pin 2 as output gpio_set_direction(GPIO_NUM_2, GPIO_MODE_OUTPUT); 4) The LovyanGFX library does not work.

For example, the TFT_eSPI library continues to work after gpio_set_direction(GPIO_NUM_2, GPIO_MODE_OUTPUT); How do I restore the operation of LovyanGFX after changing the settings for pin D0?

2serg2 commented 5 months ago

For instance, if the display contacts are connected to the ESP32 S3 microcontroller as follows: D0 – 2 GPIO D1 – 1 GPIO CS – 5 GPIO RS – 6 GPIO Then, we use these pins to operate the touchscreen.

To restore the operation of the LovyanGFX library, you can do the following:

gpio_set_direction(GPIO_NUM_5, GPIO_MODE_OUTPUT); // sets as output
gpio_matrix_out(6, LCD_DC_IDX, 0, 0); // 6 GPIO - RS
gpio_matrix_out(2, LCD_DATA_OUT0_IDX + 0, 0, 0); // 2 GPIO - D0
gpio_matrix_out(1, LCD_DATA_OUT0_IDX + 1, 0, 0); // 1 GPIO – D1

These functions were taken from the LovyanGFX library initialization code.

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 4 months ago

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.