Closed srduino closed 2 years ago
Can you tell me which device it is? This sample uses LovyanGFX drivers so you need to make that work first. Once that's working, the LVGL part will work as well.
This repo readme has code for touch drawing without LVGL, you need to make that work first to confirm the drivers are working. Its here
You can use below sample to make a custom device setting work.
In my sample the device - WT32-SC01
is already supported by LovyanGFX so Autodetect works without configuration.
For custom configuration of LovyanGFX, check here https://github.com/lovyan03/LovyanGFX/blob/master/src/lgfx_user/LGFX_ESP32_sample.hpp
thanks for your answer!i am using a private custom device.
This touch driver is available: https://github.com/aselectroworks/Arduino-FT6336U
lovyan03/LovyanGFX@^0.4.15:configure touch not responding
not sure what I'm doing wrong!
the provided case I have tested.. touch section unavailable!
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
class LGFX : public lgfx::LGFX_Device
{
lgfx::Panel_ST7789 _panel_instance;
lgfx::Bus_SPI _bus_instance;
lgfx::Light_PWM _light_instance;
lgfx::Touch_FT5x06 _touch_instance;
public:
LGFX(void)
{
{
auto cfg = _bus_instance.config();
cfg.spi_host = VSPI_HOST;
cfg.spi_mode = 0;
cfg.freq_write = 40000000;
cfg.freq_read = 16000000;
cfg.spi_3wire = false;
cfg.use_lock = true;
cfg.dma_channel = 1;
cfg.pin_sclk = 18;
cfg.pin_mosi = 19;
cfg.pin_miso = -1;
cfg.pin_dc = 16;
_bus_instance.config(cfg);
_panel_instance.setBus(&_bus_instance);
}
{
auto cfg = _panel_instance.config();
cfg.pin_cs = 5;
cfg.pin_rst = 23;
cfg.pin_busy = -1;
cfg.panel_width = 240;
cfg.panel_height = 320;
cfg.offset_x = 0;
cfg.offset_y = 0;
cfg.offset_rotation = 3;
cfg.dummy_read_pixel = 8;
cfg.dummy_read_bits = 1;
cfg.readable = true;
cfg.invert = false;
cfg.rgb_order = false;
cfg.dlen_16bit = false;
cfg.bus_shared = true;
_panel_instance.config(cfg);
}
{
auto cfg = _light_instance.config();
cfg.pin_bl = 4;
cfg.invert = false;
cfg.freq = 1023;
cfg.pwm_channel = 8;
_light_instance.config(cfg);
_panel_instance.setLight(&_light_instance);
}
{
auto cfg = _touch_instance.config();
cfg.x_min = 0;
cfg.x_max = 239;
cfg.y_min = 0;
cfg.y_max = 319;
cfg.pin_int = 2;
cfg.bus_shared = true;
cfg.offset_rotation = 0;
cfg.i2c_port = 1;
cfg.i2c_addr = 0x38;
cfg.pin_sda = 21;
cfg.pin_scl = 22;
cfg.freq = 400000;
_touch_instance.config(cfg);
_panel_instance.setTouch(&_touch_instance);
}
setPanel(&_panel_instance);
}
};
LGFX display;
void setup(void)
{
display.init();
display.setRotation(0);
display.setBrightness(255);
display.setColorDepth(16);
display.fillScreen(TFT_BLACK);
}
uint32_t count = ~0;
void loop(void)
{
display.startWrite();
display.setRotation(++count & 7);
display.setColorDepth((count & 8) ? 16 : 24);
display.setTextColor(TFT_WHITE);
display.drawNumber(display.getRotation(), 16, 0);
display.setTextColor(0xFF0000U);
display.drawString("R", 30, 16);
display.setTextColor(0x00FF00U);
display.drawString("G", 40, 16);
display.setTextColor(0x0000FFU);
display.drawString("B", 50, 16);
display.drawRect(30, 30, display.width() - 60, display.height() - 60, count * 7);
display.drawFastHLine(0, 0, 10);
display.endWrite();
std::int32_t tx, ty, tc;
tc = display.getTouch(&tx, &ty);
if (display.getTouch(&tx, &ty))
{
display.fillRect(tx - 2, ty - 2, 5, 5, count * 7);
Serial.print("????????");
}
}
Please open an issue on LovyanGFX repo for assistance. Your problem is not drivers but configuration.
Once this works my sample should work as well.
@srduino Closing this as nothing more expected here. Once the LovyanGFX library is working and need further assistance in the integration with LVGL8.x you can open another issue.
ask for your advice! my configuration is as follows:
how should it be configured? Touch not working!!!