Made rtimer callback a typedefed type to make function prototypes nicer

This commit is contained in:
adamdunkels 2007-10-23 20:33:19 +00:00
parent 9a11bc1543
commit d3319f71b3
2 changed files with 11 additions and 7 deletions

View file

@ -42,7 +42,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: rtimer.c,v 1.4 2007/05/22 20:58:38 adamdunkels Exp $
* @(#)$Id: rtimer.c,v 1.5 2007/10/23 20:33:19 adamdunkels Exp $
*/
#include "sys/rtimer.h"
@ -75,8 +75,9 @@ rtimer_init(void)
}
/*---------------------------------------------------------------------------*/
int
rtimer_set(struct rtimer *rtimer, rtimer_clock_t time, rtimer_clock_t duration,
void (* func)(struct rtimer *t, void *ptr), void *ptr)
rtimer_set(struct rtimer *rtimer, rtimer_clock_t time,
rtimer_clock_t duration,
rtimer_callback_t func, void *ptr)
{
int i;

View file

@ -45,7 +45,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: rtimer.h,v 1.5 2007/05/22 20:58:49 adamdunkels Exp $
* @(#)$Id: rtimer.h,v 1.6 2007/10/23 20:33:19 adamdunkels Exp $
*/
#ifndef __RTIMER_H__
#define __RTIMER_H__
@ -62,6 +62,9 @@ typedef unsigned short rtimer_clock_t;
*/
void rtimer_init(void);
struct rtimer;
typedef void (* rtimer_callback_t)(struct rtimer *t, void *ptr);
/**
* \brief Repressentation of a real-time task
*
@ -71,7 +74,7 @@ void rtimer_init(void);
*/
struct rtimer {
rtimer_clock_t time;
void (* func)(struct rtimer *t, void *ptr);
rtimer_callback_t func;
void *ptr;
};
@ -93,8 +96,8 @@ enum {
* time in the future.
*
*/
int rtimer_set(struct rtimer *t, rtimer_clock_t time, rtimer_clock_t duration,
void (* func)(struct rtimer *t, void *ptr), void *ptr);
int rtimer_set(struct rtimer *t, rtimer_clock_t time,
rtimer_clock_t duration, rtimer_callback_t func, void *ptr);
/**
* \brief Execute the next real-time task and schedule the next task, if any