notro / fbtft_tools

27 stars 17 forks source link

Touch Interrupt on STMPE610 #9

Closed gurtajs4 closed 8 years ago

gurtajs4 commented 8 years ago

Hi Sir,

I am using https://www.adafruit.com/products/1601 LDC Display to interface with Raspberry Pi. I am not using kernel drivers to access the controller, but rather using Python based Libaries to Initialize the ILI9341 and STMPE610.

I have used the concept from your pitft_test.c code to turn on and off the backlight. This works straight away.

But I am facing issue with getting touch interrupt on a particular GPIO. I would like to connect multiple Display to RPi using SPIDEV, different Chip Select and GPIO pin to control LCD and Touch

For this to work, I want to get interrupt from a TS on a particular GPIO Pin, when user touch that display, and hence data can be drive accordingly to display.

Can you point me to some C/Python Sample to achieve this similar to backlight control

Thanks Gurtaj

notro commented 8 years ago

I haven't used gpio interrupts from userspace before, but this is how it's done in the bcm2835 library: http://www.airspayce.com/mikem/bcm2835/event_8c-example.html

gurtajs4 commented 8 years ago

Sir, My knowledge is scare when it comes to hardware. I though see you setting Alternate funtction to GPIO-2 to control backlight in your pitft_test.c

  1. Where do you come to know that gpio-2 is connected to backlight(datasheet?)
  2. Do I have to use Alternate function with some gpio-x to get interrupt on touch?

P.S

You do have code handling in pitft_test.c to read P1-GPIO24 which should be high. What exactly is happening with this peice of code. Should it not be the case of reading Interrupt gpio?

notro commented 8 years ago

Where do you come to know that gpio-2 is connected to backlight(datasheet?)

Schematics: https://learn.adafruit.com/assets/13040

It's a long time since I wrote this code, so I don't remember any details.

gurtajs4 commented 8 years ago

Thanks,I will look into above suggestions. But a sample of code to read the touch interrupt is enough for my purpose.

Regards & Thank Gurtaj

gurtajs4 commented 8 years ago

Hi Notro, I was able to get interrupt using correct values in INT_CTRL Interrupt control register.

Thanks & Regards, Gurtaj