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:
I attach the files for Simulide and the sketches
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
- touch.zip
- You don't have permission to download attachments.
- (5 Kb) Downloaded 8 times
- touchtest.zip
- You don't have permission to download attachments.
- (4 Kb) Downloaded 6 times