ESP8266_RTOS_SDK  v1.4.0
esp_timer.h
1 /*
2  * ESPRSSIF MIT License
3  *
4  * Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5  *
6  * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7  * it is free of charge, to any person obtaining a copy of this software and associated
8  * documentation files (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11  * to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or
14  * substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef __ESP_TIMER_H__
26 #define __ESP_TIMER_H__
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /* timer related */
33 typedef void os_timer_func_t(void *timer_arg);
34 
35 typedef struct _os_timer_t {
36  struct _os_timer_t *timer_next;
37  void *timer_handle;
38  uint32 timer_expire;
39  uint32 timer_period;
40  os_timer_func_t *timer_func;
41  bool timer_repeat_flag;
42  void *timer_arg;
43 } os_timer_t;
44 
71 void os_timer_setfn(os_timer_t *ptimer, os_timer_func_t *pfunction, void *parg);
72 
82 void os_timer_arm(os_timer_t *ptimer, uint32 msec, bool repeat_flag);
83 
91 void os_timer_disarm(os_timer_t *ptimer);
92 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif
void os_timer_setfn(os_timer_t *ptimer, os_timer_func_t *pfunction, void *parg)
Set the timer callback function.
Definition: esp_timer.h:35
void os_timer_arm(os_timer_t *ptimer, uint32 msec, bool repeat_flag)
Enable the millisecond timer.
void os_timer_disarm(os_timer_t *ptimer)
Disarm the timer.