405 Commits

Author SHA1 Message Date
Enes Albay
eead55af45 Replace fftSize with more meaningful name num_fft_bins 2025-05-23 19:43:22 +03:00
Michael Ossmann
75431531f2 Merge pull request #1510 from martinling/sgpio-deadline-check
SGPIO deadline check
2024-12-05 11:30:06 -05:00
Martin Ling
03551cb1fd Detect whether the M0 missed its deadline.
Counter-intuitively, this actually saves us two cycles because we unroll
the first iteration of the loop that spins on the interrupt flag, saving
a branch in the case that the flag is clear the first time.
2024-11-26 19:34:29 +00:00
Simon Berger
c0181b46d1 hackrf-tools: handle ctrl+break signal on windows 2024-10-18 14:32:56 +00:00
Demetri Maltsiniotis
3d83a2f911 * Fix quoting issue causing bad library include path, add install step hackrf-tools.
* Add artifact publish step for Windows libraries and host tools.
* Replace runner.workspace with github.workspace.
* Update checkout task to v4 to supress warning.
* Update CMAKE for libhackrf and hackrf-tools to also install DLLs on WIN32 platforms.
* Update uploadartifact task to v4 since v3 uses an end-of-life node version 16.
* Add a new windows variable for the vcpkg cmake toolchain makefile.
2024-02-29 18:39:03 -06:00
Michael Ossmann
d0bb89643a Merge pull request #1403 from smburdick/build-updates
Update CMAKE minimum version to 2.8.12
2024-02-22 13:56:15 -05:00
Gabriele Gristina
f6598e7b14 hackrf_sweep: normalized timestamp (#1350)
* Added a new option (-n) to enable timestamp normalization within a same sweep
2024-02-01 17:24:55 +00:00
Sam Burdick
3b55d5a65e Min CMAKE Version -> 2.8.12 2024-02-01 09:18:31 -08:00
Sam Burdick
f445c265b1 Update CMAKE minimum version 2024-01-15 18:31:42 -08:00
Gisle Vanem
e1f0a2cea1 Add '#include <io.h>'
Compiling with clang-cl, gives this error:
```c
hackrf-tools/src/hackrf_sweep.c(685,3): error: call to undeclared function '_setmode'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  685 |                 _setmode(_fileno(stdout), _O_BINARY);
      |                 ^
```

fixed by simply adding `#include <io.h>`.
2023-12-01 11:34:55 +01:00
Jonathan Suite
799d9ad158 Run fftw_execute() once on an empty buffer (Fix #1366), add option to save wisdom and specify plan (#863) (#1368)
* Call fftw_execute once prior to starting IQ streaming
* Add options to use/save to an FFTW wisdom file and specify plan
* Fix bug where using -P would also enable one-shot mode

Fixes #1366
Fixes #1260
Addresses #863
2023-11-02 11:25:13 -04:00
Jonathan Suite
dab548bf29 Firmware updates to allow fine-grained control of biast from command line (#1314)
* Initial commit of hackrf_biast

* Cleaned up hackrf_biast

* Cleaned up usage info

* Include getopt.h for non-GNU systems

* Add support for overriding HackRF's default antenna power behavior in firmware.  Add support for specifying antenna power behavior in libhackrf.

* Moved bias tee config routines into user_config.c, cleaned up operation of hackrf_biast

* hackrf_biast now calls usage() and exits when invoked with no arguments

* Fixed minor documentation error in usage()

* minor syntax cleanup

* Add some documentation to the host API call

* Add proper declaration magic in hackrf.h to hackrf_set_user_bias_t_opts() to appease Visual Studio

* Documentation changes suggested by @martinling

* Moved bias t setting above switch statement, removed line that explicit turned bias t off when entering OFF mode

* Change hackrf_set_user_bias_t_opts() to use a friendly struct() instead of a bitmask.  User friendliness fixes to hackrf_biast options.  More clang-format appeasement.

* Removed support for integer mode args from hackrf_biast

* clang-format error fixes

* Tweaked position of comment for clang-format v14

* Reformat files with clang-format v14 instead of 16

* Remove internal numeric modes for bias T settings

Co-authored-by: Martin Ling <martin-github@earth.li>

* Fix documentation error in hackrf_biast.c

---------

Co-authored-by: Martin Ling <martin-github@earth.li>
2023-09-13 11:15:30 -04:00
grvvy
fe86f005f6 change the device long option to required in hackrf_debug 2023-02-08 12:18:27 -07:00
Mike Walters
c2b3052c78 hackrf_spiflash: implement compatibility checking using new firmware info struct 2023-01-05 15:18:52 +00:00
Mike Walters
f426ac2174 hackrf_spiflash: use defines for compatibility_check return value 2023-01-05 15:13:06 +00:00
Michael Ossmann
3d39660be1 Merge pull request #1237 from greatscottgadgets/tuning
restrict IF to 2170-2740 MHz
2022-12-23 11:56:38 -05:00
Michael Ossmann
3d687a20fd increase forceable IF range to 2000-3000 MHz 2022-12-23 06:06:22 -05:00
Michael Ossmann
173612ac77 add --led option to hackrf_debug
and corresponding changes to libhackrf and firmware
2022-12-18 07:22:17 -05:00
Michael Ossmann
86c1d8ce6e restrict IF to 2170-2740 MHz 2022-12-09 09:12:37 -05:00
Michael Ossmann
0e8b941897 hackrf_transfer: fix function name in debug output 2022-09-24 14:23:29 -04:00
Michael Ossmann
06b9d7bee0 Clean up source code copyright notices. 2022-09-23 14:46:52 -04:00
Michael Ossmann
3d378466fb hackrf_operacake: clean up text output 2022-09-23 14:45:34 -04:00
Michael Ossmann
45504ff397 Don't repeat file that can't advance its position.
This avoids a confusing condition when hackrf_transfer is reading from
stdin with -R in which it does not repeat previous data but repeatedly
restarts reading new data after the user types Ctrl-D to indicate EOF.

The -R option should repeat previous data or should do nothing if the
input file cannot be rewound.
2022-09-23 06:48:01 -04:00
Michael Ossmann
8fbaf1336c Improve handling of file read results. 2022-09-23 06:47:54 -04:00
Martin Ling
db33e1bdaf Revert rename of byte_count now that we only have one count. 2022-09-23 05:19:29 -04:00
Martin Ling
0becbc6b4a Indicate success or failure to flush callback. 2022-09-23 05:19:29 -04:00
Martin Ling
c089bb0b88 Fix handling of EOF and error conditions after fread. 2022-09-23 05:19:29 -04:00
Martin Ling
eae7049284 Fix empty report when TX ends soon after the last report. 2022-09-23 05:19:29 -04:00
Martin Ling
14093fe73b Provide a callback for completion of a TX transfer. 2022-09-23 05:19:29 -04:00
Martin Ling
2448796e35 Handle failures in fread from TX callback. 2022-09-23 05:19:29 -04:00
Martin Ling
cb8fc333aa Fix inaccurate error message when TX completes near a 1 second boundary. 2022-09-23 05:19:29 -04:00
Martin Ling
98faa5429f Fix inaccurate statistics in hackrf_transfer. 2022-09-23 05:19:29 -04:00
Martin Ling
b872647e97 Provide a callback for TX flush, rather than a wait function. 2022-09-23 05:19:29 -04:00
Michael Ossmann
1167f49b7f hackrf_transfer: refer to triggers as "triggers" 2022-09-21 10:37:40 -04:00
Michael Ossmann
f4202d1163 hackrf_transfer: Don't skip preload stats in RX
Fixes a bug introduced in 8a9af7a: Statistics skipped for initial
buffers not only when preloaded in TX mode but also in RX mode with no
preloading.

The total bytes transferred may appear inflated in RX mode when
receiving a small number of samples with -n, but the stats represent
data transferred over USB, some of which may have been discarded by the
host.
2022-09-18 13:27:51 -04:00
Michael Ossmann
82ecfce414 hackrf_transfer: simplify hardware sync mode logic
The -H option now requires no argument.
2022-09-18 05:49:03 -04:00
Michael Ossmann
9181cbe049 hackrf_transfer: send signal to own PID
Instead of sending a signal to the process group, get our own process ID
and send the signal to it. This fixes a bug that prevented termination
when called from a script.
2022-09-18 05:07:09 -04:00
Martin Ling
55fdddd81e Merge remote-tracking branch 'origin/master' into tx-transfer-sizing 2022-09-15 15:32:20 +01:00
Michael Ossmann
2b1aa545f8 Merge pull request #1157 from martinling/standardise-dbfs
Standardise dBFS level
2022-09-15 04:59:45 -04:00
Martin Ling
09c6030ec9 Start TX/RX in hackrf_transfer after all other requests.
This avoids glitches and lost samples at the start of a transmission.
2022-09-15 09:51:11 +01:00
Martin Ling
f1e34b7cea Correct the calculation of dBfs signal level.
dBFS is defined in AES Standard AES17-1998, IEC 61606, and ITU-T Recs.
P.381 and P.382, such that the RMS value of a full-scale sine wave is
designated 0 dBFS.

A full scale sine wave on HackRF has the range -127 to 127.

We calculate the full scale ratio relative to a signal in which both I
and Q are held at 127. This represents a signal with sqrt(2) times
the amplitude, and thus twice the power, of a full scale sine wave.

Therefore to obtain dBfs by the above definition, we add 3dB.
2022-09-14 18:21:07 +01:00
Martin Ling
66fa76c550 In CW mode, set only the I component to the specified amplitude. 2022-09-14 18:14:59 +01:00
Martin Ling
d5d2b09fe8 Restrict CW mode amplitude to 127. 2022-09-14 18:14:23 +01:00
Martin Ling
f2d00adab8 Add commentary to TX callback. 2022-09-14 15:55:07 +01:00
Martin Ling
e38534b99d Don't return -1 from the TX callback that provides the last data. 2022-09-14 15:55:07 +01:00
Martin Ling
5ad08cfd96 Set valid_length correctly in hackrf_transfer TX callback. 2022-09-14 15:55:04 +01:00
Martin Ling
9905e960a4 Rearrange to avoid duplicating sample limit return path. 2022-09-14 15:16:18 +01:00
Martin Ling
16f93d9b27 Move duplicated code to one place. 2022-09-14 15:15:34 +01:00
Martin Ling
29787cd291 Clarify variables used in TX callback.
The power measurement depends on the number of bytes that were valid
from the previous use of the transfer buffer.

The number of bytes to be read to fill the next transfer, is the full
size of the buffer.
2022-09-14 15:10:13 +01:00
Michael Ossmann
9329c5e44e Detect hardware platform at run-time.
Firmware now detects the hardware it is running on at startup and
refuses to run if it is compiled for the wrong platform. The board ID
returned by firmware to the host is now derived from run-time detection
rather than a compile-time value. A separate method to retrieve
compile-time supported platform is added.

On HackRF One, pin straps are checked to determine hardware revision.
This is informational to aid troubleshooting and does not affect any
function.
2022-09-14 07:08:47 -04:00