* @brief This function will initialize a timer * normally this function is used to initialize a static timer object. * * @param timer is the point of timer * * @param name is a pointer to the name of the timer * * @param timeout is the callback of timer * * @param parameter is the param of the callback * * @param time is timeout ticks of timer * * NOTE: The max time
| 265 | * |
| 266 | */ |
| 267 | void rt_timer_init(rt_timer_t timer, |
| 268 | const char *name, |
| 269 | void (*timeout)(void *parameter), |
| 270 | void *parameter, |
| 271 | rt_tick_t time, |
| 272 | rt_uint8_t flag) |
| 273 | { |
| 274 | /* parameter check */ |
| 275 | RT_ASSERT(timer != RT_NULL); |
| 276 | RT_ASSERT(timeout != RT_NULL); |
| 277 | RT_ASSERT(time < RT_TICK_MAX / 2); |
| 278 | |
| 279 | /* timer object initialization */ |
| 280 | rt_object_init(&(timer->parent), RT_Object_Class_Timer, name); |
| 281 | |
| 282 | _timer_init(timer, timeout, parameter, time, flag); |
| 283 | } |
| 284 | RTM_EXPORT(rt_timer_init); |
| 285 | |
| 286 | /** |