You probably meant to sent the project files here instead of in the other thread (https://community.platformio.org/t/using-an-raspberry-pico-as-picoprobe-debugger-for-another-rp2040-based-board/38568/15?u=maxgerhardt).
The problem is exactly I’ve said above:
You lib_deps
all these different libraries
lib_deps =
adafruit/Adafruit GFX Library@^1.11.11
adafruit/Adafruit ILI9341@^1.6.1
https://github.com/PaulStoffregen/XPT2046_Touchscreen.git
adafruit/Adafruit BusIO@^1.16.2
but you only ever
#include "XPT2046_Touchscreen.h"
PlatformIO will not properly resolve library dependencies if you don’t include them into your project. Hence, the build for Adafruit ILI9341, Adafruit BusIO etc fails horribly.
But, the problem is a while different one. You just copy-pasted the contents of the XPT2046_Touchscreen.cpp and XPT2046_Touchscreen.h
file from the XPT2046_Touchscreen library into your project. That makes no sense. You already include the library’s code in lib_deps = https://github.com/PaulStoffregen/XPT2046_Touchscreen.git
. Copying the files of that library again in your project makes no sense.
I would advise to just delete src/XPT2046_Touchscreen.cpp
and src/XPT2046_Touchscreen.h
, create a new file src/main.cpp
and use this content
#include <Arduino.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "XPT2046_Touchscreen.h"
// For My TFT Spi 240x320 display
#define TFT_DC 22
#define TFT_CS 17
//#define TFT_MOSI 19
//#define TFT_MISO 16
#define TFT_RST 21
#define TFT_CLK 18
#define LCD_LED 28
// For My XPT2046 Touch screen driver
#define T_CS_PIN 26
// MOSI=11, MISO=12, SCK=13
#define TIRQ_PIN 27
XPT2046_Touchscreen ts = XPT2046_Touchscreen(T_CS_PIN, TIRQ_PIN); // Param 2 - Touch IRQ Pin - interrupt enabled polling
#define ILI9341 1
#define SetColor(color) _color = (color)
unsigned int _color;
long X_value = 0;
long Y_value = 0;
long alfa_value = 0.1;
int16_t radius = 120;
voidFuncPtr* bitmap=0;
TS_Point p;
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST); // lényegesen gyorsabb!!
void display_task(void) {
tft.fillRoundRect(0, 0, 320, 240, 20, ILI9341_RED);
tft.drawCircle(160, 120, 119, ILI9341_BLUE); // Óralap rajzolása
tft.drawCircle(160, 120, 120, ILI9341_BLUE);
tft.setCursor(20, 10); // felirat
tft.setFont();
tft.setTextSize(5);
tft.println("centirozo");
tft.setCursor(10, 100);
tft.setTextSize(3);
tft.setCursor(10, 100);
tft.println("X ertek");
tft.setCursor(10, 200);
tft.println("Y ertek");
digitalWrite(28, HIGH);
}
void setup()
{
Serial.begin(115200);
ts.begin();
ts.setRotation(1);
tft.setSPISpeed(1600000000L);
pinMode(LCD_LED, OUTPUT);
tft.begin();
tft.setRotation(1);
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_YELLOW);
tft.setTextSize(5);
display_task();
}
void loop() {
if (ts.touched()) { // képernyő érintése
TS_Point p = ts.getPoint();
Serial.print("Pressure = ");
Serial.print(p.z);
Serial.print(", x = ");
Serial.print(p.x);
Serial.print(", y = ");
Serial.print(p.y);
delay(30);
Serial.println();
tft.fillRoundRect(280, 0, 40, 40, 5, ILI9341_BLUE);
}
if (!ts.touched()){
tft.fillRoundRect(280, 0, 40, 40, 5, ILI9341_RED);
}
tft.setCursor(160, 100); //mutató rajzolása
tft.println(X_value);
tft.setCursor(160, 200);
tft.println(Y_value);
tft.drawLine(160, 119, X_value,Y_value, ILI9341_RED);
X_value = 160 + radius*cos(alfa_value*M_PI/180);
Y_value = 120 + radius*sin(alfa_value*M_PI/180);
tft.drawLine(160, 119, X_value,Y_value, ILI9341_YELLOW);
delay(100);
tft.fillRect(160, 100, 80, 28, ILI9341_RED); // nyomógomb rajzolása
tft.fillRect(160, 200, 53, 28, ILI9341_RED);
if (alfa_value < 360)
{
alfa_value = alfa_value +1L;
}
else alfa_value = 0;
}
void loop1()
{
// tft.fillRoundRect((p.x/20-20), (p.y/20-20), 20, (20), 5, ILI9341_BLUE);
//tft.fillRoundRect((p.x/20-20), (p.y/20-20), 20, (20), 5, ILI9341_BLUE);
}