1 /**
2  * @file lv_nuttx_entry.h
3  *
4  */
5 
6 /*********************
7  *      INCLUDES
8  *********************/
9 
10 #ifndef LV_NUTTX_ENTRY_H
11 #define LV_NUTTX_ENTRY_H
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /*********************
18  *      INCLUDES
19  *********************/
20 
21 #include "../../lv_conf_internal.h"
22 #include "../../display/lv_display.h"
23 #include "../../indev/lv_indev.h"
24 
25 #if LV_USE_NUTTX
26 
27 /*********************
28  *      DEFINES
29  *********************/
30 
31 /**********************
32  *      TYPEDEFS
33  **********************/
34 typedef struct {
35     const char * fb_path;
36     const char * input_path;
37     const char * utouch_path;
38 } lv_nuttx_dsc_t;
39 
40 typedef struct {
41     lv_display_t * disp;
42     lv_indev_t * indev;
43     lv_indev_t * utouch_indev;
44 } lv_nuttx_result_t;
45 
46 typedef struct _lv_nuttx_ctx_t {
47     void * image_cache;
48 } lv_nuttx_ctx_t;
49 
50 /**********************
51  * GLOBAL PROTOTYPES
52  **********************/
53 
54 /**
55  * Initialize the lv_nuttx_dsc_t structure with default values for the NuttX port of LVGL.
56  * @param dsc Pointer to the lv_nuttx_dsc_t structure to be initialized.
57  */
58 void lv_nuttx_dsc_init(lv_nuttx_dsc_t * dsc);
59 
60 /**
61  * Initialize the LVGL display driver for NuttX using the provided configuration information.
62  * @param dsc Pointer to the lv_nuttx_dsc_t structure containing the configuration information for the display driver.
63  * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
64  */
65 void lv_nuttx_init(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result);
66 
67 /**
68  * Deinitialize the LVGL display driver for NuttX.
69  * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
70  */
71 void lv_nuttx_deinit(lv_nuttx_result_t * result);
72 
73 #if LV_USE_NUTTX_CUSTOM_INIT
74 /**
75  * Initialize the LVGL display driver for NuttX using the provided custom configuration information.
76  * @param dsc Pointer to the lv_nuttx_dsc_t structure containing the custom configuration for the display driver.
77  * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
78  */
79 void lv_nuttx_init_custom(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result);
80 
81 /**
82  * Deinitialize the LVGL display driver for NuttX using the provided custom configuration information.
83  * @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
84  */
85 void lv_nuttx_deinit_custom(lv_nuttx_result_t * result);
86 #endif /* LV_USE_NUTTX_CUSTOM_INIT */
87 
88 /**
89  * Call `lv_timer_handler()` (LVGL's super loop) in an endless loop.
90  * If LV_USE_NUTTX_LIBUV is enabled an UV timer will be created,
91  * else `lv_timer_handler()` will be called in a loop with some sleep.
92  * @param result pointer to a variable initialized by `lv_nuttx_init()` or `lv_nuttx_init_custom()`
93  */
94 void lv_nuttx_run(lv_nuttx_result_t * result);
95 
96 /**
97  * Get the idle percentage of the system.
98  * @return The idle percentage of the system.
99  */
100 uint32_t lv_nuttx_get_idle(void);
101 
102 /**********************
103  *      MACROS
104  **********************/
105 
106 #endif /* LV_USE_NUTTX*/
107 
108 #ifdef __cplusplus
109 } /* extern "C" */
110 #endif
111 
112 #endif /* LV_NUTTX_ENTRY_H */
113