v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
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) { if (gpioIF == nullptr) {
sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; 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()); spiTransferStruct[0].rx_buf = reinterpret_cast<__u64>(recvBuffer.data());
setSendBuffer(); setSendBuffer();
} }
@ -46,15 +46,25 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
performL3gTest(gyro1L3gd20ChipSelect); performL3gTest(gyro1L3gd20ChipSelect);
break; break;
} }
case (TestModes::SUS_0): { case (TestModes::MAX1227): {
performMax1227Test(); performOneShotMax1227Test();
break; break;
} }
} }
return HasReturnvaluesIF::RETURN_OK; 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) { void SpiTestClass::performRm3100Test(uint8_t mgmId) {
/* Configure all SPI chip selects and pull them high */ /* 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; sif::info << "Z: " << angVelocZ << std::endl;
} }
void SpiTestClass::performMax1227Test() { void SpiTestClass::performOneShotMax1227Test() {
using namespace max1227; using namespace max1227;
testRadSensorExtConvWithDelay = false; testRadSensorExtConvWithDelay = false;
testRadSensorIntConv = false; testRadSensorIntConv = false;
@ -289,6 +299,23 @@ void SpiTestClass::performMax1227Test() {
plPcduAdcExtConv = false; plPcduAdcExtConv = false;
plPcduAdcIntConv = true; 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 #ifdef XIPHOS_Q7S
std::string deviceName = q7s::SPI_DEFAULT_DEV; std::string deviceName = q7s::SPI_DEFAULT_DEV;
#elif defined(RASPBERRY_PI) #elif defined(RASPBERRY_PI)
@ -527,6 +554,7 @@ void SpiTestClass::max1227PlPcduTest(int fd) {
shiftOutZeros(); shiftOutZeros();
transfer(fd, gpioIds::PLPCDU_ADC_CS); transfer(fd, gpioIds::PLPCDU_ADC_CS);
setSendBuffer(); setSendBuffer();
arrayprinter::print(recvBuffer.data(), 26, OutputType::HEX);
uint16_t adcRaw[n + 1] = {}; uint16_t adcRaw[n + 1] = {};
int16_t tempRaw = ((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1]; int16_t tempRaw = ((recvBuffer[0] & 0x0f) << 8) | recvBuffer[1];
sif::info << "Temperature: " << tempRaw * 0.125 << " C" << std::endl; sif::info << "Temperature: " << tempRaw * 0.125 << " C" << std::endl;

View File

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