Removed old programs for uniformity in this repo
This commit is contained in:
parent
9112d8980b
commit
57a0714738
@ -148,6 +148,8 @@ def pingpong(lora, initializer: bool, lcd_connected=True, interrupt_pin=None):
|
|||||||
as_responder(lora, lcd, lcd_connected, interrupt_pin)
|
as_responder(lora, lcd, lcd_connected, interrupt_pin)
|
||||||
|
|
||||||
|
|
||||||
|
# initialize LoRa
|
||||||
|
|
||||||
device_spi = SPI(baudrate = 10000000,
|
device_spi = SPI(baudrate = 10000000,
|
||||||
polarity = 0, phase = 0, bits = 8, firstbit = SPI.MSB, id=0,
|
polarity = 0, phase = 0, bits = 8, firstbit = SPI.MSB, id=0,
|
||||||
sck = Pin(2, Pin.OUT, Pin.PULL_DOWN),
|
sck = Pin(2, Pin.OUT, Pin.PULL_DOWN),
|
||||||
@ -168,9 +170,22 @@ parameters = {
|
|||||||
'invert_IQ': False,
|
'invert_IQ': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def run():
|
lora = SX127x(device_spi, pins={"dio_0": 6, "ss": 5, "led": 27}, parameters=parameters)"
|
||||||
lora = SX127x(device_spi, pins={"dio_0": 6, "ss": 5, "led": 27}, parameters=parameters)
|
|
||||||
|
|
||||||
|
# The run function (for different options; see below the "if __name__ == ..." section)
|
||||||
|
|
||||||
|
def run_lcd_init():
|
||||||
|
pingpong(lora, initializer=True, lcd_connected=True)
|
||||||
|
def run_wo_lcd_init():
|
||||||
|
pingpong(lora, initializer=True, lcd_connected=False)
|
||||||
|
def run_lcd_resp():
|
||||||
pingpong(lora, initializer=False, lcd_connected=True)
|
pingpong(lora, initializer=False, lcd_connected=True)
|
||||||
|
def run_wo_lcd_resp():
|
||||||
|
pingpong(lora, initializer=False, lcd_connected=False)"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
run()
|
#run_lcd_resp() # run as responder (with lcd)
|
||||||
|
#run_wo_lcd_resp() # run as responder (without lcd)
|
||||||
|
#run_lcd_init() # run as initializer (with lcd)
|
||||||
|
run_wo_lcd_init() # run as initializer (without lcd)
|
||||||
|
35
main_+lcd.py
35
main_+lcd.py
@ -2,10 +2,6 @@ from ProgramChooser import ProgramChooser
|
|||||||
import sys
|
import sys
|
||||||
import gc
|
import gc
|
||||||
|
|
||||||
def micronec_run():
|
|
||||||
from micronEC import micronec
|
|
||||||
micronec.run()
|
|
||||||
gc.collect()
|
|
||||||
def lora_receiver_run():
|
def lora_receiver_run():
|
||||||
from lora_simple import lora_receiver
|
from lora_simple import lora_receiver
|
||||||
lora_receiver.run()
|
lora_receiver.run()
|
||||||
@ -14,32 +10,21 @@ def lora_sender_run():
|
|||||||
from lora_simple import lora_sender
|
from lora_simple import lora_sender
|
||||||
lora_sender.run()
|
lora_sender.run()
|
||||||
gc.collect()
|
gc.collect()
|
||||||
def lora_pingpong_run():
|
def lora_pingpong_init():
|
||||||
import lora_pingpong
|
import lora_pingpong
|
||||||
lora_pingpong.run()
|
lora_pingpong.run_lcd_init()
|
||||||
gc.collect()
|
gc.collect()
|
||||||
def lcd_big_hello_run():
|
def lora_pingpong_resp():
|
||||||
from lcd_examples import lcd_big_hello
|
import lora_pingpong
|
||||||
lcd_big_hello.run()
|
lora_pingpong.run_lcd_resp()
|
||||||
gc.collect()
|
|
||||||
def lcd_libtest_run():
|
|
||||||
from lcd_examples import lcd_libtest
|
|
||||||
lcd_libtest.run()
|
|
||||||
gc.collect()
|
|
||||||
def led_test_run():
|
|
||||||
from excercise import led_test
|
|
||||||
led_test.run()
|
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
"micronEC": micronec_run,
|
"simplereceiver": lora_receiver_run,
|
||||||
"lorareceiver": lora_receiver_run,
|
"simplesender": lora_sender_run,
|
||||||
"lorasender": lora_sender_run,
|
"pingpong_init": lora_pingpong_init,
|
||||||
"lora_pingpong": lora_pingpong_run,
|
"pingpong_resp": lora_pingpong_resp,
|
||||||
"lcd_big_hello": lcd_big_hello_run,
|
|
||||||
"lcd_libtest": lcd_libtest_run,
|
|
||||||
"led_blink": led_test_run,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pc = ProgramChooser(programs, 7, 8, debug=True)
|
pc = ProgramChooser(programs, 7, 8, debug=True)
|
||||||
pc.run()
|
pc.run()
|
||||||
|
10
main_-lcd.py
10
main_-lcd.py
@ -1,11 +1,13 @@
|
|||||||
from simplelora import sender, receiver
|
from simplelora import sender, receiver
|
||||||
import lora_pingpong
|
import lora_pingpong
|
||||||
|
|
||||||
to_run = 0 # 0: ping-pong | 1: sender | 2: receiver
|
to_run = 0 # 0: ping-pong as responder | 1: ping-pong as initializer | 2: sender | 3: receiver
|
||||||
|
|
||||||
if to_run == 0:
|
if to_run == 0:
|
||||||
lora_pingpong.run()
|
lora_pingpong.run_wo_lcd_resp()
|
||||||
elif to_run == 1:
|
if to_run == 1:
|
||||||
sender.run()
|
lora_pingpong.run_wo_lcd_init()
|
||||||
elif to_run == 2:
|
elif to_run == 2:
|
||||||
|
sender.run()
|
||||||
|
elif to_run == 3:
|
||||||
receiver.run()
|
receiver.run()
|
||||||
|
Loading…
Reference in New Issue
Block a user