Recommended display initialisation method?

I am about to start my first project with LVGL and am frankly confused between the lvgl docs porting info and how things are done in various examples. So I am hoping for some clarification here.
First, my hardware is custom with a STM32F412 and a 480x272 SSD1963 based display. The base code is working fine with drivers for writing to the display (and reading touch) working fine. No rtos, so a simple while(1) to run everything plus timers triggered from systick (1ms tick).
Next step is a simple UI (eg a button on the screen) running LVGL.
Starting at Porting — LVGL documentation it all initially makes sense.

  • lv_tick_inc(1) called from systick
  • lv_timer_handler() called from main() while(1){} //actually using lv_timer_handler_run_in_period(5);

but it starts getting confusing when I look at initialisation.
The docs says something like this:

static lv_disp_draw_buf_t draw_buf;
lv_disp_t * disp = lv_disp_create(LCD_HOR_RES  , LCD_VER_RES );
static lv_color_t buf[LCD_HOR_RES * LCD_VER_RES / 10];
lv_disp_set_draw_buffers(disp, buf, NULL, sizeof(buf), LV_DISP_RENDER_MODE_PARTIAL);
lv_disp_set_flush_cb(disp, my_flush_cb);
void my_flush_cb(lv_disp_t * disp, const lv_area_t * area, lv_color_t * buf)

However if I look examples (eg GitHub - lvgl/lv_port_stm32f429_disco: LVGL ported to STM32F429I-DISC1 using SW4STM32 (Ac6) IDE) then things look a bit different. eg

static lv_disp_drv_t disp_drv;
void tft_init(void)
	static lv_color_t disp_buf1[TFT_HOR_RES * 60];
	static lv_color_t disp_buf2[TFT_HOR_RES * 60];
	static lv_disp_draw_buf_t buf;
	lv_disp_draw_buf_init(&buf, disp_buf1, disp_buf2, TFT_HOR_RES * 40);


#if TFT_EXT_FB != 0
	disp_drv.draw_buf = &buf;
	disp_drv.flush_cb = tft_flush;
	disp_drv.monitor_cb = monitor_cb;
	disp_drv.hor_res = 240;
	disp_drv.ver_res = 320;
static void tft_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p)

So in the docs examples it appears to be using a handle for the display of lv_disp_t and referencing everything to that. In the example it is using lv_disp_draw_buf_t.

So, my questions, why the two different approaches and how do they relate? Should I be following the docs or the examples? I would rather start out understanding this than dive in and not know why…


To close this one off in case anyone reading this is also a bit confused - it would appear these are just different ways of doing things and the docs are not consistent in their approach. No problem though, it works.