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

View file

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