Skip to content

Commit

Permalink
Merge pull request #11 from nqrduck/bindi_pythi
Browse files Browse the repository at this point in the history
Added header file for python bindings.
  • Loading branch information
jupfi authored Feb 7, 2024
2 parents 980ae5a + a905f25 commit 09e5057
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 108 deletions.
111 changes: 3 additions & 108 deletions src/limedriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,120 +13,15 @@ HDF5 library
-o limedriver
*/
#include "H5Cpp.h"
#include "lime/LimeSuite.h"
#include <chrono>
#include <cstddef>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <math.h>
#include <sstream>
#include <stdio.h>
#include <string.h>

#include <errno.h> // errno, ENOENT, EEXIST
#include <string>
#include <sys/stat.h> // stat
#include <sys/types.h>
#include <vector>
#if defined(_WIN32)
#include <direct.h> // _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() {
Expand Down
115 changes: 115 additions & 0 deletions src/limedriver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#ifndef LIMECONFIG_H
#define LIMECONFIG_H

#include "H5Cpp.h"
#include "lime/LimeSuite.h"
#include <chrono>
#include <cstddef>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <math.h>
#include <sstream>
#include <stdio.h>
#include <string.h>

#include <errno.h> // errno, ENOENT, EEXIST
#include <string>
#include <sys/stat.h> // stat
#include <sys/types.h>
#include <vector>
#if defined(_WIN32)
#include <direct.h> // _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

0 comments on commit 09e5057

Please sign in to comment.