1 /** 2 * @file lv_disp.h 3 * 4 */ 5 6 #ifndef LV_DISP_H 7 #define LV_DISP_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../lv_hal/lv_hal.h" 17 #include "lv_obj.h" 18 19 /********************* 20 * DEFINES 21 *********************/ 22 23 /********************** 24 * TYPEDEFS 25 **********************/ 26 27 /********************** 28 * GLOBAL PROTOTYPES 29 **********************/ 30 31 /** 32 * Return with a pointer to the active screen 33 * @param disp pointer to display which active screen should be get. (NULL to use the default 34 * screen) 35 * @return pointer to the active screen object (loaded by 'lv_scr_load()') 36 */ 37 lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp); 38 39 /** 40 * Make a screen active 41 * @param scr pointer to a screen 42 */ 43 void lv_disp_load_scr(lv_obj_t * scr); 44 45 /** 46 * Return with the top layer. (Same on every screen and it is above the normal screen layer) 47 * @param disp pointer to display which top layer should be get. (NULL to use the default screen) 48 * @return pointer to the top layer object (transparent screen sized lv_obj) 49 */ 50 lv_obj_t * lv_disp_get_layer_top(lv_disp_t * disp); 51 52 /** 53 * Return with the sys. layer. (Same on every screen and it is above the normal screen and the top 54 * layer) 55 * @param disp pointer to display which sys. layer should be get. (NULL to use the default screen) 56 * @return pointer to the sys layer object (transparent screen sized lv_obj) 57 */ 58 lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp); 59 60 /** 61 * Assign a screen to a display. 62 * @param disp pointer to a display where to assign the screen 63 * @param scr pointer to a screen object to assign 64 */ 65 void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr); 66 67 /** 68 * Get a pointer to the screen refresher task to 69 * modify its parameters with `lv_task_...` functions. 70 * @param disp pointer to a display 71 * @return pointer to the display refresher task. (NULL on error) 72 */ 73 lv_task_t * lv_disp_get_refr_task(lv_disp_t * disp); 74 75 /** 76 * Get elapsed time since last user activity on a display (e.g. click) 77 * @param disp pointer to an display (NULL to get the overall smallest inactivity) 78 * @return elapsed ticks (milliseconds) since the last activity 79 */ 80 uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp); 81 82 /** 83 * Manually trigger an activity on a display 84 * @param disp pointer to an display (NULL to use the default display) 85 */ 86 void lv_disp_trig_activity(lv_disp_t * disp); 87 88 /*------------------------------------------------ 89 * To improve backward compatibility 90 * Recommended only if you have one display 91 *------------------------------------------------*/ 92 93 /** 94 * Get the active screen of the default display 95 * @return pointer to the active screen 96 */ lv_scr_act(void)97static inline lv_obj_t * lv_scr_act(void) 98 { 99 return lv_disp_get_scr_act(lv_disp_get_default()); 100 } 101 102 /** 103 * Get the top layer of the default display 104 * @return pointer to the top layer 105 */ lv_layer_top(void)106static inline lv_obj_t * lv_layer_top(void) 107 { 108 return lv_disp_get_layer_top(lv_disp_get_default()); 109 } 110 111 /** 112 * Get the active screen of the deafult display 113 * @return pointer to the sys layer 114 */ lv_layer_sys(void)115static inline lv_obj_t * lv_layer_sys(void) 116 { 117 return lv_disp_get_layer_sys(lv_disp_get_default()); 118 } 119 lv_scr_load(lv_obj_t * scr)120static inline void lv_scr_load(lv_obj_t * scr) 121 { 122 lv_disp_load_scr(scr); 123 } 124 125 /********************** 126 * MACROS 127 **********************/ 128 129 /*------------------------------------------------ 130 * To improve backward compatibility 131 * Recommended only if you have one display 132 *------------------------------------------------*/ 133 134 #ifndef LV_HOR_RES 135 /** 136 * The horizontal resolution of the currently active display. 137 */ 138 #define LV_HOR_RES lv_disp_get_hor_res(lv_disp_get_default()) 139 #endif 140 141 #ifndef LV_VER_RES 142 /** 143 * The vertical resolution of the currently active display. 144 */ 145 #define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default()) 146 #endif 147 148 #ifdef __cplusplus 149 } /* extern "C" */ 150 #endif 151 152 #endif /*LV_TEMPL_H*/ 153