WIP: PL PCDU #142

Closed
muellerr wants to merge 118 commits from mueller/plpcdu-sus-updates into develop
2 changed files with 36 additions and 6 deletions
Showing only changes of commit 151621b49a - Show all commits

View File

@ -24,7 +24,7 @@ SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF *gpioIF)
if (gpioIF == nullptr) {
sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl;
}
testMode = TestModes::SUS_0;
testMode = TestModes::MAX1227;
spiTransferStruct[0].rx_buf = reinterpret_cast<__u64>(recvBuffer.data());
setSendBuffer();
}
@ -46,15 +46,25 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
performL3gTest(gyro1L3gd20ChipSelect);
break;
}
case (TestModes::SUS_0): {
performMax1227Test();
case (TestModes::MAX1227): {
performOneShotMax1227Test();
break;
}
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t SpiTestClass::performPeriodicAction() { return HasReturnvaluesIF::RETURN_OK; }
ReturnValue_t SpiTestClass::performPeriodicAction() {
switch (testMode) {
case (TestModes::MAX1227): {
performPeriodicMax1227Test();
break;
}
default:
break;
}
return HasReturnvaluesIF::RETURN_OK;
}
void SpiTestClass::performRm3100Test(uint8_t mgmId) {
/* Configure all SPI chip selects and pull them high */
@ -279,7 +289,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
sif::info << "Z: " << angVelocZ << std::endl;
}
void SpiTestClass::performMax1227Test() {
void SpiTestClass::performOneShotMax1227Test() {
using namespace max1227;
testRadSensorExtConvWithDelay = false;
testRadSensorIntConv = false;
@ -289,6 +299,23 @@ void SpiTestClass::performMax1227Test() {
plPcduAdcExtConv = false;
plPcduAdcIntConv = true;
performMax1227Test();
}
void SpiTestClass::performPeriodicMax1227Test() {
using namespace max1227;
testRadSensorExtConvWithDelay = false;
testRadSensorIntConv = false;
susExtConversion = false;
susIntConversion = false;
plPcduAdcExtConv = false;
plPcduAdcIntConv = true;
performMax1227Test();
}
void SpiTestClass::performMax1227Test() {
#ifdef XIPHOS_Q7S
std::string deviceName = q7s::SPI_DEFAULT_DEV;
#elif defined(RASPBERRY_PI)
@ -527,6 +554,7 @@ void SpiTestClass::max1227PlPcduTest(int fd) {
shiftOutZeros();
transfer(fd, gpioIds::PLPCDU_ADC_CS);
setSendBuffer();
arrayprinter::print(recvBuffer.data(), 26, OutputType::HEX);
uint16_t adcRaw[n + 1] = {};
int16_t tempRaw = ((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1];
sif::info << "Temperature: " << tempRaw * 0.125 << " C" << std::endl;

View File

@ -15,7 +15,7 @@
class SpiTestClass : public TestTask {
public:
enum TestModes { NONE, MGM_LIS3MDL, MGM_RM3100, GYRO_L3GD20H, SUS_0 };
enum TestModes { NONE, MGM_LIS3MDL, MGM_RM3100, GYRO_L3GD20H, MAX1227 };
TestModes testMode;
@ -34,6 +34,8 @@ class SpiTestClass : public TestTask {
void performRm3100Test(uint8_t mgmId);
void performLis3MdlTest(uint8_t lis3Id);
void performL3gTest(uint8_t l3gId);
void performOneShotMax1227Test();
void performPeriodicMax1227Test();
void performMax1227Test();
/* ACS board specific code which pulls all GPIOs high */