EasyGUI
gui_timer.h
1 
6 /*
7  * Copyright (c) 2019 Tilen MAJERLE
8  *
9  * Permission is hereby granted, free of charge, to any person
10  * obtaining a copy of this software and associated documentation
11  * files (the "Software"), to deal in the Software without restriction,
12  * including without limitation the rights to use, copy, modify, merge,
13  * publish, distribute, sublicense, and/or sell copies of the Software,
14  * and to permit persons to whom the Software is furnished to do so,
15  * subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
23  * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  *
29  * This file is part of EasyGUI library.
30  *
31  * Author: Tilen Majerle <tilen@majerle.eu>
32  */
33 #ifndef GUI_HDR_TIMER_H
34 #define GUI_HDR_TIMER_H
35 
36 /* C++ detection */
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #include "gui_utils.h"
42 
57 #define guii_timer_getparams(t) ((t)->params)
58 
59 gui_timer_t* guii_timer_create(uint16_t period, void (*callback)(gui_timer_t *), void* const param);
60 uint8_t guii_timer_remove(gui_timer_t** const t);
61 uint8_t guii_timer_start(gui_timer_t* const t);
62 uint8_t guii_timer_startperiodic(gui_timer_t* const t);
63 uint8_t guii_timer_stop(gui_timer_t* const t);
64 uint8_t guii_timer_reset(gui_timer_t* const t);
65 
66 uint32_t guii_timer_getactivecount(void);
67 void guii_timer_process(void);
68 
73 /* C++ detection */
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif /* GUI_HDR_TIMER_H */
uint8_t guii_timer_remove(gui_timer_t **const t)
Remove timer.
Definition: gui_timer.c:83
uint8_t guii_timer_stop(gui_timer_t *const t)
Stop timer.
Definition: gui_timer.c:134
uint8_t guii_timer_reset(gui_timer_t *const t)
Reset timer to zero.
Definition: gui_timer.c:149
uint8_t guii_timer_start(gui_timer_t *const t)
Start timer.
Definition: gui_timer.c:99
void guii_timer_process(void)
Internal processing called by GUI library.
Definition: gui_timer.c:162
uint32_t guii_timer_getactivecount(void)
Get number of currently active timers.
Definition: gui_timer.c:208
gui_timer_t * guii_timer_create(uint16_t period, void(*callback)(gui_timer_t *), void *const param)
Create new software timer.
Definition: gui_timer.c:53
Timer structure.
Definition: gui_defs.h:769
uint8_t guii_timer_startperiodic(gui_timer_t *const t)
Start timer periodically. It will start again when callback is called.
Definition: gui_timer.c:119