Skip to content

Instantly share code, notes, and snippets.

@Saqoosha
Created January 29, 2023 11:58
Show Gist options
  • Save Saqoosha/f2f11dbd4baee371b58aa6b91e528371 to your computer and use it in GitHub Desktop.
Save Saqoosha/f2f11dbd4baee371b58aa6b91e528371 to your computer and use it in GitHub Desktop.
LovyanGFX device config for "3.5inch Touch Display Module for Raspberry Pi Pico" of Waveshare
class LGFX : public lgfx::LGFX_Device
{
lgfx::Panel_ILI9488 _panel_instance;
lgfx::Bus_SPI _bus_instance;
lgfx::Touch_XPT2046 _touch_instance;
public:
LGFX(void)
{
{
auto cfg = _bus_instance.config();
cfg.freq_write = 80000000;
// cfg.freq_read = 2000000;
cfg.pin_sclk = 10;
cfg.pin_mosi = 11;
cfg.pin_miso = 12;
cfg.pin_dc = 8;
_bus_instance.config(cfg);
_panel_instance.setBus(&_bus_instance);
}
{
auto cfg = _panel_instance.config();
cfg.pin_cs = 9;
cfg.pin_rst = 15;
cfg.pin_busy = -1;
cfg.panel_width = 320;
cfg.panel_height = 480;
cfg.offset_rotation = 1;
cfg.invert = true;
cfg.rgb_order = false;
cfg.dlen_16bit = true;
cfg.bus_shared = true;
_panel_instance.config(cfg);
}
/* Touch Panel (Cannot compile right now...)
{
auto cfg = _touch_instance.config();
cfg.x_min = 0;
cfg.x_max = 319;
cfg.y_min = 0;
cfg.y_max = 479;
cfg.pin_int = 17;
cfg.bus_shared = true;
cfg.pin_cs = 16;
_touch_instance.config(cfg);
_panel_instance.setTouch(&_touch_instance);
}
//*/
setPanel(&_panel_instance);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment