📄 hpltda5250configp.nc
字号:
currentConfig = CONFIG_LNA_GAIN_HIGH(currentConfig); call CONFIG.set(currentConfig); } /* <<tested>> */ async command void HplTda5250Config.LowLNAGain() { currentConfig = CONFIG_LNA_GAIN_LOW(currentConfig); call CONFIG.set(currentConfig); } async command void HplTda5250Config.EnableReceiverInTimedModes() { currentConfig = CONFIG_EN_RX_ENABLE(currentConfig); call CONFIG.set(currentConfig); } async command void HplTda5250Config.DisableReceiverInTimedModes() { currentConfig = CONFIG_EN_RX_DISABLE(currentConfig); call CONFIG.set(currentConfig); } /* <<tested>> */ async command void HplTda5250Config.UseHighTxPower() { currentConfig = CONFIG_PA_PWR_HIGHTX(currentConfig); call CONFIG.set(currentConfig); } /* <<tested>> */ async command void HplTda5250Config.UseLowTxPower() { currentConfig = CONFIG_PA_PWR_LOWTX(currentConfig); call CONFIG.set(currentConfig); } async command void HplTda5250Config.TuneNomFreqWithBipolarFET(tda5250_bipolar_fet_ramp_times_t ramp_time, tda5250_cap_vals_t cap_val) { call XTAL_CONFIG.set(ramp_time); call XTAL_CONFIG.set(((uint16_t)cap_val) & 0x003F); } async command void HplTda5250Config.TuneNomFreqWithFET(tda5250_cap_vals_t cap_val) { call XTAL_CONFIG.set(0x00); call XTAL_CONFIG.set(((uint16_t)cap_val) & 0x003F); } /* <<tested>> */ async command void HplTda5250Config.SetRFPower(uint8_t value) { call RF_POWER.set(value); } /** Set the mode of the radio The choices are SLAVE_MODE, TIMER_MODE, SELF_POLLING_MODE */ /* << tested >> */ async command void HplTda5250Config.SetSlaveMode() { call PWDDDInterrupt.disable(); call PWDDD.makeOutput(); call PWDDD.clr(); currentConfig = CONFIG_MODE_1_SLAVE_OR_TIMER(currentConfig); currentConfig = CONFIG_MODE_2_SLAVE(currentConfig); // SetSlaveMode() is always called in conjunction with another function that writes the config... // call CONFIG.set(currentConfig); } async command void HplTda5250Config.SetTimerMode(float on_time, float off_time) { call PWDDD.clr(); call ON_TIME.set(TDA5250_CONVERT_TIME(on_time)); call OFF_TIME.set(TDA5250_CONVERT_TIME(off_time)); currentConfig = CONFIG_MODE_1_SLAVE_OR_TIMER(currentConfig); currentConfig = CONFIG_MODE_2_TIMER(currentConfig); call CONFIG.set(currentConfig); call TXRX.set(); call PWDDD.makeInput(); call PWDDDInterrupt.enableFallingEdge(); } async command void HplTda5250Config.ResetTimerMode() { call PWDDD.clr(); currentConfig = CONFIG_MODE_1_SLAVE_OR_TIMER(currentConfig); currentConfig = CONFIG_MODE_2_TIMER(currentConfig); call CONFIG.set(currentConfig); call PWDDD.makeInput(); call PWDDDInterrupt.enableFallingEdge(); } async command void HplTda5250Config.SetSelfPollingMode(float on_time, float off_time) { call PWDDD.clr(); call ON_TIME.set(TDA5250_CONVERT_TIME(on_time)); call OFF_TIME.set(TDA5250_CONVERT_TIME(off_time)); currentConfig = CONFIG_MODE_1_SELF_POLLING(currentConfig); call CONFIG.set(currentConfig); call TXRX.set(); call PWDDD.makeInput(); call PWDDDInterrupt.enableFallingEdge(); } async command void HplTda5250Config.ResetSelfPollingMode() { call PWDDD.clr(); currentConfig = CONFIG_MODE_1_SELF_POLLING(currentConfig); call CONFIG.set(currentConfig); call TXRX.set(); call PWDDD.makeInput(); call PWDDDInterrupt.enableFallingEdge(); } /** Set the on time and off time of the radio (Only makes sense when in TIMER or SELF_POLLING Mode) */ async command void HplTda5250Config.SetOnTime_ms(float time) { call ON_TIME.set(TDA5250_CONVERT_TIME(time)); } async command void HplTda5250Config.SetOffTime_ms(float time) { call OFF_TIME.set(TDA5250_CONVERT_TIME(time)); } /** Set the frequency that the CLK_DIV outputs (Available frequencies given in Tda5250ClockFreq_t struct) */ async command void HplTda5250Config.UseSetClock() { currentClockDiv &= 0x0F; call CLK_DIV.set(currentClockDiv); } async command void HplTda5250Config.Use18MHzClock() { currentClockDiv |= 0x10; currentClockDiv &= 0x1F; call CLK_DIV.set(currentClockDiv); } async command void HplTda5250Config.Use32KHzClock() { currentClockDiv |= 0x20; currentClockDiv &= 0x2F; call CLK_DIV.set(currentClockDiv); } async command void HplTda5250Config.UseWindowCountAsClock() { currentClockDiv |= 0x30; call CLK_DIV.set(currentClockDiv); } async command void HplTda5250Config.SetRadioClock(tda5250_clock_out_freqs_t freq) { currentClockDiv = (currentClockDiv & 0x30) + freq; call CLK_DIV.set(currentClockDiv); } /** Sets the threshold Values for internal evaluation */ /* <<tested>> */ async command void HplTda5250Config.SetRSSIThreshold(uint8_t value) { call RSSI_TH3.set(0xC0 | value); } async command void HplTda5250Config.SetVCCOver5Threshold(uint8_t value) { call RSSI_TH3.set(0x3F & value); } async command void HplTda5250Config.SetLowerDataRateThreshold(uint16_t value) { call COUNT_TH1.set(value); } async command void HplTda5250Config.SetUpperDataRateThreshold(uint16_t value) { call COUNT_TH2.set(value); } /** Get parts of certain registers according to their logical functionality */ async command uint8_t HplTda5250Config.GetRSSIValue() { return (0x3F & call ADC.get()); } async command uint8_t HplTda5250Config.GetADCSelectFeedbackBit() { return ((0x40 & call ADC.get()) >> 6); } async command uint8_t HplTda5250Config.GetADCPowerDownFeedbackBit() { return ((0x80 & call ADC.get()) >> 7); } async command bool HplTda5250Config.IsDataRateLessThanLowerThreshold() { if((0x80 & call STATUS.get()) == TRUE) return TRUE; return FALSE; } async command bool HplTda5250Config.IsDataRateBetweenThresholds() { if((0x40 & call STATUS.get()) == TRUE) return TRUE; return FALSE; } async command bool HplTda5250Config.IsDataRateLessThanUpperThreshold() { if((0x20 & call STATUS.get()) == TRUE) return TRUE; return FALSE; } async command bool HplTda5250Config.IsDataRateLessThanHalfOfLowerThreshold() { if((0x10 & call STATUS.get()) == TRUE) return TRUE; return FALSE; } async command bool HplTda5250Config.IsDataRateBetweenHalvesOfThresholds() { if((0x08 & call STATUS.get()) == TRUE) return TRUE; return FALSE; } async command bool HplTda5250Config.IsDataRateLessThanHalfOfUpperThreshold() { if((0x04 & call STATUS.get()) == TRUE) return TRUE; return FALSE; } async command bool HplTda5250Config.IsRSSIEqualToThreshold() { if((0x02 & call STATUS.get()) == TRUE) return TRUE; return FALSE; } async command bool HplTda5250Config.IsRSSIGreaterThanThreshold() { if((0x01 & call STATUS.get()) == TRUE) return TRUE; return FALSE; } /** Switches radio between states when in SLAVE_MODE */ /* << tested >> */ async command void HplTda5250Config.SetTxMode() { currentConfig = CONFIG_RX_NTX_TX(currentConfig); currentConfig = CONFIG_ALL_PD_NORMAL(currentConfig); if (currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER) { call CONFIG.set(currentConfig); } else { call TXRX.clr(); call PWDDD.clr(); } } /* << tested >> */ async command void HplTda5250Config.SetRxMode() { currentConfig = CONFIG_RX_NTX_RX(currentConfig); currentConfig = CONFIG_ALL_PD_NORMAL(currentConfig); if (currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER) { call CONFIG.set(currentConfig); } else { call TXRX.set(); call PWDDD.clr(); } } /* << tested >> */ async command void HplTda5250Config.SetSleepMode() { currentConfig = CONFIG_ALL_PD_POWER_DOWN(currentConfig); call PWDDD.makeOutput(); call PWDDD.set(); } async command bool HplTda5250Config.IsTxRxPinControlled() { return (currentConfig & MASK_CONFIG_CONTROL_TXRX_REGISTER); } /**************************************************************** Events Implemented ************************************************/ /** Interrupt Signal on PWD_DD pin in TIMER_MODE and SELF_POLLING_MODE */ async event void PWDDDInterrupt.fired() { signal HplTda5250Config.PWDDDInterrupt(); } default async event void HplTda5250Config.PWDDDInterrupt() {}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -