SPI update, Version bump #22
@ -42,12 +42,22 @@ ReturnValue_t SpiTestClass::performPeriodicAction() {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpiTestClass::performRm3100Test() {
|
void SpiTestClass::performRm3100Test(uint8_t mgmId) {
|
||||||
/* Configure all SPI chip selects and pull them high */
|
/* Configure all SPI chip selects and pull them high */
|
||||||
acsInit();
|
acsInit();
|
||||||
|
|
||||||
/* Adapt accordingly */
|
/* 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;
|
uint32_t rm3100Speed = 3'900'000;
|
||||||
uint8_t rm3100whoAmIReg = 0b0000'1111;
|
uint8_t rm3100whoAmIReg = 0b0000'1111;
|
||||||
int rm3100mode = SPI_MODE_3;
|
int rm3100mode = SPI_MODE_3;
|
||||||
@ -75,6 +85,9 @@ void SpiTestClass::performRm3100Test() {
|
|||||||
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!");
|
utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gpioIF->pullLow(currentGpioId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpiTestClass::acsInit() {
|
void SpiTestClass::acsInit() {
|
||||||
|
@ -29,7 +29,7 @@ private:
|
|||||||
std::array<uint8_t, 128> sendBuffer;
|
std::array<uint8_t, 128> sendBuffer;
|
||||||
struct spi_ioc_transfer spiTransferStruct;
|
struct spi_ioc_transfer spiTransferStruct;
|
||||||
|
|
||||||
void performRm3100Test();
|
void performRm3100Test(uint8_t mgmId);
|
||||||
/* ACS board specific code which pulls all GPIOs high */
|
/* ACS board specific code which pulls all GPIOs high */
|
||||||
void acsInit();
|
void acsInit();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user