Keyboard callback is not navigating in menus


keyboard callback is not navigating in menus

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

Atmel Cortex M7 MCU, Atmel Studio, GCC

What LVGL version are you using?


What do you want to achieve?

With the serial port receive, I like to navigate by receiving on the serial port the + and - characters

What have you tried so far?

I put a breakpoint in my code. It properly breaks when I receive a serial characters. I see no navigation happening in my LCD GUI. I already made the touchscreen and rotary encoder navigate properly.

I don’t understand when I am supposed to return true or false in the callback.

Code to reproduce

bool isKeyPressed=false;
char serialReadBuffer[1]={0};
void serial_rx_cb(const struct usart_async_descriptor * const io_descriptor ){
	int32_t status =0;
	status = io_read(ioSerial, (  uint8_t *)serialReadBuffer, 1 )  ;

bool my_keyboard_read(lv_indev_drv_t * drv, lv_indev_data_t*data){
	int32_t status =0;
	if  (isKeyPressed==true){
		if (serialReadBuffer[0]=='5') data->key = LV_KEY_ENTER;
		else if (serialReadBuffer[0]=='+') data->key = LV_KEY_NEXT;
		else if (serialReadBuffer[0]=='-') data->key = LV_KEY_PREV;
		else if (serialReadBuffer[0]=='8') data->key = LV_KEY_UP;
		else if (serialReadBuffer[0]=='4') data->key = LV_KEY_LEFT;
		else if (serialReadBuffer[0]=='6') data->key = LV_KEY_RIGHT;
		else if (serialReadBuffer[0]=='2') data->key = LV_KEY_DOWN;
		else data->key = LV_KEY_NEXT;
		data->state = LV_INDEV_STATE_PR;  
		isKeyPressed=false; /*breakpoint here*/
	}else {
		data->state = LV_INDEV_STATE_REL;

	return false; /*I don't understand what I am supposed to return*/

lv_indev_t * enc_indev_3 ;
lv_indev_drv_t indev_drv3;
void init(void){
 	indev_drv3.type = LV_INDEV_TYPE_KEYPAD;
 	indev_drv3.read_cb = my_keyboard_read;
 	enc_indev_3 =  lv_indev_drv_register(&indev_drv3);

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.