only turn off if we are not in CC1020_OFF state. (patch by Jesper Karlsson)
This commit is contained in:
parent
4d21a3e203
commit
cd96248306
|
@ -364,20 +364,22 @@ cc1020_off(void)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
if(cc1020_state & CC1020_RX_SEARCHING) {
|
if(cc1020_state != CC1020_OFF) {
|
||||||
/* Discard the current read buffer when the radio is shutting down. */
|
if(cc1020_state & CC1020_RX_SEARCHING) {
|
||||||
cc1020_rxlen = 0;
|
/* Discard the current read buffer when the radio is shutting down. */
|
||||||
|
cc1020_rxlen = 0;
|
||||||
|
|
||||||
LNA_POWER_OFF(); /* power down lna */
|
LNA_POWER_OFF(); /* power down lna */
|
||||||
s = splhigh();
|
s = splhigh();
|
||||||
DISABLE_RX_IRQ();
|
DISABLE_RX_IRQ();
|
||||||
cc1020_state = CC1020_OFF;
|
cc1020_state = CC1020_OFF;
|
||||||
splx(s);
|
splx(s);
|
||||||
cc1020_setupPD(); /* power down radio */
|
cc1020_setupPD(); /* power down radio */
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
|
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
|
||||||
cc1020_state = CC1020_OFF;
|
cc1020_state = CC1020_OFF;
|
||||||
} else {
|
} else {
|
||||||
cc1020_state |= CC1020_TURN_OFF;
|
cc1020_state |= CC1020_TURN_OFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -720,7 +722,7 @@ static void
|
||||||
cc1020_setupPD(void)
|
cc1020_setupPD(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Power down components an reset all registers except MAIN
|
* Power down components and reset all registers except MAIN
|
||||||
* to their default values.
|
* to their default values.
|
||||||
*/
|
*/
|
||||||
cc1020_write_reg(CC1020_MAIN,
|
cc1020_write_reg(CC1020_MAIN,
|
||||||
|
@ -776,3 +778,4 @@ cc1020_wakeupTX(int analog)
|
||||||
MS_DELAY(1);
|
MS_DELAY(1);
|
||||||
cc1020_write_reg(CC1020_MAIN, 0xD1);
|
cc1020_write_reg(CC1020_MAIN, 0xD1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue