From a905f258e280f252f3f08cdae35bf9a9b1cb1552 Mon Sep 17 00:00:00 2001 From: jupfi Date: Wed, 7 Feb 2024 15:48:03 +0100 Subject: [PATCH] Added header file for python bindings. --- src/limedriver.cpp | 107 +---------------------------------------- src/limedriver.h | 115 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 106 deletions(-) create mode 100644 src/limedriver.h diff --git a/src/limedriver.cpp b/src/limedriver.cpp index b418eb2..dd75bc0 100644 --- a/src/limedriver.cpp +++ b/src/limedriver.cpp @@ -13,120 +13,15 @@ $(h5c++ -show) limedriver.cpp -std=c++11 $(pkg-config --cflags --libs LimeSuite) -o limedriver */ -#include "H5Cpp.h" -#include "lime/LimeSuite.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // errno, ENOENT, EEXIST -#include -#include // stat -#include -#include -#if defined(_WIN32) -#include // _mkdir -#endif +#include "limedriver.h" using namespace std; // structure that holds all the relevant parameters for a N-pulse experiment. // See initialization below for description const int maxNpulse = 50; -struct LimeConfig_t { - float srate; - float frq; - float frq_set; - float RX_LPF; - float TX_LPF; - int RX_gain; - int TX_gain; - int TX_IcorrDC; - int TX_QcorrDC; - int TX_IcorrGain; - int TX_QcorrGain; - int TX_IQcorrPhase; - int RX_IcorrGain; - int RX_QcorrGain; - int RX_IQcorrPhase; - int RX_gain_rback[4]; - int TX_gain_rback[3]; - - int Npulses; - double *p_dur; - int *p_dur_smp; - int *p_offs; - double *p_amp; - double *p_frq; - double *p_frq_smp; - double *p_pha; - int *p_phacyc_N; - int *p_phacyc_lev; - double *am_frq; - double *am_pha; - double *am_depth; - int *am_mode; - double *am_frq_smp; - double *fm_frq; - double *fm_pha; - double *fm_width; - int *fm_mode; - double *fm_frq_smp; - - int *p_c0_en; - int *p_c1_en; - int *p_c2_en; - int *p_c3_en; - - int c0_tim[4]; - int c1_tim[4]; - int c2_tim[4]; - int c3_tim[4]; - - int c0_synth[5]; - int c1_synth[5]; - int c2_synth[5]; - int c3_synth[5]; - - int averages; - int repetitions; - int pcyc_bef_avg; - double reptime_secs; - double rectime_secs; - int reptime_smps; - int rectime_smps; - int buffersize; - - string file_pattern; - string file_stamp; - string save_path; - int override_save; - int override_init; - - string stamp_start; - string stamp_end; -}; - -// structure that will be used to map LimeConfig to HDF attribute -struct Config2HDFattr_t { - string arg; - H5std_string Name; - H5::DataType dType; - void *Value; - hsize_t dim; -}; - -// Device structure, should be initialize to NULL -static lms_device_t *device = NULL; // LMS error function int error() { diff --git a/src/limedriver.h b/src/limedriver.h new file mode 100644 index 0000000..d2293ab --- /dev/null +++ b/src/limedriver.h @@ -0,0 +1,115 @@ +#ifndef LIMECONFIG_H +#define LIMECONFIG_H + +#include "H5Cpp.h" +#include "lime/LimeSuite.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // errno, ENOENT, EEXIST +#include +#include // stat +#include +#include +#if defined(_WIN32) +#include // _mkdir +#endif + + +struct LimeConfig_t { + + float srate; + float frq; + float frq_set; + float RX_LPF; + float TX_LPF; + int RX_gain; + int TX_gain; + int TX_IcorrDC; + int TX_QcorrDC; + int TX_IcorrGain; + int TX_QcorrGain; + int TX_IQcorrPhase; + int RX_IcorrGain; + int RX_QcorrGain; + int RX_IQcorrPhase; + int RX_gain_rback[4]; + int TX_gain_rback[3]; + + int Npulses; + double *p_dur; + int *p_dur_smp; + int *p_offs; + double *p_amp; + double *p_frq; + double *p_frq_smp; + double *p_pha; + int *p_phacyc_N; + int *p_phacyc_lev; + double *am_frq; + double *am_pha; + double *am_depth; + int *am_mode; + double *am_frq_smp; + double *fm_frq; + double *fm_pha; + double *fm_width; + int *fm_mode; + double *fm_frq_smp; + + int *p_c0_en; + int *p_c1_en; + int *p_c2_en; + int *p_c3_en; + + int c0_tim[4]; + int c1_tim[4]; + int c2_tim[4]; + int c3_tim[4]; + + int c0_synth[5]; + int c1_synth[5]; + int c2_synth[5]; + int c3_synth[5]; + + int averages; + int repetitions; + int pcyc_bef_avg; + double reptime_secs; + double rectime_secs; + int reptime_smps; + int rectime_smps; + int buffersize; + + std::string file_pattern; + std::string file_stamp; + std::string save_path; + int override_save; + int override_init; + + std::string stamp_start; + std::string stamp_end; +}; + +// structure that will be used to map LimeConfig to HDF attribute +struct Config2HDFattr_t { + std::string arg; + H5std_string Name; + H5::DataType dType; + void *Value; + hsize_t dim; +}; + +// Device structure, should be initialize to NULL +static lms_device_t *device = NULL; + +#endif // LIMECONFIG_H \ No newline at end of file