SOLVED - Help with encoder input device

Hello,

I am having some trouble trying to get the encoder working after switching to 6.0:

bool enc_main_read(lv_indev_drv_t * drv, lv_indev_data_t*data)
{
	if (enc_rotations > 0)
	{
		data->state = LV_INDEV_STATE_PR;
		enc_to_gui = LV_KEY_NEXT;
	}
	if (enc_rotations < 0)
	{
		data->state = LV_INDEV_STATE_PR;
		enc_to_gui = LV_KEY_PREV;
	}
	if (enc_button)
	{
		data->state = LV_INDEV_STATE_PR;
		enc_to_gui = LV_KEY_ENTER;
	}
	enc_rotations = 0;
	enc_button = 0;
	return false;
}

lv_indev_t * enc_main_indev;
lv_indev_drv_t indev_main;
lv_indev_drv_init(&indev_main);
indev_main.read_task = enc_main_read;
indev_main.type = LV_INDEV_TYPE_ENCODER;
enc_main_indev = lv_indev_drv_register(&indev_main);
main_group = lv_group_create();   

With 5.3 i would always set the state in the read function to LV_INDEV_STATE_PR since there would always be only one button at any time in my group object. The button in the group with call different functions based on the value of the enc_to_gui global variable.

My question is, how do i use the new lv_obj_set_event_cb function?

test_btn = lv_btn_create(test_sc, NULL);
lv_obj_set_pos(test_btn, 20, 20);
lv_group_add_obj(main_group, test_btn);
lv_obj_set_event_cb(test_btn, Test_CallBack);

void Test_CallBack(lv_obj_t * obj, lv_event_t event)
{
	if (event == LV_EVENT_PRESSED)
	{
		if (enc_to_gui == LV_KEY_NEXT)
			{
				test_pos += 20;
				lv_obj_set_pos(test_lbl, test_pos, 120);
				enc_to_gui = 0;
			}
				
			if (enc_to_gui == LV_KEY_PREV)
			{
				test_pos -= 20;
				lv_obj_set_pos(test_lbl, test_pos, 120);
				enc_to_gui = 0;
			}	
	}
}

Thank you,
Erol

SOLVED:

indev_main.read_task = enc_main_read;

changed to:
indev_main.read_cb = enc_main_read;
Intellisense was not showing .read_cb.

You should have get a warning for “incompatible pointer types” to indicate the typo.