interface RadioByteComm;
interface ResourceRequested;
interface ClkDiv;
+#ifdef LNDW
+ interface RfPower;
+#endif
}
uses {
interface HplTda5250Config;
radioMode_t radioMode; // Current Mode of the Radio
float onTime, offTime;
+#ifdef LNDW
+ norace bool rfpowerdirty = FALSE;
+ norace uint8_t rfpower = INITIAL_RF_POWER;
+ task void setRfPower() {
+ uint8_t rp, rd;
+ atomic {
+ rp = rfpower;
+ rd = rfpowerdirty;
+ }
+ if(rd) {
+ if(call ConfigResource.immediateRequest() == SUCCESS) {
+ call HplTda5250Config.SetRFPower(rp);
+ atomic rfpowerdirty = FALSE;
+ }
+ else {
+ post setRfPower();
+ }
+ }
+ }
+#endif
+
/**************** Radio Init *****************/
command error_t Init.init() {
radioMode = RADIO_MODE_OFF;
call HplTda5250Config.SetSleepMode();
atomic radioMode = RADIO_MODE_SLEEP;
signal Tda5250Control.SleepModeDone();
+ if(rfpowerdirty) post setRfPower();
break;
case RADIO_MODE_TX_TRANSITION:
call HplTda5250Config.SetSlaveMode();
}
default async event void ClkDiv.stopping() {
}
+#ifdef LNDW
+ async command error_t RfPower.set(uint8_t setting) {
+ atomic {
+ rfpower = setting;
+ rfpowerdirty = TRUE;
+ }
+ return SUCCESS;
+ }
+#endif
}