feat(nuttx): add lv_nuttx_deinit
This commit is contained in:
@@ -48,6 +48,13 @@ void lv_nuttx_cache_init(void)
|
||||
handlers->flush_cache_cb = flush_cache;
|
||||
}
|
||||
|
||||
void lv_nuttx_cache_deinit(void)
|
||||
{
|
||||
lv_draw_buf_handlers_t * handlers = lv_draw_buf_get_handlers();
|
||||
handlers->invalidate_cache_cb = NULL;
|
||||
handlers->flush_cache_cb = NULL;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -28,6 +28,8 @@ extern "C" {
|
||||
|
||||
void lv_nuttx_cache_init(void);
|
||||
|
||||
void lv_nuttx_cache_deinit(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -177,6 +177,38 @@ uint32_t lv_nuttx_get_idle(void)
|
||||
|
||||
#endif
|
||||
|
||||
void lv_nuttx_deinit(lv_nuttx_result_t * result)
|
||||
{
|
||||
#if !LV_USE_NUTTX_CUSTOM_INIT
|
||||
if(result) {
|
||||
if(result->disp) {
|
||||
lv_display_delete(result->disp);
|
||||
result->disp = NULL;
|
||||
}
|
||||
|
||||
if(result->indev) {
|
||||
lv_indev_delete(result->indev);
|
||||
result->indev = NULL;
|
||||
}
|
||||
|
||||
if(result->utouch_indev) {
|
||||
lv_indev_delete(result->utouch_indev);
|
||||
result->utouch_indev = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
lv_nuttx_deinit_custom(result);
|
||||
#endif
|
||||
|
||||
if(nuttx_ctx_p) {
|
||||
lv_nuttx_cache_deinit();
|
||||
lv_nuttx_image_cache_deinit();
|
||||
|
||||
lv_free(nuttx_ctx_p);
|
||||
nuttx_ctx_p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -64,6 +64,12 @@ void lv_nuttx_dsc_init(lv_nuttx_dsc_t * dsc);
|
||||
*/
|
||||
void lv_nuttx_init(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result);
|
||||
|
||||
/**
|
||||
* Deinitialize the LVGL display driver for NuttX.
|
||||
* @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
|
||||
*/
|
||||
void lv_nuttx_deinit(lv_nuttx_result_t * result);
|
||||
|
||||
#if LV_USE_NUTTX_CUSTOM_INIT
|
||||
/**
|
||||
* Initialize the LVGL display driver for NuttX using the provided custom configuration information.
|
||||
@@ -72,6 +78,11 @@ void lv_nuttx_init(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result);
|
||||
*/
|
||||
void lv_nuttx_init_custom(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result);
|
||||
|
||||
/**
|
||||
* Deinitialize the LVGL display driver for NuttX using the provided custom configuration information.
|
||||
* @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
|
||||
*/
|
||||
void lv_nuttx_deinit_custom(lv_nuttx_result_t * result);
|
||||
#endif /* LV_USE_NUTTX_CUSTOM_INIT */
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,6 +66,19 @@ void lv_nuttx_image_cache_init(void)
|
||||
ctx->initialized = false;
|
||||
}
|
||||
|
||||
void lv_nuttx_image_cache_deinit(void)
|
||||
{
|
||||
if(ctx->initialized == false) goto FREE_CONTEXT;
|
||||
|
||||
mm_uninitialize(ctx->heap);
|
||||
free(ctx->mem);
|
||||
|
||||
FREE_CONTEXT:
|
||||
lv_free(ctx);
|
||||
|
||||
ctx = NULL;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -76,7 +89,7 @@ static bool defer_init(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
if(img_cache_p->max_size == 0) {
|
||||
if(lv_image_cache_is_enabled() == false) {
|
||||
LV_LOG_INFO("Image cache is not initialized yet. Skipping deferred initialization. Because max_size is 0.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ extern "C" {
|
||||
|
||||
void lv_nuttx_image_cache_init(void);
|
||||
|
||||
void lv_nuttx_image_cache_deinit(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
Reference in New Issue
Block a user