May 29, 2020, 4:56pm
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.
May 29, 2020, 5:01pm
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
* Initialize the encoder
* Get encoder (i.e. mouse wheel) ticks difference and pressed state
* @param indev_drv pointer to the related input device driver
* @param data store the read data here
* @return false: all ticks and button state are handled
bool mousewheel_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
* It is called periodically from the SDL thread to check a key is pressed/released
* @param event describes the event
void mousewheel_handler(SDL_Event *event);
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
After that I had to install SDL2 in Windows, I followed this tutorial:
And got the demo working
Hope this helps
June 1, 2020, 6:46pm
Maybe the problem is that I installed SDL instead of SDL2? I will try to look after it tomorrow when I have time
It may be, sure, let me know if you make it work.
June 2, 2020, 9:01am
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 (
June 3, 2020, 8:06am
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…