example for adc index in users

This commit is contained in:
Dhanya Maliakal 2017-09-21 11:51:38 +02:00
parent 7e37a1da4b
commit f2be03be05
3 changed files with 52 additions and 32 deletions

View File

@ -829,6 +829,42 @@ virtual void readFrameFromReceiver()=0;
}};
/**
@short returns adc index from string
\param s can be temp_adc, temp_fpga, temp_fpgaext, temp_10ge, temp_dcdc, temp_sodl, temp_sodr, temp_fpgafl, temp_fpgafr,
i_a, i_b, i_c, i_d, vm_a, vm_b,vm_c, vm_d, vm_io, i_io
\returns TEMPERATURE_ADC, TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL,
TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, I_POWER_A, I_POWER_B, I_POWER_C, I_POWER_D, V_POWER_A, V_POWER_B,
V_POWER_C, V_POWER_D, V_POWER_IO, I_POWER_IO
-1 when wrong mode
*/
static int getADCIndex(string s){
{
int idac;
if (sscanf(s.c_str(),"adc:%d",&idac)==1)
return (dacIndex)(idac+1000);
}
if (s=="temp_adc") return TEMPERATURE_ADC;
if (s=="temp_fpga") return TEMPERATURE_FPGA;
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT;
if (s=="temp_10ge") return TEMPERATURE_10GE;
if (s=="temp_dcdc") return TEMPERATURE_DCDC;
if (s=="temp_sodl") return TEMPERATURE_SODL;
if (s=="temp_sodr") return TEMPERATURE_SODR;
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2;
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3;
if (s=="i_a") return I_POWER_A;
if (s=="i_b") return I_POWER_B;
if (s=="i_c") return I_POWER_C;
if (s=="i_d") return I_POWER_D;
if (s=="vm_a") return V_POWER_A;
if (s=="vm_b") return V_POWER_B;
if (s=="vm_c") return V_POWER_C;
if (s=="vm_d") return V_POWER_D;
if (s=="vm_io") return V_POWER_IO;
if (s=="i_io") return I_POWER_IO;
return -1;
};
};

View File

@ -174,8 +174,6 @@ double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds){
return ((1E-9) * (double)myDetector->setDelayAfterTrigger(tms));
}
int64_t slsDetectorUsers::setNumberOfGates(int64_t t){
return myDetector->setNumberOfGates(t);
}
@ -208,15 +206,10 @@ string slsDetectorUsers::getDetectorType(){
return myDetector->sgetDetectorsType();
}
void slsDetectorUsers::initDataset(int refresh){
myDetector->initDataset(refresh);
}
void slsDetectorUsers::addFrame(double *data, double pos, double i0, double t, string fname, double var){
myDetector->addFrame(data,pos,i0,t,fname,var);
}
@ -226,8 +219,6 @@ void slsDetectorUsers::finalizeDataset(double *a, double *v, double *e, int &np)
myDetector->finalizeDataset(a, v, e, np);
}
int slsDetectorUsers::setReceiverMode(int n){
return myDetector->setReadReceiverFrequency(1,n);
}
@ -236,7 +227,6 @@ int slsDetectorUsers::enableDataStreamingFromReceiver(int i){
return myDetector->enableDataStreamingFromReceiver(i);
}
int64_t slsDetectorUsers::getModuleFirmwareVersion(){
return myDetector->getModuleFirmwareVersion();
}
@ -301,13 +291,14 @@ void slsDetectorUsers::registerGetI0Callback( double (*func)(int,void*),void *ar
}
string slsDetectorUsers::putCommand(int narg, char *args[], int pos){
if(narg < 2)
return string("Error: Insufficient Parameters");
return myCmd->putCommand(narg, args, pos);
}
string slsDetectorUsers::getCommand(int narg, char *args[], int pos){
if(narg < 1)
return string("Error: Insufficient Parameters");
@ -315,71 +306,63 @@ string slsDetectorUsers::getCommand(int narg, char *args[], int pos){
}
int slsDetectorUsers::setClockDivider(int value) {
return myDetector->setClockDivider(value);
}
int slsDetectorUsers::getContinuousReadoutFlag(){
return myDetector->getContinuousReadoutFlag();
}
void slsDetectorUsers::setContinuousReadoutFlag(){
myDetector->setContinuousReadoutFlag();
}
int slsDetectorUsers::getStoreInRamReadoutFlag(){
return myDetector->getStoreInRamReadoutFlag();
}
void slsDetectorUsers::setStoreInRamReadoutFlag(){
myDetector->setStoreInRamReadoutFlag();
}
int slsDetectorUsers::getParallelReadoutFlag(){
return myDetector->getParallelReadoutFlag();
}
void slsDetectorUsers::setParallelReadoutFlag(){
myDetector->setParallelReadoutFlag();
}
int slsDetectorUsers::getNonParallelReadoutFlag(){
return myDetector->getNonParallelReadoutFlag();
}
void slsDetectorUsers::setNonParallelReadoutFlag(){
myDetector->setNonParallelReadoutFlag();
}
int slsDetectorUsers::getSafeReadoutFlag(){
return myDetector->getSafeReadoutFlag();
}
void slsDetectorUsers::setSafeReadoutFlag(){
myDetector->setSafeReadoutFlag();
}
int slsDetectorUsers::setAllTrimbits(int val) {
return myDetector->setAllTrimbits(val);
int slsDetectorUsers::setAllTrimbits(int val, int id) {
return myDetector->setAllTrimbits(val, id);
}
int slsDetectorUsers::setDAC(int dacindex, int val, int id) {
return myDetector->setDACValue(val, dacindex, id);
}
int slsDetectorUsers::getADC(int adcindex, int id) {
int slsDetectorUsers::getADC(string adc, int id) {
int adcindex = myDetector->getADCIndex(adc);
if(adcindex == -1) return -9999;
return myDetector->getADCValue(adcindex, id);
}

View File

@ -616,9 +616,10 @@ class slsDetectorUsers
/**
@short sets all trimbits to value (only available for eiger)
\param val value to be set (-1 gets)
\param id module index (-1 for all)
\returns value set
*/
int setAllTrimbits(int val);
int setAllTrimbits(int val, int id = -1);
/**
@short set dac value
@ -631,12 +632,12 @@ class slsDetectorUsers
/**
@short get adc value
\param adcindex adc index \sa dacIndex
\param adc adc as string. can be temp_adc, temp_fpga, temp_fpgaext, temp_10ge, temp_dcdc, temp_sodl, temp_sodr, temp_fpgafl, temp_fpgafr,
i_a, i_b, i_c, i_d, vm_a, vm_b,vm_c, vm_d, vm_io, i_io
\param id module index (-1 for all)
\returns adc value
\returns adc value, -1 (if id=-1,adcvalue is different for all modules), -9999 if adc string does not match
*/
int getADC(int adcindex, int id = -1);
int getADC(string adc, int id = -1);
/**
@short start receiver listening mode
@ -730,7 +731,7 @@ class slsDetectorUsers
/**
@short returns external communication mode string from index
\param f index for communication mode
\param s index for communication mode
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
*/