Closed amitsamanta996 closed 1 year ago
After reading the source code I found a solution to use HSPI instead of VSPI.
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include <XPT2046_Touchscreen.h>
#define TFT_CS 15
#define TFT_DC 17
#define TFT_MOSI 13
#define TFT_CLK 14
#define TFT_RST 4
#define TFT_MISO 12
#define Touch_CS 33
#define Touch_IRQ 34
SPIClass *hspi=new SPIClass();
Adafruit_ILI9341 tft=Adafruit_ILI9341(hspi,TFT_DC,TFT_CS,TFT_RST);
XPT2046_Touchscreen ts(Touch_CS,Touch_IRQ);
void setup() {
hspi->begin(TFT_CLK,TFT_MISO,TFT_MOSI);
tft.begin();
tft.setRotation(3);
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_WHITE,ILI9341_BLACK);
tft.setTextSize(2);
tft.setCursor(0,0);
tft.println("ILI9341 + XPT2046 Test");
ts.begin(*hspi);
ts.setRotation(1); }
void loop() {
if (ts.touched()) {
TS_Point touch=ts.getPoint();
tft.setCursor(50,100);
tft.print("X:"); tft.print(touch.x); tft.print(" ");
tft.print("Y:"); tft.print(touch.y); tft.println(" "); } }
Use of alternate SPI ports is shown in these examples.
I have also added it to the readme file
I believe this should fully satisfy any concern whether use of other SPI ports is documented.
----------------------------- Remove above -----------------------------
Description
DOCUMENTATION ON SPI NOT CLEAR
Steps To Reproduce Problem
Documentation on how to use the SPIClass for different spi pins is not mentioned but code is present
Hardware & Software
Board ESP32 Shields / modules used Arduino IDE version 1.8.19 Teensyduino version (if using Teensy) Version info & package name (from Tools > Boards > Board Manager) ESP32 DEVKIT V1 Operating system & version win11 Any other software or hardware?
Arduino Sketch
Errors or Incorrect Output
If you see any errors or incorrect output, please show it here. Please use copy & paste to give an exact copy of the message. Details matter, so please show (not merely describe) the actual message or error exactly as it appears.