summaryrefslogtreecommitdiff
path: root/lib/luavgl/simulator/widgets/lv_analog_time.h
blob: f4e63fed185edb198efb74be1d7d4f21c684f778 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef LV_WIDGETS_ANALOG_TIME_H_
#define LV_WIDGETS_ANALOG_TIME_H_

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/

#include <lvgl.h>

#if LV_USE_ANALOG_TIME

/*********************
 *      DEFINES
 *********************/

/**********************
 *      TYPEDEFS
 **********************/

typedef struct {
    lv_obj_t obj;
    lv_obj_t* hour;
    lv_obj_t* minute;
    lv_obj_t* second;
    uint32_t period;
    lv_timer_t* timer;
} lv_analog_time_t;

extern const lv_obj_class_t lv_analog_time_class;

/**********************
 * GLOBAL PROTOTYPES
 **********************/

lv_obj_t* lv_analog_time_create(lv_obj_t* parent);

/**
 * Set images for hands of hour, minute and second.
 * If specified hands image is NULL, then it's deleted.
 *
 * @note for simplicity, image pivot is set to image center.
 */
void lv_analog_time_set_hands(lv_obj_t* obj, const void* hour,
                               const void* minute, const void* second);

void lv_analog_time_pause(lv_obj_t* obj);
void lv_analog_time_resume(lv_obj_t* obj);
void lv_analog_time_set_period(lv_obj_t* obj, uint32_t period);

/**********************
 *      MACROS
 **********************/

#endif /*  */

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* LV_WIDGETS_ANALOG_TIME_H_ */