Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch input for st7793. open smart 16pin #25

Closed
davidarroyo1234 opened this issue Apr 7, 2022 · 6 comments
Closed

Touch input for st7793. open smart 16pin #25

davidarroyo1234 opened this issue Apr 7, 2022 · 6 comments

Comments

@davidarroyo1234
Copy link

First of all I wanted to thank you for your work.

I have a question.

I have a open smart 3.5 tft display with this setup.

(Screen pins-> ESP32 pins)
D0 -> 12
D1 -> 13
D2 -> 26
D3 -> 25
D4 -> 17
D5 -> 19
D6 -> 27
D7 -> 14
RD -> 2
WR -> 4
RS -> 15
CS -> 33
RESET -> 32

Which are the correct pins on each parameter for this to work? Especially the parameter adc_yp and adc_xm
image

@nopnop2002
Copy link
Owner

nopnop2002 commented Apr 7, 2022

The 4-line resistor touch screen uses 4 pins.

  • X(+):Digital Output
  • X(-):Digital Output/Analog Input
  • Y(+):Digital Output/Analog Input
  • Y(-):Digital Output

ESP-IDF cannot provide both digital output and analog input at the same time using a single gpio.
Two GPIOs are required to perform digital output and analog input.
(X-) and ESP32 are connected by two wires.
(Y+) and ESP32 are connected by two wires.

(X-) ----+---- Gpio for Digital Output
         +---- Gpio for Analog Input

(Y+) ----+---- Gpio for Digital Output
         +---- Gpio for Analog Input

When reading analog with the ESP-IDF ADC, use the channel number instead of the GPIO number.

adc_yp is ADC1 channel# for reading Y+ analog value.

adc_xm is ADC1 channel# for reading X- analog value.

Refer to the ESP32 data sheet for the relationship between ADC channels and GPIOs.


The explanation was difficult to understand, so I updated the README.

ADC-CANNEL

@davidarroyo1234
Copy link
Author

davidarroyo1234 commented Apr 8, 2022

Oh so from the same lcd pin i have to connect to 2 esp32 pins? 1 for the input and 1 for the output?

@nopnop2002
Copy link
Owner

Yes
You're right.

from the same lcd pin you have to connect to 2 esp32 pins

(X-) ----+---- Gpio for Digital Output
         +---- Gpio for Analog Input

(Y+) ----+---- Gpio for Digital Output
         +---- Gpio for Analog Input

@davidarroyo1234
Copy link
Author

Okay, thank you so much.

I will try this in the afternoon.

@nopnop2002
Copy link
Owner

nopnop2002 commented Apr 8, 2022

These TFTs are designed for the AtMega328 (Arduino UNO).

With AtMega328 (Arduno UNO), one GPIO can be used by switching between digital output and analog input at runtime.

However, ESP-IDF cannot do this, so two GPIOs are required.

@davidarroyo1234
Copy link
Author

Thank you :), now it's working.

Im closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants