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.
*
* @(#)$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.
@ -301,12 +301,14 @@ simple_cc2420_send(const u8_t *payload, u16_t payload_len)
for(i = LOOP_20_SYMBOLS; i > 0; i--) {
if(SFD_IS_1) {
/* PRINTF("simple_cc2420: do_send() transmission has started\n");*/
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
ENERGEST_ON(ENERGEST_TYPE_TRANSMIT);
do {
spiStatusByte = status();
} while(spiStatusByte & BV(CC2420_TX_ACTIVE));
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
RELEASE_LOCK();
return 0; /* Transmission has started. */