check if ENERGEST_CONF_LEVELDEVICE_LEVELS is set.

call ENERGEST_ON_LEVEL.
This commit is contained in:
nvt-se 2008-01-15 08:33:02 +00:00
parent 21c690ecae
commit c3653b96ce

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * 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. * 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_OFF(ENERGEST_TYPE_LISTEN);
ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); 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 { do {
spiStatusByte = status(); spiStatusByte = status();
} while(spiStatusByte & BV(CC2420_TX_ACTIVE)); } 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 */ #endif /* SIMPLE_CC2420_CONF_TIMESTAMPS */
/* add time for power level also */ #ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
{ ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,simple_cc2420_get_txpower());
int current_powerlevel; #endif
current_powerlevel = (int)(getreg(CC2420_TXCTRL) & 0x001f);
ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,current_powerlevel);
}
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
ENERGEST_ON(ENERGEST_TYPE_LISTEN); ENERGEST_ON(ENERGEST_TYPE_LISTEN);