Skip to content

Commit

Permalink
use new callback signature (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
777arc authored Nov 5, 2024
1 parent 51cbbfd commit 4eee156
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions content/hackrf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ If your max is 127 (which means you saturated the ADC) then lower the two gain v
Installing the Python API
#########################

Lastly, we must install the HackRF One `Python bindings <https://github.com/GvozdevLeonid/python_hackrf>`_, maintained by `GvozdevLeonid <https://github.com/GvozdevLeonid>`_. This was tested to work in Ubuntu 22.04 on 10/19/2024.
Lastly, we must install the HackRF One `Python bindings <https://github.com/GvozdevLeonid/python_hackrf>`_, maintained by `GvozdevLeonid <https://github.com/GvozdevLeonid>`_. This was tested to work in Ubuntu 22.04 on 11/04/2024 using the latest main branch.

.. code-block:: bash
Expand Down Expand Up @@ -220,7 +220,7 @@ After running the code below, if in your time plot, the samples are reaching the
samples = np.zeros(num_samples, dtype=np.complex64)
last_idx = 0
def rx_callback(buffer, buffer_length, valid_length): # this callback function always needs to have these three args
def rx_callback(device, buffer, buffer_length, valid_length): # this callback function always needs to have these four args
global samples, last_idx
accepted = valid_length // 2
Expand Down
4 changes: 3 additions & 1 deletion figure-generating-scripts/hackrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
sdr.pyhackrf_set_lna_gain(30) # LNA gain - 0 to 40 dB in 8 dB steps
sdr.pyhackrf_set_vga_gain(50) # VGA gain - 0 to 62 dB in 2 dB steps
sdr.pyhackrf_close()

exit()


# These settings should match the hackrf_transfer example used in the textbook, and the resulting waterfall should look about the same
Expand Down Expand Up @@ -80,7 +82,7 @@
samples = np.zeros(num_samples, dtype=np.complex64)
last_idx = 0

def rx_callback(buffer, buffer_length, valid_length): # this callback function always needs to have these three args
def rx_callback(device, buffer, buffer_length, valid_length): # this callback function always needs to have these four args
global samples, last_idx

accepted = valid_length // 2
Expand Down

0 comments on commit 4eee156

Please sign in to comment.