mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-13 19:08:42 +01:00
send back the result of the SPI write (#1387)
All checks were successful
Build on RHEL9 / build (push) Successful in 3m21s
Build on RHEL8 / build (push) Successful in 4m47s
Run Simulator Tests on local RHEL9 / build (push) Successful in 14m39s
Build on local RHEL9 / build (push) Successful in 1m25s
Run Simulator Tests on local RHEL8 / build (push) Successful in 16m57s
Build on local RHEL8 / build (push) Successful in 3m32s
All checks were successful
Build on RHEL9 / build (push) Successful in 3m21s
Build on RHEL8 / build (push) Successful in 4m47s
Run Simulator Tests on local RHEL9 / build (push) Successful in 14m39s
Build on local RHEL9 / build (push) Successful in 1m25s
Run Simulator Tests on local RHEL8 / build (push) Successful in 16m57s
Build on local RHEL8 / build (push) Successful in 3m32s
This commit is contained in:
@@ -2206,8 +2206,8 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{});
|
py::arg() = Positions{});
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"writeSpi",
|
"writeSpi",
|
||||||
(void (Detector::*)(int, int, const std::vector<uint8_t> &,
|
(Result<std::vector<uint8_t>>(Detector::*)(
|
||||||
sls::Positions)) &
|
int, int, const std::vector<uint8_t> &, sls::Positions)) &
|
||||||
Detector::writeSpi,
|
Detector::writeSpi,
|
||||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{});
|
py::arg(), py::arg(), py::arg(), py::arg() = Positions{});
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -11375,7 +11375,10 @@ int spi_write(int file_des){
|
|||||||
local_tx[i+1] = data[i];
|
local_tx[i+1] = data[i];
|
||||||
|
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
// For the virtual detector we have nothing to do
|
// For the virtual detector copy the data from local_tx to local_rx
|
||||||
|
for (int i=0; i < n_bytes+1; i++){
|
||||||
|
local_rx[i] = local_tx[i];
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
int spifd = open("/dev/spidev2.0", O_RDWR);
|
int spifd = open("/dev/spidev2.0", O_RDWR);
|
||||||
LOG(logINFO, ("SPI Read: opened spidev2.0 with fd=%d\n", spifd));
|
LOG(logINFO, ("SPI Read: opened spidev2.0 with fd=%d\n", spifd));
|
||||||
@@ -11397,11 +11400,13 @@ int spi_write(int file_des){
|
|||||||
close(spifd);
|
close(spifd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ret = OK;
|
||||||
|
LOG(logDEBUG1, ("SPI Write Complete\n"));
|
||||||
|
Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
sendData(file_des, local_rx+1, n_bytes, OTHER);
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
free(local_tx);
|
free(local_tx);
|
||||||
free(local_rx);
|
free(local_rx);
|
||||||
|
return ret;
|
||||||
ret = OK;
|
|
||||||
LOG(logDEBUG1, ("SPI Write Complete\n"));
|
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
|
||||||
}
|
}
|
||||||
@@ -2250,7 +2250,7 @@ class Detector {
|
|||||||
Result<std::vector<uint8_t>> readSpi(int chip_id, int register_id,
|
Result<std::vector<uint8_t>> readSpi(int chip_id, int register_id,
|
||||||
int n_bytes, Positions pos = {}) const;
|
int n_bytes, Positions pos = {}) const;
|
||||||
|
|
||||||
void writeSpi(int chip_id, int register_id,
|
Result<std::vector<uint8_t>> writeSpi(int chip_id, int register_id,
|
||||||
const std::vector<uint8_t> &data, Positions pos = {});
|
const std::vector<uint8_t> &data, Positions pos = {});
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -2961,9 +2961,9 @@ Result<std::vector<uint8_t>> Detector::readSpi(int chip_id, int register_id,
|
|||||||
n_bytes);
|
n_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::writeSpi(int chip_id, int register_id,
|
Result<std::vector<uint8_t>> Detector::writeSpi(int chip_id, int register_id,
|
||||||
const std::vector<uint8_t> &data, Positions pos){
|
const std::vector<uint8_t> &data, Positions pos){
|
||||||
pimpl->Parallel(&Module::writeSpi, pos, chip_id, register_id, data);
|
return pimpl->Parallel(&Module::writeSpi, pos, chip_id, register_id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4097,7 +4097,7 @@ std::vector<uint8_t> Module::readSpi(int chip_id, int register_id,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::writeSpi(int chip_id, int register_id,
|
std::vector<uint8_t> Module::writeSpi(int chip_id, int register_id,
|
||||||
const std::vector<uint8_t> &data){
|
const std::vector<uint8_t> &data){
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
client.Send(F_SPI_WRITE);
|
client.Send(F_SPI_WRITE);
|
||||||
@@ -4113,6 +4113,11 @@ void Module::writeSpi(int chip_id, int register_id,
|
|||||||
<< " returned error: " << client.readErrorMessage();
|
<< " returned error: " << client.readErrorMessage();
|
||||||
throw DetectorError(os.str());
|
throw DetectorError(os.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read the output from the SPI write. This contains the data before the write.
|
||||||
|
std::vector<uint8_t> ret(data.size());
|
||||||
|
client.Receive(ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
|||||||
@@ -610,7 +610,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
std::vector<uint8_t> readSpi(int chip_id, int register_id,
|
std::vector<uint8_t> readSpi(int chip_id, int register_id,
|
||||||
int n_bytes) const;
|
int n_bytes) const;
|
||||||
|
|
||||||
void writeSpi(int chip_id, int register_id, const std::vector<uint8_t> &data);
|
std::vector<uint8_t> writeSpi(int chip_id, int register_id, const std::vector<uint8_t> &data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string getReceiverLongVersion() const;
|
std::string getReceiverLongVersion() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user