diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-07-08 15:49:23 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-11-26 16:51:25 +0100 |
commit | 558a210085b61b84e3be5a420d86d2ee6a500c8e (patch) | |
tree | cb16ff88132ef9e7c946a4e3f5523f9113cf4aed /src/DabMod.cpp | |
parent | 22fd7d757f11a6c976d7e711fd46cf2ce3247c44 (diff) | |
download | dabmod-558a210085b61b84e3be5a420d86d2ee6a500c8e.tar.gz dabmod-558a210085b61b84e3be5a420d86d2ee6a500c8e.tar.bz2 dabmod-558a210085b61b84e3be5a420d86d2ee6a500c8e.zip |
Add support for BladeRF devices
Many thanks to Steven Rossel for the work he did during his student
project.
Diffstat (limited to 'src/DabMod.cpp')
-rw-r--r-- | src/DabMod.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 979df87..f97c05d 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -57,6 +57,7 @@ #include "output/UHD.h" #include "output/Soapy.h" #include "output/Lime.h" +#include "output/BladeRF.h" #include "OutputZeroMQ.h" #include "InputReader.h" #include "PcDebug.h" @@ -158,6 +159,13 @@ static void printModSettings(const mod_settings_t& mod_settings) mod_settings.sdr_device_config.masterClockRate << "\n"; } #endif +#if defined(HAVE_BLADERF) + else if (mod_settings.useBladeRFOutput) { + ss << " BladeRF\n" + " Device: " << mod_settings.sdr_device_config.device << "\n" << + " refclk: " << mod_settings.sdr_device_config.refclk_src << "\n"; + } +#endif else if (mod_settings.useZeroMQOutput) { ss << " ZeroMQ\n" << " Listening on: " << mod_settings.outputName << "\n" << @@ -251,6 +259,16 @@ static shared_ptr<ModOutput> prepare_output( rcs.enrol((Output::SDR*)output.get()); } #endif +#if defined(HAVE_BLADERF) + else if (s.useBladeRFOutput) { + /* We normalise specifically for the BladeRF output : range [-2048; 2047] */ + s.normalise = 2047.0f / normalise_factor; + s.sdr_device_config.sampleRate = s.outputRate; + auto bladerfdevice = make_shared<Output::BladeRF>(s.sdr_device_config); + output = make_shared<Output::SDR>(s.sdr_device_config, bladerfdevice); + rcs.enrol((Output::SDR*)output.get()); + } +#endif #if defined(HAVE_ZEROMQ) else if (s.useZeroMQOutput) { /* We normalise the same way as for the UHD output */ @@ -301,7 +319,8 @@ int launch_modulator(int argc, char* argv[]) mod_settings.useUHDOutput or mod_settings.useZeroMQOutput or mod_settings.useSoapyOutput or - mod_settings.useLimeOutput)) { + mod_settings.useLimeOutput or + mod_settings.useBladeRFOutput)) { throw std::runtime_error("Configuration error: Output not specified"); } @@ -314,6 +333,9 @@ int launch_modulator(int argc, char* argv[]) mod_settings.fileOutputFormat == "s16")) { format_converter = make_shared<FormatConverter>(mod_settings.fileOutputFormat); } + else if (mod_settings.useBladeRFOutput) { + format_converter = make_shared<FormatConverter>(mod_settings.BladeRFOutputFormat); + } auto output = prepare_output(mod_settings); |