continued test class

This commit is contained in:
Robin Müller 2021-02-23 17:05:48 +01:00
parent a47c8d91a0
commit cb0fa384ca
2 changed files with 16 additions and 3 deletions

View File

@ -42,12 +42,22 @@ ReturnValue_t SpiTestClass::performPeriodicAction() {
return HasReturnvaluesIF::RETURN_OK;
}
void SpiTestClass::performRm3100Test() {
void SpiTestClass::performRm3100Test(uint8_t mgmId) {
/* Configure all SPI chip selects and pull them high */
acsInit();
/* Adapt accordingly */
uint8_t chipSelectPin = mgm1Rm3100ChipSelect;
if(mgmId != mgm1Rm3100ChipSelect or mgmId != mgm3Rm3100ChipSelect) {
sif::warning << "SpiTestClass::performRm3100Test: Invalid MGM ID!" << std::endl;
}
gpioId_t currentGpioId = 0;
uint8_t chipSelectPin = mgmId;
if(chipSelectPin == mgm1Rm3100ChipSelect) {
currentGpioId = gpioIds::MGM_1_RM3100_CS;
}
else {
currentGpioId = gpioIds::MGM_3_RM3100_CS;
}
uint32_t rm3100Speed = 3'900'000;
uint8_t rm3100whoAmIReg = 0b0000'1111;
int rm3100mode = SPI_MODE_3;
@ -75,6 +85,9 @@ void SpiTestClass::performRm3100Test() {
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!");
}
gpioIF->pullLow(currentGpioId);
}
void SpiTestClass::acsInit() {

View File

@ -29,7 +29,7 @@ private:
std::array<uint8_t, 128> sendBuffer;
struct spi_ioc_transfer spiTransferStruct;
void performRm3100Test();
void performRm3100Test(uint8_t mgmId);
/* ACS board specific code which pulls all GPIOs high */
void acsInit();