Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

XPT2046 Touchscreen for ILI9341

3 posters

Go down  Message [Page 1 of 1]

1XPT2046 Touchscreen for ILI9341 Empty XPT2046 Touchscreen for ILI9341 Sat Nov 26, 2022 8:43 pm

feri



I made a touch screen for illi9341, it supports 12 bit and 8 bit commands via SPI.
For voltage and temperature it responds with arbitrary values.
I didn't make the XPT2046 as a component to go with the existing touch pad because it was too complicated for me.
The library I tested it with is "XPT2046_Touchscreen.h", though
I slightly modified it for calibration reasons like this:

Code:

   // Average pair with least distance between each measured x then y
   //Serial.printf("    z1=%d,z2=%d  ", z1, z2);
   //Serial.printf("p=%d,  %d,%d  %d,%d  %d,%d", zraw,
   //data[0], data[1], data[2], data[3], data[4], data[5]);
   int16_t x = map( besttwoavg(data[0], data[2], data[4]), MIN_X, MAX_X, 0, 4095);   // Simulide
   int16_t y = map( besttwoavg(data[1], data[3], data[5]), MIN_Y, MAX_Y, 0, 4095);   // Simulide
   
   //Serial.printf("    %d,%d", x, y);
   //Serial.println();
   if (z >= Z_THRESHOLD) {
      msraw = now;   // good read completed, set wait
      switch (rotation) {
        case 0:
         xraw = 4095 - y;
         yraw = x;
         break;
        case 1:
         xraw = x;
         yraw = y;
         break;
        case 2:
         xraw = y;
         yraw = 4095 - x;
         break;
        default: // 3
         xraw = 4095 - x;
         yraw = 4095 - y;
      }
   }
}

I attach the files for Simulide and the sketches
Attachments
XPT2046 Touchscreen for ILI9341 Attachmenttouch.zip
You don't have permission to download attachments.
(5 Kb) Downloaded 8 times
XPT2046 Touchscreen for ILI9341 Attachmenttouchtest.zip
You don't have permission to download attachments.
(4 Kb) Downloaded 6 times

2XPT2046 Touchscreen for ILI9341 Empty Re: XPT2046 Touchscreen for ILI9341 Sun Nov 27, 2022 3:53 pm

arcachofo

arcachofo

Thanks. I will have a look.

3XPT2046 Touchscreen for ILI9341 Empty Re: XPT2046 Touchscreen for ILI9341 Mon Mar 27, 2023 9:26 pm

KarstenLehmann



hello feri,
I have tested some of your excellent tools and I like them all!!! (Thumbs up!) ;-)

but in this case… :-/ I don't get it to run. Think, I need the correct header-files…?!?  
Can you help me please?
best regards and thank you in advance!


oh, I forgot… I have tested this in 1.0.0-SR0 under ubuntu-linux.

after start it looks like this…
but clicking on the touch screen has no reaction.

XPT2046 Touchscreen for ILI9341 Touch_10

4XPT2046 Touchscreen for ILI9341 Empty Re: XPT2046 Touchscreen for ILI9341 Mon Apr 10, 2023 8:39 am

KarstenLehmann



hello feri,
did you see a chance to help me?
best regards and thank you in advance!

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum