-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christoph Schmied
committed
Nov 17, 2022
0 parents
commit 35f42a2
Showing
7 changed files
with
481 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Christoph Schmied | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# BladeRF SDR asynchronous wrapper | ||
|
||
A python wrapper for the bladerf python bindings from Nuand. It provides synchronous as well as asynchronous functionality to send and receive data to and from the BladeRF SDR. | ||
|
||
## Installation | ||
|
||
- To install system-wide: `sudo python3 setup.py install` | ||
- To install for your user: `python3 setup.py install` | ||
|
||
## Usage | ||
|
||
Below is an example of how to use the asynchronous wrapper with a python context manager and an asynchronous generator | ||
to continuously receive samples from the SDR for 5 seconds. | ||
|
||
```python | ||
import asyncio | ||
import bladerf | ||
from bladerfsdraio import AioBladeRF | ||
|
||
|
||
async def main(): | ||
with AioBladeRF() as sdr: | ||
ch_rx = sdr.Channel(bladerf.CHANNEL_RX(0)) | ||
ch_rx.sample_rate = 1e6 | ||
ch_rx.frequency = 1e9 | ||
|
||
async def stream_samples(sdr: AioBladeRF): | ||
async for samples in sdr.stream_samples_async(ch_rx, chunk_size=1024): | ||
# .. handle samples | ||
print(samples.max()) | ||
|
||
async def cancel_after(secs: float, sdr: AioBladeRF): | ||
await asyncio.sleep(secs) | ||
sdr.cancel_receive() | ||
|
||
await asyncio.gather( | ||
stream_samples(sdr), | ||
cancel_after(5, sdr) | ||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
asyncio.run(main()) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .bladerfsdraio import AioBladeRF, print_channel_info |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.