Flush_cb not called despite lv_display_set_flush_cb being used

Description

What MCU/Processor/Board and compiler are you using?

STM32F407 Discovery kit gcc-arm-none-eabi

What do you want to achieve?

To display anything on the screen

What have you tried so far?

Followed both the STM32 and the porting guide.I am using the ST7735 160x80 screen and its library works.But the flush_cb() will not get called.The lv_port_disp_init() initializes the ST7735, so i guess there is a bug in my code, because the example in the introduction page works perfectly fine(I am referring to the last given code snippet in this post) .I am filling the screen with a color, but the LVGL will not do anything afterwards

Code to reproduce

lv_log_register_print_cb(my_print);
lv_init();
lv_port_disp_init();
ST7735_FillScreen(ST7735_BLUE);
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_t * spinner = lv_spinner_create(lv_screen_active());
lv_obj_set_size(spinner, 64, 64);
lv_obj_align(spinner, LV_ALIGN_BOTTOM_MID, 0, 0);

and the flush_cb() :

void disp_flush(lv_display_t * disp_drv, const lv_area_t * area, uint8_t * px_map)
{
    //see it it gets called by using the led
	HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12, 1); 
	if(disp_flush_enabled) {
        int32_t x;
        int32_t y;
        for(y = area->y1; y <= area->y2; y++) {
        for(x = area->x1; x <= area->x2; x++) {
        ST7735_DrawPixel(y,x,*px_map);
         x_map++;
            }
        }
    }
    lv_display_flush_ready(disp_drv);
}

This example works fine :

#define BUF_W 20
#define BUF_H 10

lv_color_t buf[BUF_W * BUF_H];
lv_color_t * buf_p = buf;
uint16_t x, y;
for(y = 0; y < BUF_H; y++) {
    lv_color_t c = lv_color_mix(LV_COLOR_BLUE, LV_COLOR_RED, (y * 255) / BUF_H);
    for(x = 0; x < BUF_W; x++){
        (*buf_p) =  c;
        buf_p++;
    }
}

lv_area_t a;
a.x1 = 10;
a.y1 = 40;
a.x2 = a.x1 + BUF_W - 1;
a.y2 = a.y1 + BUF_H - 1;
disp_flush(NULL, &a, buf);

You dont show where and how you call lv handler. Without this lv dont work.
Too your init dont show lv disp init and assig callbacks for display and indev when used…

My bad,I forgot to call the lv_timer_handler.Now instead of a spinner i get garbage on the screen.Here is the init() and the loop part :

void lv_port_disp_init(void)
{
    disp_init();

    lv_display_t * disp = lv_display_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);
    lv_display_set_flush_cb(disp, disp_flush);
    lv_display_set_rotation(disp, 1);
    /* Example 1
     * One buffer for partial rendering*/
    static lv_color_t buf_1_1[MY_DISP_HOR_RES * 10];                          /*A buffer for 10 rows*/
    lv_display_set_buffers(disp, buf_1_1, NULL, sizeof(buf_1_1), 0);
}
static void disp_init(void)
{
     ST7735_Init();
}
while (1)
  {
      lv_timer_handler();
	 // HAL_Delay(5);
  }
void SysTick_Handler(void)
{
  /* USER CODE BEGIN SysTick_IRQn 0 */
  lv_tick_inc(1);
  /* USER CODE END SysTick_IRQn 0 */
  HAL_IncTick();
  /* USER CODE BEGIN SysTick_IRQn 1 */

  /* USER CODE END SysTick_IRQn 1 */
}

and here is the picture :

from your code “working” addition is ugly …
too flush cb swap x and y and draw one pixel is most slow method for flush .
next fail is px_map as uint8 and ++ when RGB565 is used etc.