mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 06:29:21 +01:00
refactor LTC2620 writedac
This commit is contained in:
Binary file not shown.
@@ -31,7 +31,8 @@ int LTC2620_D_DacToVoltage(int dacval, int *voltage);
|
|||||||
int LTC2620_D_WriteDACValue(int dacnum, int dacvalue, char *dacname);
|
int LTC2620_D_WriteDACValue(int dacnum, int dacvalue, char *dacname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value for dac only
|
* Only for DACs (not power regulators) to validate indices and convert values
|
||||||
|
* to dac units if needed
|
||||||
* @param dacval if val is in mV, returns dac units set
|
* @param dacval if val is in mV, returns dac units set
|
||||||
*/
|
*/
|
||||||
int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
|
int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
// to include power down file name suffix
|
// to include power down file name suffix directly
|
||||||
#ifdef XILINX_CHIPTESTBOARDD
|
#ifdef XILINX_CHIPTESTBOARDD
|
||||||
#include "slsDetectorServer_defs.h"
|
#include "slsDetectorServer_defs.h"
|
||||||
#else
|
#else
|
||||||
@@ -70,13 +70,24 @@ int LTC2620_D_WriteDACValue(int dacnum, int dacvalue, char *dacname) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate value
|
// validate max value
|
||||||
if ((dacvalue < 0 && dacvalue != LTC2620_D_PWR_DOWN_VAL) ||
|
if (dacvalue > LTC2620_D_MAX_DAC_VAL) {
|
||||||
(dacvalue > LTC2620_D_MAX_DAC_VAL)) {
|
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Dac %d %s: Invalid dac value %d\n", dacnum, dacname, dacvalue));
|
("Dac %d %s: Invalid dac value %d\n", dacnum, dacname, dacvalue));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
// validate negative values
|
||||||
|
if (dacvalue < 0) {
|
||||||
|
// dacs only: allow power down value (-100)
|
||||||
|
if ((dacnum < LTC2620_D_NumDacsOnly &&
|
||||||
|
dacvalue != LTC2620_D_PWR_DOWN_VAL) ||
|
||||||
|
// power regulators: allow no negative values
|
||||||
|
(dacnum >= LTC2620_D_NumDacsOnly)) {
|
||||||
|
LOG(logERROR, ("Dac %d %s: Invalid dac value %d\n", dacnum, dacname,
|
||||||
|
dacvalue));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// print info
|
// print info
|
||||||
if (dacvalue == LTC2620_D_PWR_DOWN_VAL) {
|
if (dacvalue == LTC2620_D_PWR_DOWN_VAL) {
|
||||||
|
|||||||
Binary file not shown.
@@ -4,7 +4,7 @@
|
|||||||
#define APILIB "0.0.0 0x250909"
|
#define APILIB "0.0.0 0x250909"
|
||||||
#define APIRECEIVER "0.0.0 0x250822"
|
#define APIRECEIVER "0.0.0 0x250822"
|
||||||
#define APICTB "0.0.0 0x250922"
|
#define APICTB "0.0.0 0x250922"
|
||||||
#define APIGOTTHARD2 "0.0.0 0x260113"
|
#define APIGOTTHARD2 "0.0.0 0x260114"
|
||||||
#define APIMOENCH "0.0.0 0x250909"
|
#define APIMOENCH "0.0.0 0x250909"
|
||||||
#define APIEIGER "0.0.0 0x250909"
|
#define APIEIGER "0.0.0 0x250909"
|
||||||
#define APIXILINXCTB "0.0.0 0x260114"
|
#define APIXILINXCTB "0.0.0 0x260114"
|
||||||
|
|||||||
Reference in New Issue
Block a user