Merge pull request #1228 from bkozak-scanimetrics/contikimac_replace_function_pointer_cast

Replaced function pointer cast in contikimac
This commit is contained in:
Simon Duquennoy 2015-12-01 15:35:28 +01:00
commit 27fd590b51
1 changed files with 11 additions and 8 deletions

View File

@ -290,6 +290,7 @@ off(void)
}
/*---------------------------------------------------------------------------*/
static volatile rtimer_clock_t cycle_start;
static void powercycle_wrapper(struct rtimer *t, void *ptr);
static char powercycle(struct rtimer *t, void *ptr);
static void
schedule_powercycle(struct rtimer *t, rtimer_clock_t time)
@ -302,8 +303,7 @@ schedule_powercycle(struct rtimer *t, rtimer_clock_t time)
time = RTIMER_NOW() - RTIMER_TIME(t) + 2;
}
r = rtimer_set(t, RTIMER_TIME(t) + time, 1,
(void (*)(struct rtimer *, void *))powercycle, NULL);
r = rtimer_set(t, RTIMER_TIME(t) + time, 1, powercycle_wrapper, NULL);
if(r != RTIMER_OK) {
PRINTF("schedule_powercycle: could not set rtimer\n");
}
@ -321,8 +321,7 @@ schedule_powercycle_fixed(struct rtimer *t, rtimer_clock_t fixed_time)
fixed_time = RTIMER_NOW() + 1;
}
r = rtimer_set(t, fixed_time, 1,
(void (*)(struct rtimer *, void *))powercycle, NULL);
r = rtimer_set(t, fixed_time, 1, powercycle_wrapper, NULL);
if(r != RTIMER_OK) {
PRINTF("schedule_powercycle: could not set rtimer\n");
}
@ -354,6 +353,12 @@ powercycle_turn_radio_on(void)
}
}
/*---------------------------------------------------------------------------*/
static void
powercycle_wrapper(struct rtimer *t, void *ptr)
{
powercycle(t, ptr);
}
/*---------------------------------------------------------------------------*/
static char
powercycle(struct rtimer *t, void *ptr)
{
@ -1015,8 +1020,7 @@ init(void)
radio_is_on = 0;
PT_INIT(&pt);
rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1,
(void (*)(struct rtimer *, void *))powercycle, NULL);
rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1, powercycle_wrapper, NULL);
contikimac_is_on = 1;
@ -1032,8 +1036,7 @@ turn_on(void)
if(contikimac_is_on == 0) {
contikimac_is_on = 1;
contikimac_keep_radio_on = 0;
rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1,
(void (*)(struct rtimer *, void *))powercycle, NULL);
rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1, powercycle_wrapper, NULL);
}
return 1;
}