one thing i have noticed is the gfx_conf.h file references lgfx::Touch_GT911 _touch_instance, but if we are now using PCA9557 is this a conflict? Still have no touch. I was told i should send my code to you, and i would be contacted. No contact so i am postingthe code here.
// esp32 by Expressif Systems 2.9.15
// Arduino ESP32 Boards by Arduino 20.0.13
// LovyanGFX by Lovyan03 1.1.12
// lvgl by kisvegabor 8.3.11
// PCA9557
// PSRAM; opi psram
// Partition Scheme: Huge App
include <Wire.h>
include <SPI.h>
include <PCA9557.h>
include <lvgl.h>
#include "ui.h"
/**************************LVGL and UI END************************/
/*******************************************************************************
Config the display panel and touch panel in gfx_conf.h
******************************************************************************/
Comments
Winny,
how do i send you the code? I have not recieved an email from you yet.
Hi,
You can try modify the following sentence in the sample code I sent.
And please remember to check the psram setting is correct.
If it still not working, please contact us at techsupport@elecrow.com
one thing i have noticed is the gfx_conf.h file references lgfx::Touch_GT911 _touch_instance, but if we are now using PCA9557 is this a conflict? Still have no touch. I was told i should send my code to you, and i would be contacted. No contact so i am postingthe code here.
// esp32 by Expressif Systems 2.9.15
// Arduino ESP32 Boards by Arduino 20.0.13
// LovyanGFX by Lovyan03 1.1.12
// lvgl by kisvegabor 8.3.11
// PCA9557
// PSRAM; opi psram
// Partition Scheme: Huge App
include <Wire.h>
include <SPI.h>
include <PCA9557.h>
include <lvgl.h>
#include "ui.h"
/**************************LVGL and UI END************************/
/*******************************************************************************
Config the display panel and touch panel in gfx_conf.h
******************************************************************************/
include "gfx_conf.h"
static lv_disp_draw_buf_t draw_buf;
static lv_color_t disp_draw_buf1[screenWidth * screenHeight / 10];
static lv_color_t disp_draw_buf2[screenWidth * screenHeight / 10];
static lv_disp_drv_t disp_drv;
PCA9557 Out; //for touch timing init
/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
tft.pushImageDMA(area->x1, area->y1, w, h,(lgfx::rgb565_t*)&color_p->full);
lv_disp_flush_ready( disp );
}
void my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
{
uint16_t touchX, touchY;
bool touched = tft.getTouch( &touchX, &touchY);
if( !touched )
{
data->state = LV_INDEV_STATE_REL;
}
else
{
data->state = LV_INDEV_STATE_PR;
}
}
void setup()
{
Serial.begin(9600);
Serial.println("LVGL Widgets Demo");
//GPIO init
if defined (CrowPanel_50) || defined (CrowPanel_70)
pinMode(38, OUTPUT);
digitalWrite(38, LOW);
pinMode(17, OUTPUT);
digitalWrite(17, LOW);
pinMode(18, OUTPUT);
digitalWrite(18, LOW);
pinMode(42, OUTPUT);
digitalWrite(42, LOW);
//touch timing init
Wire.begin(19, 20);
Out.reset();
Out.setMode(IO_OUTPUT);
Out.setState(IO0, IO_LOW);
Out.setState(IO1, IO_LOW);
delay(20);
Out.setState(IO0, IO_HIGH);
delay(100);
Out.setMode(IO1, IO_INPUT);
elif defined (CrowPanel_43)
pinMode(20, OUTPUT);
digitalWrite(20, LOW);
pinMode(19, OUTPUT);
digitalWrite(19, LOW);
pinMode(35, OUTPUT);
digitalWrite(35, LOW);
pinMode(38, OUTPUT);
digitalWrite(38, LOW);
pinMode(0, OUTPUT);//TOUCH-CS
endif
//Display Prepare
tft.begin();
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2);
delay(200);
lv_init();
delay(100);
lv_disp_draw_buf_init(&draw_buf, disp_draw_buf1, disp_draw_buf2, screenWidth * screenHeight/10);
/* Initialize the display /
lv_disp_drv_init(&disp_drv);
/ Change the following line to your display resolution */
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.full_refresh = 1;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register(&disp_drv);
/* Initialize the (dummy) input device driver */
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
tft.fillScreen(TFT_BLACK);
ui_init();
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler();
delay(5);
}