1 /**
2  * @file lv_demo_smartwatch_home.h
3  *
4  */
5 
6 #ifndef LV_DEMO_SMARTWATCH_HOME_H
7 #define LV_DEMO_SMARTWATCH_HOME_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "lv_demo_smartwatch.h"
17 
18 #if LV_USE_DEMO_SMARTWATCH
19 
20 /*********************
21  *      DEFINES
22  *********************/
23 
24 /**********************
25  *      TYPEDEFS
26  **********************/
27 
28 /**********************
29  * GLOBAL PROTOTYPES
30  **********************/
31 
32 /**
33  * Create the home page. Called only once.
34  * @param       parent  tileview object
35  */
36 void lv_demo_smartwatch_home_create(lv_obj_t * parent);
37 
38 /**
39  * Get the home tile object that holds the watchfaces
40  * @return pointer to the home tile object
41  */
42 lv_obj_t * lv_demo_smartwatch_get_tile_home(void);
43 
44 /**
45  * Register external watchfaces
46  * @param name      name of the app
47  * @param preview   preview image of the watchface (180x180)
48  * @param watchface pointer to main object of the watchface
49  * @param seconds   pointer to analog seconds object. Used for smooth analog seconds animation
50  */
51 void lv_demo_smartwatch_register_watchface_cb(const char * name, const lv_image_dsc_t * preview, lv_obj_t ** watchface,
52                                               lv_obj_t ** seconds);
53 
54 /**
55  * Watchface selected callback
56  * @param e event
57  */
58 void lv_demo_smartwatch_face_selected_cb(lv_event_t * e);
59 
60 /**
61  * Update the position of animated analog seconds
62  * @param second    the current seconds position
63  */
64 void lv_demo_smartwatch_face_update_seconds(int second);
65 
66 /**
67  * Function to send watchface events
68  * @param e     event
69  */
70 void lv_demo_smartwatch_face_events_cb(lv_event_t * e);
71 
72 /**
73  * function to load watchface
74  * @param index     position of the watchface
75  * @return whether success or not (unsuccessful means watchface at index was not found)
76  */
77 bool lv_demo_smartwatch_face_load(uint16_t index);
78 
79 /**
80  * Update weather in the default watchface
81  * @param temp  current temp in °C
82  * @param icon  weather icon to use (0-7)
83  */
84 void lv_demo_smartwatch_home_set_weather(int temp, const lv_img_dsc_t * icon);
85 
86 /**
87  * Update time on the default watchface
88  * @param minute    minute
89  * @param hour      hour
90  * @param am_pm     am/pm label
91  * @param date      day of month
92  * @param month     month label
93  * @param weekday   day of the week
94  */
95 void lv_demo_smartwatch_home_set_time(int minute, int hour, const char * am_pm, int date, const char * month,
96                                       const char * weekday);
97 
98 /**********************
99  *      MACROS
100  **********************/
101 
102 
103 #endif /*LV_USE_DEMO_SMARTWATCH*/
104 
105 #ifdef __cplusplus
106 } /*extern "C"*/
107 #endif
108 
109 #endif /*LV_DEMO_SMARTWATCH_HOME_H*/
110