feat(indev): add possibility to enable/disable all input devices at once (#3179)

* add possibility to globally enable/disable all input devices

* fix copy/paste error

* merge lv_indev_globally_enable into lv_indev_enable

* add missing simicolon

* remove unused variable
This commit is contained in:
Viatorus 2022-03-21 14:53:40 +01:00 committed by GitHub
parent fcf833f9af
commit 962d374791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -171,6 +171,7 @@ A new screen can be loaded with animation by using `lv_scr_load_anim(scr, transi
Setting `auto_del` to `true` will automatically delete the old screen when the animation is finished.
The new screen will become active (returned by `lv_scr_act()`) when the animation starts after `delay` time.
All inputs are disabled during the screen animation.
### Handling multiple displays
Screens are created on the currently selected *default display*.

View File

@ -122,9 +122,18 @@ void lv_indev_read_timer_cb(lv_timer_t * timer)
void lv_indev_enable(lv_indev_t * indev, bool en)
{
if(!indev) return;
uint8_t enable = en ? 0 : 1;
indev->proc.disabled = en ? 0 : 1;
if(indev) {
indev->proc.disabled = enable;
}
else {
lv_indev_t * i = lv_indev_get_next(NULL);
while(i) {
indev->proc.disabled = enable;
i = lv_indev_get_next(i);
}
}
}
lv_indev_t * lv_indev_get_act(void)

View File

@ -36,8 +36,8 @@ extern "C" {
void lv_indev_read_timer_cb(lv_timer_t * timer);
/**
* Enable or disable an input device (default enabled)
* @param indev pointer to an input device
* Enable or disable one or all input devices (default enabled)
* @param indev pointer to an input device or NULL to enable/disable all of them
* @param en true to enable, false to disable
*/
void lv_indev_enable(lv_indev_t * indev, bool en);