-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwets-cyclic.h
More file actions
126 lines (113 loc) · 4.49 KB
/
wets-cyclic.h
File metadata and controls
126 lines (113 loc) · 4.49 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* WETS - Warcomeb Easy Task Scheduler
* Copyright (C) 2019 Marco Giammarini <http://www.warcomeb.it>
*
* Authors:
* Marco Giammarini <m.giammarini@warcomeb.it>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/*!
* \file /wets-cyclic.h
* \brief
*/
#ifndef __WARCOMEB_WETS_CYCLIC_H
#define __WARCOMEB_WETS_CYCLIC_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "wets-types.h"
/*!
* \defgroup WETS_CyclicEvent WETS Cyclic Events Management
* \ingroup WETS
* \{
*/
/*!
* This function is called to add a cyclic event that is generated periodicaly
* every specified timeout in milli-seconds.
* Every times the timeout expires, the specific event will be generated and
* the callback invoked.
*
* \param[in] cb: The callback for the event.
* \param[in] priority: The priority group for the event.
* \param[in] event: The event to be notified.
* \param[in] cycle: The timeout cycle value in milli-second.
* \return The function returns:
* \arg \ref WETS_ERROR_SUCCESS when the delayed event was created.
* \arg \ref WETS_ERROR_NO_TIMER_AVAILABLE when there isn't available
* spaces for the new delayed event (no new timer possible).
* \arg \ref WETS_ERROR_WRONG_PARAMS when the function parameters
* is not valid.
*/
WETS_Error_t WETS_addCyclicEvent (pEventCallback cb,
uint8_t priority,
uint32_t event,
uint32_t cycle);
/*!
* This function is called to stop the timer that has already been started
* to generate a cyclic event.
* If the programmed event exists, the function will cancel it and the
* related timer.
*
* \param[in] priority: The priority group for the event.
* \param[in] event: The event to be notified.
* \return The function returns:
* \arg \ref WETS_ERROR_SUCCESS when the delayed event was removed.
* \arg \ref WETS_ERROR_NO_TIMER_FOUND when the dalayed event was not
* found.
* \arg \ref WETS_ERROR_WRONG_PARAMS when the function parameters
* is not valid.
*/
WETS_Error_t WETS_removeCyclicEvent (uint8_t priority,
uint32_t event);
/*!
* This function change the timeout of the selected cyclic event.
*
* \param[in] priority: The priority group for the event.
* \param[in] event: The event to be notified.
* \param[in] cycle: The new timeout cycle value for the event.
* \return The function returns:
* \arg \ref WETS_ERROR_SUCCESS when the delayed event was removed.
* \arg \ref WETS_ERROR_NO_TIMER_FOUND when the dalayed event was not
* found.
* \arg \ref WETS_ERROR_WRONG_PARAMS when the function parameters
* is not valid.
*/
WETS_Error_t WETS_editCyclicEvent (uint8_t priority,
uint32_t event,
uint32_t timeout);
/*!
* This function clear all cyclic events. It stop all timers.
*/
void WETS_removeAllCyclicEvents (void);
/*!
* This function it is called inside the main loop of the scheduler (\ref WETS_loop())
* when the microcontroller's timer asserts the own interrupt.
*
* \note It not must be called in other cases.
*/
void WETS_updateCyclicEvents (void);
/*!
* \}
*/
#ifdef __cplusplus
}
#endif
#endif // __WARCOMEB_WETS_CYCLIC_H