summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2018-03-23 10:33:49 +0300
committerYuval Adam <_@yuv.al>2018-03-23 10:33:49 +0300
commit36d5d452f2ed3d4fe556d60a5f1a2f58d29bdca6 (patch)
tree6083a825fad2571c0c8358e7e905c6bf929e45f4
parent9a5622e58b3176737dafb8a839c501472157759a (diff)
Leftovers
-rw-r--r--asynciotest.py8
-rw-r--r--fm.py24
2 files changed, 32 insertions, 0 deletions
diff --git a/asynciotest.py b/asynciotest.py
new file mode 100644
index 0000000..f588a22
--- /dev/null
+++ b/asynciotest.py
@@ -0,0 +1,8 @@
+import asyncio
+
+async def echo():
+ pass
+
+if __name__ == '__main__':
+ loop = asyncio.get_event_loop()
+ loop.run_forever(echo())
diff --git a/fm.py b/fm.py
new file mode 100644
index 0000000..2a1d8be
--- /dev/null
+++ b/fm.py
@@ -0,0 +1,24 @@
+import asyncio
+from rtlsdr import RtlSdr
+
+RATE_IN = RATE_OUT = 170000
+RATE_OUT2 = 32000
+CUSTOM_ATAN = 1
+DEEMPH = 1
+SQUELCH = 0
+
+async def streaming():
+ sdr = RtlSdr()
+
+ async for samples in sdr.stream():
+ # do something with samples
+ # ...
+
+ # to stop streaming:
+ await sdr.stop()
+
+ # done
+ sdr.close()
+
+loop = asyncio.get_event_loop()
+loop.run_until_complete(streaming())