mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
changed setBit and getBit to uint32_t
This commit is contained in:
parent
8b02aa9e91
commit
0d2dd93498
@ -4904,15 +4904,15 @@ uint32_t multiSlsDetector::readRegister(uint32_t addr){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::setBit(int addr, int n) {
|
uint32_t multiSlsDetector::setBit(uint32_t addr, int n) {
|
||||||
int ret1, ret=-100;
|
uint32_t ret, ret1;
|
||||||
|
|
||||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
|
for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
ret1=detectors[i]->setBit(addr,n);
|
ret1=detectors[i]->setBit(addr,n);
|
||||||
if(detectors[i]->getErrorMask())
|
if(detectors[i]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<i));
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
if (ret==-100)
|
if (i==0)
|
||||||
ret=ret1;
|
ret=ret1;
|
||||||
else if (ret!=ret1) {
|
else if (ret!=ret1) {
|
||||||
// not setting it to -1 as it is a possible value
|
// not setting it to -1 as it is a possible value
|
||||||
@ -4926,15 +4926,15 @@ int multiSlsDetector::setBit(int addr, int n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::clearBit(int addr, int n) {
|
uint32_t multiSlsDetector::clearBit(uint32_t addr, int n) {
|
||||||
int ret1, ret=-100;
|
uint32_t ret, ret1;
|
||||||
|
|
||||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
|
for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
ret1=detectors[i]->clearBit(addr,n);
|
ret1=detectors[i]->clearBit(addr,n);
|
||||||
if(detectors[i]->getErrorMask())
|
if(detectors[i]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<i));
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
if (ret==-100)
|
if (i==0)
|
||||||
ret=ret1;
|
ret=ret1;
|
||||||
else if (ret!=ret1) {
|
else if (ret!=ret1) {
|
||||||
// not setting it to -1 as it is a possible value
|
// not setting it to -1 as it is a possible value
|
||||||
|
@ -1082,7 +1082,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
|
|
||||||
DO NOT USE!!! ONLY EXPERT USER!!!
|
DO NOT USE!!! ONLY EXPERT USER!!!
|
||||||
*/
|
*/
|
||||||
int setBit(int addr, int n);
|
uint32_t setBit(uint32_t addr, int n);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1093,7 +1093,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
|
|
||||||
DO NOT USE!!! ONLY EXPERT USER!!!
|
DO NOT USE!!! ONLY EXPERT USER!!!
|
||||||
*/
|
*/
|
||||||
int clearBit(int addr, int n);
|
uint32_t clearBit(uint32_t addr, int n);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2440,25 +2440,24 @@ uint32_t slsDetector::readRegister(uint32_t addr){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::setBit(int addr, int n) {
|
uint32_t slsDetector::setBit(uint32_t addr, int n) {
|
||||||
if (n<0 || n>31) {
|
if (n<0 || n>31) {
|
||||||
std::cout << "Bit number out of Range" << std:: endl;
|
std::cout << "Bit number out of Range" << std:: endl;
|
||||||
setErrorMask((getErrorMask())|(REGISER_WRITE_READ));
|
setErrorMask((getErrorMask())|(REGISER_WRITE_READ));
|
||||||
}
|
}
|
||||||
|
|
||||||
// normal bit range
|
// normal bit range
|
||||||
|
//TODO! (Erik) Check for errors! cannot use value since reg is 32bits
|
||||||
else {
|
else {
|
||||||
int val = readRegister(addr);
|
uint32_t val = readRegister(addr);
|
||||||
if (val != -1) {
|
|
||||||
writeRegister(addr,val | 1<<n);
|
writeRegister(addr,val | 1<<n);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return readRegister(addr);
|
return readRegister(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::clearBit(int addr, int n) {
|
uint32_t slsDetector::clearBit(uint32_t addr, int n) {
|
||||||
if (n<0 || n>31) {
|
if (n<0 || n>31) {
|
||||||
std::cout << "Bit number out of Range" << std:: endl;
|
std::cout << "Bit number out of Range" << std:: endl;
|
||||||
setErrorMask((getErrorMask())|(REGISER_WRITE_READ));
|
setErrorMask((getErrorMask())|(REGISER_WRITE_READ));
|
||||||
@ -2466,11 +2465,9 @@ int slsDetector::clearBit(int addr, int n) {
|
|||||||
|
|
||||||
// normal bit range
|
// normal bit range
|
||||||
else {
|
else {
|
||||||
int val = readRegister(addr);
|
uint32_t val = readRegister(addr);
|
||||||
if (val != -1) {
|
|
||||||
writeRegister(addr,val & ~(1<<n));
|
writeRegister(addr,val & ~(1<<n));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return readRegister(addr);
|
return readRegister(addr);
|
||||||
}
|
}
|
||||||
|
@ -892,7 +892,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
|
|
||||||
DO NOT USE!!! ONLY EXPERT USER!!!
|
DO NOT USE!!! ONLY EXPERT USER!!!
|
||||||
*/
|
*/
|
||||||
int setBit(int addr, int n);
|
uint32_t setBit(uint32_t addr, int n);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -903,7 +903,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
|
|
||||||
DO NOT USE!!! ONLY EXPERT USER!!!
|
DO NOT USE!!! ONLY EXPERT USER!!!
|
||||||
*/
|
*/
|
||||||
int clearBit(int addr, int n);
|
uint32_t clearBit(uint32_t addr, int n);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
set dacs value
|
set dacs value
|
||||||
|
@ -529,7 +529,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
|
|
||||||
DO NOT USE!!! ONLY EXPERT USER!!!
|
DO NOT USE!!! ONLY EXPERT USER!!!
|
||||||
*/
|
*/
|
||||||
virtual int setBit(int addr, int n)=0;
|
virtual uint32_t setBit(uint32_t addr, int n)=0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -540,7 +540,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
|
|
||||||
DO NOT USE!!! ONLY EXPERT USER!!!
|
DO NOT USE!!! ONLY EXPERT USER!!!
|
||||||
*/
|
*/
|
||||||
virtual int clearBit(int addr, int n)=0;
|
virtual uint32_t clearBit(uint32_t addr, int n)=0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user