mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
add lv_disp_remove
This commit is contained in:
parent
370f8223b6
commit
15007e9071
@ -310,6 +310,7 @@ static void indev_proc_task(void * param)
|
||||
|
||||
/*Read and process all indevs*/
|
||||
while(i) {
|
||||
if(i->driver.disp == NULL) continue; /*Not assigned to any displays*/
|
||||
indev_act = i;
|
||||
|
||||
/*Handle reset query before processing the point*/
|
||||
|
@ -280,7 +280,7 @@ static void lv_refr_area(const lv_area_t * area_p)
|
||||
/*Calculate the max row num*/
|
||||
lv_coord_t w = lv_area_get_width(area_p);
|
||||
lv_coord_t h = lv_area_get_height(area_p);
|
||||
lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(NULL) ? y2 = lv_disp_get_ver_res(NULL) - 1 : area_p->y2;
|
||||
lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? y2 = lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
|
||||
|
||||
int32_t max_row = (uint32_t) vdb->size / w;
|
||||
|
||||
|
@ -135,6 +135,31 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
return disp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a display
|
||||
* @param disp pointer to display
|
||||
*/
|
||||
void lv_disp_remove(lv_disp_t * disp)
|
||||
{
|
||||
bool was_default = false;
|
||||
if(disp == lv_disp_get_default()) was_default = true;
|
||||
|
||||
/*Detach the input devices */
|
||||
lv_indev_t * indev;
|
||||
indev = lv_indev_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->driver.disp == disp) {
|
||||
indev->driver.disp = NULL;
|
||||
}
|
||||
indev = lv_indev_next(indev);
|
||||
}
|
||||
|
||||
lv_ll_rem(&LV_GC_ROOT(_lv_disp_ll), disp);
|
||||
lv_mem_free(disp);
|
||||
|
||||
if(was_default) lv_disp_set_default(lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a default screen. The new screens will be created on it by default.
|
||||
* @param disp pointer to a display
|
||||
|
@ -160,6 +160,12 @@ void lv_disp_buf_init(lv_disp_buf_t * disp_buf, void * buf1, void * buf2, uint32
|
||||
*/
|
||||
lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver);
|
||||
|
||||
/**
|
||||
* Remove a display
|
||||
* @param disp pointer to display
|
||||
*/
|
||||
void lv_disp_remove(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Set a default screen. The new screens will be created on it by default.
|
||||
* @param disp pointer to a display
|
||||
|
Loading…
x
Reference in New Issue
Block a user