From 36d5d452f2ed3d4fe556d60a5f1a2f58d29bdca6 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Fri, 23 Mar 2018 10:33:49 +0300 Subject: Leftovers --- asynciotest.py | 8 ++++++++ fm.py | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 asynciotest.py create mode 100644 fm.py 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()) -- cgit v1.3.1