I found a little solution on the net but it need some modification.
The problem now i am encountring is:
no matter how i set the cursor it does not print on the right position.
Here is the code:
#include "JC3248W535.h"
int16_t W, H;
int16_t X, Y;
int8_t R;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.setDebugOutput(true);
while(!Serial);
Serial.println("Initializing Display");
#ifdef GFX_EXTRA_PRE_INIT
GFX_EXTRA_PRE_INIT()
#endif
// Init Display
// if (!gfx->begin())
if (!gfx->begin(GFX_SPEED))
{
Serial.println("gfx->begin() failed!");
}
gfx->fillScreen(WHITE);
#ifdef GFX_BL
pinMode(GFX_BL, OUTPUT);
digitalWrite(GFX_BL, HIGH);
#endif
Serial.println("gfx has began");
// gfx->setTextBound(0, 0, 320, 480);
delay(2000); // 5 seconds
#ifdef CANVAS
gfx->flush();
#endif
delay(1000);
W = gfx->width();
H = gfx->height();
X = gfx->getCursorX();
Y = gfx->getCursorY();
R = gfx->getRotation();
Serial.println("BEFORE WRITTING: ");
Serial.print("Width W: ");
Serial.print(W);
Serial.print(", Height H: ");
Serial.print(H);
Serial.print(", Cursor X: ");
Serial.print(X);
Serial.print(", Cursor Y: ");
Serial.print(Y);
Serial.print(", Rotation R: ");
Serial.println(R);
delay(1500);
gfx->setCursor(X + 10, Y + 10);
Serial.println("AFTER SETTING THE CURSOR: ");
Serial.print("Width W: ");
Serial.print(W);
Serial.print(", Height H: ");
Serial.print(H);
Serial.print(", Cursor X: ");
Serial.print(gfx->getCursorX());
Serial.print(", Cursor Y: ");
Serial.print(gfx->getCursorY());
Serial.print(", Rotation R: ");
Serial.println(R);
delay(1500);
gfx->setTextColor(BLACK, WHITE);
gfx->setTextWrap(false);
gfx->setTextSize(5);
gfx->print("Hello World");
delay(2500);
Serial.println("AFTER WRITTING: ");
X = gfx->getCursorX();
Y = gfx->getCursorY();
R = gfx->getRotation();
Serial.print("Width W: ");
Serial.print(W);
Serial.print(", Height H: ");
Serial.print(H);
Serial.print(", Cursor X: ");
Serial.print(gfx->getCursorX());
Serial.print(", Cursor Y: ");
Serial.print(gfx->getCursorY());
Serial.print(", Rotation R: ");
Serial.println(R);
gfx->setCursor(45, Y + 100);
Serial.println("AFTER NEW SETTING THE CURSOR: ");
Serial.print("Width W: ");
Serial.print(W);
Serial.print(", Height H: ");
Serial.print(H);
Serial.print(", Cursor X: ");
Serial.print(gfx->getCursorX());
Serial.print(", Cursor Y: ");
Serial.print(gfx->getCursorY());
Serial.print(", Rotation R: ");
Serial.println(R);
gfx->setTextColor(BLUE, YELLOW);
gfx->print("123");
delay(2500);
}
void loop() {
// put your main code here, to run repeatedly:
}
here is how the display look like:
EDIT:
the JC3248W535.h file:
#pragma once
// Display
#include <Arduino_GFX_Library.h>
#define GFX_BL 1
Arduino_DataBus *bus = new Arduino_ESP32QSPI(
45 /*CS*/, 47 /*SCK*/, 21 /*D0*/, 48 /*D0*/, 40 /*D2*/, 39 /*D3*/);
// #define CANVAS_R1
#ifdef CANVAS_R1
Arduino_AXS15231B *g = new Arduino_AXS15231B(bus, GFX_NOT_DEFINED /* RST */, 0 /* Rotation */, false /* IPS */, 320 /* Width */, 480 /* Height */);
#define CANVAS
Arduino_Canvas *gfx = new Arduino_Canvas(320 /* Width */, 480 /* Height */, g, 0 /* Output_x */, 0 /* Output_y */, 1 /* Rotation */);
#else
Arduino_AXS15231B *gfx = new Arduino_AXS15231B(bus, GFX_NOT_DEFINED /* RST */, 0 /* Rotation */, false /* IPS */, 320 /* Width */, 480 /* Height */);
#endif
#define GFX_SPEED 4000000UL
// Button
// #define BTN_A_PIN 0
// #define BTN_B_PIN 21
// I2C
#define I2C_SDA 4 // 8
#define I2C_SCL 8 // 4
// Touch schreen
#define TOUCH_MODULES_GT911
#define TOUCH_MODULE_ADDR GT911_SLAVE_ADDRESS1
#define TOUCH_SCL I2C_SCL
#define TOUCH_SDA I2C_SDA
#define TOUCH_RES 38
#define TOUCH_INT 3
// SD card
#define SD_SCK 12
#define SD_MOSI 11 // CMD
#define SD_MISO 13 // D0
// #define SD_D1 1
// #define SD_D2 6
#define SD_CS 10 // D3
// I2S
#define I2S_DEFAULT_GAIN_LEVEL 0.1
#define I2S_OUTPUT_NUM I2S_NUM_0
#define I2S_MCLK -1
#define I2S_BCLK 42
#define I2S_LRCK 2
#define I2S_DOUT 41
#define I2S_DIN -1
// #define AUDIO_MUTE_PIN 48 // LOW for mute