mikroSDK Reference Manual
lv_timer.h
Go to the documentation of this file.
1
5#ifndef LV_TIMER_H
6#define LV_TIMER_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12/*********************
13 * INCLUDES
14 *********************/
15#include "../lv_conf_internal.h"
16#include "../hal/lv_hal_tick.h"
17
18#include <stdint.h>
19#include <stdbool.h>
20
21/*********************
22 * DEFINES
23 *********************/
24#ifndef LV_ATTRIBUTE_TIMER_HANDLER
25#define LV_ATTRIBUTE_TIMER_HANDLER
26#endif
27
28#define LV_NO_TIMER_READY 0xFFFFFFFF
29
30/**********************
31 * TYPEDEFS
32 **********************/
33
34struct _lv_timer_t;
35
39typedef void (*lv_timer_cb_t)(struct _lv_timer_t *);
40
44typedef struct _lv_timer_t {
45 uint32_t period;
46 uint32_t last_run;
48 void * user_data;
49 int32_t repeat_count;
50 uint32_t paused : 1;
52
53/**********************
54 * GLOBAL PROTOTYPES
55 **********************/
56
61
63
68LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void);
69
71
78static inline LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler_run_in_period(uint32_t ms)
79{
80 static uint32_t last_tick = 0;
81 uint32_t curr_tick = lv_tick_get();
82
83 if((curr_tick - last_tick) >= (ms)) {
84 last_tick = curr_tick;
85 return lv_timer_handler();
86 }
87 return 1;
88}
89
96
106lv_timer_t * lv_timer_create(lv_timer_cb_t timer_xcb, uint32_t period, void * user_data);
107
113
119
120void lv_timer_resume(lv_timer_t * timer);
121
128
134void lv_timer_set_period(lv_timer_t * timer, uint32_t period);
135
141
147void lv_timer_set_repeat_count(lv_timer_t * timer, int32_t repeat_count);
148
155
160void lv_timer_enable(bool en);
161
166uint8_t lv_timer_get_idle(void);
167
174
175/**********************
176 * MACROS
177 **********************/
178
179#ifdef __cplusplus
180} /*extern "C"*/
181#endif
182
183#endif
uint32_t lv_tick_get(void)
void lv_timer_enable(bool en)
void lv_timer_set_cb(lv_timer_t *timer, lv_timer_cb_t timer_cb)
void lv_timer_set_repeat_count(lv_timer_t *timer, int32_t repeat_count)
void lv_timer_ready(lv_timer_t *timer)
void lv_timer_del(lv_timer_t *timer)
lv_timer_t * lv_timer_create_basic(void)
void(* lv_timer_cb_t)(struct _lv_timer_t *)
Definition lv_timer.h:39
uint8_t lv_timer_get_idle(void)
lv_timer_t * lv_timer_get_next(lv_timer_t *timer)
void lv_timer_pause(lv_timer_t *timer)
lv_timer_t * lv_timer_create(lv_timer_cb_t timer_xcb, uint32_t period, void *user_data)
struct _lv_timer_t lv_timer_t
void lv_timer_reset(lv_timer_t *timer)
void lv_timer_set_period(lv_timer_t *timer, uint32_t period)
void _lv_timer_core_init(void)
Definition lv_timer.h:44
void * user_data
Definition lv_timer.h:48
uint32_t last_run
Definition lv_timer.h:46
uint32_t period
Definition lv_timer.h:45
lv_timer_cb_t timer_cb
Definition lv_timer.h:47
int32_t repeat_count
Definition lv_timer.h:49