nick94
May 8, 2020, 12:46am
#1
Hi,
i have a 2,8" TFT Touch Shield V2.0
I want to use it with an Arduino DUE.
The Display is working, but the touch doesnt work.
I hope some of you can help me.
unsigned char xp_pin = digitalPinToBitMask(_xp);
*portOutputRegister(digitalPinToPort(_yp)) &= ~yp_pin;
I dont know how i have to change these parts in the “SeeedTouchScreen.cpp”
Thank you
}
bool Point::operator==(Point p1) {
return ((p1.x == x) && (p1.y == y) && (p1.z == z));
}
bool Point::operator!=(Point p1) {
return ((p1.x != x) || (p1.y != y) || (p1.z != z));
}
TouchScreen::TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym) {
_yp = yp;
_xm = xm;
_ym = ym;
_xp = xp;
}
#if AVERAGE
#define AVERAGETIME 4
int avr_analog(int adpin) {
int sum = 0;
You just need to set the pin and if your ArduinoCore is official, you should be fine.
nick94
May 8, 2020, 10:20am
#3
I tried this before, but this wasnt the solution.
Later I find out that there ist no direct port manipulation for the Arduino DUE. So I changed the pins I used with pinMode.
But thank you very much.
Baozhu
May 8, 2020, 10:55am
#4
Thanks for your feedback. Can you share your modified code? @nick94
I’ve found it on the Internet.
// Touch screen library with X Y and Z (pressure) readings as well
// as oversampling to avoid 'bouncing'
// (c) ladyada / adafruit
// Code under MIT License
#include "pins_arduino.h"
#include "wiring_private.h"
#include <avr/pgmspace.h>
#include "TouchScreen.h"
// increase or decrease the touchscreen oversampling. This is a little different than you make think:
// 1 is no oversampling, whatever data we get is immediately returned
// 2 is double-sampling and we only return valid data if both points are the same
// 3+ uses insert sort to get the median value.
// We found 2 is precise yet not too slow so we suggest sticking with it!
#define NUMSAMPLES 2
TSPoint::TSPoint(void) {
x = y = 0;
This file has been truncated. show original