continued test task

This commit is contained in:
Robin Müller 2021-02-23 17:01:25 +01:00
parent 178c3e2540
commit a47c8d91a0

View File

@ -43,9 +43,13 @@ ReturnValue_t SpiTestClass::performPeriodicAction() {
} }
void SpiTestClass::performRm3100Test() { void SpiTestClass::performRm3100Test() {
/* Configure all SPI chip selects and pull them high */
acsInit();
/* Adapt accordingly */ /* Adapt accordingly */
uint8_t chipSelectPin = mgm1Rm3100ChipSelect; uint8_t chipSelectPin = mgm1Rm3100ChipSelect;
uint32_t rm3100Speed = 3'900'000; uint32_t rm3100Speed = 3'900'000;
uint8_t rm3100whoAmIReg = 0b0000'1111;
int rm3100mode = SPI_MODE_3; int rm3100mode = SPI_MODE_3;
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
std::string deviceName = "spidev0.0"; std::string deviceName = "spidev0.0";
@ -61,11 +65,16 @@ void SpiTestClass::performRm3100Test() {
return; return;
} }
int retval = ioctl(fileDescriptor, SPI_IOC_WR_MODE, rm3100Speed); int retval = ioctl(fileDescriptor, SPI_IOC_WR_MODE, rm3100mode);
if(retval != 0) { if(retval != 0) {
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!");
} }
acsInit();
retval = ioctl(fileDescriptor, SPI_IOC_WR_MAX_SPEED_HZ, rm3100Speed);
if(retval != 0) {
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!");
}
} }
void SpiTestClass::acsInit() { void SpiTestClass::acsInit() {