Robin Mueller
e142408bb8
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
43 lines
983 B
C++
43 lines
983 B
C++
#ifndef LINUX_BOARDTEST_I2CTESTCLASS_H_
|
|
#define LINUX_BOARDTEST_I2CTESTCLASS_H_
|
|
|
|
#include <test/testtasks/TestTask.h>
|
|
|
|
#include "mission/devices/devicedefinitions/BpxBatteryDefinitions.h"
|
|
#include <string>
|
|
#include <array>
|
|
|
|
class I2cTestClass : public TestTask {
|
|
public:
|
|
I2cTestClass(object_id_t objectId, std::string i2cdev);
|
|
|
|
ReturnValue_t initialize() override;
|
|
ReturnValue_t performPeriodicAction() override;
|
|
|
|
private:
|
|
enum TestModes {
|
|
NONE,
|
|
BPX_BATTERY
|
|
};
|
|
struct I2cInfo {
|
|
int addr = 0;
|
|
int fd = 0;
|
|
};
|
|
|
|
TestModes mode = TestModes::NONE;
|
|
void battInit();
|
|
void battPeriodic();
|
|
|
|
I2cInfo bpxInfo = { .addr = 0x07, .fd = 0 };
|
|
std::string i2cdev;
|
|
size_t sendLen = 0;
|
|
size_t recvLen = 0;
|
|
std::array<uint8_t, 64> cmdBuf = {};
|
|
std::array<uint8_t, 64> replyBuf = {};
|
|
|
|
ReturnValue_t i2cWrite(int fd, uint8_t* data, size_t len);
|
|
ReturnValue_t i2cRead(int fd, uint8_t* data, size_t len);
|
|
};
|
|
|
|
#endif /* LINUX_BOARDTEST_I2CTESTCLASS_H_ */
|