Turn off listen energy accounting when transmitting

This commit is contained in:
adamdunkels 2007-10-25 09:38:15 +00:00
parent a9e4287cbe
commit 349274cb81

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.11 2007/10/25 09:30:39 adamdunkels Exp $ * @(#)$Id: simple-cc2420.c,v 1.12 2007/10/25 09:38:15 adamdunkels 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.
@ -302,11 +302,13 @@ simple_cc2420_send(const u8_t *payload, u16_t payload_len)
if(SFD_IS_1) { if(SFD_IS_1) {
/* PRINTF("simple_cc2420: do_send() transmission has started\n");*/ /* PRINTF("simple_cc2420: do_send() transmission has started\n");*/
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); ENERGEST_ON(ENERGEST_TYPE_TRANSMIT);
do { do {
spiStatusByte = status(); spiStatusByte = status();
} while(spiStatusByte & BV(CC2420_TX_ACTIVE)); } while(spiStatusByte & BV(CC2420_TX_ACTIVE));
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
RELEASE_LOCK(); RELEASE_LOCK();
return 0; /* Transmission has started. */ return 0; /* Transmission has started. */