def run(self, freq): fc, hbsel, fb = freq_utils.carrier_freq(freq) print "changing to freq: ", freq self.setup_rf(fc, hbsel, fb) while True: self.tx_data() print "transmitted packet" time.sleep(0.1)
def run(self, freq): fc, hbsel, fb = freq_utils.carrier_freq(freq) if DEBUG: print "changing to freq: ", freq self.setup_rf(fc, hbsel, fb) # while True: self.tx_data() if DEBUG: print "transmitted packet"
def _fsm(self, fsm_state): while True: if fsm_state == 'idle': fc, hbsel, fb = freq_utils.carrier_freq(434e6) self.setup_rf(fc, hbsel, fb) self.check_rssi() elif fsm_state == 'tx': pass elif fsm_state == 'rx': fc, hbsel, fb = freq_utils.carrier_freq(434e6) self.setup_rf(fc, hbsel, fb) self.receive() if self.packet_count == 50: break else: state = 'rx' else: pass
def sweep(self): f = 295e6 freqs = [] while f < 930e6: freqs.append(f) f += 10e6 for i in freqs: fc, hbsel, fb = freq_utils.carrier_freq(i) print "changing to freq: ", i for j in range(10): self.setup_rf(fc, hbsel, fb) self.tx_data() print "transmitted packet" time.sleep(0.01)
def _fsm(self, fsm_state): while True: if fsm_state == 'idle': pass elif fsm_state == 'tx': pass elif fsm_state == 'rx': fc, hbsel, fb = freq_utils.carrier_freq(434e6) self.setup_rf(fc, hbsel, fb) self.receive() if self.packet_count == 50: break else: state = 'rx' else: pass
def set_frequency(self, freq): """ Set the operating frequency. This function sets the values in registers 0x75, 0x76, 0x77, that determine the operating center frequency. Parameters ---------- freq : float Center frequency, this should be between 240.0e6 and 930.0e6. Examples -------- >>> set_frequency(434e6) """ fc, hbsel, fb = freq_utils.carrier_freq(freq) freq_band = 0x40 | hbsel << 5 | fb self._set_reg_freq_band(freq_band) self._set_reg_carrier_freq_1(fc >> 8) self._set_reg_carrier_freq_0(fc & 0xff)