bladeRF/host/libraries/libbladeRF_bindings/python
realmadsci ac7456ebed Python bindings: Fix get_gain_modes
Despite documentation to the contrary (https://github.com/Nuand/bladeRF/blob/master/host/libraries/libbladeRF/include/libbladeRF.h#L902), you should *not* call bladerf_get_gain_modes with NULL to get the number of modes to expect.
Just call it with a `struct bladerf_gain_modes **` and let it point you at the internal structure which lists the applicable modes, and then use its return value as the length.
2022-04-03 19:35:01 -07:00
..
bladerf Python bindings: Fix get_gain_modes 2022-04-03 19:35:01 -07:00
scripts host: python: improve import_header.py script 2018-09-27 14:45:16 -04:00
.gitignore host: python: Python packaging (#18) 2018-03-26 12:26:46 -04:00
CHANGELOG host: python: bump to version 1.1.2 2020-12-23 20:29:55 -08:00
README.md host: python: Python packaging (#18) 2018-03-26 12:26:46 -04:00
setup.py host: python v1.2.0 2019-07-31 18:28:22 -05:00

Python 3 Bindings

This package provides libbladeRF bindings for Python 3, using the CFFI interface.

Installation

  • To install system-wide: sudo python3 setup.py install
  • To install for your user: python3 setup.py install

Usage: Python module

A Python module is provided. To use, import bladerf and then instantiate the bladerf.BladeRF class to access your board.

An example of opening the first available device and changing the frequency of the first RX channel:

>>> import bladerf
>>> d = bladerf.BladeRF()
>>> d
<BladeRF(<DevInfo(libusb:device=6:53 instance=0 serial=...)>)>
>>> ch = d.Channel(bladerf.CHANNEL_RX(0))
>>> ch
<Channel(<BladeRF(<DevInfo(libusb:device=6:53 instance=0 serial=...)>)>,CHANNEL_RX(0))>
>>> ch.frequency
2484000000
>>> ch.frequency = 1.0e9
>>> ch.frequency
1000000000

Usage: bladerf-tool

A command-line interface named bladerf-tool is provided. For usage instructions, type bladerf-tool --help.

Example usage:

$ bladerf-tool info
*** Devices found: 1

*** Device 0
Board Name        bladerf1
Device Speed      Super
FPGA Size         40
FPGA Configured   True
FPGA Version      v0.6.0 ("0.6.0")
Firmware Version  v2.1.0 ("2.1.0")
RX Channel Count  1
  Channel RX1:
    Gain          39
    Gain Mode     Manual
    Symbol RSSI   None
    Frequency     1000000000
    Bandwidth     28000000
    Sample Rate   1000000
TX Channel Count  1
  Channel TX1:
    Gain          -14
    Gain Mode     Manual
    Frequency     2446999999
    Bandwidth     28000000
    Sample Rate   1000000

License

This code is distributed under an MIT License.