interface SplitControl as RadioControl;
interface ActiveMessageAddress;
+ interface LowPowerListening;
}
}
#define SEND_PERIOD 10
#endif
+#ifndef SLEEP_INTERVAL
+#define SLEEP_INTERVAL 50
+#endif
+
implementation
{
task void radioPowerUp()
post radioPowerUp();
else
{
+#ifdef LOW_POWER_LISTENING
+ call LowPowerListening.setLocalSleepInterval(SLEEP_INTERVAL);
+#endif
call SendTimer.startPeriodic(SEND_PERIOD);
call ReportTimer.startPeriodic(1000);
}
}
uint32_t sendCount;
- uint32_t sendError;
uint32_t sendDoneSuccess;
uint32_t sendDoneError;
uint32_t ackedCount;
if( call DiagMsg.record() )
{
call DiagMsg.uint16(sendCount);
- call DiagMsg.uint16(sendError);
call DiagMsg.uint16(sendDoneSuccess);
call DiagMsg.uint16(sendDoneError);
call DiagMsg.uint16(ackedCount);
call Packet.clear(&txMsg);
call PacketAcknowledgements.requestAck(&txMsg);
+#ifdef LOW_POWER_LISTENING
+ call LowPowerListening.setRxSleepInterval(&txMsg, SLEEP_INTERVAL);
+#endif
addr = call ActiveMessageAddress.amAddress();
if( addr == 2 )
if( call AMSend.send(addr, &txMsg, sizeof(ping_t)) == SUCCESS )
++sendCount;
- else
- ++sendError;
}
event void AMSend.sendDone(message_t* msg, error_t error)
* radio can even receive a message, and generate a TRX_UR interrupt
* because of concurrent access, but that message probably cannot be
* recovered.
+ *
+ * TODO: this needs to be verified, and make sure that the chip is
+ * not locked up in this case.
*/
- if( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) != RF230_BUSY_TX )
- {
- ASSERT( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) == RF230_PLL_ON );
-
- writeRegister(RF230_TRX_STATE, RF230_RX_ON);
- readRegister(RF230_IRQ_STATUS);
- radioIrq = FALSE;
-
- call PacketTimeStamp.clear(msg);
-
- return FAIL;
- }
// go back to RX_ON state when finished
writeRegister(RF230_TRX_STATE, RF230_RX_ON);