feat(lv_hal_indev): add missing lv_indev_delete() (#2854)

* feat(lv_hal_indev): Add missing lv_indev_delete()

* feat(lv_hal_indev): Add missing lv_indev_delete() (fix formatting)
This commit is contained in:
geert-KLA-BE
2021-12-01 15:37:44 +01:00
committed by GitHub
parent ecabf77d58
commit 6282996764
2 changed files with 23 additions and 0 deletions
+17
View File
@@ -127,6 +127,23 @@ void lv_indev_drv_update(lv_indev_t * indev, lv_indev_drv_t * new_drv)
indev->proc.reset_query = 1;
}
/**
* Remove the provided input device. Make sure not to use the provided input device afterwards anymore.
* @param indev pointer to delete
*/
void lv_indev_delete(lv_indev_t * indev)
{
LV_ASSERT_NULL(indev);
LV_ASSERT_NULL(indev->driver);
LV_ASSERT_NULL(indev->driver->read_timer);
/*Clean up the read timer first*/
lv_timer_del(indev->driver->read_timer);
/*Remove the input device from the list*/
_lv_ll_remove(&LV_GC_ROOT(_lv_indev_ll), indev);
/*Free the memory of the input device*/
lv_mem_free(indev);
}
/**
* Get the next input device.
* @param indev pointer to the current input device. NULL to initialize.
+6
View File
@@ -207,6 +207,12 @@ lv_indev_t * lv_indev_drv_register(struct _lv_indev_drv_t * driver);
*/
void lv_indev_drv_update(lv_indev_t * indev, struct _lv_indev_drv_t * new_drv);
/**
* Remove the provided input device. Make sure not to use the provided input device afterwards anymore.
* @param indev pointer to delete
*/
void lv_indev_delete(lv_indev_t * indev);
/**
* Get the next input device.
* @param indev pointer to the current input device. NULL to initialize.