MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _timer_init

Function _timer_init

src/timer.c:131–160  ·  view source on GitHub ↗

* @brief [internal] The init funtion of timer * * The internal called function of rt_timer_init * * @see rt_timer_init * * @param timer is timer object * * @param timeout is the timeout function * * @param parameter is the parameter of timeout function * * @param time is the tick of timer * * @param flag the flag of timer */

Source from the content-addressed store, hash-verified

129 * @param flag the flag of timer
130 */
131static void _timer_init(rt_timer_t timer,
132 void (*timeout)(void *parameter),
133 void *parameter,
134 rt_tick_t time,
135 rt_uint8_t flag)
136{
137 int i;
138
139#ifdef RT_USING_TIMER_ALL_SOFT
140 flag |= RT_TIMER_FLAG_SOFT_TIMER;
141#endif
142
143 /* set flag */
144 timer->parent.flag = flag;
145
146 /* set deactivated */
147 timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED;
148
149 timer->timeout_func = timeout;
150 timer->parameter = parameter;
151
152 timer->timeout_tick = 0;
153 timer->init_tick = time;
154
155 /* initialize timer list */
156 for (i = 0; i < RT_TIMER_SKIP_LIST_LEVEL; i++)
157 {
158 rt_list_init(&(timer->row[i]));
159 }
160}
161
162/**
163 * @brief Find the next emtpy timer ticks

Callers 2

rt_timer_initFunction · 0.70
rt_timer_createFunction · 0.70

Calls 1

rt_list_initFunction · 0.85

Tested by

no test coverage detected