acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_disp.h (7109B)
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 "../hal/lv_hal.h" 17 #include "lv_obj.h" 18 #include "lv_theme.h" 19 20 /********************* 21 * DEFINES 22 *********************/ 23 24 /********************** 25 * TYPEDEFS 26 **********************/ 27 28 typedef enum { 29 LV_SCR_LOAD_ANIM_NONE, 30 LV_SCR_LOAD_ANIM_OVER_LEFT, 31 LV_SCR_LOAD_ANIM_OVER_RIGHT, 32 LV_SCR_LOAD_ANIM_OVER_TOP, 33 LV_SCR_LOAD_ANIM_OVER_BOTTOM, 34 LV_SCR_LOAD_ANIM_MOVE_LEFT, 35 LV_SCR_LOAD_ANIM_MOVE_RIGHT, 36 LV_SCR_LOAD_ANIM_MOVE_TOP, 37 LV_SCR_LOAD_ANIM_MOVE_BOTTOM, 38 LV_SCR_LOAD_ANIM_FADE_IN, 39 LV_SCR_LOAD_ANIM_FADE_ON = LV_SCR_LOAD_ANIM_FADE_IN, /*For backward compatibility*/ 40 LV_SCR_LOAD_ANIM_FADE_OUT, 41 LV_SCR_LOAD_ANIM_OUT_LEFT, 42 LV_SCR_LOAD_ANIM_OUT_RIGHT, 43 LV_SCR_LOAD_ANIM_OUT_TOP, 44 LV_SCR_LOAD_ANIM_OUT_BOTTOM, 45 } lv_scr_load_anim_t; 46 47 /********************** 48 * GLOBAL PROTOTYPES 49 **********************/ 50 51 /** 52 * Return with a pointer to the active screen 53 * @param disp pointer to display which active screen should be get. (NULL to use the default 54 * screen) 55 * @return pointer to the active screen object (loaded by 'lv_scr_load()') 56 */ 57 lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp); 58 59 /** 60 * Return with a pointer to the previous screen. Only used during screen transitions. 61 * @param disp pointer to display which previous screen should be get. (NULL to use the default 62 * screen) 63 * @return pointer to the previous screen object or NULL if not used now 64 */ 65 lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp); 66 67 /** 68 * Make a screen active 69 * @param scr pointer to a screen 70 */ 71 void lv_disp_load_scr(lv_obj_t * scr); 72 73 /** 74 * Return with the top layer. (Same on every screen and it is above the normal screen layer) 75 * @param disp pointer to display which top layer should be get. (NULL to use the default screen) 76 * @return pointer to the top layer object (transparent screen sized lv_obj) 77 */ 78 lv_obj_t * lv_disp_get_layer_top(lv_disp_t * disp); 79 80 /** 81 * Return with the sys. layer. (Same on every screen and it is above the normal screen and the top 82 * layer) 83 * @param disp pointer to display which sys. layer should be retrieved. (NULL to use the default screen) 84 * @return pointer to the sys layer object (transparent screen sized lv_obj) 85 */ 86 lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp); 87 88 /** 89 * Set the theme of a display 90 * @param disp pointer to a display 91 */ 92 void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th); 93 94 /** 95 * Get the theme of a display 96 * @param disp pointer to a display 97 * @return the display's theme (can be NULL) 98 */ 99 lv_theme_t * lv_disp_get_theme(lv_disp_t * disp); 100 101 /** 102 * Set the background color of a display 103 * @param disp pointer to a display 104 * @param color color of the background 105 */ 106 void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color); 107 108 /** 109 * Set the background image of a display 110 * @param disp pointer to a display 111 * @param img_src path to file or pointer to an `lv_img_dsc_t` variable 112 */ 113 void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src); 114 115 /** 116 * Set opacity of the background 117 * @param disp pointer to a display 118 * @param opa opacity (0..255) 119 */ 120 void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa); 121 122 /** 123 * Switch screen with animation 124 * @param scr pointer to the new screen to load 125 * @param anim_type type of the animation from `lv_scr_load_anim_t`, e.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT` 126 * @param time time of the animation 127 * @param delay delay before the transition 128 * @param auto_del true: automatically delete the old screen 129 */ 130 void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del); 131 132 /** 133 * Get elapsed time since last user activity on a display (e.g. click) 134 * @param disp pointer to a display (NULL to get the overall smallest inactivity) 135 * @return elapsed ticks (milliseconds) since the last activity 136 */ 137 uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp); 138 139 /** 140 * Manually trigger an activity on a display 141 * @param disp pointer to a display (NULL to use the default display) 142 */ 143 void lv_disp_trig_activity(lv_disp_t * disp); 144 145 /** 146 * Clean any CPU cache that is related to the display. 147 * @param disp pointer to a display (NULL to use the default display) 148 */ 149 void lv_disp_clean_dcache(lv_disp_t * disp); 150 151 /** 152 * Get a pointer to the screen refresher timer to 153 * modify its parameters with `lv_timer_...` functions. 154 * @param disp pointer to a display 155 * @return pointer to the display refresher timer. (NULL on error) 156 */ 157 lv_timer_t * _lv_disp_get_refr_timer(lv_disp_t * disp); 158 159 /*------------------------------------------------ 160 * To improve backward compatibility 161 * Recommended only if you have one display 162 *------------------------------------------------*/ 163 164 /** 165 * Get the active screen of the default display 166 * @return pointer to the active screen 167 */ 168 static inline lv_obj_t * lv_scr_act(void) 169 { 170 return lv_disp_get_scr_act(lv_disp_get_default()); 171 } 172 173 /** 174 * Get the top layer of the default display 175 * @return pointer to the top layer 176 */ 177 static inline lv_obj_t * lv_layer_top(void) 178 { 179 return lv_disp_get_layer_top(lv_disp_get_default()); 180 } 181 182 /** 183 * Get the active screen of the default display 184 * @return pointer to the sys layer 185 */ 186 static inline lv_obj_t * lv_layer_sys(void) 187 { 188 return lv_disp_get_layer_sys(lv_disp_get_default()); 189 } 190 191 static inline void lv_scr_load(lv_obj_t * scr) 192 { 193 lv_disp_load_scr(scr); 194 } 195 196 /********************** 197 * MACROS 198 **********************/ 199 200 /*------------------------------------------------ 201 * To improve backward compatibility 202 * Recommended only if you have one display 203 *------------------------------------------------*/ 204 205 #ifndef LV_HOR_RES 206 /** 207 * The horizontal resolution of the currently active display. 208 */ 209 #define LV_HOR_RES lv_disp_get_hor_res(lv_disp_get_default()) 210 #endif 211 212 #ifndef LV_VER_RES 213 /** 214 * The vertical resolution of the currently active display. 215 */ 216 #define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default()) 217 #endif 218 219 /** 220 * Scale the given number of pixels (a distance or size) relative to a 160 DPI display 221 * considering the DPI of the default display. 222 * It ensures that e.g. `lv_dpx(100)` will have the same physical size regardless to the 223 * DPI of the display. 224 * @param n the number of pixels to scale 225 * @return `n x current_dpi/160` 226 */ 227 static inline lv_coord_t lv_dpx(lv_coord_t n) 228 { 229 return LV_DPX(n); 230 } 231 232 /** 233 * Scale the given number of pixels (a distance or size) relative to a 160 DPI display 234 * considering the DPI of the given display. 235 * It ensures that e.g. `lv_dpx(100)` will have the same physical size regardless to the 236 * DPI of the display. 237 * @param obj a display whose dpi should be considered 238 * @param n the number of pixels to scale 239 * @return `n x current_dpi/160` 240 */ 241 static inline lv_coord_t lv_disp_dpx(const lv_disp_t * disp, lv_coord_t n) 242 { 243 return _LV_DPX_CALC(lv_disp_get_dpi(disp), n); 244 } 245 246 #ifdef __cplusplus 247 } /*extern "C"*/ 248 #endif 249 250 #endif /*LV_DISP_H*/