hz.tools/sdr: go bindings for software defined radiosPaul Tagliamonte 2023-02-22 project
This… is the big one. This library represents the majority of the shared types and bindings, and is likely the most useful place to look at when learning about the IO boundary between a program and an SDR.
The git repo can be found at github.com/hztools/go-sdr, and is importable as hz.tools/sdr.
This library is designed to look (and in some cases, mirror) the Go
so that this library feels as idiomatic as it can, so that Go builtins interact
with IQ in a way that’s possible to reason about, and to avoid reinventing the
wheel by designing new API surface. While some of the API looks (and is even
called) the same thing as a similar function in
io, the implementation is
usually a lot more naive, and may have unexpected sharp edges such as
concurrency issues or performance problems.
The following IQ types are implemented using the
sdr.Samples interface. The
hz.tools/sdr package contains helpers for conversion between types, and some
basic manipulation of IQ streams.
|IQ Format||hz.tools Name||Underlying Go Type|
|Interleaved uint8 (rtl-sdr)|
|Interleaved int8 (hackrf, uhd)|
|Interleaved int16 (pluto, uhd)|
|Interleaved float32 (airspy, uhd)|
The following SDRs have implemented drivers in-tree.
The following major packages and subpackages exist at the time of writing:
|Import||What is it?|
|hz.tools/sdr||Core IQ types, supporting types and implementations that interact with the byte boundary|
|hz.tools/sdr/rtl/kerberos||Helpers to enable coherent RX using the Kerberos SDR.|
|hz.tools/sdr/rtl/e4k||Helpers to interact with the E4000 RTL-SDR dongle.|
|hz.tools/sdr/fft||Interfaces for performing an FFT, which are implemented by other packages.|
|hz.tools/sdr/mock||Mock SDR for testing purposes.|
|hz.tools/sdr/internal/simd||SIMD helpers for IQ operations, written in Go ASM. This isn’t the best to learn from, and it contains pure go implemtnations alongside.|
|hz.tools/sdr/stream||Common Reader/Writer helpers that operate on IQ streams.|