Touchpad_read dose not be executed in v8

Description

I port v8 to my stm32 project via revising the v7 template project that the lvgl file in v7 is replaced by v8.
The v7 template project is work correctly, but in v8, touch dose not response.

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

STM32H743

What LVGL version are you using?

v8

What do you want to achieve?

porting the touch correctly

What have you tried so far?

I have checked the touch via read the touch status and point the touch point, it works correctly and prints the touch point.

Hence I think that the touchpad_read() function does not be executed.

Beside,
In a layout example, the screen can be refresh correctly, hence I think the timer tick of lvgl is works correctly.
Both of the cases of #define LV_TICK_CUSTOM 1 and #define LV_TICK_CUSTOM 0 are tried, it do not change anything.

Code to reproduce

The following code is the code related to the touchpad in the file lv_port_indev.c :

void lv_port_indev_init(void)
{
    /**
     * Here you will find example implementation of input devices supported by LittelvGL:
     *  - Touchpad
     *  - Mouse (with cursor support)
     *  - Keypad (supports GUI usage only with key)
     *  - Encoder (supports GUI usage only with: left, right, push)
     *  - Button (external buttons to press points on the screen)
     *
     *  The `..._read()` function are only examples.
     *  You should shape them according to your hardware
     */

    lv_indev_drv_t indev_drv;

    /*Register a touchpad input device*/
    lv_indev_drv_init(&indev_drv);
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read_cb = touchpad_read;
    //indev_touchpad = 
		lv_indev_drv_register(&indev_drv);
}

static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
    printf("EXECUTE TOUCHPAD_READ \r\n"); 

		static lv_coord_t last_x = 0;
    static lv_coord_t last_y = 0;
   
    /*Save the pressed coordinates and the state*/
		if(tp_dev.sta&TP_PRES_DOWN)//觸摸按下了
		{
			printf("screen pressed x=%d y=%d\r\n",tp_dev.x[0],tp_dev.y[0]);
			last_x = tp_dev.x[0];
			last_y = tp_dev.y[0];
			data->point.x = last_x;
			data->point.y = last_y;
			data->state = LV_INDEV_STATE_PR;
		}else{
			printf("screen reased x=%d y=%d\r\n",last_x,last_y);
			data->point.x = last_x;
			data->point.y = last_y;
			data->state = LV_INDEV_STATE_REL;
		}
    /*Return `false` because we are not buffering and no more data to read*/

   // return false;
}

the following is the code in main() file and the touch is initialized here :

#include "sys.h"
#include "delay.h"
#include "usart.h" 
#include "led.h"
#include "key.h"
#include "mpu.h"
#include "lcd.h"
#include "ltdc.h"
#include "sdram.h"
#include "touch.h"
#include "timer.h"
#include "lvgl.h"
#include "lv_port_disp.h"
#include "lv_port_indev.h"
#include "lv_examples.h"
#include "../lv_demos/lv_demo.h"

int main(void)
{
	Cache_Enable();                	
	MPU_Memory_Protection();				
	HAL_Init();				        			
	Stm32_Clock_Init(160,5,2,4);  	
	delay_init(400);								
	uart_init(115200);							
	printf("usart init finish ! \r\n");
	LED_Init();											
	KEY_Init();											
	TIM3_Init(999,199);							
	SDRAM_Init();                  
	LCD_Init();										
	if(lcdltdc.pwidth!=0)		
	LCD_Display_Dir(1);						
	tp_dev.init();	// touchpad initialize			    			
	
	POINT_COLOR=RED;
	LCD_ShowString(30,50,200,16,16,"Apollo STM32H7"); 
	LCD_ShowString(30,70,200,16,16,"TOUCH TEST");	
	LCD_ShowString(30,90,200,16,16,"ATOM@ALIENTEK");
	HAL_Delay(2000);
	lv_init();											
	lv_port_disp_init();						
	lv_port_indev_init();						

//	lv_example_btnmatrix_3();
	lv_example_keyboard_1();
//	lv_example_grid_5();
  //lv_example_btn_1();
	printf("return to main() \r\n");
  uint16_t t_counter=0;
	uint8_t tp_sta_temp = 0;
	while(1)
	{
		tp_dev.scan(0);
		if (tp_dev.sta!=tp_sta_temp ){
			if(tp_dev.sta&TP_PRES_DOWN)//觸摸按下了
			{
				printf("screen pressed x=%d y=%d\r\n",tp_dev.x[0],tp_dev.y[0]);
			
			}else{
				printf("screen released\r\n");
			}
			tp_sta_temp=tp_dev.sta;
		}
		
		lv_task_handler();
		t_counter+=1;
		if (t_counter == 10000){
			//printf("time_out");
			
			t_counter = 0;
			LED1_Toggle;
			
		}
	}
}



Thank you for your suggestion, best wishes.

indev_drv needs to be static in v8.

Thank you, it works correctly!

@embeddedt I’m facing a similar problem in my project as well, could you have a look at it ?