Demo_keypad error


I am trying to compile the lv_demo_keypad_encoder test, and I am getting compilation errors

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

CodeBlocks simulator with v7-dev (updated yesterday)

What do you want to achieve?

I want to test the lv_demo_keypad_encoder functionalities. When compiling, I get the error:

undefined reference to “mousewheel_read”.

I have checked that this function is not in the system, but I don’t know how to do it.

What have you tried so far?

I have installed SDL libraries and enable all the defines for MOUSE use.

OK, for some reason the file mousewheel.c was not included in the project.

I have added it, and now the error is

SDL_Event has no member named 'wheel'

I don’t know if something is missing, or this part is not finished yet…


I’m not sure this is the rootcause of your problem but the lv_drivers repo have the mousewheel files, mousewheel_read is defined in mousewheel.h:

I will try to take a look at the simulator repo, maybe it’s not pulling or adding the lv_driver directory to the CodeBlocks include search path.


In the lv_ex_conf.h file you need to set LV_EX_MOUSEWHEEL to 1 like so for the mousewheel function to be defined, but I think you will also need to have SDL2 installed.

#define LV_EX_PRINTF       1       /*Enable printf-ing data in demoes and examples*/
#define LV_EX_KEYBOARD     1       /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/
#define LV_EX_MOUSEWHEEL   1       /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/

Then define the symbols USE_MOUSE, USE_MOUSEWHEEL and USE_KEYBOARD.

After that I had to install SDL2 in Windows, I followed this tutorial:

And got the demo working

Hope this helps @abueno

1 Like

Maybe the problem is that I installed SDL instead of SDL2? I will try to look after it tomorrow when I have time



1 Like

It may be, sure, let me know if you make it work.

1 Like


I have installed SDL2 and now it compiles fine. But when I execute the program, I cannot move the focus with the mouse or keyboard. I was expecting that the mousewheel changed focus. I have set a breakpoint in the mousewheel_handler function, and the SDL_MOUSEWHEEL event does not trigger whatever I do… any clues?


Have you registered the mousewheel driver like you do for the mouse (lv_indev_drv_register)?

I am using the example, and it just calls:

lv_indev_t * enc_indev = lv_indev_drv_register(&enc_drv);

I don’t know if I have to do anything else.

I don’t know if I have to initialize the SDL system. There is a call to


in monitor.c. I don’t know if I should initialize something similar for mousewheel…