From c3653b96ced84b060a6e1b5a580c6eb7731ea1d3 Mon Sep 17 00:00:00 2001 From: nvt-se Date: Tue, 15 Jan 2008 08:33:02 +0000 Subject: [PATCH] check if ENERGEST_CONF_LEVELDEVICE_LEVELS is set. call ENERGEST_ON_LEVEL. --- core/dev/simple-cc2420.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/dev/simple-cc2420.c b/core/dev/simple-cc2420.c index d5850d367..00fe97a97 100644 --- a/core/dev/simple-cc2420.c +++ b/core/dev/simple-cc2420.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: simple-cc2420.c,v 1.20 2008/01/14 16:19:25 thiemovoigt Exp $ + * @(#)$Id: simple-cc2420.c,v 1.21 2008/01/15 08:33:02 nvt-se Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -327,6 +327,10 @@ simple_cc2420_send(const void *payload, unsigned short payload_len) ENERGEST_OFF(ENERGEST_TYPE_LISTEN); ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); + /* add time for power level also */ +#ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS + ENERGEST_ON_LEVEL(ENERGEST_TYPE_TRANSMIT,simple_cc2420_get_txpower()); +#endif do { spiStatusByte = status(); } while(spiStatusByte & BV(CC2420_TX_ACTIVE)); @@ -340,13 +344,9 @@ simple_cc2420_send(const void *payload, unsigned short payload_len) } #endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */ - /* add time for power level also */ - { - int current_powerlevel; - - current_powerlevel = (int)(getreg(CC2420_TXCTRL) & 0x001f); - ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,current_powerlevel); - } +#ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS + ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,simple_cc2420_get_txpower()); +#endif ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); ENERGEST_ON(ENERGEST_TYPE_LISTEN);