1 /** 2 * @file lv_demo_high_res.h 3 * 4 */ 5 6 #ifndef LV_DEMO_HIGH_RES_H 7 #define LV_DEMO_HIGH_RES_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "../../src/lv_conf_internal.h" 18 #if LV_USE_DEMO_HIGH_RES 19 20 #include "../../src/others/observer/lv_observer.h" 21 22 /********************* 23 * DEFINES 24 *********************/ 25 26 /********************** 27 * TYPEDEFS 28 **********************/ 29 30 typedef struct { 31 struct { 32 /* input subjects */ 33 /* int: the hour shown on clocks, e.g. 9 */ 34 lv_subject_t hour; 35 /* int: the minute shown on clocks, e.g. 36 */ 36 lv_subject_t minute; 37 /* pointer: day of the week string, e.g. "Tuesday" */ 38 lv_subject_t week_day_name; 39 /* int: the day of the month, e.g. 31 */ 40 lv_subject_t month_day; 41 /* pointer: the month string, e.g. "October" */ 42 lv_subject_t month_name; 43 /* int: tenths of a degree C, e.g. 140 (for 14.0 degrees celsius) */ 44 lv_subject_t temperature_outdoor; 45 /* int: tenths of a degree C, e.g. 225 (for 22.5 degrees celsius) */ 46 lv_subject_t temperature_indoor; 47 /* pointer: wifi network name string, e.g. "my home Wi-Fi network" (or `NULL` for offline) */ 48 lv_subject_t wifi_ssid; 49 /* pointer: wifi local IP address string, e.g. "192.168.1.1" (or `NULL` for offline) */ 50 lv_subject_t wifi_ip; 51 52 /* output subjects */ 53 /* int: boolean 0 for music paused, 1 for music playing */ 54 lv_subject_t music_play; 55 56 /* input+output subjects */ 57 /* int: boolean 0 for not locked, 1 for locked. When it is 1, you can set it back to 0 */ 58 lv_subject_t locked; 59 /* int: a value 0-100 of the smart home volume slider */ 60 lv_subject_t volume; 61 /* int: a value 0-20000 of the smart home light "temperature" slider in Kelvin */ 62 lv_subject_t main_light_temperature; 63 /* int: a value 0-100 of the smart home light intensity slider */ 64 lv_subject_t main_light_intensity; 65 /* int: a value 0-100 of the thermostat fan speed slider */ 66 lv_subject_t thermostat_fan_speed; 67 /* int: a value 150-300 in tenths of a degree C, e.g. 225 (for 22.5 degrees celsius) */ 68 lv_subject_t thermostat_target_temperature; 69 } subjects; 70 71 /* the object that is created on the active screen which contains the demo contents. 72 * Can be deleted to close the demo. 73 */ 74 lv_obj_t * base_obj; 75 void * user_data; /* optional extra data field for the user to use freely */ 76 } lv_demo_high_res_api_t; 77 78 typedef void (*lv_demo_high_res_exit_cb_t)(lv_demo_high_res_api_t * api); 79 80 /********************** 81 * GLOBAL PROTOTYPES 82 **********************/ 83 84 /** 85 * Start the High Resolution Demo on the default display, on the active screen. 86 * This demo requires `LV_USE_DEMO_HIGH_RES` and `LV_FONT_FMT_TXT_LARGE` 87 * to be enabled as well as a filesystem driver to be configured and the 88 * `LV_FS_DEFAULT_DRIVER_LETTER` set. The display size should be 89 * 800x480, 1280x720, or 1920x1080. 90 * @param assets_path Folder where the image assets are. 91 * If `NULL`, "lvgl/demos/high_res/assets" will be used. 92 * @param logo_path A path to a logo to display in the bottom-left 93 * of the home screen. If `NULL`, an LVGL logo is used. 94 * @param slides_path Folder where the "About" app slideshow slides are. 95 * If `NULL`, "about_app_slides" will be used. 96 * The images should be named like Slide1.png, Slide2.png, etc. 97 * They will be scaled to nine sixteenths the height of the 98 * display. I.e., a slide will not be scaled if it is 99 * 405 px high and the display is 720 px high. 100 * @param exit_cb A callback function which will be called when the 101 * "logout" button is clicked, or `NULL` to do nothing. 102 * @return A struct with subjects to control the UI 103 * and react to input. 104 */ 105 lv_demo_high_res_api_t * lv_demo_high_res(const char * assets_path, 106 const char * logo_path, 107 const char * slides_path, 108 lv_demo_high_res_exit_cb_t exit_cb); 109 110 /** 111 * This function demonstrates how the demo's API can be used. 112 * Start the High Resolution Demo on the default display, on the active screen. 113 * This demo requires `LV_USE_DEMO_HIGH_RES` and `LV_FONT_FMT_TXT_LARGE` 114 * to be enabled as well as a filesystem driver to be configured and the 115 * `LV_FS_DEFAULT_DRIVER_LETTER` set. The display size should be 116 * 800x480, 1280x720, or 1920x1080. 117 * @param assets_path Folder where the image assets are. 118 * If `NULL`, "lvgl/demos/high_res/assets" will be used. 119 * @param logo_path A path to a logo to display in the bottom-left 120 * of the home screen. If `NULL`, an LVGL logo is used. 121 * @param slides_path Folder where the "About" app slideshow slides are. 122 * If `NULL`, "about_app_slides" will be used. 123 * The images should be named like Slide1.png, Slide2.png, etc. 124 * They will be scaled to nine sixteenths the height of the 125 * display. I.e., a slide will not be scaled if it is 126 * 405 px high and the display is 720 px high. 127 */ 128 void lv_demo_high_res_api_example(const char * assets_path, const char * logo_path, const char * slides_path); 129 130 /********************** 131 * MACROS 132 **********************/ 133 134 #endif /*LV_USE_DEMO_HIGH_RES*/ 135 136 #ifdef __cplusplus 137 } /*extern "C"*/ 138 #endif 139 140 #endif /*LV_DEMO_HIGH_RES_H*/ 141