Robin Mueller
55608f0660
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
41 lines
962 B
C++
41 lines
962 B
C++
#ifndef LINUX_BOARDTEST_I2CTESTCLASS_H_
|
|
#define LINUX_BOARDTEST_I2CTESTCLASS_H_
|
|
|
|
#include <test/TestTask.h>
|
|
|
|
#include <array>
|
|
#include <string>
|
|
|
|
#include "mission/devices/devicedefinitions/BpxBatteryDefinitions.h"
|
|
|
|
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_ */
|