Description
What MCU/Processor/Board and compiler are you using?
I am using a Arduino Due with PlatformIO.
What do you want to achieve?
I am trying to setup a very simple and basic test project running LVGL on Arduino Due.
What have you tried so far?
I am using ILI9341_due library with some adaptions to the initialisation to make it work with ST7789.
This is working. I am able to draw the display without lvgl.
I tried to activate logging, but I do not get any output. I think the crash happens, before the serial monitor has connected.
Code to reproduce
#define TFT_RST 51
#define TFT_DC 11
#define TFT_CS 10
#define PIN_DISPLAY_BACKLIGHT 9
#define TFT_HOR_RES 320
#define TFT_VER_RES 240
#define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8))
void log(lv_log_level_t level, const char *buf)
{
Serial.print(level);
Serial.print(": ");
Serial.println(buf);
}
static void flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)
{
ILI9341_due *tft = (ILI9341_due *)lv_display_get_driver_data(disp);
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
tft->setAddrWindow(area->x1, area->y1, w, h);
tft->pushColors((uint16_t *)px_map, w * h, true);
lv_display_flush_ready(disp);
}
uint32_t draw_buf[DRAW_BUF_SIZE / 4];
void setup()
{
pinMode(PIN_DISPLAY_BACKLIGHT, OUTPUT);
digitalWrite(PIN_DISPLAY_BACKLIGHT, HIGH);
ILI9341_due *tft = new ILI9341_due(TFT_CS, TFT_DC, TFT_RST);
tft->begin();
tft->fillScreen(ILI9341_RED);
lv_init();
lv_log_register_print_cb(log);
lv_display_t *display = lv_display_create(TFT_HOR_RES, TFT_VER_RES);
lv_display_set_driver_data(display, (void *)tft);
lv_display_set_flush_cb(display, flush_cb);
lv_display_set_buffers(display, (void *)draw_buf, NULL, sizeof(draw_buf), LV_DISPLAY_RENDER_MODE_PARTIAL);
lv_obj_t *_label = lv_label_create(lv_scr_act());
lv_label_set_text(_label, "This is a test");
lv_obj_align(_label, LV_ALIGN_LEFT_MID, 5, 0);
lv_obj_set_width(_label, 100);
}
void loop()
{
lv_timer_handler();
lv_tick_inc(3);
}
When commenting all lv_
lines, the displays is drawn red.
When only lv_init()
is un-commented, I see a red display with some artefacts on the right hand side and the Arduino hangs as it immediately powers off.
I am using pretty much the lv_conf_template
. I’ve copied it under /src
and set the following build_flags
build_flags =
-D LV_CONF_INCLUDE_SIMPLE
-I src
I’ve made 2 changes to the lv_conf.h
file:
#define LV_USE_DEMO_WIDGETS 0
#define LV_USE_ST7789 1