示例#1
0
    def run(self):
        BOARD.setup()
        parser = LoRaArgumentParser("Continous LoRa receiver.")

        lora = LoRaRcvCont(verbose=False)
        args = parser.parse_args(lora)

        lora.set_mode(MODE.STDBY)
        lora.set_pa_config(pa_select=1)
        lora.set_freq(434.0)
        #lora.set_rx_crc(True)
        #lora.set_coding_rate(CODING_RATE.CR4_6)
        #lora.set_pa_config(max_power=0, output_power=0)
        #lora.set_lna_gain(GAIN.G1)
        #lora.set_implicit_header_mode(False)
        #lora.set_low_data_rate_optim(True)
        #lora.set_pa_ramp(PA_RAMP.RAMP_50_us)
        #lora.set_agc_auto_on(True)

        print("lora: {0}".format(lora))
        assert (lora.get_agc_auto_on() == 1)
        time.sleep(1)
        try:
            lora.start()
        except KeyboardInterrupt:
            sys.stdout.flush()
            print("")
            sys.stderr.write("KeyboardInterrupt\n")
        finally:
            sys.stdout.flush()
            print("")
            lora.set_mode(MODE.SLEEP)
            print(lora)
            BOARD.teardown()
示例#2
0
    def on_fhss_change_channel(self):
        print("\non_FhssChangeChannel")
        print(self.get_irq_flags())

    def start(self):
        global args
        sys.stdout.write("\rstart")
        self.tx_counter = 0
        BOARD.led_on()
        self.write_payload([0x0f])
        self.set_mode(MODE.TX)
        while True:
            sleep(1)

lora = LoRaBeacon(verbose=False)
args = parser.parse_args(lora)

lora.set_pa_config(pa_select=1)
#lora.set_rx_crc(True)
#lora.set_agc_auto_on(True)
#lora.set_lna_gain(GAIN.NOT_USED)
#lora.set_coding_rate(CODING_RATE.CR4_6)
#lora.set_implicit_header_mode(False)
#lora.set_pa_config(max_power=0x04, output_power=0x0F)
#lora.set_pa_config(max_power=0x04, output_power=0b01000000)
#lora.set_low_data_rate_optim(True)
#lora.set_pa_ramp(PA_RAMP.RAMP_50_us)


print(lora)
#assert(lora.get_lna()['lna_gain'] == GAIN.NOT_USED)
示例#3
0
    def start(self):
        self.reset_ptr_rx()
        self.set_mode(MODE.RXCONT)
        while True:
            sleep(.5)
        rssi_value = self.get_rssi_value()
        status = self.get_modem_status()
        sys.stdout.flush()
        sys.stdout.write(
            "\r%d %d %d" %
            (rssi_value, status['rx_ongoing'], status['modem_clear']))


lora = LoRaRcvCont(verbose=False)
args = parser.parse_args(lora)

lora.set_mode(MODE.STDBY)
lora.set_pa_config(pa_select=1)
lora.set_rx_crc(True)
lora.set_coding_rate(CODING_RATE.CR4_6)
lora.set_pa_config(max_power=15, output_power=15)
lora.set_lna_gain(GAIN.G1)
lora.set_implicit_header_mode(False)
lora.set_low_data_rate_optim(True)
lora.set_pa_ramp(PA_RAMP.RAMP_50_us)
lora.set_agc_auto_on(True)

#print(lora)
assert (lora.get_agc_auto_on() == 1)
        self.tx_counter = 0
        self.write_payload([255, 255, 0, 0, 104, 101, 108, 108, 111])
        self.reset_ptr_rx()
        self.set_mode(MODE.RXCONT)
        while True:
            sleep(.5)
            rssi_value = self.get_rssi_value()
            status = self.get_modem_status()
            sys.stdout.flush()
            sys.stdout.write(
                "\r%d %d %d" %
                (rssi_value, status['rx_ongoing'], status['modem_clear']))


lora = LoRaRcvCont(verbose=False)
args = parser.parse_args(lora)  # configs in LoRaArgumentParser.py

lora.set_mode(MODE.STDBY)
lora.set_pa_config(pa_select=1)

assert (lora.get_agc_auto_on() == 1)

try:
    print("START")
    lora.start()
except KeyboardInterrupt:
    sys.stdout.flush()
    print("Exit")
    sys.stderr.write("KeyboardInterrupt\n")
finally:
    sys.stdout.flush()
示例#5
0
    def start(self):
        self.read_config()
        self.send()
        while True:
            sleep(1)


# Init
devaddr = []
nwskey = []
appskey = []
fCnt = 0
lora = LoRaWANotaa(False)

# Setup
parser.parse_args(lora)
lora.set_mode(MODE.SLEEP)
lora.set_dio_mapping([1, 0, 0, 0, 0, 0])
lora.set_freq(923.2)
lora.set_bw(7)
lora.set_spreading_factor(7)
lora.set_pa_config(pa_select=1)
lora.set_pa_config(max_power=0x0F, output_power=0x0E)
lora.set_invert_iq(0)
lora.set_sync_word(0x34)
lora.set_rx_crc(True)

#print(lora)
assert (lora.get_agc_auto_on() == 1)

try: