Want to use touchscreen and encoder at the same time.
What have you tried so far?
I have ‘doubled up’ the lv_indev parts of the code, trying to combine two working examples into one. Curently if I make a indev_drv2, or I try to ‘reuse’ the same lv_indev, I get the ESP rebooting in a kernel panic endless loop. Thanks for any advice!!
Code to reproduce
static lv_indev_t* encoder_indev; //The input device
static lv_indev_t* touchscreen_indev; //The input device
...
*Initialize the ENCODER*/
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_ENCODER;
indev_drv.read_cb = read_encoder;
encoder_indev = lv_indev_drv_register(&indev_drv);
/*Initialize the touch pad*/
//lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv); /*Descriptor of a input device driver*/
indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
touchscreen_indev = lv_indev_drv_register(&indev_drv); /*Finally register the driver*/
```
Yes. Both of my test files work separately. The code above is from my attempt to combine them. When run it sends the ESP32 into an endless reboot cycle, with a kernel panic message on the terminal. I have working callback\event functions for both. But they do not work together. In addition, the encoder input is very sluggish, but I haven’t tried to figure out why or fix it yet. I am using example code found here:
Can you maybe just say a few brief words on the method(s) one would use to have both? Do I create separate indev_drv objects? Or just one and the two input devices register themselves separately?
Sorry if this should be obvious! I can post all of my code somewhere if it is helpful, but I was thinking a more general bit of advice might be enough. The code I posted above, the top 2 lines are just below all the includes and the 2 bottom blocks are in the setup function.
The touchscreen code is from the arduino LGVL example files. I can find a direct link if it will be helpful
Congratulations on the new website. It looks absolutely great, and your library is awesome! Thanks!