LittlevGL settings for small display

I tried to use littlevGL (which looks very powerful) in a small application that use STM32G0 and ST7735S (color 160x80, 186dpi, 0.98", SPI display) with no touchscreen. I need only fonts (with antiallias) and basic geometric forms with fill and some bitmaps as c files; no theme or complex graphics.

My questions are:

  1. how needs to look lv_conf.h in order to save as much as memory?
  2. beside writing ST7735_flush function and display init function ST7735_Init, do I need something else?
  3. I use Keil (and CubeMX) to compile the project, the main function looks as below; do I need something else to integrate the library?
int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */
  

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_LPUART1_UART_Init();
  MX_SPI1_Init();
  MX_TIM2_Init();
  /* USER CODE BEGIN 2 */
	
	
	ST7735_Init();
	
	static lv_disp_buf_t disp_buf;
  static lv_color_t buf_1[LV_HOR_RES_MAX * 10];		// Declare a buffer for 10 lines
	
	lv_disp_buf_init(&disp_buf, buf_1, NULL, LV_HOR_RES_MAX * 10);
	lv_init();
	
  lv_disp_drv_t disp_drv;
  lv_disp_drv_init(&disp_drv);
	
	disp_drv.hor_res = 160;           //Set the horizontal resolution
	disp_drv.ver_res = 80;						//Set the vertical resolution
	
  
  disp_drv.flush_cb = ST7735_flush;
	disp_drv.buffer = &disp_buf;
	
	lv_disp_t * disp;
	lv_disp_drv_register(&disp_drv);
	
	lv_obj_t *label = lv_label_create(lv_scr_act(), NULL);
  lv_label_set_text(label, "Testing");
  lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
	
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
		lv_tick_inc(5);
		lv_task_handler();
		HAL_Delay(10);
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

Thanks,
Andrei

I think lvgl is not a good choice only for display text and geometric primitives, if you have to save memory.
A simple library should be enough.

It is nice to have antialias and various true type fonts, alignment, etc… I’m wondering how small is could be with those features only enabled.
Thanks,
Andrei

Why don’t you read through lv_conf.h and experiment with turning off unneeded options? They are all documented in that file.

Off the top of my head, you probably don’t need animations, GPU support, or a filesystem.

1 Like

You can see the minimum and recommended requirements here: https://docs.littlevgl.com/en/html/index.html#requirements