abueno
May 29, 2020, 4:56pm
#1
Description
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.
abueno
May 29, 2020, 5:01pm
#2
OK, for some reason the file mousewheel.c was not included in the project.
I have added it, and now the error is
SDL_MOUSEWHEEL undeclared
SDL_Event has no member named 'wheel'
I don’t know if something is missing, or this part is not finished yet…
Alex
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
:
* Initialize the encoder
*/
void mousewheel_init(void);
/**
* 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);
/**********************
* MACROS
**********************/
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.
Regards
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: https://www.youtube.com/watch?v=Gj3iXwvKmUY
And got the demo working
Hope this helps @abueno
1 Like
abueno
June 1, 2020, 6:46pm
#5
Maybe the problem is that I installed SDL instead of SDL2? I will try to look after it tomorrow when I have time
Thanks
Alex
1 Like
It may be, sure, let me know if you make it work.
1 Like
abueno
June 2, 2020, 9:01am
#7
Hi!
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?
Alex
Have you registered the mousewheel driver like you do for the mouse (lv_indev_drv_register
)?
abueno
June 3, 2020, 8:06am
#9
embeddedt:
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
SDL_Init(SDL_INIT_VIDEO)
in monitor.c. I don’t know if I should initialize something similar for mousewheel…
Alex