eive-obsw/linux/boardtest/SpiTestClass.h
2021-02-23 16:47:34 +01:00

51 lines
1.1 KiB
C++

#ifndef LINUX_BOARDTEST_SPITESTCLASS_H_
#define LINUX_BOARDTEST_SPITESTCLASS_H_
#include <linux/gpio/GpioIF.h>
#include <linux/spi/SpiCookie.h>
#include <test/testtasks/TestTask.h>
#include <vector>
class SpiTestClass: public TestTask {
public:
enum TestModes {
MGM_LIS3MDL,
MGM_RM3100,
GYRO_L3GD20H,
};
TestModes testMode;
SpiTestClass(object_id_t objectId, GpioIF* gpioIF);
ReturnValue_t performOneShotAction() override;
ReturnValue_t performPeriodicAction() override;
private:
GpioIF* gpioIF;
std::array<uint8_t, 128> recvBuffer;
std::array<uint8_t, 128> sendBuffer;
struct spi_ioc_transfer spiTransferStruct;
void performRm3100Test();
/* ACS board specific code which pulls all GPIOs high */
void acsInit();
/* ACS board specific variables */
uint8_t mgm0Lis3ChipSelect = 0;
uint8_t mgm1Rm3100ChipSelect = 1;
uint8_t gyro0AdisChipSelect = 5;
uint8_t gyro1L3gd20ChipSelect = 6;
uint8_t gyro2L3gd20ChipSelect = 4;
uint8_t mgm2Lis3mdlChipSelect = 17;
uint8_t mgm3Rm3100ChipSelect = 27;
};
#endif /* LINUX_BOARDTEST_SPITESTCLASS_H_ */