From 5e0d0630860f4bae18efc4d979894e812dd67613 Mon Sep 17 00:00:00 2001 From: _VIFEXTech Date: Thu, 12 Oct 2023 05:51:08 +0800 Subject: [PATCH] feat(nuttx): add structure default initialization (#4651) Signed-off-by: pengyiqiang Co-authored-by: pengyiqiang --- src/dev/nuttx/lv_nuttx_entry.c | 9 ++++++++- src/dev/nuttx/lv_nuttx_entry.h | 22 +++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/dev/nuttx/lv_nuttx_entry.c b/src/dev/nuttx/lv_nuttx_entry.c index 4fda074b4..844e67736 100644 --- a/src/dev/nuttx/lv_nuttx_entry.c +++ b/src/dev/nuttx/lv_nuttx_entry.c @@ -79,7 +79,14 @@ lv_global_t * lv_global_default(void) } #endif -lv_display_t * lv_nuttx_init(lv_nuttx_t * info) +void lv_nuttx_info_init(lv_nuttx_t * info) +{ + lv_memzero(info, sizeof(lv_nuttx_t)); + info->fb_path = "/dev/fb0"; + info->input_path = "/dev/input0"; +} + +lv_display_t * lv_nuttx_init(const lv_nuttx_t * info) { lv_display_t * disp = NULL; diff --git a/src/dev/nuttx/lv_nuttx_entry.h b/src/dev/nuttx/lv_nuttx_entry.h index 302a0e7a0..9377f2fb6 100644 --- a/src/dev/nuttx/lv_nuttx_entry.h +++ b/src/dev/nuttx/lv_nuttx_entry.h @@ -40,11 +40,27 @@ typedef struct { * GLOBAL PROTOTYPES **********************/ -lv_display_t * lv_nuttx_init(lv_nuttx_t * info); +/** + * Initialize the lv_nuttx_t structure with default values for the NuttX port of LVGL. + * @param info Pointer to the lv_nuttx_t structure to be initialized. + */ +void lv_nuttx_info_init(lv_nuttx_t * info); + +/** + * Initialize the LVGL display driver for NuttX using the provided configuration information. + * @param info Pointer to the lv_nuttx_t structure containing the configuration information for the display driver. + * @return Pointer to the lv_display_t structure representing the initialized display driver. + */ +lv_display_t * lv_nuttx_init(const lv_nuttx_t * info); #if LV_USE_NUTTX_CUSTOM_INIT -lv_display_t * lv_nuttx_init_custom(lv_nuttx_t * info); -#endif +/** + * Initialize the LVGL display driver for NuttX using the provided custom configuration information. + * @param info Pointer to the lv_nuttx_t structure containing the custom configuration information for the display driver. + * @return Pointer to the lv_display_t structure representing the initialized display driver. + */ +lv_display_t * lv_nuttx_init_custom(const lv_nuttx_t * info); +#endif /* LV_USE_NUTTX_CUSTOM_INIT */ /********************** * MACROS