📄 tda5250radiop.nc
字号:
async event void DataResourceRequested.immediateRequested() { signal ResourceRequested.immediateRequested(); } /** Set the mode of the radio The choices are TIMER_MODE, SELF_POLLING_MODE */ async command error_t Tda5250Control.TimerMode(float on_time, float off_time) { radioMode_t mode; atomic { if(radioBusy() == FALSE) { radioMode = RADIO_MODE_TIMER_TRANSITION; onTime = on_time; offTime = off_time; } mode = radioMode; } if(radioMode == RADIO_MODE_TIMER_TRANSITION) { call DataResource.release(); if (call ConfigResource.immediateRequest() == SUCCESS) { switchConfigResource(); } else { call ConfigResource.request(); } return SUCCESS; } return FAIL; } async command error_t Tda5250Control.ResetTimerMode() { radioMode_t mode; atomic { if(radioBusy() == FALSE) { radioMode = RADIO_MODE_TIMER_TRANSITION; } mode = radioMode; } if(radioMode == RADIO_MODE_TIMER_TRANSITION) { call DataResource.release(); if (call ConfigResource.immediateRequest() == SUCCESS) { switchConfigResource(); } else { call ConfigResource.request(); } return SUCCESS; } return FAIL; } async command error_t Tda5250Control.SelfPollingMode(float on_time, float off_time) { radioMode_t mode; atomic { if(radioBusy() == FALSE) { radioMode = RADIO_MODE_SELF_POLLING_TRANSITION; onTime = on_time; offTime = off_time; } mode = radioMode; } if(radioMode == RADIO_MODE_SELF_POLLING_TRANSITION) { call DataResource.release(); if (call ConfigResource.immediateRequest() == SUCCESS) { switchConfigResource(); } else { call ConfigResource.request(); } return SUCCESS; } return FAIL; } async command error_t Tda5250Control.ResetSelfPollingMode() { radioMode_t mode; atomic { if(radioBusy() == FALSE) { radioMode = RADIO_MODE_SELF_POLLING_TRANSITION; } mode = radioMode; } if(radioMode == RADIO_MODE_SELF_POLLING_TRANSITION) { call DataResource.release(); if (call ConfigResource.immediateRequest() == SUCCESS) { switchConfigResource(); } else { call ConfigResource.request(); } return SUCCESS; } return FAIL; } async command error_t Tda5250Control.SleepMode() { radioMode_t mode; atomic{ if(radioBusy() == FALSE) { radioMode = RADIO_MODE_SLEEP_TRANSITION; } mode = radioMode; } if(mode == RADIO_MODE_SLEEP_TRANSITION) { call DataResource.release(); switchConfigResource(); return SUCCESS; } return FAIL; } async command error_t Tda5250Control.TxMode() { radioMode_t mode; atomic { if(radioBusy() == FALSE) { radioMode = RADIO_MODE_TX_TRANSITION; } mode = radioMode; } if(mode == RADIO_MODE_TX_TRANSITION) { call DataResource.release(); call HplTda5250DataControl.setToTx(); if (call HplTda5250Config.IsTxRxPinControlled()) { switchConfigResource(); } else { if (call ConfigResource.immediateRequest() == SUCCESS) { switchConfigResource(); } else { call ConfigResource.request(); } } return SUCCESS; } return FAIL; } async command error_t Tda5250Control.RxMode() { radioMode_t mode; atomic { if(radioBusy() == FALSE) { radioMode = RADIO_MODE_RX_TRANSITION; } mode = radioMode; } if(mode == RADIO_MODE_RX_TRANSITION) { call DataResource.release(); call HplTda5250DataControl.setToRx(); if (call HplTda5250Config.IsTxRxPinControlled()) { switchConfigResource(); } else { if (call ConfigResource.immediateRequest() == SUCCESS) { switchConfigResource(); } else { call ConfigResource.request(); } } return SUCCESS; } return FAIL; } async event void HplTda5250Data.txReady() { signal RadioByteComm.txByteReady(SUCCESS); } async event void HplTda5250Data.rxDone(uint8_t data) { signal RadioByteComm.rxByteReady(data); } async event void HplTda5250Config.PWDDDInterrupt() { signal Tda5250Control.PWDDDInterrupt(); } async command void RadioByteComm.txByte(uint8_t data) { error_t error = call HplTda5250Data.tx(data); if(error != SUCCESS) { signal RadioByteComm.txByteReady(error); } } async command bool RadioByteComm.isTxDone() { //return call HplTda5250Data.isTxDone(); return TRUE; } /* Generate events (these are no interrupts */ async event void DelayTimer.fired() { delayTimer_t delay; atomic { delay = delayTimer; } switch (delay) { case RSSISTABLE_DELAY : signal Tda5250Control.RssiStable(); break; case RECEIVER_DELAY : signal ClkDiv.startDone(); delayTimer = RSSISTABLE_DELAY; call DelayTimer.start(TDA5250_RSSI_STABLE_TIME-TDA5250_RECEIVER_SETUP_TIME); if (call DataResource.immediateRequest() == SUCCESS) { switchDataResource(); } else { call DataResource.request(); } break; case TRANSMITTER_DELAY : signal ClkDiv.startDone(); if (call DataResource.immediateRequest() == SUCCESS) { switchDataResource(); } else { call DataResource.request(); } break; } } default async event void ResourceRequested.requested() { } default async event void ResourceRequested.immediateRequested() { } default async event void Tda5250Control.TimerModeDone(){ } default async event void Tda5250Control.SelfPollingModeDone(){ } default async event void Tda5250Control.RxModeDone(){ } default async event void Tda5250Control.TxModeDone(){ } default async event void Tda5250Control.SleepModeDone(){ } default async event void Tda5250Control.PWDDDInterrupt() { } default async event void RadioByteComm.rxByteReady(uint8_t data) { } default async event void RadioByteComm.txByteReady(error_t error) { } default async event void ClkDiv.startDone() { } 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}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -