From 3670fac61897efb87711bbeed04c9f1934a484db Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Thu, 8 Apr 2010 18:23:24 +0000 Subject: [PATCH] Bugfix: timing fixed --- core/dev/cc2420.c | 5 +++-- core/net/mac/contikimac.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/dev/cc2420.c b/core/dev/cc2420.c index e87a74333..5fe29a1e8 100644 --- a/core/dev/cc2420.c +++ b/core/dev/cc2420.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: cc2420.c,v 1.50 2010/04/04 07:49:30 adamdunkels Exp $ + * @(#)$Id: cc2420.c,v 1.51 2010/04/08 18:23:24 adamdunkels Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -188,6 +188,7 @@ on(void) ENABLE_FIFOP_INT(); strobe(CC2420_SRXON); + while(!(status() & (BV(CC2420_XOSC16M_STABLE)))); ENERGEST_ON(ENERGEST_TYPE_LISTEN); leds_on(LEDS_GREEN); } @@ -200,8 +201,8 @@ off(void) /* Wait for transmission to end before turning radio off. */ while(status() & BV(CC2420_TX_ACTIVE)); - strobe(CC2420_SRFOFF); ENERGEST_OFF(ENERGEST_TYPE_LISTEN); + strobe(CC2420_SRFOFF); DISABLE_FIFOP_INT(); leds_off(LEDS_GREEN); diff --git a/core/net/mac/contikimac.c b/core/net/mac/contikimac.c index 779731b54..5a4f46717 100644 --- a/core/net/mac/contikimac.c +++ b/core/net/mac/contikimac.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: contikimac.c,v 1.31 2010/04/08 09:32:56 adamdunkels Exp $ + * $Id: contikimac.c,v 1.32 2010/04/08 18:23:24 adamdunkels Exp $ */ /** @@ -335,7 +335,7 @@ powercycle(struct rtimer *t, void *ptr) } powercycle_turn_radio_off(); } - schedule_powercycle(t, CCA_SLEEP_TIME); + schedule_powercycle_fixed(t, RTIMER_NOW() + CCA_SLEEP_TIME); /* COOJA_DEBUG_STR("yield\n");*/ PT_YIELD(&pt); }