Reset CCA mode to default. Make sure that the radio gto switched on when reading RSSI; otherwise node will reboot because of watchdog
This commit is contained in:
parent
52114b50e3
commit
cc7d3ae142
1 changed files with 5 additions and 5 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: cc2420.c,v 1.41 2010/02/25 16:06:44 adamdunkels Exp $
|
||||
* @(#)$Id: cc2420.c,v 1.42 2010/03/09 13:18:16 adamdunkels Exp $
|
||||
*/
|
||||
/*
|
||||
* This code is almost device independent and should be easy to port.
|
||||
|
@ -280,8 +280,6 @@ cc2420_init(void)
|
|||
/* Turn on/off automatic packet acknowledgment and address decoding. */
|
||||
reg = getreg(CC2420_MDMCTRL0);
|
||||
|
||||
reg |= 0x40; /* XXX CCA mode 1 */
|
||||
|
||||
#if CC2420_CONF_AUTOACK
|
||||
reg |= AUTOACK | ADR_DECODE;
|
||||
#else
|
||||
|
@ -370,7 +368,6 @@ cc2420_transmit(unsigned short payload_len)
|
|||
accurate measurement of the transmission time.*/
|
||||
while(status() & BV(CC2420_TX_ACTIVE));
|
||||
|
||||
|
||||
#ifdef ENERGEST_CONF_LEVELDEVICE_LEVELS
|
||||
ENERGEST_OFF_LEVEL(ENERGEST_TYPE_TRANSMIT,cc2420_get_txpower());
|
||||
#endif
|
||||
|
@ -761,9 +758,12 @@ cc2420_cca(void)
|
|||
if(!receive_on) {
|
||||
radio_was_off = 1;
|
||||
cc2420_on();
|
||||
|
||||
}
|
||||
|
||||
/* Make sure that the radio really got turned on. */
|
||||
if(!receive_on) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while(!(status() & BV(CC2420_RSSI_VALID))) {
|
||||
/* printf("cc2420_rssi: RSSI not valid.\n"); */
|
||||
|
|
Loading…
Reference in a new issue